刷新门店价格修改

This commit is contained in:
苏尹岚
2020-06-03 09:54:37 +08:00
parent d7679ef6ee
commit 1eb43ea9b9
3 changed files with 17 additions and 9 deletions

View File

@@ -1618,7 +1618,7 @@ func UploadJdsImage(ctx *jxcontext.Context) (err error) {
return err
}
func RefreshJXPriceChange(ctx *jxcontext.Context) (hint string, err error) {
func RefreshJXPriceChange(ctx *jxcontext.Context, storeID int) (hint string, err error) {
db := dao.GetDB()
var (
stores []*model.Store
@@ -1630,9 +1630,12 @@ func RefreshJXPriceChange(ctx *jxcontext.Context) (hint string, err error) {
SELECT *
FROM store
WHERE deleted_at = ? AND status <> ?
AND id in (?,?,?)
`
sqlParams := []interface{}{utils.DefaultTimeValue, model.StoreStatusDisabled, 100118, 100205, 100274}
sqlParams := []interface{}{utils.DefaultTimeValue, model.StoreStatusDisabled}
if storeID != 0 {
sql += " AND id = ?"
sqlParams = append(sqlParams, storeID)
}
err = dao.GetRows(db, &stores, sql, sqlParams)
task := tasksch.NewParallelTask("刷新门店价格", tasksch.NewParallelConfig().SetIsContinueWhenError(isContinueWhenError), ctx,
func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
@@ -1672,6 +1675,8 @@ func RefreshJXPriceChange(ctx *jxcontext.Context) (hint string, err error) {
skuBindInfos = append(skuBindInfos, skuBindInfo)
}
cms.UpdateStoresSkusByBind(ctx, task, skuBindInfos, isAsync, isContinueWhenError, false)
store.PayPercentage = 100
dao.UpdateEntity(db, store, "PayPercentage")
return retVal, err
}, stores)
tasksch.HandleTask(task, nil, true).Run()