创建标品优化
This commit is contained in:
@@ -1996,14 +1996,43 @@ func CreateUpcSkuByExcelBin(ctx *jxcontext.Context, reader io.Reader, categoryID
|
|||||||
skuName.Price = v.Price
|
skuName.Price = v.Price
|
||||||
}
|
}
|
||||||
skuName.Name = productInfo.Name
|
skuName.Name = productInfo.Name
|
||||||
skuName.Unit = productInfo.Unit
|
if v.Unit != "" {
|
||||||
if productInfo.SpecQuality == 0 {
|
skuName.Unit = v.Unit
|
||||||
skuName.Skus[0].SpecQuality = productInfo.Weight
|
|
||||||
} else {
|
} else {
|
||||||
skuName.Skus[0].SpecQuality = productInfo.SpecQuality
|
if productInfo.Unit == "" {
|
||||||
|
retVal = []*CreateUpcSkuByExcelErr{buildCreateUpcSkuByExcelErr(v, "未查询到商品单位,请补充商品单位!")}
|
||||||
|
return retVal, err
|
||||||
|
} else {
|
||||||
|
skuName.Unit = productInfo.Unit
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if v.SpecQuality != 0 {
|
||||||
|
skuName.Skus[0].SpecQuality = v.SpecQuality
|
||||||
|
skuName.Skus[0].Weight = int(utils.Str2Int64(utils.Float64ToStr(float64(v.SpecQuality))))
|
||||||
|
} else {
|
||||||
|
_, _, _, _, _, specQuality := jxutils.SplitSkuName(v.Name)
|
||||||
|
if specQuality != 0 {
|
||||||
|
skuName.Skus[0].SpecQuality = specQuality
|
||||||
|
skuName.Skus[0].Weight = int(utils.Str2Int64(utils.Float64ToStr(float64(specQuality))))
|
||||||
|
} else {
|
||||||
|
if productInfo.SpecQuality == 0 {
|
||||||
|
retVal = []*CreateUpcSkuByExcelErr{buildCreateUpcSkuByExcelErr(v, "未查询到商品重量,请补充商品重量!")}
|
||||||
|
return retVal, err
|
||||||
|
} else {
|
||||||
|
if productInfo.Weight != 0 {
|
||||||
|
skuName.Skus[0].Weight = int(utils.Str2Int64(utils.Float64ToStr(float64(productInfo.Weight))))
|
||||||
|
} else {
|
||||||
|
skuName.Skus[0].Weight = int(utils.Str2Int64(utils.Float64ToStr(float64(productInfo.SpecQuality))))
|
||||||
|
}
|
||||||
|
skuName.Skus[0].SpecQuality = productInfo.SpecQuality
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if productInfo.SpecUnit == "" {
|
||||||
|
skuName.Skus[0].SpecUnit = model.SpecUnitNames[0]
|
||||||
|
} else {
|
||||||
|
skuName.Skus[0].SpecUnit = productInfo.SpecUnit
|
||||||
}
|
}
|
||||||
skuName.Skus[0].SpecUnit = productInfo.SpecUnit
|
|
||||||
skuName.Skus[0].Weight = int(utils.Str2Int64(utils.Float64ToStr(float64(productInfo.Weight))))
|
|
||||||
if len(productInfo.ImgList) > 0 {
|
if len(productInfo.ImgList) > 0 {
|
||||||
skuName.Img = productInfo.ImgList[0]
|
skuName.Img = productInfo.ImgList[0]
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user