From f92ff23a56b029534fc90cb6485e23a1c6529639 Mon Sep 17 00:00:00 2001 From: gazebo Date: Fri, 19 Jul 2019 14:46:07 +0800 Subject: [PATCH] =?UTF-8?q?-=20=E5=B0=86OpenRemoteStoreByJxStatus=E5=8A=A0?= =?UTF-8?q?=E5=85=A5=E6=AF=8F=E6=97=A5=E8=B0=83=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/cms/store.go | 6 ++++-- business/jxstore/cms/sync_store.go | 4 +++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/business/jxstore/cms/store.go b/business/jxstore/cms/store.go index a8c9fbbfb..51fd244ed 100644 --- a/business/jxstore/cms/store.go +++ b/business/jxstore/cms/store.go @@ -1593,7 +1593,7 @@ func sendStoreStatusInfo2Mobile(mobile, title, txtAlarm string) { } } -func SaveAndSendAlarmVendorSnapshot(ctx *jxcontext.Context, vendorIDs, storeIDs []int) (err error) { +func SaveAndSendAlarmVendorSnapshot(ctx *jxcontext.Context, vendorIDs, storeIDs []int, isAsync bool) (err error) { curSnapshotAt := getCurrentSnapshotAt(time.Now()) db := dao.GetDB() var curSnapshotList, prevSnapshotList []*model.VendorStoreSnapshot @@ -1617,6 +1617,8 @@ func SaveAndSendAlarmVendorSnapshot(ctx *jxcontext.Context, vendorIDs, storeIDs return nil, err }, 4) tasksch.ManageTask(task).Run() - _, err = task.GetResult(0) + if !isAsync { + _, err = task.GetResult(0) + } return err } diff --git a/business/jxstore/cms/sync_store.go b/business/jxstore/cms/sync_store.go index 5d58de7c7..8aac73b73 100644 --- a/business/jxstore/cms/sync_store.go +++ b/business/jxstore/cms/sync_store.go @@ -37,7 +37,9 @@ func OpenRemoteStoreByJxStatus(ctx *jxcontext.Context, vendorIDs, storeIDs []int storeDetail, err := dao.GetStoreDetail(db, storeMap.StoreID, storeMap.VendorID) if err == nil && storeDetail.Status == model.StoreStatusOpened { if err = handler.UpdateStoreStatus(ctx, storeMap.StoreID, storeMap.VendorStoreID, model.StoreStatusOpened); err == nil { - retVal = []int{0} + storeMap.Status = model.StoreStatusOpened + dao.UpdateEntity(db, storeMap, model.FieldStatus) + retVal = []int{1} } } }