根据excel创建标品解决图片上传

This commit is contained in:
苏尹岚
2020-04-10 14:40:08 +08:00
parent f9e6ab814e
commit 1b97f69b53

View File

@@ -1960,6 +1960,13 @@ func CreateUpcSkuByExcelBin(ctx *jxcontext.Context, reader io.Reader) (hint stri
createUpcSkuByExcelErrList = append(createUpcSkuByExcelErrList, buildCreateUpcSkuByExcelErr(v, fmt.Sprintf("暂不支持的图片格式:[%v]", skuName.Img)))
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 {
skuName.Img = downloadURL
}
}
}
skuName.Status = model.SkuStatusNormal
skuName.IsGlobal = model.YES
skuName.CategoryID = model.NoCatCatgoryID