商品额外信息
This commit is contained in:
@@ -2534,3 +2534,51 @@ func deleteJdsSku(db *dao.DaoDB, skuID int) (err error) {
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func UpdateSkuExinfoMap(ctx *jxcontext.Context, nameIDs []int, imgWaterMark string, vendorID int, exPrefix, fromTime, toTime string, isAsync, isContinueWhenError bool) (hint string, err error) {
|
||||
var (
|
||||
fromTimeP time.Time
|
||||
toTimeP time.Time
|
||||
db = dao.GetDB()
|
||||
)
|
||||
if fromTime != "" {
|
||||
fromTimeP = utils.Time2Date(utils.Str2Time(fromTime))
|
||||
}
|
||||
if toTime != "" {
|
||||
toTimeP = utils.Time2Date(utils.Str2Time(toTime))
|
||||
}
|
||||
if toTimeP.Before(fromTimeP) {
|
||||
return "", fmt.Errorf("结束时间不可以小于开始时间!开始时间:[%v],结束时间:[%v]", fromTimeP, toTimeP)
|
||||
}
|
||||
task := tasksch.NewParallelTask("RefreshOrdersPriceInfo", tasksch.NewParallelConfig().SetIsContinueWhenError(isContinueWhenError), ctx,
|
||||
func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
|
||||
nameID := batchItemList[0].(int)
|
||||
skuEx := &model.SkuExinfoMap{
|
||||
NameID: nameID,
|
||||
ImgWatermark: imgWaterMark,
|
||||
ExPrefix: exPrefix,
|
||||
VendorID: vendorID,
|
||||
BeginAt: fromTimeP,
|
||||
EndAt: toTimeP,
|
||||
}
|
||||
dao.WrapAddIDCULEntity(skuEx, ctx.GetUserName())
|
||||
skuExs, _ := dao.GetSkuExinfos(db, []int{nameID}, vendorID, "", utils.ZeroTimeValue, utils.ZeroTimeValue)
|
||||
if len(skuExs) > 0 {
|
||||
skuEx2 := skuExs[0]
|
||||
dao.WrapAddIDCULDEntity(skuEx2, ctx.GetUserName())
|
||||
dao.UpdateEntity(db, skuEx2)
|
||||
dao.CreateEntity(db, skuEx)
|
||||
} else {
|
||||
dao.CreateEntity(db, skuEx)
|
||||
}
|
||||
return retVal, err
|
||||
}, nameIDs)
|
||||
tasksch.HandleTask(task, nil, true).Run()
|
||||
if isAsync {
|
||||
hint = task.GetID()
|
||||
} else {
|
||||
_, err = task.GetResult(0)
|
||||
hint = "1"
|
||||
}
|
||||
return hint, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user