创建标品测试

This commit is contained in:
苏尹岚
2020-04-22 14:13:26 +08:00
parent 95c4f30897
commit 0911b71253

View File

@@ -1853,8 +1853,10 @@ func CreateUpcSkuByExcelBin(ctx *jxcontext.Context, reader io.Reader, categoryID
} }
case 1: case 1:
taskFunc := func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) { taskFunc := func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
v := batchItemList[0].(*model.SkuName) var (
skuName := &model.SkuNameExt{ v = batchItemList[0].(*model.SkuName)
skuNames []model.SkuName
skuName = &model.SkuNameExt{
SkuName: model.SkuName{}, SkuName: model.SkuName{},
Skus: []*model.SkuWithVendor{ Skus: []*model.SkuWithVendor{
&model.SkuWithVendor{ &model.SkuWithVendor{
@@ -1862,6 +1864,7 @@ func CreateUpcSkuByExcelBin(ctx *jxcontext.Context, reader io.Reader, categoryID
}, },
}, },
} }
)
if v.Upc != nil { if v.Upc != nil {
upc := upcRegexp.FindString(*v.Upc) upc := upcRegexp.FindString(*v.Upc)
if upc == "" { if upc == "" {
@@ -1873,10 +1876,11 @@ func CreateUpcSkuByExcelBin(ctx *jxcontext.Context, reader io.Reader, categoryID
retVal = []*CreateUpcSkuByExcelErr{buildCreateUpcSkuByExcelErr(v, "商品的条码不能为空!")} retVal = []*CreateUpcSkuByExcelErr{buildCreateUpcSkuByExcelErr(v, "商品的条码不能为空!")}
return retVal, err return retVal, err
} }
skuNames, err := dao.GetSkuNames(db, nil, []string{*v.Upc}, "", false) sql := `
fmt.Println(utils.Format4Output(v, false)) SELECT * FROM sku_name WHERE upc = ? AND deleted_at = ?
fmt.Println(err) `
fmt.Println("test1111111111111111111111111111", utils.Format4Output(skuNames, false)) sqlParams := []interface{}{*v.Upc, utils.DefaultTimeValue}
err = dao.GetRows(db, &skuNames, sql, sqlParams)
if len(skuNames) > 0 { if len(skuNames) > 0 {
retVal = []*CreateUpcSkuByExcelErr{buildCreateUpcSkuByExcelErr(v, "商品在京西库中已存在!")} retVal = []*CreateUpcSkuByExcelErr{buildCreateUpcSkuByExcelErr(v, "商品在京西库中已存在!")}
return retVal, err return retVal, err