From c237c4957cffd5276ae7823fb28da7e382ea1567 Mon Sep 17 00:00:00 2001 From: gazebo Date: Thu, 10 Oct 2019 09:40:48 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=B4=E6=97=B6=E4=BC=91?= =?UTF-8?q?=E6=81=AF=E8=87=AA=E5=8A=A8=E6=81=A2=E5=A4=8D=E9=80=BB=E8=BE=91?= =?UTF-8?q?=EF=BC=8C=E5=85=BC=E5=AE=B9=E4=B9=8B=E5=89=8D=E6=B2=A1=E6=9C=89?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E6=81=A2=E5=A4=8D=E8=90=A5=E4=B8=9A=E6=97=B6?= =?UTF-8?q?=E9=97=B4=E7=9A=84=E6=83=85=E5=86=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/cms/store.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/business/jxstore/cms/store.go b/business/jxstore/cms/store.go index 1bf99307e..695d8d49f 100644 --- a/business/jxstore/cms/store.go +++ b/business/jxstore/cms/store.go @@ -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()