1
This commit is contained in:
@@ -22,17 +22,18 @@ func CopyOnStoreSkuToOther(ctx *jxcontext.Context, fromVendorStoreId, toStoreId
|
|||||||
)
|
)
|
||||||
|
|
||||||
// 门店api加载
|
// 门店api加载
|
||||||
// fromStore, err := dao.GetStoreDetail(db, fromStoreId, model.VendorIDMTWM, "")
|
toStore, err := dao.GetStoreDetailByVendorStoreID(db, utils.Int2Str(toStoreId), model.VendorIDMTWM, "")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
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)
|
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)
|
taskName := fmt.Sprintf("将平台门店[%d],分类和商品复制到[%d]", fromVendorStoreId, toStoreId)
|
||||||
config := tasksch.NewParallelConfig().SetParallelCount(1).SetIsContinueWhenError(false)
|
config := tasksch.NewParallelConfig().SetParallelCount(1).SetIsContinueWhenError(false)
|
||||||
work := func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
|
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 {
|
switch step {
|
||||||
case 1:
|
case 1:
|
||||||
// 1.加载门店商品,删除商品.当分类下没有商品时.删除分类
|
// 1.加载门店商品,删除商品.当分类下没有商品时.删除分类
|
||||||
errs := LoadingStoreSkuList(ctx, toApi, toStore.VendorStoreID)
|
//errs := LoadingStoreSkuList(ctx, toApi, toStore.VendorStoreID)
|
||||||
if errs != nil && len(errs) > 0 {
|
//if errs != nil && len(errs) > 0 {
|
||||||
return nil, errs[0]
|
// return nil, errs[0]
|
||||||
}
|
//}
|
||||||
case 2:
|
case 2:
|
||||||
// 同步分类
|
// 同步分类
|
||||||
fromCategoryList, err := toApi.RetailCatList(utils.Int2Str(fromVendorStoreId))
|
fromCategoryList, err := fromApi.RetailCatList(utils.Int2Str(fromVendorStoreId))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@@ -73,7 +74,7 @@ func CopyOnStoreSkuToOther(ctx *jxcontext.Context, fromVendorStoreId, toStoreId
|
|||||||
|
|
||||||
case 3:
|
case 3:
|
||||||
// 同步商品
|
// 同步商品
|
||||||
fromFoodList, err1 := toApi.RetailListAll(utils.Int2Str(fromVendorStoreId))
|
fromFoodList, err1 := fromApi.RetailListAll(utils.Int2Str(fromVendorStoreId))
|
||||||
if err1 != nil {
|
if err1 != nil {
|
||||||
return nil, err1
|
return nil, err1
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user