根据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
}

View File

@@ -577,9 +577,10 @@ func GetStorePriceScore(db *DaoDB, storeIDs, vendorIDs []int, fromScore, toScore
LEFT JOIN act_map c ON c.act_id = b.act_id
LEFT JOIN act d ON d.id = c.act_id
WHERE 1=1
AND d.status = ?
`
sqlParams := []interface{}{
model.ActSkuDirectDown, model.ActSkuSecKill,
model.ActSkuDirectDown, model.ActSkuSecKill, model.ActStatusCreated,
}
if len(storeIDs) > 0 {
sql += " AND a.store_id IN(" + GenQuestionMarks(len(storeIDs)) + ")"
@@ -592,12 +593,12 @@ func GetStorePriceScore(db *DaoDB, storeIDs, vendorIDs []int, fromScore, toScore
sql += `
AND NOW() BETWEEN d.begin_at AND d.end_at
AND a.status = ?
AND a.deleted_at = ?
AND a.deleted_at = ? AND b.deleted_at = ? AND c.deleted_at = ? AND d.deleted_at = ?
GROUP BY 1,2,3)t1
GROUP BY 1)t2 ON t2.store_id = a.store_id
WHERE 1=1
`
sqlParams = append(sqlParams, model.StoreSkuBindStatusNormal, utils.DefaultTimeValue)
sqlParams = append(sqlParams, model.StoreSkuBindStatusNormal, utils.DefaultTimeValue, utils.DefaultTimeValue, utils.DefaultTimeValue, utils.DefaultTimeValue)
if fromScore != 0 || toScore != 0 {
sql += " AND a.score BETWEEN ? AND ?"
sqlParams = append(sqlParams, fromScore, toScore)