更新商品前缀图修改
This commit is contained in:
@@ -2542,6 +2542,7 @@ func UpdateSkuExinfoMap(ctx *jxcontext.Context, nameIDs []int, imgWaterMark stri
|
|||||||
fromTimeP time.Time
|
fromTimeP time.Time
|
||||||
toTimeP time.Time
|
toTimeP time.Time
|
||||||
db = dao.GetDB()
|
db = dao.GetDB()
|
||||||
|
skuIDs []int
|
||||||
)
|
)
|
||||||
if fromTime != "" {
|
if fromTime != "" {
|
||||||
fromTimeP = utils.Time2Date(utils.Str2Time(fromTime))
|
fromTimeP = utils.Time2Date(utils.Str2Time(fromTime))
|
||||||
@@ -2552,8 +2553,10 @@ func UpdateSkuExinfoMap(ctx *jxcontext.Context, nameIDs []int, imgWaterMark stri
|
|||||||
if toTimeP.Before(fromTimeP) {
|
if toTimeP.Before(fromTimeP) {
|
||||||
return "", fmt.Errorf("结束时间不可以小于开始时间!开始时间:[%v],结束时间:[%v]", fromTimeP, toTimeP)
|
return "", fmt.Errorf("结束时间不可以小于开始时间!开始时间:[%v],结束时间:[%v]", fromTimeP, toTimeP)
|
||||||
}
|
}
|
||||||
task := tasksch.NewParallelTask("UpdateSkuExinfoMap", tasksch.NewParallelConfig().SetIsContinueWhenError(isContinueWhenError), ctx,
|
taskSeqFunc := func(task *tasksch.SeqTask, step int, params ...interface{}) (result interface{}, err error) {
|
||||||
func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
|
switch step {
|
||||||
|
case 0:
|
||||||
|
taskFunc := func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
|
||||||
nameID := batchItemList[0].(int)
|
nameID := batchItemList[0].(int)
|
||||||
skuEx := &model.SkuExinfoMap{
|
skuEx := &model.SkuExinfoMap{
|
||||||
NameID: nameID,
|
NameID: nameID,
|
||||||
@@ -2593,25 +2596,32 @@ func UpdateSkuExinfoMap(ctx *jxcontext.Context, nameIDs []int, imgWaterMark stri
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return retVal, err
|
return retVal, err
|
||||||
}, nameIDs)
|
}
|
||||||
tasksch.HandleTask(task, nil, true).Run()
|
taskParallel := tasksch.NewParallelTask("UpdateSkuExinfoMap", tasksch.NewParallelConfig().SetParallelCount(parallelCount), ctx, taskFunc, nameIDs)
|
||||||
if isAsync {
|
tasksch.HandleTask(taskParallel, task, true).Run()
|
||||||
hint = task.GetID()
|
|
||||||
} else {
|
|
||||||
var skuIDs []int
|
|
||||||
result, err2 := task.GetResult(0)
|
result, err2 := task.GetResult(0)
|
||||||
err = err2
|
err = err2
|
||||||
if len(result) > 0 {
|
if len(result) > 0 {
|
||||||
for _, v := range result {
|
for _, v := range result {
|
||||||
skuIDs = append(skuIDs, int(utils.Interface2Int64WithDefault(v, 0)))
|
skuIDs = append(skuIDs, int(utils.Interface2Int64WithDefault(v, 0)))
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
case 1:
|
||||||
if partner.IsMultiStore(vendorID) {
|
if partner.IsMultiStore(vendorID) {
|
||||||
CurVendorSync.SyncSkus(ctx, db, nil, skuIDs, isAsync, isContinueWhenError, ctx.GetUserName())
|
CurVendorSync.SyncSkus(ctx, db, nil, skuIDs, isAsync, isContinueWhenError, ctx.GetUserName())
|
||||||
} else {
|
} else {
|
||||||
CurVendorSync.SyncStoresSkus2(ctx, nil, 0, db, []int{vendorID}, nil, false, skuIDs, nil, model.SyncFlagModifiedMask, isAsync, isContinueWhenError)
|
CurVendorSync.SyncStoresSkus2(ctx, nil, 0, db, []int{vendorID}, nil, false, skuIDs, nil, model.SyncFlagModifiedMask, isAsync, isContinueWhenError)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return result, err
|
||||||
|
}
|
||||||
|
taskSeq := tasksch.NewSeqTask2("更新商品前缀", ctx, isContinueWhenError, taskSeqFunc, 2)
|
||||||
|
tasksch.HandleTask(taskSeq, nil, true).Run()
|
||||||
|
if !isAsync {
|
||||||
|
_, err = taskSeq.GetResult(0)
|
||||||
hint = "1"
|
hint = "1"
|
||||||
|
} else {
|
||||||
|
hint = taskSeq.GetID()
|
||||||
}
|
}
|
||||||
return hint, err
|
return hint, err
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user