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

60 lines
1.9 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 GetSeat struct {
ShowId string `json:"showId"` // 场次标识
}
type GetSeatResponse struct {
Code int `json:"code"`
Message string `json:"message"`
Data struct {
SeatData struct {
Restrictions int `json:"restrictions"`
Seats []GetSeatSeats `json:"seats"`
} `json:"seatData"`
} `json:"data"`
Success bool `json:"success"`
}
type GetSeatSeats struct {
Area string `json:"area"` // 本座位所在的区域,根据场次排期接口的 scheduleArea 字段, 可得到当前座位的分区价格
ColumnNo string `json:"columnNo"` // 列
Lovestatus int `json:"lovestatus"` // 0为非情侣座1为情侣座左2为情侣座右
RowNo string `json:"rowNo"` // 行
SeatId string `json:"seatId"` // 座位标识符,锁座位和秒出票的时候需要用到
SeatNo string `json:"seatNo"` // 座位名
Status string `json:"status"` // N可售LK不可售
}
type GetSeatResult struct {
Result GetSeatResponse // 结果
Body []byte // 内容
Http gorequest.Response // 请求
Err error // 错误
}
func newGetSeatResult(result GetSeatResponse, body []byte, http gorequest.Response, err error) *GetSeatResult {
return &GetSeatResult{Result: result, Body: body, Http: http, Err: err}
}
// GetSeat 座位 https://www.showdoc.com.cn/1154868044931571/5866824368760475
func (c *Client) GetSeat(ctx context.Context, showId string) *GetSeatResult {
// 参数
param := gorequest.NewParams()
param.Set("showId", showId)
// 转换
params := gorequest.NewParamsWith(param)
// 请求
request, err := c.request(ctx, apiUrl+"/movieapi/movie-info/get-seat", params)
// 定义
var response GetSeatResponse
err = json.Unmarshal(request.ResponseBody, &response)
return newGetSeatResult(response, request.ResponseBody, request, err)
}