This commit is contained in:
邹宗楠
2023-11-29 15:45:45 +08:00
parent 52b3ceae40
commit 9476575dc8
3 changed files with 26 additions and 281 deletions

View File

@@ -95,26 +95,36 @@ func SyncStoreCategories(ctx *jxcontext.Context, parentTask tasksch.ITask, vendo
num := 0
rootTask := tasksch.NewSeqTask(fmt.Sprintf("%s SyncStoreCategory step1", model.VendorChineseNames[vendorID]), ctx,
func(rootTask *tasksch.SeqTask, step int, params ...interface{}) (result interface{}, err error) {
level := step + 1
catList, err := dao.GetDirtyStoreCategories(db, vendorID, storeID, level, skuIDs)
// 保证下面api成功率添加校验
if vendorID == model.VendorIDEBAI {
// 门店审核状态
status, err := api.EbaiAPI.ShopStatusGet("", utils.Str2Int64(vendorStoreID))
if err != nil {
return nil, err
}
// 门店营业状态
ebaiStatus, err := api.EbaiAPI.ShopBusStatusGet("", utils.Str2Int64(vendorStoreID), ebaiapi.PlatformFlagElm)
switch status {
case ebaiapi.ShopCheckStatusCheckSuccess:
case ebaiapi.ShopCheckStatusNew, ebaiapi.ShopCheckStatusWaitCheck, ebaiapi.ShopCheckStatusUpdateWaitCheck:
return nil, fmt.Errorf("门店审核中,请联系饿了么工作人员加快审核")
if ebaiStatus == ebaiapi.ShopBusStatusSuspended {
return nil, fmt.Errorf("门店审核中,请联系饿了么工作人员加快审核")
}
case ebaiapi.ShopCheckStatusGoLiveFail:
return nil, fmt.Errorf("门店上线审核失败,请联系饿了么工作人员加快审核")
if ebaiStatus == ebaiapi.ShopBusStatusSuspended {
return nil, fmt.Errorf("门店上线审核失败,请联系饿了么工作人员加快审核")
}
case ebaiapi.ShopCheckStatusCheckFail:
return nil, fmt.Errorf("门店审核未通过")
if ebaiStatus == ebaiapi.ShopBusStatusSuspended {
return nil, fmt.Errorf("门店审核未通过")
}
}
}
level := step + 1
catList, err := dao.GetDirtyStoreCategories(db, vendorID, storeID, level, skuIDs)
if len(catList) > 0 {
num += len(catList)
task := tasksch.NewParallelTask(fmt.Sprintf("%s SyncStoreCategory step2, level=%d", model.VendorChineseNames[vendorID], level),