From 76b98bb5130bbcdded1650bf455e24acb6c27799 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Mon, 13 Feb 2023 17:44:56 +0800 Subject: [PATCH] 1 --- business/jxstore/cms/sku.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/business/jxstore/cms/sku.go b/business/jxstore/cms/sku.go index 260a09bf0..b2b865f9a 100644 --- a/business/jxstore/cms/sku.go +++ b/business/jxstore/cms/sku.go @@ -1,6 +1,7 @@ package cms import ( + "encoding/json" "errors" "fmt" "git.rosy.net.cn/jx-callback/globals/api/apimanager" @@ -1086,7 +1087,8 @@ func UpdateSkuName(ctx *jxcontext.Context, nameID int, payload map[string]interf } if len(skuIDs) > 0 { // 判断是否改价 - if skuName.Price != payload["price"].(int) { + nowPrice, _ := payload["price"].(json.Number).Int64() + if skuName.Price != int(nowPrice) && nowPrice != 0 { i := payload["skus"].([]struct { Id int `json:"id"` SpecQuality int `json:"specQuality"` @@ -1102,11 +1104,11 @@ func UpdateSkuName(ctx *jxcontext.Context, nameID int, payload map[string]interf ExdSkuID string `json:"exdSkuID"` }) for _, v := range i { - skuPrice := 0 + var skuPrice int64 = 0 if payload["unit"] == "份" { // 商品规格等于份的时候,标准重量保持为500g - skuPrice = (v.SpecQuality / 500) * payload["price"].(int) + skuPrice = int64(v.SpecQuality/500) * nowPrice } else { - skuPrice = payload["price"].(int) + skuPrice = nowPrice } sql := ` UPDATE store_sku_bind s SET s.price = ? WHERE s.sku_id = ? AND s.deleted_at = ?`