This commit is contained in:
苏尹岚
2020-12-02 18:10:22 +08:00
parent 8fcd186ed3
commit 3405090597
3 changed files with 9 additions and 4 deletions

View File

@@ -348,6 +348,6 @@ func EjyStationToStationInfo(station *ejyapi.GetStationListResult) (stationInfo
return stationInfo
}
func GetStationList(ctx *jxcontext.Context, stationName string, cityCode int, lat, lng float64, sortType, offset, pageSize int) (pageInfo *model.PagedInfo, err error) {
return dao.GetStationInfoList(dao.GetDB(), stationName, cityCode, lat, lng, sortType, offset, pageSize)
func GetStationList(ctx *jxcontext.Context, stationName string, cityCode int, lat, lng float64, oilCode string, sortType, offset, pageSize int) (pageInfo *model.PagedInfo, err error) {
return dao.GetStationInfoList(dao.GetDB(), stationName, cityCode, lat, lng, oilCode, sortType, offset, pageSize)
}

View File

@@ -423,7 +423,7 @@ func GetStationList(db *DaoDB) (stations []*model.StationInfo, err error) {
return stations, err
}
func GetStationInfoList(db *DaoDB, stationName string, cityCode int, lat, lng float64, sortType, offset, pageSize int) (pagedInfo *model.PagedInfo, err error) {
func GetStationInfoList(db *DaoDB, stationName string, cityCode int, lat, lng float64, oilCode string, sortType, offset, pageSize int) (pagedInfo *model.PagedInfo, err error) {
var (
stations []*model.StationInfo
distanceFlag bool
@@ -451,6 +451,10 @@ func GetStationInfoList(db *DaoDB, stationName string, cityCode int, lat, lng fl
sql += " AND city_id = ?"
sqlParams = append(sqlParams, cityCode)
}
if oilCode != "" {
sql += " AND POSITION(oilCode IN prices) > 0"
sqlParams = append(sqlParams, oilCode)
}
if sortType != 0 {
if sortType == 1 {
sql += " ORDER BY distance"

View File

@@ -329,6 +329,7 @@ func (c *JobController) CheckJdDeliveryWeight() {
// @Param cityCode query int false "城市ID"
// @Param lat query float64 false "用户坐标"
// @Param lng query float64 false "用户坐标"
// @Param oilCode query string false "油号"
// @Param sortType query int false "排序, 1为距离2为评分"
// @Param offset query int false "门店列表起始序号以0开始缺省为0"
// @Param pageSize query int false "门店列表页大小缺省为50-1表示全部"
@@ -337,7 +338,7 @@ func (c *JobController) CheckJdDeliveryWeight() {
// @router /GetStationList [get]
func (c *JobController) GetStationList() {
c.callGetStationList(func(params *tJobGetStationListParams) (retVal interface{}, errCode string, err error) {
retVal, err = cms.GetStationList(params.Ctx, params.StationName, params.CityCode, params.Lat, params.Lng, params.SortType, params.Offset, params.PageSize)
retVal, err = cms.GetStationList(params.Ctx, params.StationName, params.CityCode, params.Lat, params.Lng, params.OilCode, params.SortType, params.Offset, params.PageSize)
return retVal, "", err
})
}