From 86f58bd376dda2d27194d97c0d13daa2bb51b16f Mon Sep 17 00:00:00 2001 From: suyl <770236076@qq.com> Date: Fri, 6 Aug 2021 10:47:33 +0800 Subject: [PATCH] aa --- business/jxstore/cms/sync.go | 30 ++++++++++++++++++++++++++++++ business/jxstore/misc/misc.go | 3 ++- business/jxstore/tempop/tempop.go | 2 +- 3 files changed, 33 insertions(+), 2 deletions(-) diff --git a/business/jxstore/cms/sync.go b/business/jxstore/cms/sync.go index 1aed3aa54..427222c21 100644 --- a/business/jxstore/cms/sync.go +++ b/business/jxstore/cms/sync.go @@ -1530,3 +1530,33 @@ func SetMTPSStatus(ctx *jxcontext.Context, storeId, courierStatus int) { } globals.SugarLogger.Debug("SetMTPSStatus is Complete") } + +func SetMTPSStatus2(storeID int) { + var ( + db = dao.GetDB() + storeIDs []int + ) + if storeID != 0 { + storeIDs = append(storeIDs, storeID) + } + stores, _ := dao.GetStoreCourierList(db, storeIDs, []int{model.VendorIDMTPS}, model.StoreStatusAll, model.StoreAuditStatusAll) + for _, v := range stores { + storeDetail, _ := dao.GetStoreDetail2(db, v.StoreID, "", model.VendorIDMTPS) + _, err := api.MtpsAPI.CheckOrder(utils.Int2Str(v.StoreID), storeDetail.Address, int64(storeDetail.Lng), int64(storeDetail.Lat), time.Now().Unix()) + if mtpsapi.IsOpen(err) { + sl := make(map[string]interface{}) + sl["status"] = 1 + sl["vendorStatus"] = 1 + UpdateStoreCourierMap(jxcontext.AdminCtx, db, v.StoreID, model.VendorIDMTPS, sl, "jxadmin") + } else { + if mtpsapi.IsExist(err) { + DeleteStoreCourierMap(jxcontext.AdminCtx, db, v.StoreID, model.VendorIDMTPS, "jxadmin") + } else { + sl := make(map[string]interface{}) + sl["status"] = 0 + sl["vendorStatus"] = 0 + UpdateStoreCourierMap(jxcontext.AdminCtx, db, v.StoreID, model.VendorIDMTPS, sl, "jxadmin") + } + } + } +} diff --git a/business/jxstore/misc/misc.go b/business/jxstore/misc/misc.go index bb61079de..09759cc11 100644 --- a/business/jxstore/misc/misc.go +++ b/business/jxstore/misc/misc.go @@ -318,7 +318,8 @@ func Init() { //刷新物料订单状态 localjx.RefreshAllMatterOrderStatus(jxcontext.AdminCtx) //同步美团配送与否状态及美团门店是否存在 - cms.SetMTPSStatus(jxcontext.AdminCtx, 0, 0) + //cms.SetMTPSStatus(jxcontext.AdminCtx, 0, 0) + cms.SetMTPSStatus2(0) //售后单如果超过12小时没有审核,就自动通过 RefreshAfsOrderStatusAccess(jxcontext.AdminCtx) //刷新门店分组管理 diff --git a/business/jxstore/tempop/tempop.go b/business/jxstore/tempop/tempop.go index 1d2be4f0c..918109b3e 100644 --- a/business/jxstore/tempop/tempop.go +++ b/business/jxstore/tempop/tempop.go @@ -1970,7 +1970,7 @@ func UploadJdsImage(ctx *jxcontext.Context) (err error) { // } // } //} - cms.RefreshPageStore() + cms.SetMTPSStatus2(668202) return err }