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

67 lines
2.4 KiB

2 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"
2 years ago
)
type GetShowList struct {
Page int `json:"page,omitempty"` // 页码默认1
Limit int `json:"limit,omitempty"` // 条数,默认 10
FilmId int `json:"filmId"` // 影片id由热映/即将上映接口获得
CityId int `json:"cityId"` // 城市id由城市列表接口获得
Area string `json:"area,omitempty"` // 区域名,由区域列表接口获得
Date string `json:"date,omitempty"` // 日期2020-01-01不传默认当天
Latitude float64 `json:"latitude,omitempty"` // 纬度,不传则无距离排序
Longitude float64 `json:"longitude,omitempty"` // 经度,不传则无距离排序
}
type GetShowListResponse struct {
2 years ago
Code int `json:"code"`
Message string `json:"message"`
Data struct {
HasMore int `json:"hasMore"`
List []struct {
Address string `json:"address"`
ShowId string `json:"showId"`
Distance string `json:"distance"`
CinemaId int `json:"cinemaId"`
CinemaName string `json:"cinemaName"`
Latitude float64 `json:"latitude"`
ShowTime string `json:"showTime"`
HallName string `json:"hallName"`
Longitude float64 `json:"longitude"`
} `json:"list"`
} `json:"data"`
Success bool `json:"success"`
}
type GetShowListResult struct {
Result GetShowListResponse // 结果
Body []byte // 内容
Http gorequest.Response // 请求
Err error // 错误
}
2 years ago
func newGetShowListResult(result GetShowListResponse, body []byte, http gorequest.Response, err error) *GetShowListResult {
return &GetShowListResult{Result: result, Body: body, Http: http, Err: err}
}
2 years ago
// GetShowList 包含某电影的影院 https://www.showdoc.com.cn/1154868044931571/6067372188376779
2 years ago
func (c *Client) GetShowList(ctx context.Context, param GetShowList) *GetShowListResult {
2 years ago
// api params
params := map[string]interface{}{}
1 year ago
b, _ := gojson.Marshal(&param)
2 years ago
var m map[string]interface{}
1 year ago
_ = gojson.Unmarshal(b, &m)
2 years ago
for k, v := range m {
params[k] = v
}
2 years ago
request, err := c.request(ctx, apiUrl+"/movieapi/movie-info/get-show-list", params)
// 定义
var response GetShowListResponse
1 year ago
err = gojson.Unmarshal(request.ResponseBody, &response)
2 years ago
return newGetShowListResult(response, request.ResponseBody, request, err)
2 years ago
}