You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
go-library/service/pintoto/movie_info_get_city_list.go

43 lines
1.3 KiB

3 years ago
package pintoto
import (
2 years ago
"context"
1 year ago
"github.com/dtapps/go-library/utils/gojson"
2 years ago
"github.com/dtapps/go-library/utils/gorequest"
3 years ago
)
2 years ago
type GetCityListResponse struct {
3 years ago
Code int `json:"code"`
Message string `json:"message"`
Data struct {
2 years ago
List []GetCityListResponseDataList `json:"list"`
3 years ago
} `json:"data"`
Success bool `json:"success"`
}
2 years ago
type GetCityListResponseDataList struct {
PinYin string `json:"pinYin"` // 城市首字母
RegionName string `json:"regionName"` // 城市名
CityId int `json:"cityId"` // 城市id
}
type GetCityListResult struct {
Result GetCityListResponse // 结果
Body []byte // 内容
Http gorequest.Response // 请求
2 years ago
Err error // 错误
}
2 years ago
func newGetCityListResult(result GetCityListResponse, body []byte, http gorequest.Response, err error) *GetCityListResult {
return &GetCityListResult{Result: result, Body: body, Http: http, Err: err}
2 years ago
}
// GetCityList 城市列表
// https://www.showdoc.com.cn/1154868044931571/5865562425538244
2 years ago
func (c *Client) GetCityList(ctx context.Context) *GetCityListResult {
request, err := c.request(ctx, apiUrl+"/movieapi/movie-info/get-city-list", map[string]interface{}{})
2 years ago
var response GetCityListResponse
1 year ago
err = gojson.Unmarshal(request.ResponseBody, &response)
2 years ago
return newGetCityListResult(response, request.ResponseBody, request, err)
3 years ago
}