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.
43 lines
1.3 KiB
43 lines
1.3 KiB
package pintoto
|
|
|
|
import (
|
|
"context"
|
|
"github.com/dtapps/go-library/utils/gojson"
|
|
"github.com/dtapps/go-library/utils/gorequest"
|
|
)
|
|
|
|
type GetCityListResponse struct {
|
|
Code int `json:"code"`
|
|
Message string `json:"message"`
|
|
Data struct {
|
|
List []GetCityListResponseDataList `json:"list"`
|
|
} `json:"data"`
|
|
Success bool `json:"success"`
|
|
}
|
|
|
|
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 // 请求
|
|
Err error // 错误
|
|
}
|
|
|
|
func newGetCityListResult(result GetCityListResponse, body []byte, http gorequest.Response, err error) *GetCityListResult {
|
|
return &GetCityListResult{Result: result, Body: body, Http: http, Err: err}
|
|
}
|
|
|
|
// GetCityList 城市列表
|
|
// https://www.showdoc.com.cn/1154868044931571/5865562425538244
|
|
func (c *Client) GetCityList(ctx context.Context) *GetCityListResult {
|
|
request, err := c.request(ctx, apiUrl+"/movieapi/movie-info/get-city-list", map[string]interface{}{})
|
|
var response GetCityListResponse
|
|
err = gojson.Unmarshal(request.ResponseBody, &response)
|
|
return newGetCityListResult(response, request.ResponseBody, request, err)
|
|
}
|