客户建议发送内容修改
This commit is contained in:
@@ -1083,3 +1083,53 @@ func syncStoreSkusFromYb(ctx *jxcontext.Context, storeID, vendorID int, vendorSt
|
||||
hint = taskSeq.GetID()
|
||||
return hint, err
|
||||
}
|
||||
|
||||
func (v *VendorSync) SyncJdsStoresSkus(ctx *jxcontext.Context, storeIDs []int, vendorStoreID string, isAsync, isContinueWhenError bool) (hint string, err error) {
|
||||
var (
|
||||
db = dao.GetDB()
|
||||
)
|
||||
_, hint, err = v.LoopStoresMap2(ctx, nil, db, fmt.Sprintf("同步京东商城库存商品信息:%v", storeIDs), isAsync, true, []int{model.VendorIDJDShop}, storeIDs, false,
|
||||
func(t *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (interface{}, error) {
|
||||
loopMapInfo := batchItemList[0].(*LoopStoreMapInfo)
|
||||
if handler := v.GetStoreHandler(loopMapInfo.VendorID); handler != nil {
|
||||
parallelCount := 5
|
||||
if model.MultiStoresVendorMap[loopMapInfo.VendorID] == 1 {
|
||||
parallelCount = 2
|
||||
}
|
||||
loopStoreTask := tasksch.NewParallelTask(fmt.Sprintf("处理平台%s", model.VendorChineseNames[loopMapInfo.VendorID]),
|
||||
tasksch.NewParallelConfig().SetParallelCount(parallelCount).SetIsContinueWhenError(isContinueWhenError), ctx,
|
||||
func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
|
||||
storeMap := batchItemList[0].(*model.StoreMap)
|
||||
if storeMap.Status > model.StoreStatusDisabled && storeMap.StoreID != model.JdShopMainStoreID && storeMap.SyncRule != 0 {
|
||||
err = syncJdsStoresSkus(ctx, db, storeMap)
|
||||
}
|
||||
return nil, err
|
||||
}, loopMapInfo.StoreMapList)
|
||||
t.AddChild(loopStoreTask).Run()
|
||||
_, err = loopStoreTask.GetResult(0)
|
||||
}
|
||||
return nil, partner.AddVendorInfo2Err(err, loopMapInfo.VendorID)
|
||||
}, isContinueWhenError)
|
||||
return hint, err
|
||||
}
|
||||
|
||||
func syncJdsStoresSkus(ctx *jxcontext.Context, db *dao.DaoDB, storeMap *model.StoreMap) (err error) {
|
||||
var (
|
||||
mainSkusMap = make(map[int]*model.StoreSkuBind)
|
||||
)
|
||||
storeSkusMain, err := dao.GetStoresSkusInfo(db, []int{model.JdShopMainStoreID}, nil)
|
||||
for _, v := range storeSkusMain {
|
||||
mainSkusMap[v.SkuID] = v
|
||||
}
|
||||
storeSkus, err := dao.GetStoresSkusInfo(db, []int{storeMap.StoreID}, nil)
|
||||
for _, v := range storeSkus {
|
||||
if mainSkusMap[v.SkuID] != nil {
|
||||
|
||||
} else {
|
||||
if storeMap.SyncRule == 1 {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user