果园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" "time"
"unicode" "unicode"
"github.com/astaxie/beego"
"git.rosy.net.cn/baseapi/platformapi/jdshopapi" "git.rosy.net.cn/baseapi/platformapi/jdshopapi"
"git.rosy.net.cn/jx-callback/globals/api" "git.rosy.net.cn/jx-callback/globals/api"
@@ -843,7 +845,23 @@ 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) { 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)) globals.SugarLogger.Debugf("UpdateStoresSkus:%s, storeIDs:%v, skuBindInfos:%s", ctx.GetTrackInfo(), storeIDs, utils.Format4Output(skuBindInfos, true))
flag, err := doStoreSkuAudit(ctx, storeIDs, skuBindInfos) if beego.BConfig.RunMode == "jxgy" {
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)
}
} else {
flag, _ := doStoreSkuAudit(ctx, storeIDs, skuBindInfos)
if !flag { if !flag {
var num int64 var num int64
db := dao.GetDB() db := dao.GetDB()
@@ -860,6 +878,7 @@ func UpdateStoresSkus(ctx *jxcontext.Context, causeFlag int, storeIDs []int, sku
hint = utils.Int64ToStr(num) hint = utils.Int64ToStr(num)
} }
} }
}
return hint, err return hint, err
} }

View File

@@ -5,6 +5,8 @@ import (
"regexp" "regexp"
"strings" "strings"
"github.com/astaxie/beego"
"git.rosy.net.cn/baseapi/platformapi/mtwmapi" "git.rosy.net.cn/baseapi/platformapi/mtwmapi"
"git.rosy.net.cn/baseapi/utils" "git.rosy.net.cn/baseapi/utils"
"git.rosy.net.cn/jx-callback/business/jxutils" "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["unit"] = storeSku.Unit
foodData["box_num"] = 1 foodData["box_num"] = 1
foodData["box_price"] = jxutils.IntPrice2Standard(storeSku.BoxFee) foodData["box_price"] = jxutils.IntPrice2Standard(storeSku.BoxFee)
if beego.BConfig.RunMode == "jxgy" {
foodData["common_attr_value"] = switchAttr(storeSku.VendorVendorCatID)
}
catCode := tryCatName2Code(storeSku.VendorCatID) catCode := tryCatName2Code(storeSku.VendorCatID)
if catCode != "" { if catCode != "" {
foodData["category_code"] = catCode foodData["category_code"] = catCode