From 5efc05444f00f73b7eefc4eb2931d716c0754ba0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Tue, 13 Apr 2021 18:13:05 +0800 Subject: [PATCH] aa --- business/jxstore/cms/store.go | 22 +++++++++++++++++++--- business/model/store.go | 2 ++ controllers/cms_store.go | 1 + 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/business/jxstore/cms/store.go b/business/jxstore/cms/store.go index d3665501b..ac4292662 100644 --- a/business/jxstore/cms/store.go +++ b/business/jxstore/cms/store.go @@ -430,7 +430,7 @@ func getStoresSql(ctx *jxcontext.Context, keyword string, params map[string]inte return sql, sqlParams, sqlFrom, sqlFromParams, nil } -func setStoreMapInfo(ctx *jxcontext.Context, db *dao.DaoDB, storesInfo *StoresInfo, storeIDs []int, briefLevel int) (err error) { +func setStoreMapInfo(ctx *jxcontext.Context, db *dao.DaoDB, storesInfo *StoresInfo, storeIDs []int, briefLevel int, isBussinessStatus interface{}) (err error) { storeMapList, err := dao.GetStoresMapList(db, nil, storeIDs, nil, model.StoreStatusAll, model.StoreIsSyncAll, "", "", "") if err != nil { return err @@ -439,7 +439,12 @@ func setStoreMapInfo(ctx *jxcontext.Context, db *dao.DaoDB, storesInfo *StoresIn if err != nil { return err } - + isStoreVendorStatus := false + if isBussinessStatus != nil { + if isBussinessStatus.(bool) { + isStoreVendorStatus = true + } + } storeMapMap := dao.StoreMapList2Map(storeMapList) storeCourierMap := dao.StoreCourierList2Map(storeCourierList) @@ -453,6 +458,17 @@ func setStoreMapInfo(ctx *jxcontext.Context, db *dao.DaoDB, storesInfo *StoresIn v.Licence2Image = "" } for _, v2 := range storeMapMap[v.ID] { + if isStoreVendorStatus { + if handler := CurVendorSync.GetStoreHandler(v2.VendorID); handler != nil { + if store, err := handler.ReadStore(ctx, v2.VendorOrgCode, v2.VendorStoreID); err == nil && store != nil { + if store.Status != model.StoreStatusDisabled { + v2.BussinessStatus = 1 + } else { + v2.BussinessStatus = -1 + } + } + } + } v.StoreMaps = append(v.StoreMaps, v2) } for _, v2 := range storeCourierMap[v.ID] { @@ -586,7 +602,7 @@ func GetStores(ctx *jxcontext.Context, keyword string, params map[string]interfa } if len(retVal.Stores) > 0 { - setStoreMapInfo(ctx, db, retVal, storeIDs, briefLevel) + setStoreMapInfo(ctx, db, retVal, storeIDs, briefLevel, params["isBussinessStatus"]) retVal.MapCenterLng, retVal.MapCenterLat = getMapCenter(retVal.Stores) } return retVal, err diff --git a/business/model/store.go b/business/model/store.go index 2fe4c72e5..05ea394f3 100644 --- a/business/model/store.go +++ b/business/model/store.go @@ -459,6 +459,8 @@ type StoreMap struct { MtwmToken string `orm:"size(255)" json:"mtwmToken"` //美团外卖商超token,有效期30天,每20天刷一次 MtwmRefreshToken string `orm:"size(255)" json:"mtwmRefreshToken"` //美团外卖商超refreshToken EbaiSupplierID string `orm:"column(ebai_supplier_id)" json:"ebaiSupplierID"` //饿百供应商ID + + BussinessStatus int `orm:"-" json:"bussinessStatus"` } func (*StoreMap) TableUnique() [][]string { diff --git a/controllers/cms_store.go b/controllers/cms_store.go index 9e786d51a..829e01089 100644 --- a/controllers/cms_store.go +++ b/controllers/cms_store.go @@ -47,6 +47,7 @@ type StoreController struct { // @Param brandID query int false "品牌ID" // @Param marketManPhones query string false "市场负责人电话们" // @Param earningType query int false "结算方式(1为报价,2为扣点)" +// @Param isBussinessStatus query bool false "查不查门店上下线状态" // @Param offset query int false "门店列表起始序号(以0开始,缺省为0)" // @Param pageSize query int false "门店列表页大小(缺省为50,-1表示全部)" // @Success 200 {object} controllers.CallResult