根据excel导入标品
This commit is contained in:
@@ -1850,12 +1850,15 @@ func CreateUpcSkuByExcelBin(ctx *jxcontext.Context, reader io.Reader) (err error
|
|||||||
skuName.Img = downloadURL2
|
skuName.Img = downloadURL2
|
||||||
} else {
|
} else {
|
||||||
createUpcSkuByExcelErrList = append(createUpcSkuByExcelErrList, buildCreateUpcSkuByExcelErr(v, err.Error()))
|
createUpcSkuByExcelErrList = append(createUpcSkuByExcelErrList, buildCreateUpcSkuByExcelErr(v, err.Error()))
|
||||||
|
continue
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
createUpcSkuByExcelErrList = append(createUpcSkuByExcelErrList, buildCreateUpcSkuByExcelErr(v, err.Error()))
|
createUpcSkuByExcelErrList = append(createUpcSkuByExcelErrList, buildCreateUpcSkuByExcelErr(v, err.Error()))
|
||||||
|
continue
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
createUpcSkuByExcelErrList = append(createUpcSkuByExcelErrList, buildCreateUpcSkuByExcelErr(v, err.Error()))
|
createUpcSkuByExcelErrList = append(createUpcSkuByExcelErrList, buildCreateUpcSkuByExcelErr(v, err.Error()))
|
||||||
|
continue
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
skuName.Img = model.NOSkuNameImg
|
skuName.Img = model.NOSkuNameImg
|
||||||
@@ -1868,6 +1871,7 @@ func CreateUpcSkuByExcelBin(ctx *jxcontext.Context, reader io.Reader) (err error
|
|||||||
if v.Price == 0 {
|
if v.Price == 0 {
|
||||||
if result.Price == "" {
|
if result.Price == "" {
|
||||||
createUpcSkuByExcelErrList = append(createUpcSkuByExcelErrList, buildCreateUpcSkuByExcelErr(v, "商品的售价不能为空!"))
|
createUpcSkuByExcelErrList = append(createUpcSkuByExcelErrList, buildCreateUpcSkuByExcelErr(v, "商品的售价不能为空!"))
|
||||||
|
continue
|
||||||
} else {
|
} else {
|
||||||
skuName.Price = int(utils.Str2Int64(result.Price) * 100)
|
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
|
skuName.Unit = v.Unit
|
||||||
} else {
|
} else {
|
||||||
createUpcSkuByExcelErrList = append(createUpcSkuByExcelErrList, buildCreateUpcSkuByExcelErr(v, "商品的单位不能为空!"))
|
createUpcSkuByExcelErrList = append(createUpcSkuByExcelErrList, buildCreateUpcSkuByExcelErr(v, "商品的单位不能为空!"))
|
||||||
|
continue
|
||||||
}
|
}
|
||||||
if v.SpecQuality != 0 {
|
if v.SpecQuality != 0 {
|
||||||
skuName.Skus[0].SpecQuality = v.SpecQuality
|
skuName.Skus[0].SpecQuality = v.SpecQuality
|
||||||
skuName.Skus[0].Weight = int(utils.Str2Int64(utils.Float64ToStr(float64(v.SpecQuality))))
|
skuName.Skus[0].Weight = int(utils.Str2Int64(utils.Float64ToStr(float64(v.SpecQuality))))
|
||||||
} else {
|
} else {
|
||||||
createUpcSkuByExcelErrList = append(createUpcSkuByExcelErrList, buildCreateUpcSkuByExcelErr(v, "商品的重量不能为空!"))
|
createUpcSkuByExcelErrList = append(createUpcSkuByExcelErrList, buildCreateUpcSkuByExcelErr(v, "商品的重量不能为空!"))
|
||||||
|
continue
|
||||||
}
|
}
|
||||||
skuName.Skus[0].SpecUnit = model.SpecialSpecUnit
|
skuName.Skus[0].SpecUnit = model.SpecialSpecUnit
|
||||||
} else {
|
} else {
|
||||||
@@ -1906,6 +1912,7 @@ func CreateUpcSkuByExcelBin(ctx *jxcontext.Context, reader io.Reader) (err error
|
|||||||
}
|
}
|
||||||
if result.Price == "" {
|
if result.Price == "" {
|
||||||
createUpcSkuByExcelErrList = append(createUpcSkuByExcelErrList, buildCreateUpcSkuByExcelErr(v, "商品的售价不能为空!"))
|
createUpcSkuByExcelErrList = append(createUpcSkuByExcelErrList, buildCreateUpcSkuByExcelErr(v, "商品的售价不能为空!"))
|
||||||
|
continue
|
||||||
} else {
|
} else {
|
||||||
skuName.Price = int(utils.Str2Int64(result.Price) * 100)
|
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())
|
_, err = AddSkuName(ctx, skuName, ctx.GetUserName())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
createUpcSkuByExcelErrList = append(createUpcSkuByExcelErrList, buildCreateUpcSkuByExcelErr(v, err.Error()))
|
createUpcSkuByExcelErrList = append(createUpcSkuByExcelErrList, buildCreateUpcSkuByExcelErr(v, err.Error()))
|
||||||
|
continue
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case 2:
|
case 2:
|
||||||
@@ -1962,6 +1970,7 @@ func writeToExcel(excelTitle []string, dataList interface{}, task *tasksch.SeqTa
|
|||||||
} else {
|
} else {
|
||||||
noticeMsg := fmt.Sprintf("[详情点我]path=%s\n", downloadURL)
|
noticeMsg := fmt.Sprintf("[详情点我]path=%s\n", downloadURL)
|
||||||
task.SetNoticeMsg(noticeMsg)
|
task.SetNoticeMsg(noticeMsg)
|
||||||
|
baseapi.SugarLogger.Debug("WriteToExcel: dataSuccess downloadURL: [%v]", downloadURL)
|
||||||
}
|
}
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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_map c ON c.act_id = b.act_id
|
||||||
LEFT JOIN act d ON d.id = c.act_id
|
LEFT JOIN act d ON d.id = c.act_id
|
||||||
WHERE 1=1
|
WHERE 1=1
|
||||||
|
AND d.status = ?
|
||||||
`
|
`
|
||||||
sqlParams := []interface{}{
|
sqlParams := []interface{}{
|
||||||
model.ActSkuDirectDown, model.ActSkuSecKill,
|
model.ActSkuDirectDown, model.ActSkuSecKill, model.ActStatusCreated,
|
||||||
}
|
}
|
||||||
if len(storeIDs) > 0 {
|
if len(storeIDs) > 0 {
|
||||||
sql += " AND a.store_id IN(" + GenQuestionMarks(len(storeIDs)) + ")"
|
sql += " AND a.store_id IN(" + GenQuestionMarks(len(storeIDs)) + ")"
|
||||||
@@ -592,12 +593,12 @@ func GetStorePriceScore(db *DaoDB, storeIDs, vendorIDs []int, fromScore, toScore
|
|||||||
sql += `
|
sql += `
|
||||||
AND NOW() BETWEEN d.begin_at AND d.end_at
|
AND NOW() BETWEEN d.begin_at AND d.end_at
|
||||||
AND a.status = ?
|
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,2,3)t1
|
||||||
GROUP BY 1)t2 ON t2.store_id = a.store_id
|
GROUP BY 1)t2 ON t2.store_id = a.store_id
|
||||||
WHERE 1=1
|
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 {
|
if fromScore != 0 || toScore != 0 {
|
||||||
sql += " AND a.score BETWEEN ? AND ?"
|
sql += " AND a.score BETWEEN ? AND ?"
|
||||||
sqlParams = append(sqlParams, fromScore, toScore)
|
sqlParams = append(sqlParams, fromScore, toScore)
|
||||||
|
|||||||
Reference in New Issue
Block a user