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_cinema_list.go

54 lines
2.0 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
)
type GetCinemaListResponse struct {
3 years ago
Code int `json:"code"`
Message string `json:"message"`
Data struct {
List []struct {
CinemaId int `json:"cinemaId"` // 影院id
CityId int `json:"cityId"` // 城市id
CinemaName string `json:"cinemaName"` // 影院名称
Address string `json:"address"` // 影院地址
Latitude float64 `json:"latitude"` // 纬度
Longitude float64 `json:"longitude"` // 经度
Phone string `json:"phone"` // 影院电话
RegionName string `json:"regionName"` // 地区名称
IsAcceptSoonOrder int `json:"isAcceptSoonOrder"` // 是否支持秒出票0为不支持1为支持
NetPrice int `json:"netPrice"` // 当前影院最低价的排期
} `json:"list"`
} `json:"data"`
Success bool `json:"success"`
}
type GetCinemaListResult struct {
Result GetCinemaListResponse // 结果
Body []byte // 内容
Http gorequest.Response // 请求
Err error // 错误
}
2 years ago
func newGetCinemaListResult(result GetCinemaListResponse, body []byte, http gorequest.Response, err error) *GetCinemaListResult {
return &GetCinemaListResult{Result: result, Body: body, Http: http, Err: err}
}
3 years ago
// GetCinemaList 影院列表 https://www.showdoc.com.cn/1154868044931571/5866426126744792
2 years ago
func (c *Client) GetCinemaList(ctx context.Context, cityId int) *GetCinemaListResult {
2 years ago
// 参数
2 years ago
param := gorequest.NewParams()
2 years ago
param.Set("cityId", cityId)
// 转换
2 years ago
params := gorequest.NewParamsWith(param)
2 years ago
// 请求
2 years ago
request, err := c.request(ctx, apiUrl+"/movieapi/movie-info/get-cinema-list", params)
// 定义
var response GetCinemaListResponse
1 year ago
err = gojson.Unmarshal(request.ResponseBody, &response)
2 years ago
return newGetCinemaListResult(response, request.ResponseBody, request, err)
3 years ago
}