创建标品优化

This commit is contained in:
苏尹岚
2020-04-14 08:42:35 +08:00
parent 6f64c953c8
commit b3d8f68999

View File

@@ -1944,6 +1944,7 @@ func CreateUpcSkuByExcelBin(ctx *jxcontext.Context, reader io.Reader) (hint stri
if len(skuNames2) == 1 && (productInfo.SpecQuality == skuNames2[0].SpecQuality && productInfo.SpecUnit == skuNames2[0].SpecUnit) {
skuNames2[0].Upc = v.Upc
dao.UpdateEntity(db, skuNames2[0], "Upc")
return "", err
} else {
if v.Price == 0 {
result, err := api.AliUpcAPI.GetAliUpcInfo(*v.Upc)
@@ -1982,8 +1983,8 @@ func CreateUpcSkuByExcelBin(ctx *jxcontext.Context, reader io.Reader) (hint stri
continue
}
if !strings.Contains(skuName.Img, "image.jxc4.com") {
if resBinary, _, err := jxutils.DownloadFileByURL(skuName.Img); err == nil {
if downloadURL, err := jxutils.UploadExportContent(resBinary, skuName.Img[strings.LastIndex(skuName.Img, "/"):len(skuName.Img)]); err == nil {
if resBinary, _, err := jxutils.DownloadFileByURL(skuName.Img + model.SkuNameImgStandard); err == nil {
if downloadURL, err := jxutils.UploadExportContent(resBinary, skuName.Img[strings.LastIndex(skuName.Img, "/")+1:len(skuName.Img)]); err == nil {
skuName.Img = downloadURL
}
}