Commit 8ce9c84e by mushishixian

优化

parent 914a481b
The file could not be displayed because it is too large.
......@@ -15,6 +15,9 @@ func GetBomItems(bomId int) (bomItems []model.BomItem) {
//更新没有匹配的到bom详情
func UpdateNoMatchBomItem(bomItems []model.BomItem) (err error) {
if len(bomItems) == 0 {
return nil
}
var updateIdList []int
var bomIdStr string
for _, bomItem := range bomItems {
......
......@@ -4,7 +4,6 @@ import (
"bom_server/configs"
"bom_server/internal/model"
"encoding/json"
"fmt"
"github.com/imroc/req"
"reflect"
"strconv"
......@@ -109,9 +108,7 @@ func UpdateGoodsData(goodsMapList []GoodsMap) (err error) {
}
}
}
start := time.Now()
err = BatchSaveMatchings(bomId, bomMatchingList)
fmt.Println(time.Now().Sub(start))
if err != nil {
return
}
......
......@@ -30,7 +30,7 @@ func MatchGoods(bomId int) (err error) {
return errors.New("没有商品的bom单")
}
bomItems := bom.BomItems
perGoDealNumber := 200
perGoDealNumber := 50
//开启协程处理搜索.每50个开启一个协程
var wg sync.WaitGroup
//判断是否有余数
......@@ -139,7 +139,6 @@ func getUpdateGoodsData(bomId int, bomItems []model.BomItem, client *es.Client,
}
res, err := search.Do(context.Background())
if err != nil {
fmt.Println(err)
return
}
if len(res.Responses) == 0 {
......
......@@ -9,6 +9,10 @@ func hello(name string) string {
return "Hello " + name + "!"
}
func export(bomId int) {
}
func main() {
service := rpc.NewHTTPService()
service.AddFunction("hello", hello, rpc.Options{})
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment