-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvalidator.go
138 lines (119 loc) · 4.25 KB
/
validator.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
package sso
import "time"
type RespBase struct {
Id string `json:"id,omitempty" url:"id" form:"id"`
UpdateAt time.Time `json:"update_at" url:"update_at" form:"update_at"`
CreateAt time.Time `json:"create_at" url:"create_at" form:"create_at"`
}
// ProductPayResp 商品收款返回
type ProductPayResp struct {
OrderNo string `json:"order_no" form:"order_no"`
Detail string `json:"detail" form:"detail"`
}
// PreOrderResp 预下单返回
type PreOrderResp struct {
PreOrderId string `json:"pre_order_id" form:"pre_order_id"`
}
type BalanceChangeHistoryResp struct {
Page uint64 `json:"page"`
PageSize uint64 `json:"page_size"`
Data []BalanceChangeHistoryItem `json:"data"`
Total uint64 `json:"total"` //
}
type PreOrderItem struct {
RespBase
AppId string `json:"app_id"`
ProductInfo ProductInfo `json:"product_info"`
Substance string `json:"substance"`
Extra string `json:"extra"`
ExpireTime time.Time `json:"expire_time"`
}
type GetOrderInfoResp struct {
Pay BalanceChangeHistoryItem `json:"pay" form:"pay"`
PreOrder PreOrderItem `json:"pre_order"`
}
// BalanceChangeHistoryItem 成交记录
type BalanceChangeHistoryItem struct {
RespBase
UserId string `json:"user_id,omitempty" url:"user_id" form:"user_id"`
PreOrderId string `json:"pre_order_id,omitempty" url:"pre_order_id" form:"pre_order_id"`
MapId string `json:"map_id,omitempty" url:"map_id" form:"map_id"`
Quantity uint64 `json:"quantity,omitempty" url:"quantity" form:"quantity"` // 支付金额
ProductUid string `json:"product_uid,omitempty" url:"product_uid" form:"product_uid"`
ProductName string `json:"product_name,omitempty" url:"product_name" form:"product_name"`
ProductUrl string `json:"product_url,omitempty" url:"product_url" form:"product_url"`
Remark string `json:"remark,omitempty" url:"remark" form:"remark"`
OrderUid string `json:"order_uid,omitempty" url:"order_uid" form:"order_uid"`
PublicKey string `json:"public_key,omitempty" url:"public_key" form:"public_key"`
Extra string `json:"extra" url:"extra" from:"extra"`
}
type UidGetUserReq struct {
Uid string `json:"uid" form:"uid"`
SignBase
}
type UidGetUserResp struct {
User UserInfo `json:"user"`
Info BaseUserInfo `json:"info"`
}
func (c *UidGetUserResp) HasPower(name string) bool {
for _, power := range c.Info.Powers {
if name == power {
return true
}
}
return false
}
func (c *UidGetUserResp) HasManagePower(name string) bool {
for _, power := range c.Info.ManagePowers {
if name == power {
return true
}
}
return false
}
type PowerChangeReq struct {
UidGetUserReq
Eng string `json:"eng" form:"eng"`
Open bool `json:"open" form:"open" ` // 打开还是关闭
Reason string `json:"reason" form:"reason"` // 理由
}
type PowerSettingReq struct {
UidGetUserReq
Eng string `json:"eng" form:"eng"`
}
type PowerSettingResp struct {
UpdateAt string `json:"update_at"`
Data string `json:"data"`
}
// UploadKeyResp 上传key请求resp
type UploadKeyResp struct {
SecretID string
SecretKey string
SessionToken string
ExpiredTime uint64
Prefix string
Visit string
}
type UploadImageResp struct {
Origin string `json:"origin"`
Thumbnail string `json:"thumbnail"`
}
// JsonSchemaReq 用户填写了表单的回调
type JsonSchemaReq struct {
SendUserInfo struct {
Mid string `json:"mid" form:"mid" comment:"用户id" validate:"required"`
PublicKey string `json:"public_key,omitempty" form:"public_key,omitempty"`
} `json:"send_user_info" form:"send_user_info" validate:"required"`
SendSignInfo SignBase `json:"send_sign_info,omitempty" form:"send_sign_info,omitempty"`
FormId string `json:"form_id" form:"form_id" comment:"表单ID" validate:"required"`
FormEng string `json:"form_eng,omitempty" form:"form_eng,omitempty" comment:"表单英文唯一"`
Data string `json:"data" form:"data" comment:"表单数据" validate:"required"`
InjectData string `json:"inject_data,omitempty" form:"inject_data,omitempty" comment:"注入数据"`
}
type HitTextResp struct {
Success bool `json:"success"`
Msg string `json:"msg"`
}
type HitImgResp struct {
Success bool `json:"success"`
}