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

59 lines
2.2 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 GetSoonListResponse struct {
Code int `json:"code"`
Message string `json:"message"`
Data struct {
HasMore int `json:"hasMore"`
List []struct {
Director string `json:"director"` // 导演
PublishDate string `json:"publishDate"` // 影片上映日期
VersionTypes string `json:"versionTypes"` // 上映类型
Language string `json:"language"` // 语言
ShowStatus int `json:"showStatus"` // 放映状态1 正在热映。2 即将上映
Pic string `json:"pic"` // 海报URL地址
FilmTypes string `json:"filmTypes"` // 影片类型
LikeNum int `json:"likeNum"` // 想看人数
Duration int64 `json:"duration"` // 时长,分钟
Cast string `json:"cast"` // 主演
FilmId int `json:"filmId"` // 影片id
Grade interface{} `json:"grade"` // 评分
Intro string `json:"intro"` // 简介
Name string `json:"name"` // 影片名
} `json:"list"`
} `json:"data"`
Success bool `json:"success"`
}
type GetSoonListResult struct {
Result GetSoonListResponse // 结果
Body []byte // 内容
Http gorequest.Response // 请求
Err error // 错误
}
func newGetSoonListResult(result GetSoonListResponse, body []byte, http gorequest.Response, err error) *GetSoonListResult {
return &GetSoonListResult{Result: result, Body: body, Http: http, Err: err}
}
// GetSoonList 即将上映 https://www.showdoc.com.cn/1154868044931571/5866125707634369
func (c *Client) GetSoonList(ctx context.Context, cityId int) *GetSoonListResult {
// 参数
param := gorequest.NewParams()
param.Set("cityId", cityId)
// 转换
params := gorequest.NewParamsWith(param)
// 请求
request, err := c.request(ctx, apiUrl+"/movieapi/movie-info/get-soon-list", params)
// 定义
var response GetSoonListResponse
err = json.Unmarshal(request.ResponseBody, &response)
return newGetSoonListResult(response, request.ResponseBody, request, err)
}