根据excel导入标品

This commit is contained in:
苏尹岚
2020-04-08 18:17:08 +08:00
parent 610a87bf40
commit 010987a93c
2 changed files with 13 additions and 3 deletions

View File

@@ -1850,12 +1850,15 @@ func CreateUpcSkuByExcelBin(ctx *jxcontext.Context, reader io.Reader) (err error
skuName.Img = downloadURL2
} else {
createUpcSkuByExcelErrList = append(createUpcSkuByExcelErrList, buildCreateUpcSkuByExcelErr(v, err.Error()))
continue
}
} else {
createUpcSkuByExcelErrList = append(createUpcSkuByExcelErrList, buildCreateUpcSkuByExcelErr(v, err.Error()))
continue
}
} else {
createUpcSkuByExcelErrList = append(createUpcSkuByExcelErrList, buildCreateUpcSkuByExcelErr(v, err.Error()))
continue
}
} else {
skuName.Img = model.NOSkuNameImg
@@ -1868,6 +1871,7 @@ func CreateUpcSkuByExcelBin(ctx *jxcontext.Context, reader io.Reader) (err error
if v.Price == 0 {
if result.Price == "" {
createUpcSkuByExcelErrList = append(createUpcSkuByExcelErrList, buildCreateUpcSkuByExcelErr(v, "商品的售价不能为空!"))
continue
} else {
skuName.Price = int(utils.Str2Int64(result.Price) * 100)
}
@@ -1878,12 +1882,14 @@ func CreateUpcSkuByExcelBin(ctx *jxcontext.Context, reader io.Reader) (err error
skuName.Unit = v.Unit
} else {
createUpcSkuByExcelErrList = append(createUpcSkuByExcelErrList, buildCreateUpcSkuByExcelErr(v, "商品的单位不能为空!"))
continue
}
if v.SpecQuality != 0 {
skuName.Skus[0].SpecQuality = v.SpecQuality
skuName.Skus[0].Weight = int(utils.Str2Int64(utils.Float64ToStr(float64(v.SpecQuality))))
} else {
createUpcSkuByExcelErrList = append(createUpcSkuByExcelErrList, buildCreateUpcSkuByExcelErr(v, "商品的重量不能为空!"))
continue
}
skuName.Skus[0].SpecUnit = model.SpecialSpecUnit
} else {
@@ -1906,6 +1912,7 @@ func CreateUpcSkuByExcelBin(ctx *jxcontext.Context, reader io.Reader) (err error
}
if result.Price == "" {
createUpcSkuByExcelErrList = append(createUpcSkuByExcelErrList, buildCreateUpcSkuByExcelErr(v, "商品的售价不能为空!"))
continue
} else {
skuName.Price = int(utils.Str2Int64(result.Price) * 100)
}
@@ -1927,6 +1934,7 @@ func CreateUpcSkuByExcelBin(ctx *jxcontext.Context, reader io.Reader) (err error
_, err = AddSkuName(ctx, skuName, ctx.GetUserName())
if err != nil {
createUpcSkuByExcelErrList = append(createUpcSkuByExcelErrList, buildCreateUpcSkuByExcelErr(v, err.Error()))
continue
}
}
case 2:
@@ -1962,6 +1970,7 @@ func writeToExcel(excelTitle []string, dataList interface{}, task *tasksch.SeqTa
} else {
noticeMsg := fmt.Sprintf("[详情点我]path=%s\n", downloadURL)
task.SetNoticeMsg(noticeMsg)
baseapi.SugarLogger.Debug("WriteToExcel: dataSuccess downloadURL: [%v]", downloadURL)
}
return err
}