This commit is contained in:
苏尹岚
2021-04-13 18:13:05 +08:00
parent b074de535b
commit 5efc05444f
3 changed files with 22 additions and 3 deletions

View File

@@ -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

View File

@@ -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 {

View File

@@ -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