Merge remote-tracking branch 'origin/mark' into don
This commit is contained in:
@@ -649,8 +649,22 @@ func UpdateStore(ctx *jxcontext.Context, storeID int, payload map[string]interfa
|
||||
break
|
||||
}
|
||||
}
|
||||
status := 0
|
||||
if valid["status"] != nil {
|
||||
syncStatus |= model.SyncFlagStoreStatus
|
||||
|
||||
status = int(utils.Interface2Int64WithDefault(valid["status"], 0))
|
||||
if status != model.StoreStatusClosed && status != model.StoreStatusHaveRest {
|
||||
valid["autoEnableAt"] = nil
|
||||
} else {
|
||||
if valid["autoEnableAt"] != nil {
|
||||
status = model.StoreStatusHaveRest
|
||||
valid["autoEnableAt"] = utils.Time2Date(utils.Str2Time(utils.Interface2String(valid["autoEnableAt"])))
|
||||
} else {
|
||||
status = model.StoreStatusClosed
|
||||
}
|
||||
valid["status"] = status
|
||||
}
|
||||
}
|
||||
|
||||
if valid["deliveryRange"] != nil {
|
||||
@@ -678,7 +692,7 @@ func UpdateStore(ctx *jxcontext.Context, storeID int, payload map[string]interfa
|
||||
dummy := &model.StoreMap{}
|
||||
kv := make(map[string]interface{})
|
||||
if valid["status"] != nil {
|
||||
if status := int(utils.Interface2Int64WithDefault(valid["status"], 0)); status == model.StoreStatusOpened {
|
||||
if syncStatus&model.SyncFlagStoreStatus != 0 && status == model.StoreStatusOpened {
|
||||
kv[model.FieldStatus] = status
|
||||
}
|
||||
}
|
||||
@@ -728,7 +742,15 @@ func EnableHaveRestStores(ctx *jxcontext.Context, isAsync, isContinueWhenError b
|
||||
task := tasksch.NewParallelTask("EnableHaveRestStores", tasksch.NewParallelConfig().SetIsContinueWhenError(isContinueWhenError), ctx,
|
||||
func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
|
||||
store := batchItemList[0].(*StoreExt)
|
||||
err = SetStoreStatus(ctx, store.ID, model.StoreStatusOpened)
|
||||
var autoEnableAt time.Time
|
||||
if store.AutoEnableAt != nil {
|
||||
autoEnableAt = *store.AutoEnableAt
|
||||
} else {
|
||||
autoEnableAt = utils.Time2Date(time.Now().Add(24 * time.Hour)) // 临时休息,但没有设置恢复营业时间,缺省是第二天
|
||||
}
|
||||
if time.Now().Sub(autoEnableAt) >= -2*time.Hour {
|
||||
err = SetStoreStatus(ctx, store.ID, model.StoreStatusOpened)
|
||||
}
|
||||
return nil, err
|
||||
}, storeInfo.Stores)
|
||||
tasksch.ManageTask(task).Run()
|
||||
|
||||
Reference in New Issue
Block a user