创建标品增加api
This commit is contained in:
@@ -1935,6 +1935,7 @@ func CreateUpcSkuByExcelBin(ctx *jxcontext.Context, reader io.Reader, categoryID
|
|||||||
} else {
|
} else {
|
||||||
skuName.Price = v.Price
|
skuName.Price = v.Price
|
||||||
}
|
}
|
||||||
|
getNetUpcInfo, err := api.AliUpcAPI.GetNetUpcInfo(*v.Upc)
|
||||||
if v.Unit != "" {
|
if v.Unit != "" {
|
||||||
if v.Unit == model.UnitNames[0] {
|
if v.Unit == model.UnitNames[0] {
|
||||||
retVal = []*CreateUpcSkuByExcelErr{buildCreateUpcSkuByExcelErr(v, "标品的单位不能为份!")}
|
retVal = []*CreateUpcSkuByExcelErr{buildCreateUpcSkuByExcelErr(v, "标品的单位不能为份!")}
|
||||||
@@ -1942,8 +1943,12 @@ func CreateUpcSkuByExcelBin(ctx *jxcontext.Context, reader io.Reader, categoryID
|
|||||||
}
|
}
|
||||||
skuName.Unit = v.Unit
|
skuName.Unit = v.Unit
|
||||||
} else {
|
} else {
|
||||||
retVal = []*CreateUpcSkuByExcelErr{buildCreateUpcSkuByExcelErr(v, "未查询到商品单位,请补充商品单位!")}
|
if getNetUpcInfo.Unit != "" {
|
||||||
return retVal, err
|
skuName.Unit = getNetUpcInfo.Unit
|
||||||
|
} else {
|
||||||
|
retVal = []*CreateUpcSkuByExcelErr{buildCreateUpcSkuByExcelErr(v, "未查询到商品单位,请补充商品单位!")}
|
||||||
|
return retVal, err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if v.SpecQuality != 0 {
|
if v.SpecQuality != 0 {
|
||||||
skuName.Skus[0].SpecQuality = v.SpecQuality
|
skuName.Skus[0].SpecQuality = v.SpecQuality
|
||||||
@@ -1954,8 +1959,13 @@ func CreateUpcSkuByExcelBin(ctx *jxcontext.Context, reader io.Reader, categoryID
|
|||||||
skuName.Skus[0].SpecQuality = specQuality
|
skuName.Skus[0].SpecQuality = specQuality
|
||||||
skuName.Skus[0].Weight = int(utils.Str2Int64(utils.Float64ToStr(float64(specQuality))))
|
skuName.Skus[0].Weight = int(utils.Str2Int64(utils.Float64ToStr(float64(specQuality))))
|
||||||
} else {
|
} else {
|
||||||
retVal = []*CreateUpcSkuByExcelErr{buildCreateUpcSkuByExcelErr(v, "未查询到商品重量,请补充商品重量!")}
|
if getNetUpcInfo.SpecQuality != 0 {
|
||||||
return retVal, err
|
skuName.Skus[0].SpecQuality = getNetUpcInfo.SpecQuality
|
||||||
|
skuName.Skus[0].Weight = int(utils.Str2Int64(utils.Float64ToStr(float64(getNetUpcInfo.SpecQuality))))
|
||||||
|
} else {
|
||||||
|
retVal = []*CreateUpcSkuByExcelErr{buildCreateUpcSkuByExcelErr(v, "未查询到商品重量,请补充商品重量!")}
|
||||||
|
return retVal, err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
skuName.Skus[0].SpecUnit = model.SpecialSpecUnit
|
skuName.Skus[0].SpecUnit = model.SpecialSpecUnit
|
||||||
@@ -1996,12 +2006,17 @@ 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
|
||||||
|
getNetUpcInfo, err := api.AliUpcAPI.GetNetUpcInfo(*v.Upc)
|
||||||
if v.Unit != "" {
|
if v.Unit != "" {
|
||||||
skuName.Unit = v.Unit
|
skuName.Unit = v.Unit
|
||||||
} else {
|
} else {
|
||||||
if productInfo.Unit == "" {
|
if productInfo.Unit == "" {
|
||||||
retVal = []*CreateUpcSkuByExcelErr{buildCreateUpcSkuByExcelErr(v, "未查询到商品单位,请补充商品单位!")}
|
if getNetUpcInfo.Unit != "" {
|
||||||
return retVal, err
|
skuName.Unit = getNetUpcInfo.Unit
|
||||||
|
} else {
|
||||||
|
retVal = []*CreateUpcSkuByExcelErr{buildCreateUpcSkuByExcelErr(v, "未查询到商品单位,请补充商品单位!")}
|
||||||
|
return retVal, err
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
skuName.Unit = productInfo.Unit
|
skuName.Unit = productInfo.Unit
|
||||||
}
|
}
|
||||||
@@ -2016,8 +2031,13 @@ func CreateUpcSkuByExcelBin(ctx *jxcontext.Context, reader io.Reader, categoryID
|
|||||||
skuName.Skus[0].Weight = int(utils.Str2Int64(utils.Float64ToStr(float64(specQuality))))
|
skuName.Skus[0].Weight = int(utils.Str2Int64(utils.Float64ToStr(float64(specQuality))))
|
||||||
} else {
|
} else {
|
||||||
if productInfo.SpecQuality == 0 {
|
if productInfo.SpecQuality == 0 {
|
||||||
retVal = []*CreateUpcSkuByExcelErr{buildCreateUpcSkuByExcelErr(v, "未查询到商品重量,请补充商品重量!")}
|
if getNetUpcInfo.SpecQuality != 0 {
|
||||||
return retVal, err
|
skuName.Skus[0].SpecQuality = getNetUpcInfo.SpecQuality
|
||||||
|
skuName.Skus[0].Weight = int(utils.Str2Int64(utils.Float64ToStr(float64(getNetUpcInfo.SpecQuality))))
|
||||||
|
} else {
|
||||||
|
retVal = []*CreateUpcSkuByExcelErr{buildCreateUpcSkuByExcelErr(v, "未查询到商品重量,请补充商品重量!")}
|
||||||
|
return retVal, err
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if productInfo.Weight != 0 {
|
if productInfo.Weight != 0 {
|
||||||
skuName.Skus[0].Weight = int(utils.Str2Int64(utils.Float64ToStr(float64(productInfo.Weight))))
|
skuName.Skus[0].Weight = int(utils.Str2Int64(utils.Float64ToStr(float64(productInfo.Weight))))
|
||||||
|
|||||||
Reference in New Issue
Block a user