This commit is contained in:
邹宗楠
2023-09-22 09:20:34 +08:00
parent 08cea149c7
commit 51b49e17f8

View File

@@ -22,17 +22,18 @@ func CopyOnStoreSkuToOther(ctx *jxcontext.Context, fromVendorStoreId, toStoreId
)
// 门店api加载
// fromStore, err := dao.GetStoreDetail(db, fromStoreId, model.VendorIDMTWM, "")
toStore, err := dao.GetStoreDetailByVendorStoreID(db, utils.Int2Str(toStoreId), model.VendorIDMTWM, "")
if err != nil {
return "", err
}
toStore, err := dao.GetStoreDetail(db, toStoreId, model.VendorIDMTWM, "")
if err != nil {
return "", err
}
//fromApi := partner.CurAPIManager.GetAPI(model.VendorIDMTWM, toStore.VendorOrgCode).(*mtwmapi.API)
toApi := partner.CurAPIManager.GetAPI(model.VendorIDMTWM, toStore.VendorOrgCode).(*mtwmapi.API)
fromStore, err := dao.GetStoreDetailByVendorStoreID(db, utils.Int2Str(fromVendorStoreId), model.VendorIDMTWM, "")
if err != nil {
return "", err
}
fromApi := partner.CurAPIManager.GetAPI(model.VendorIDMTWM, fromStore.VendorOrgCode).(*mtwmapi.API)
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) {
@@ -40,13 +41,13 @@ func CopyOnStoreSkuToOther(ctx *jxcontext.Context, fromVendorStoreId, toStoreId
switch step {
case 1:
// 1.加载门店商品,删除商品.当分类下没有商品时.删除分类
errs := LoadingStoreSkuList(ctx, toApi, toStore.VendorStoreID)
if errs != nil && len(errs) > 0 {
return nil, errs[0]
}
//errs := LoadingStoreSkuList(ctx, toApi, toStore.VendorStoreID)
//if errs != nil && len(errs) > 0 {
// return nil, errs[0]
//}
case 2:
// 同步分类
fromCategoryList, err := toApi.RetailCatList(utils.Int2Str(fromVendorStoreId))
fromCategoryList, err := fromApi.RetailCatList(utils.Int2Str(fromVendorStoreId))
if err != nil {
return nil, err
}
@@ -73,7 +74,7 @@ func CopyOnStoreSkuToOther(ctx *jxcontext.Context, fromVendorStoreId, toStoreId
case 3:
// 同步商品
fromFoodList, err1 := toApi.RetailListAll(utils.Int2Str(fromVendorStoreId))
fromFoodList, err1 := fromApi.RetailListAll(utils.Int2Str(fromVendorStoreId))
if err1 != nil {
return nil, err1
}