果园diff

This commit is contained in:
苏尹岚
2020-06-17 16:57:19 +08:00
parent 1dda947251
commit a1c53cebac
2 changed files with 26 additions and 2 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
}

View File

@@ -5,6 +5,8 @@ import (
"regexp"
"strings"
"github.com/astaxie/beego"
"git.rosy.net.cn/baseapi/platformapi/mtwmapi"
"git.rosy.net.cn/baseapi/utils"
"git.rosy.net.cn/jx-callback/business/jxutils"
@@ -265,6 +267,9 @@ func (p *PurchaseHandler) createOrUpdateStoreSkus(ctx *jxcontext.Context, storeI
foodData["unit"] = storeSku.Unit
foodData["box_num"] = 1
foodData["box_price"] = jxutils.IntPrice2Standard(storeSku.BoxFee)
if beego.BConfig.RunMode == "jxgy" {
foodData["common_attr_value"] = switchAttr(storeSku.VendorVendorCatID)
}
catCode := tryCatName2Code(storeSku.VendorCatID)
if catCode != "" {
foodData["category_code"] = catCode