修改临时休息自动恢复逻辑,兼容之前没有设置恢复营业时间的情况
This commit is contained in:
@@ -742,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