This commit is contained in:
邹宗楠
2023-02-15 15:26:41 +08:00
parent 02de1644f6
commit b42a823540
2 changed files with 17 additions and 19 deletions

View File

@@ -1087,23 +1087,25 @@ func UpdateSkuName(ctx *jxcontext.Context, nameID int, payload map[string]interf
}
if len(skuIDs) > 0 {
// 判断是否改价
nowPrice, _ := payload["price"].(json.Number).Int64()
if skuName.Price != int(nowPrice) && nowPrice != 0 {
if payload["price"] != nil {
nowPrice, _ := payload["price"].(json.Number).Int64()
if skuName.Price != int(nowPrice) && nowPrice != 0 {
for _, v1 := range payload["skus"].([]interface{}) {
v := v1.(map[string]interface{})
skuInfo := &aa{}
if err := utils.Map2StructByJson(v, skuInfo, false); err != nil {
globals.SugarLogger.Debugf("errr %v", err)
continue
for _, v1 := range payload["skus"].([]interface{}) {
v := v1.(map[string]interface{})
skuInfo := &aa{}
if err := utils.Map2StructByJson(v, skuInfo, false); err != nil {
globals.SugarLogger.Debugf("errr %v", err)
continue
}
var skuPrice int64 = 0
if payload["unit"] == "份" { // 商品规格等于份的时候,标准重量保持为500g
skuPrice = int64(float64(skuInfo.SpecQuality) / float64(500) * float64(nowPrice))
} else {
skuPrice = nowPrice
}
SetUpdateSkuPriceIfChange(db, skuPrice, nowPrice, skuInfo.Id)
}
var skuPrice int64 = 0
if payload["unit"] == "份" { // 商品规格等于份的时候,标准重量保持为500g
skuPrice = int64(float64(skuInfo.SpecQuality) / float64(500) * float64(nowPrice))
} else {
skuPrice = nowPrice
}
SetUpdateSkuPriceIfChange(db, skuPrice, nowPrice, skuInfo.Id)
}
}

View File

@@ -3,7 +3,6 @@ package apimanager
import (
"git.rosy.net.cn/baseapi/platformapi/jdapi"
"git.rosy.net.cn/baseapi/platformapi/tiktok_shop/tiktok_api"
"git.rosy.net.cn/baseapi/utils"
"git.rosy.net.cn/jx-callback/business/jxutils"
"git.rosy.net.cn/jx-callback/business/jxutils/jxcontext"
"git.rosy.net.cn/jx-callback/business/model"
@@ -74,9 +73,6 @@ func (a *APIManager) GetAPI(vendorID int, appOrgCode string) (pfAPI interface{})
if len(codes) == 0 {
return nil
}
globals.SugarLogger.Debugf("============codes1 %s", utils.Format4Output(codes, false))
globals.SugarLogger.Debugf("============codes2 %s", beego.AppConfig.DefaultString("tiktokShopAppId", ""))
globals.SugarLogger.Debugf("============codes3 %s", beego.AppConfig.DefaultString("tiktokShopAppSecret", ""))
pfAPI = tiktok_api.New(beego.AppConfig.DefaultString("tiktokShopAppId", ""), beego.AppConfig.DefaultString("tiktokShopAppSecret", ""), codes[0].Token)
}
return pfAPI