GetStores添加可选参数:briefLevel

This commit is contained in:
gazebo
2019-11-06 18:31:27 +08:00
parent d01da6020a
commit d7360648ec
2 changed files with 7 additions and 2 deletions

View File

@@ -311,7 +311,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) (err error) {
func setStoreMapInfo(ctx *jxcontext.Context, db *dao.DaoDB, storesInfo *StoresInfo, storeIDs []int, briefLevel int) (err error) {
storeMapList, err := dao.GetStoresMapList(db, nil, storeIDs, model.StoreStatusAll, model.StoreIsSyncAll, "")
if err != nil {
return err
@@ -331,6 +331,9 @@ func setStoreMapInfo(ctx *jxcontext.Context, db *dao.DaoDB, storesInfo *StoresIn
}
for _, v := range storesInfo.Stores {
if briefLevel > 0 {
v.DeliveryRange = ""
}
for _, v2 := range storeMapMap[v.ID] {
v.StoreMaps = append(v.StoreMaps, utils.Struct2FlatMap(v2))
}
@@ -343,6 +346,7 @@ func setStoreMapInfo(ctx *jxcontext.Context, db *dao.DaoDB, storesInfo *StoresIn
// todo 门店绑定信息可以考虑以数组形式返回,而不是现在这样
func GetStores(ctx *jxcontext.Context, keyword string, params map[string]interface{}, offset, pageSize int, orderTimeFrom, orderTimeTo time.Time, orderCountFrom, orderCountTo int) (retVal *StoresInfo, err error) {
briefLevel := int(utils.ForceInterface2Int64(params["briefLevel"]))
sql, sqlParams, _, _, err := getStoresSql(ctx, keyword, params, orderTimeFrom, orderTimeTo)
if err != nil {
@@ -448,7 +452,7 @@ func GetStores(ctx *jxcontext.Context, keyword string, params map[string]interfa
}
if len(retVal.Stores) > 0 {
setStoreMapInfo(ctx, db, retVal, storeIDs)
setStoreMapInfo(ctx, db, retVal, storeIDs, briefLevel)
retVal.MapCenterLng, retVal.MapCenterLat = getMapCenter(retVal.Stores)
}
return retVal, err