GetStores添加可选参数:briefLevel
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -39,6 +39,7 @@ type StoreController struct {
|
||||
// @Param orderTimeTo query string false "订单创建结束时间"
|
||||
// @Param orderCountFrom query int false "订单量起始"
|
||||
// @Param orderCountTo query int false "订单量结束"
|
||||
// @Param briefLevel query int false "返回信息精简模式"
|
||||
// @Param offset query int false "门店列表起始序号(以0开始,缺省为0)"
|
||||
// @Param pageSize query int false "门店列表页大小(缺省为50,-1表示全部)"
|
||||
// @Success 200 {object} controllers.CallResult
|
||||
|
||||
Reference in New Issue
Block a user