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.
pintoto/movie_info_get_show_list.go

67 lines
2.4 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

package pintoto
import (
"context"
"encoding/json"
"go.dtapp.net/gorequest"
)
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 {
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 // 错误
}
func newGetShowListResult(result GetShowListResponse, body []byte, http gorequest.Response, err error) *GetShowListResult {
return &GetShowListResult{Result: result, Body: body, Http: http, Err: err}
}
// GetShowList 包含某电影的影院 https://www.showdoc.com.cn/1154868044931571/6067372188376779
func (c *Client) GetShowList(ctx context.Context, param GetShowList) *GetShowListResult {
// api params
params := map[string]interface{}{}
b, _ := json.Marshal(&param)
var m map[string]interface{}
_ = json.Unmarshal(b, &m)
for k, v := range m {
params[k] = v
}
request, err := c.request(ctx, apiUrl+"/movieapi/movie-info/get-show-list", params)
// 定义
var response GetShowListResponse
err = json.Unmarshal(request.ResponseBody, &response)
return newGetShowListResult(response, request.ResponseBody, request, err)
}