- combile SearchStores and GetStores to one func.

This commit is contained in:
gazebo
2018-09-05 10:24:30 +08:00
parent b6a8f22612
commit 26f5c26def
3 changed files with 18 additions and 68 deletions

View File

@@ -54,6 +54,7 @@ func (c *StoreController) UpdatePlaces() {
// @Title 得到京西门店信息
// @Description 得到京西门店信息,如下条件之间是与的关系
// @Param token header string true "认证token"
// @Param keyword query string false "查询关键字(可以为空,为空表示不限制)"
// @Param id query int false "门店ID"
// @Param name query string false "门店名称(不要求完全一致)"
// @Param placeID query int false "所属地点ID"
@@ -69,31 +70,7 @@ func (c *StoreController) UpdatePlaces() {
// @router /GetStores [get]
func (c *StoreController) GetStores() {
c.callGetStores(func(params *tStoreGetStoresParams) (retVal interface{}, errCode string, err error) {
retVal, err = cms.GetStores(params.MapData, params.Offset, params.PageSize)
return retVal, "", err
})
}
// @Title 查询京西门店信息
// @Description 查询京西门店信息,根据关键字查询门店,如果关键字可以转换成数字,还会尝试数值相关的信息
// @Param token header string true "认证token"
// @Param keyword query string true "查询关键字"
// @Param fromStatus query int false "起始状态(缺省为营业中状态)"
// @Param toStatus query int false "结束状态"
// @Param offset query int false "门店列表起始序号以0开始缺省为0"
// @Param pageSize query int false "门店列表页大小缺省为50"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /SearchStores [get]
func (c *StoreController) SearchStores() {
c.callSearchStores(func(params *tStoreSearchStoresParams) (retVal interface{}, errCode string, err error) {
if params.MapData["fromStatus"] == nil {
params.FromStatus = 1
}
if params.MapData["toStatus"] == nil {
params.ToStatus = params.FromStatus
}
retVal, err = cms.SearchStores(params.Keyword, params.FromStatus, params.ToStatus, params.Offset, params.PageSize)
retVal, err = cms.GetStores(params.Keyword, params.MapData, params.Offset, params.PageSize)
return retVal, "", err
})
}