1
This commit is contained in:
@@ -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 = ?`
|
||||
|
||||
Reference in New Issue
Block a user