-
Notifications
You must be signed in to change notification settings - Fork 3
/
movie_info_get_sea.go
55 lines (49 loc) · 1.95 KB
/
movie_info_get_sea.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
package pintoto
import (
"context"
"github.com/dtapps/go-library/utils/gojson"
"github.com/dtapps/go-library/utils/gorequest"
)
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 // 请求
}
func newGetSeatResult(result GetSeatResponse, body []byte, http gorequest.Response) *GetSeatResult {
return &GetSeatResult{Result: result, Body: body, Http: http}
}
// GetSeat 座位 https://www.showdoc.com.cn/1154868044931571/5866824368760475
func (c *Client) GetSeat(ctx context.Context, showId string, notMustParams ...gorequest.Params) (*GetSeatResult, error) {
// 参数
params := gorequest.NewParamsWith(notMustParams...)
params.Set("showId", showId)
// 请求
request, err := c.request(ctx, apiUrl+"/movieapi/movie-info/get-seat", params)
if err != nil {
return newGetSeatResult(GetSeatResponse{}, request.ResponseBody, request), err
}
// 定义
var response GetSeatResponse
err = gojson.Unmarshal(request.ResponseBody, &response)
return newGetSeatResult(response, request.ResponseBody, request), err
}