Merge remote-tracking branch 'origin/mark' into jdshop

This commit is contained in:
苏尹岚
2020-06-17 18:31:53 +08:00
8 changed files with 144 additions and 88 deletions

View File

@@ -13,6 +13,8 @@ import (
"time"
"unicode"
"github.com/astaxie/beego"
"git.rosy.net.cn/baseapi/platformapi/jdshopapi"
"git.rosy.net.cn/jx-callback/globals/api"
@@ -843,8 +845,7 @@ func UpdateStoreSkus(ctx *jxcontext.Context, causeFlag, storeID int, skuBindInfo
func UpdateStoresSkus(ctx *jxcontext.Context, causeFlag int, storeIDs []int, skuBindInfos []*StoreSkuBindInfo, isScale, isRefreshHigh, isAsync, isContinueWhenError bool) (hint string, err error) {
globals.SugarLogger.Debugf("UpdateStoresSkus:%s, storeIDs:%v, skuBindInfos:%s", ctx.GetTrackInfo(), storeIDs, utils.Format4Output(skuBindInfos, true))
flag, err := doStoreSkuAudit(ctx, storeIDs, skuBindInfos)
if !flag {
if beego.BConfig.RunMode == "jxgy" {
var num int64
db := dao.GetDB()
skuIDs, err := updateStoresSkusWithoutSync(ctx, db, storeIDs, skuBindInfos, isScale, isRefreshHigh)
@@ -859,6 +860,24 @@ func UpdateStoresSkus(ctx *jxcontext.Context, causeFlag int, storeIDs []int, sku
if num == 0 || !isAsync || hint == "" {
hint = utils.Int64ToStr(num)
}
} else {
flag, _ := doStoreSkuAudit(ctx, storeIDs, skuBindInfos)
if !flag {
var num int64
db := dao.GetDB()
skuIDs, err := updateStoresSkusWithoutSync(ctx, db, storeIDs, skuBindInfos, isScale, isRefreshHigh)
if err != nil {
return "", err
}
isAsync = asyncStoreSkuOpFilter(ctx, isAsync)
num = int64(len(skuIDs))
if num > 0 {
hint, err = CurVendorSync.SyncStoresSkus(ctx, nil, causeFlag, db, nil, storeIDs, skuIDs, false, isAsync, isContinueWhenError)
}
if num == 0 || !isAsync || hint == "" {
hint = utils.Int64ToStr(num)
}
}
}
return hint, err
}