This commit is contained in:
邹宗楠
2022-11-10 18:03:59 +08:00
parent d218d7c76e
commit fb9f21dd34

View File

@@ -593,6 +593,16 @@ func GetSpecPrices(specs, storeId string, mainSkuId int64, localSku *dao.StoreSk
if len(detail1) > 3 {
detail1 = detail1[0:3]
}
specsUnit := "g"
var infoValue float64 = 1
switch localSku.SpecUnit {
case "g", "G", "ml", "ML":
specsUnit = "g"
infoValue = 1
case "l", "L", "KG", "kg":
specsUnit = "g"
infoValue = 1000
}
switch len(detail1) {
case 1:
name1 := strings.Split(strings.Split(detail1[0], "|")[1], ",")
@@ -604,9 +614,10 @@ func GetSpecPrices(specs, storeId string, mainSkuId int64, localSku *dao.StoreSk
StepStockNum: 0,
SupplierID: "",
OuterSkuID: utils.Int2Str(localSku.SkuID),
DeliveryInfos: []*tiktokShop.DeliveryInfos{
{InfoType: "weight", InfoUnit: localSku.SpecUnit, InfoValue: fmt.Sprintf("%f", localSku.SpecQuality)},
},
}
sku.DeliveryInfos = []*tiktokShop.DeliveryInfos{
{InfoType: "weight", InfoUnit: specsUnit, InfoValue: utils.Float64ToStr(float64(localSku.SpecQuality) * infoValue)},
}
stock := localSku.Stock
if localSku.Stock == 0 {
@@ -631,7 +642,7 @@ func GetSpecPrices(specs, storeId string, mainSkuId int64, localSku *dao.StoreSk
SupplierID: "",
OuterSkuID: utils.Int2Str(localSku.NameID),
DeliveryInfos: []*tiktokShop.DeliveryInfos{
{InfoType: "weight", InfoUnit: localSku.SpecUnit, InfoValue: fmt.Sprintf("%f", localSku.SpecQuality)},
{InfoType: "weight", InfoUnit: specsUnit, InfoValue: utils.Float64ToStr(float64(localSku.SpecQuality) * infoValue)},
},
}
stock := localSku.Stock
@@ -661,7 +672,7 @@ func GetSpecPrices(specs, storeId string, mainSkuId int64, localSku *dao.StoreSk
SupplierID: "",
OuterSkuID: utils.Int2Str(localSku.NameID),
DeliveryInfos: []*tiktokShop.DeliveryInfos{
{InfoType: "weight", InfoUnit: localSku.SpecUnit, InfoValue: fmt.Sprintf("%f", localSku.SpecQuality)},
{InfoType: "weight", InfoUnit: specsUnit, InfoValue: utils.Float64ToStr(float64(localSku.SpecQuality) * infoValue)},
},
}
stock := localSku.Stock