1
This commit is contained in:
@@ -203,7 +203,6 @@ func SyncSkus(ctx *jxcontext.Context, parentTask tasksch.ITask, vendorIDs []int,
|
||||
}
|
||||
|
||||
if err == nil && len(skuList) > 0 {
|
||||
// todo 按vendorID orgCode合并操作SyncSkus=============
|
||||
task := tasksch.NewParallelTask(
|
||||
fmt.Sprintf("同步商品:%v,%v", nameIDs, skuIDs),
|
||||
tasksch.NewParallelConfig().SetIsContinueWhenError(true), ctx, cc, skuList)
|
||||
|
||||
@@ -15,24 +15,24 @@ import (
|
||||
)
|
||||
|
||||
// CopyOnStoreSkuToOther 将一个美团门店分类和商品复制到另一个门店
|
||||
func CopyOnStoreSkuToOther(ctx *jxcontext.Context, fromStoreId, toStoreId int, isAsync bool) (hint string, err error) {
|
||||
func CopyOnStoreSkuToOther(ctx *jxcontext.Context, fromVendorStoreId, toStoreId int, isAsync bool) (hint string, err error) {
|
||||
var (
|
||||
db = dao.GetDB()
|
||||
)
|
||||
|
||||
// 门店api加载
|
||||
fromStore, err := dao.GetStoreDetail(db, fromStoreId, model.VendorIDMTWM, "")
|
||||
// fromStore, err := dao.GetStoreDetail(db, fromStoreId, model.VendorIDMTWM, "")
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
toStore, err := dao.GetStoreDetail(db, fromStoreId, model.VendorIDMTWM, "")
|
||||
toStore, err := dao.GetStoreDetail(db, toStoreId, model.VendorIDMTWM, "")
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
fromApi := partner.CurAPIManager.GetAPI(model.VendorIDMTWM, fromStore.VendorOrgCode).(*mtwmapi.API)
|
||||
//fromApi := partner.CurAPIManager.GetAPI(model.VendorIDMTWM, toStore.VendorOrgCode).(*mtwmapi.API)
|
||||
toApi := partner.CurAPIManager.GetAPI(model.VendorIDMTWM, toStore.VendorOrgCode).(*mtwmapi.API)
|
||||
|
||||
taskName := fmt.Sprintf("将平台门店[%d],分类和商品复制到[%d]", fromStoreId, toStoreId)
|
||||
taskName := fmt.Sprintf("将平台门店[%d],分类和商品复制到[%d]", fromVendorStoreId, toStoreId)
|
||||
config := tasksch.NewParallelConfig().SetParallelCount(1).SetIsContinueWhenError(false)
|
||||
work := func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
|
||||
step := batchItemList[0].(int)
|
||||
@@ -45,7 +45,7 @@ func CopyOnStoreSkuToOther(ctx *jxcontext.Context, fromStoreId, toStoreId int, i
|
||||
}
|
||||
case 2:
|
||||
// 同步分类
|
||||
fromCategoryList, err := fromApi.RetailCatList(fromStore.VendorStoreID)
|
||||
fromCategoryList, err := toApi.RetailCatList(utils.Int2Str(fromVendorStoreId))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -72,7 +72,7 @@ func CopyOnStoreSkuToOther(ctx *jxcontext.Context, fromStoreId, toStoreId int, i
|
||||
|
||||
case 3:
|
||||
// 同步商品
|
||||
fromFoodList, err1 := fromApi.RetailListAll(fromStore.VendorStoreID)
|
||||
fromFoodList, err1 := toApi.RetailListAll(utils.Int2Str(fromVendorStoreId))
|
||||
if err1 != nil {
|
||||
return nil, err1
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user