-
Notifications
You must be signed in to change notification settings - Fork 13
/
model.go
309 lines (277 loc) · 17.1 KB
/
model.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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
package favor
import (
"encoding/json"
"time"
"github.com/pyihe/wechat-sdk/v3/model"
)
// CreateStockResponse 创建代金券批次API应答参数
type CreateStockResponse struct {
model.WechatError
RequestId string `json:"-"` // 唯一请求ID
StockId string `json:"stock_id,omitempty"` // 批次号
CreateTime time.Time `json:"create_time,omitempty"` // 创建时间
}
// StartStockResponse 激活代金券批次API应答参数
type StartStockResponse struct {
model.WechatError
RequestId string `json:"-"` // 唯一请求ID
StockId string `json:"stock_id,omitempty"` // 批次号
StartTime time.Time `json:"start_time,omitempty"` // 生效时间
}
// SendCouponsRequest 发放代金券批次API请求参数
type SendCouponsRequest struct {
StockId string `json:"stock_id"` // 批次号
OutRequestNo string `json:"out_request_no"` // 商户单据号
AppId string `json:"appid"` // 公众账号ID
StockCreatorMchId string `json:"stock_creator_mchid"` // 创建批次的商户ID
CouponValue uint64 `json:"coupon_value,omitempty"` // 指定面额发券: 面额
CouponMinimum uint64 `json:"coupon_minimum,omitempty"` // 指定面额发券: 券门槛
}
// SendStockResponse 发放代金券批次API应答参数
type SendStockResponse struct {
model.WechatError
RequestId string `json:"-"` // 唯一请求ID
CouponId string `json:"coupon_id,omitempty"` // 代金券ID
}
// PauseStockResponse 暂停代金券批次应答参数
type PauseStockResponse struct {
model.WechatError
RequestId string `json:"-"` // 唯一请求ID
PauseTime string `json:"pause_time,omitempty"` // 暂停时间
StockId string `json:"stock_id,omitempty"` // 批次号
}
// RestartStockResponse 重启代金券批次应答参数
type RestartStockResponse struct {
model.WechatError
RequestId string `json:"-"` // 唯一请求ID
StockId string `json:"stock_id,omitempty"` // 批次号
RestartTime time.Time `json:"restart_time,omitempty"` // 生效时间
}
// QueryStockListRequest 条件查询批次列表
type QueryStockListRequest struct {
Offset uint32 `json:"offset"` // 分页页码
Limit uint32 `json:"limit"` // 分页大小
StockCreatorMchId string `json:"stock_creator_mchid"` // 创建批次的商户号
CreateStartTime string `json:"create_start_time,omitempty"` // 起始时间
CreateEndTime string `json:"create_end_time,omitempty"` // 终止时间
Status string `json:"status,omitempty"` // 批次状态
}
// QueryStockListResponse 条件查询批次列表应答参数
type QueryStockListResponse struct {
model.WechatError
RequestId string `json:"-"` // 唯一请求ID
TotalCount int64 `json:"total_count,omitempty"` // 批次总数
Limit uint32 `json:"limit,omitempty"` // 分页大小
Offset uint32 `json:"offset,omitempty"` // 分页页码
Data []*Stock `json:"data,omitempty"` // 批次详情
}
// QueryStockResponse 查询批次详情请求参数
type QueryStockResponse struct {
model.WechatError
RequestId string `json:"-"` // 唯一请求ID
Stock // 代金券批次信息
}
// QueryCouponResponse 查询代金券详情
type QueryCouponResponse struct {
model.WechatError
NoCash bool `json:"no_cash,omitempty"` // 是否无资金流
SingleItem bool `json:"singleitem,omitempty"` // 是否单品优惠
RequestId string `json:"-"` // 唯一请求ID
StockCreatorMchId string `json:"stock_creator_mchid,omitempty"` // 创建批次的商户号
StockId string `json:"stock_id,omitempty"` // 批次号
CouponId string `json:"coupon_id,omitempty"` // 代金券ID
CouponName string `json:"coupon_name,omitempty"` // 代金券名称
Status string `json:"status,omitempty"` // 代金券状态
Description string `json:"description,omitempty"` // 使用说明
CouponType string `json:"coupon_type,omitempty"` // 券类型
CreateTime time.Time `json:"create_time,omitempty"` // 领券时间
AvailableBeginTime time.Time `json:"available_begin_time,omitempty"` // 可用开始时间
AvailableEndTime time.Time `json:"available_end_time,omitempty"` // 可用结束时间
CutToMessage *CutToMessage `json:"cut_to_message,omitempty"` // 单品优惠特定信息
NormalCouponInformation *FixedNormalCoupon `json:"normal_coupon_information,omitempty"` // 满减券信息
}
// QueryStockMerchantRequest 查询代金券可用商户请求参数
type QueryStockMerchantRequest struct {
Offset uint32 `json:"offset,omitempty"` // 分页页码
Limit uint32 `json:"limit,omitempty"` // 分页大小
StockCreatorMchId string `json:"stock_creator_mchid,omitempty"` // 创建批次的商户号
StockId string `json:"stock_id,omitempty"` // 批次号
}
// QueryStockMerchantResponse 查询代金券可用商户应答参数
type QueryStockMerchantResponse struct {
model.WechatError
RequestId string `json:"-"` // 唯一请求ID
TotalCount uint32 `json:"total_count,omitempty"` // 可用商户总数量
MerchantIds []string `json:"data,omitempty"` // 可用商户列表
Offset uint32 `json:"offset,omitempty"` // 分页页码
Limit uint32 `json:"limit,omitempty"` // 分页大小
StockId string `json:"stock_id,omitempty"` // 批次号
}
// QueryStockItemRequest 查询代金券可用单品请求参数
type QueryStockItemRequest struct {
Offset uint32 `json:"offset,omitempty"` // 分页页码
Limit uint32 `json:"limit,omitempty"` // 分页大小
StockCreatorMchId string `json:"stock_creator_mchid,omitempty"` // 创建批次的商户号
StockId string `json:"stock_id,omitempty"` // 批次号
}
// QueryStockItemResponse 查询代金券可用单品应答参数
type QueryStockItemResponse struct {
model.WechatError
RequestId string `json:"-"` // 唯一请求ID
TotalCount uint32 `json:"total_count,omitempty"` // 可用商户总数量
Items []string `json:"data,omitempty"` // 可用单品列表
Offset uint32 `json:"offset,omitempty"` // 分页页码
Limit uint32 `json:"limit,omitempty"` // 分页大小
StockId string `json:"stock_id,omitempty"` // 批次号
}
// QueryUserCouponsRequest 根据商户号查用户的券API请求参数
type QueryUserCouponsRequest struct {
OpenId string `json:"openid"` // 用户标识
AppId string `json:"appid"` // 公众账号ID
StockId string `json:"stock_id,omitempty"` // 批次ID
Status string `json:"status,omitempty"` // 券状态
CreatorMchId string `json:"creator_mchid,omitempty"` // 创建批次的商户ID
SenderMchId string `json:"sender_mchid,omitempty"` // 批次发放商户号
AvailableMchId string `json:"available_mchid,omitempty"` // 可用商户号
Offset uint32 `json:"offset,omitempty"` // 分页页码
Limit uint32 `json:"limit,omitempty"` // 分页大小
}
// QueryUserCouponsResponse 根据商户号查用户的券API应答参数
type QueryUserCouponsResponse struct {
model.WechatError
RequestId string `json:"-"` // 唯一请求ID
TotalCount uint32 `json:"total_count,omitempty"` // 查询结果总数
Limit uint32 `json:"limit,omitempty"` // 分页大小
Offset uint32 `json:"offset,omitempty"` // 分页页码
Coupons []*Coupon `json:"data,omitempty"` // 结果集
}
// DownloadRequest 明细下载请求参数
type DownloadRequest struct {
StockId string `json:"stock_id,omitempty"` // 批次ID
FileName string `json:"file_name,omitempty"` // 明细文件名
FilePath string `json:"file_path,omitempty"` // 文件存放路径
}
// DownloadResponse 明细下载应答参数
type DownloadResponse struct {
model.WechatError
RequestId string `json:"-"` // 唯一请求ID
Url string `json:"url,omitempty"` // 下载连接
HashValue string `json:"hash_value,omitempty"` // 安全校验码
HashType string `json:"hash_type,omitempty"` // 哈希算法类型
}
// SettingCallbacksResponse 设置消息通知地址
type SettingCallbacksResponse struct {
model.WechatError
RequestId string `json:"-"` // 唯一请求ID
UpdateTime time.Time `json:"update_time,omitempty"` // 修改时间
NotifyUrl string `json:"notify_url,omitempty"` // 通知地址
}
// UseResponse 核销事件回调通知参数
type UseResponse struct {
NotifyId string // 唯一通知ID
NoCash bool `json:"no_cash,omitempty"` // 是否无资金流
SingleItem bool `json:"singleitem,omitempty"` // 是否单品优惠
StockCreatorMchId string `json:"stock_creator_mchid,omitempty"` // 创建批次的商户号
StockId string `json:"stock_id,omitempty"` // 批次号
CouponId string `json:"coupon_id,omitempty"` // 代金券ID
CouponName string `json:"coupon_name,omitempty"` // 代金券名称
Status string `json:"status,omitempty"` // 代金券状态
Description string `json:"description,omitempty"` // 使用说明
CouponType string `json:"coupon_type,omitempty"` // 券类型
CreateTime time.Time `json:"create_time,omitempty"` // 领券时间
AvailableBeginTime time.Time `json:"available_begin_time,omitempty"` // 可用开始时间
AvailableEndTime time.Time `json:"available_end_time,omitempty"` // 可用结束时间
SingleDiscountOff *SingleDiscountOff `json:"single_discount_off,omitempty"` // 单品优惠特定信息
DiscountTo *DiscountTo `json:"discount_to,omitempty"` // 减至优惠特定信息
NormalCouponInformation *FixedNormalCoupon `json:"normal_coupon_information,omitempty"` // 普通满减券信息
ConsumeInformation *ConsumeInformation `json:"consume_information,omitempty"` // 实扣代金券信息
}
// UploadImageResponse 上传图片
type UploadImageResponse struct {
model.WechatError
RequestId string // 唯一请求ID
MediaUrl string `json:"media_url,omitempty"` // 媒体文件URL地址
}
// Stock 代金券批次详情
type Stock struct {
SingleItem bool `json:"singleitem,omitempty"` // 是否单品优惠
NoCash bool `json:"no_cash,omitempty"` // 是否无资金流
StockId string `json:"stock_id,omitempty"` // 批次号
StockCreatorMchId string `json:"stock_creator_mchid,omitempty"` // 创建批次的商户号
StockName string `json:"stock_name,omitempty"` // 批次名称
Status string `json:"status,omitempty"` // 批次状态
StockType string `json:"stock_type,omitempty"` // 批次类型
Description string `json:"description,omitempty"` // 使用说明
DistributedCoupons uint32 `json:"distributed_coupons,omitempty"` // 已发券数量
CreateTime time.Time `json:"create_time,omitempty"` // 创建时间
AvailableBeginTime time.Time `json:"available_begin_time,omitempty"` // 可用开始时间
AvailableEndTime time.Time `json:"available_end_time,omitempty"` // 可用结束时间
StartTime time.Time `json:"start_time,omitempty"` // 激活批次的时间
StopTime time.Time `json:"stop_time,omitempty"` // 终止批次的时间
StockUseRule *StockUseRule `json:"stock_use_rule,omitempty"` // 满减券批次使用规则
CutToMessage *CutToMessage `json:"cut_to_message,omitempty"` // 减至批次特定信息
}
// StockUseRule 满减批次使用规则
type StockUseRule struct {
CombineUse bool `json:"combine_use,omitempty"` // 是否可叠加其他优惠
MaxCouponsPerUser uint32 `json:"max_coupons_per_user,omitempty"` // 单个用户可领个数
CouponType string `json:"coupon_type,omitempty"` // 券类型
MaxCoupons uint64 `json:"max_coupons,omitempty"` // 最大发券数
MaxAmount uint64 `json:"max_amount,omitempty"` // 总预算
MaxAmountByDay uint64 `json:"max_amount_by_day,omitempty"` // 单天发放上限金额
RawTradeTypes json.RawMessage `json:"trade_type,omitempty"` // 用于接收支付方式的序列化数据
TradeType []string `json:"-"` // 支付方式
GoodsTag []string `json:"goods_tag,omitempty"` // 订单优惠标记
FixedNormalCoupon *FixedNormalCoupon `json:"fixed_normal_coupon,omitempty"` // 固定面额批次特定信息
}
// FixedNormalCoupon 固定面额批次特定信息
type FixedNormalCoupon struct {
CouponAmount uint64 `json:"coupon_amount,omitempty"` // 面额
TransactionMinimum uint64 `json:"transaction_minimum,omitempty"` // 门槛
}
// CutToMessage 减至批次特定信息
type CutToMessage struct {
SinglePriceMax uint64 `json:"single_price_max,omitempty"` // 可用优惠的商品最高单价
CutToPrice uint64 `json:"cut_to_price,omitempty"` // 减至后的优惠单价
}
// Coupon 优惠券
type Coupon struct {
NoCash bool `json:"no_cash,omitempty"` // 是否无资金流
SingleItem bool `json:"singleitem,omitempty"` // 是否单品优惠
StockCreatorMchId string `json:"stock_creator_mchid,omitempty"` // 创建批次的商户号
StockId string `json:"stock_id,omitempty"` // 批次号
CouponId string `json:"coupon_id,omitempty"` // 代金券ID
CouponName string `json:"coupon_name,omitempty"` // 代金券名称
Status string `json:"status,omitempty"` // 代金券状态
Description string `json:"description,omitempty"` // 使用说明
CouponType string `json:"coupon_type,omitempty"` // 券类型
CreateTime time.Time `json:"create_time,omitempty"` // 领券时间
AvailableBeginTime time.Time `json:"available_begin_time,omitempty"` // 可用开始时间
AvailableEndTime time.Time `json:"available_end_time,omitempty"` // 可用结束时间
CutToMessage *CutToMessage `json:"cut_to_message,omitempty"` // 单品优惠特定信息
NormalCouponInformation *FixedNormalCoupon `json:"normal_coupon_information,omitempty"` // 满减券信息
ConsumeInformation *ConsumeInformation `json:"consume_information,omitempty"` // 已实扣代金券信息
}
// ConsumeInformation 已实扣代金券核销信息
type ConsumeInformation struct {
ConsumeMchId string `json:"consume_mchid,omitempty"` // 核销商户号
TransactionId string `json:"transaction_id,omitempty"` // 支付单号
ConsumeTime time.Time `json:"consume_time,omitempty"` // 核销时间
GoodsDetail []*GoodsDetail `json:"goods_detail,omitempty"` // 单品信息
}
// GoodsDetail 单品信息
type GoodsDetail struct {
Quantity uint32 `json:"quantity,omitempty"` // 商品数量
GoodsId string `json:"goods_id,omitempty"` // 商品编码
Price int64 `json:"price,omitempty"` // 商品价格
DiscountAmount int64 `json:"discount_amount,omitempty"` // 优惠金额
}
// SingleDiscountOff 单品优惠特定信息
type SingleDiscountOff struct {
SinglePriceMax int64 `json:"single_price_max,omitempty"`
}
// DiscountTo 减至优惠特定信心
type DiscountTo struct {
CutToPrice int64 `json:"cut_to_price,omitempty"` // 减至后优惠单价
MaxPrice int64 `json:"max_price,omitempty"` // 最高价格
}