
1package main
2
3import (
4 "bytes"
5 "demo/wxpay_utility"
6 "encoding/json"
7 "fmt"
8 "net/http"
9 "net/url"
10 "strings"
11 "time"
12)
13
14func main() {
15
16 config, err := wxpay_utility.CreateMchConfig(
17 "19xxxxxxxx",
18 "1DDE55AD98Exxxxxxxxxx",
19 "/path/to/apiclient_key.pem",
20 "PUB_KEY_ID_xxxxxxxxxxxxx",
21 "/path/to/wxp_pub.pem",
22 )
23 if err != nil {
24 fmt.Println(err)
25 return
26 }
27
28 request := &UseUserProductCouponRequest{
29 ProductCouponId: wxpay_utility.String("1000000013"),
30 StockId: wxpay_utility.String("1000000013001"),
31 CouponCode: wxpay_utility.String("Code_123456"),
32 Appid: wxpay_utility.String("wx233544546545989"),
33 Openid: wxpay_utility.String("oh-394z-6CGkNoJrsDLTTUKiAnp4"),
34 UseTime: wxpay_utility.Time(time.Now()),
35 OutRequestNo: wxpay_utility.String("MCHUSE202003101234"),
36 BrandId: wxpay_utility.String("120344"),
37 AssociatedOrderInfo: &UserProductCouponAssociatedOrderInfo{
38 TransactionId: wxpay_utility.String("4200000000123456789123456789"),
39 },
40 }
41
42 response, err := UseUserProductCoupon(config, request)
43 if err != nil {
44 fmt.Printf("请求失败: %+v\n", err)
45
46 return
47 }
48
49
50 fmt.Printf("请求成功: %+v\n", response)
51}
52
53func UseUserProductCoupon(config *wxpay_utility.MchConfig, request *UseUserProductCouponRequest) (response *UserProductCouponEntity, err error) {
54 const (
55 host = "https://api.mch.weixin.qq.com"
56 method = "POST"
57 path = "/v3/marketing/partner/product-coupon/users/{openid}/coupons/{coupon_code}/use"
58 )
59
60 reqUrl, err := url.Parse(fmt.Sprintf("%s%s", host, path))
61 if err != nil {
62 return nil, err
63 }
64 reqUrl.Path = strings.Replace(reqUrl.Path, "{coupon_code}", url.PathEscape(*request.CouponCode), -1)
65 reqUrl.Path = strings.Replace(reqUrl.Path, "{openid}", url.PathEscape(*request.Openid), -1)
66 reqBody, err := json.Marshal(request)
67 if err != nil {
68 return nil, err
69 }
70 httpRequest, err := http.NewRequest(method, reqUrl.String(), bytes.NewReader(reqBody))
71 if err != nil {
72 return nil, err
73 }
74 httpRequest.Header.Set("Accept", "application/json")
75 httpRequest.Header.Set("Wechatpay-Serial", config.WechatPayPublicKeyId())
76 httpRequest.Header.Set("Content-Type", "application/json")
77 authorization, err := wxpay_utility.BuildAuthorization(config.MchId(), config.CertificateSerialNo(), config.PrivateKey(), method, reqUrl.RequestURI(), reqBody)
78 if err != nil {
79 return nil, err
80 }
81 httpRequest.Header.Set("Authorization", authorization)
82
83 client := &http.Client{}
84 httpResponse, err := client.Do(httpRequest)
85 if err != nil {
86 return nil, err
87 }
88 respBody, err := wxpay_utility.ExtractResponseBody(httpResponse)
89 if err != nil {
90 return nil, err
91 }
92 if httpResponse.StatusCode >= 200 && httpResponse.StatusCode < 300 {
93
94 err = wxpay_utility.ValidateResponse(
95 config.WechatPayPublicKeyId(),
96 config.WechatPayPublicKey(),
97 &httpResponse.Header,
98 respBody,
99 )
100 if err != nil {
101 return nil, err
102 }
103 response := &UserProductCouponEntity{}
104 if err := json.Unmarshal(respBody, response); err != nil {
105 return nil, err
106 }
107
108 return response, nil
109 } else {
110 return nil, wxpay_utility.NewApiException(
111 httpResponse.StatusCode,
112 httpResponse.Header,
113 respBody,
114 )
115 }
116}
117
118type UseUserProductCouponRequest struct {
119 ProductCouponId *string `json:"product_coupon_id,omitempty"`
120 StockId *string `json:"stock_id,omitempty"`
121 CouponCode *string `json:"coupon_code,omitempty"`
122 Appid *string `json:"appid,omitempty"`
123 Openid *string `json:"openid,omitempty"`
124 UseTime *time.Time `json:"use_time,omitempty"`
125 OutRequestNo *string `json:"out_request_no,omitempty"`
126 BrandId *string `json:"brand_id,omitempty"`
127 StoreId *string `json:"store_id,omitempty"`
128 AssociatedOrderInfo *UserProductCouponAssociatedOrderInfo `json:"associated_order_info,omitempty"`
129 AssociatedPayScoreOrderInfo *UserProductCouponAssociatedPayScoreOrderInfo `json:"associated_pay_score_order_info,omitempty"`
130 SavedAmount *int64 `json:"saved_amount,omitempty"`
131 UseProductNoList []string `json:"use_product_no_list,omitempty"`
132}
133
134func (o *UseUserProductCouponRequest) MarshalJSON() ([]byte, error) {
135 type Alias UseUserProductCouponRequest
136 a := &struct {
137 CouponCode *string `json:"coupon_code,omitempty"`
138 Openid *string `json:"openid,omitempty"`
139 *Alias
140 }{
141
142 CouponCode: nil,
143 Openid: nil,
144 Alias: (*Alias)(o),
145 }
146 return json.Marshal(a)
147}
148
149type UserProductCouponEntity struct {
150 CouponCode *string `json:"coupon_code,omitempty"`
151 CouponState *UserProductCouponState `json:"coupon_state,omitempty"`
152 ValidBeginTime *time.Time `json:"valid_begin_time,omitempty"`
153 ValidEndTime *time.Time `json:"valid_end_time,omitempty"`
154 ReceiveTime *string `json:"receive_time,omitempty"`
155 SendRequestNo *string `json:"send_request_no,omitempty"`
156 SendChannel *UserProductCouponSendChannel `json:"send_channel,omitempty"`
157 ConfirmRequestNo *string `json:"confirm_request_no,omitempty"`
158 ConfirmTime *time.Time `json:"confirm_time,omitempty"`
159 DeactivateRequestNo *string `json:"deactivate_request_no,omitempty"`
160 DeactivateTime *string `json:"deactivate_time,omitempty"`
161 DeactivateReason *string `json:"deactivate_reason,omitempty"`
162 SingleUsageDetail *CouponUsageDetail `json:"single_usage_detail,omitempty"`
163 ProgressiveBundleUsageDetail *CouponUsageDetail `json:"progressive_bundle_usage_detail,omitempty"`
164 UserProductCouponBundleInfo *UserProductCouponBundleInfo `json:"user_product_coupon_bundle_info,omitempty"`
165 ProductCoupon *ProductCouponEntity `json:"product_coupon,omitempty"`
166 Stock *StockEntity `json:"stock,omitempty"`
167 Attach *string `json:"attach,omitempty"`
168 ChannelCustomInfo *string `json:"channel_custom_info,omitempty"`
169 CouponTagInfo *CouponTagInfo `json:"coupon_tag_info,omitempty"`
170 BrandId *string `json:"brand_id,omitempty"`
171}
172
173type UserProductCouponAssociatedOrderInfo struct {
174 TransactionId *string `json:"transaction_id,omitempty"`
175 OutTradeNo *string `json:"out_trade_no,omitempty"`
176 Mchid *string `json:"mchid,omitempty"`
177 SubMchid *string `json:"sub_mchid,omitempty"`
178}
179
180type UserProductCouponAssociatedPayScoreOrderInfo struct {
181 OrderId *string `json:"order_id,omitempty"`
182 OutOrderNo *string `json:"out_order_no,omitempty"`
183 Mchid *string `json:"mchid,omitempty"`
184 SubMchid *string `json:"sub_mchid,omitempty"`
185}
186
187type UserProductCouponState string
188
189func (e UserProductCouponState) Ptr() *UserProductCouponState {
190 return &e
191}
192
193const (
194 USERPRODUCTCOUPONSTATE_CONFIRMING UserProductCouponState = "CONFIRMING"
195 USERPRODUCTCOUPONSTATE_PENDING UserProductCouponState = "PENDING"
196 USERPRODUCTCOUPONSTATE_EFFECTIVE UserProductCouponState = "EFFECTIVE"
197 USERPRODUCTCOUPONSTATE_USED UserProductCouponState = "USED"
198 USERPRODUCTCOUPONSTATE_EXPIRED UserProductCouponState = "EXPIRED"
199 USERPRODUCTCOUPONSTATE_DELETED UserProductCouponState = "DELETED"
200 USERPRODUCTCOUPONSTATE_DEACTIVATED UserProductCouponState = "DEACTIVATED"
201)
202
203type UserProductCouponSendChannel string
204
205func (e UserProductCouponSendChannel) Ptr() *UserProductCouponSendChannel {
206 return &e
207}
208
209const (
210 USERPRODUCTCOUPONSENDCHANNEL_BRAND_MANAGE UserProductCouponSendChannel = "BRAND_MANAGE"
211 USERPRODUCTCOUPONSENDCHANNEL_API UserProductCouponSendChannel = "API"
212 USERPRODUCTCOUPONSENDCHANNEL_RECEIVE_COMPONENT UserProductCouponSendChannel = "RECEIVE_COMPONENT"
213 USERPRODUCTCOUPONSENDCHANNEL_MEMBER UserProductCouponSendChannel = "MEMBER"
214 USERPRODUCTCOUPONSENDCHANNEL_STICKER_GIFT UserProductCouponSendChannel = "STICKER_GIFT"
215)
216
217type CouponUsageDetail struct {
218 UseRequestNo *string `json:"use_request_no,omitempty"`
219 UseTime *time.Time `json:"use_time,omitempty"`
220 ReturnRequestNo *string `json:"return_request_no,omitempty"`
221 ReturnTime *time.Time `json:"return_time,omitempty"`
222 AssociatedOrderInfo *UserProductCouponAssociatedOrderInfo `json:"associated_order_info,omitempty"`
223 AssociatedPayScoreOrderInfo *UserProductCouponAssociatedPayScoreOrderInfo `json:"associated_pay_score_order_info,omitempty"`
224 SavedAmount *int64 `json:"saved_amount,omitempty"`
225 UseProductNoList []string `json:"use_product_no_list,omitempty"`
226}
227
228type UserProductCouponBundleInfo struct {
229 UserCouponBundleId *string `json:"user_coupon_bundle_id,omitempty"`
230 UserCouponBundleIndex *int64 `json:"user_coupon_bundle_index,omitempty"`
231 TotalCount *int64 `json:"total_count,omitempty"`
232 UsedCount *int64 `json:"used_count,omitempty"`
233}
234
235type ProductCouponEntity struct {
236 ProductCouponId *string `json:"product_coupon_id,omitempty"`
237 Scope *ProductCouponScope `json:"scope,omitempty"`
238 Type *ProductCouponType `json:"type,omitempty"`
239 UsageMode *UsageMode `json:"usage_mode,omitempty"`
240 SingleUsageInfo *SingleUsageInfo `json:"single_usage_info,omitempty"`
241 ProgressiveBundleUsageInfo *ProgressiveBundleUsageInfo `json:"progressive_bundle_usage_info,omitempty"`
242 DisplayInfo *ProductCouponDisplayInfo `json:"display_info,omitempty"`
243 OutProductNo *string `json:"out_product_no,omitempty"`
244 State *ProductCouponState `json:"state,omitempty"`
245 DeactivateRequestNo *string `json:"deactivate_request_no,omitempty"`
246 DeactivateTime *string `json:"deactivate_time,omitempty"`
247 DeactivateReason *string `json:"deactivate_reason,omitempty"`
248 BrandId *string `json:"brand_id,omitempty"`
249 ShowAsExchange *bool `json:"show_as_exchange,omitempty"`
250 AvailableProductNoList []string `json:"available_product_no_list,omitempty"`
251}
252
253type StockEntity struct {
254 ProductCouponId *string `json:"product_coupon_id,omitempty"`
255 StockId *string `json:"stock_id,omitempty"`
256 Remark *string `json:"remark,omitempty"`
257 CouponCodeMode *CouponCodeMode `json:"coupon_code_mode,omitempty"`
258 CouponCodeCountInfo *CouponCodeCountInfo `json:"coupon_code_count_info,omitempty"`
259 StockSendRule *StockSendRule `json:"stock_send_rule,omitempty"`
260 SingleUsageRule *SingleUsageRule `json:"single_usage_rule,omitempty"`
261 ProgressiveBundleUsageRule *StockUsageRule `json:"progressive_bundle_usage_rule,omitempty"`
262 StockBundleInfo *StockBundleInfo `json:"stock_bundle_info,omitempty"`
263 UsageRuleDisplayInfo *UsageRuleDisplayInfo `json:"usage_rule_display_info,omitempty"`
264 CouponDisplayInfo *CouponDisplayInfo `json:"coupon_display_info,omitempty"`
265 NotifyConfig *NotifyConfig `json:"notify_config,omitempty"`
266 StoreScope *StockStoreScope `json:"store_scope,omitempty"`
267 SentCountInfo *StockSentCountInfo `json:"sent_count_info,omitempty"`
268 State *StockState `json:"state,omitempty"`
269 DeactivateRequestNo *string `json:"deactivate_request_no,omitempty"`
270 DeactivateTime *time.Time `json:"deactivate_time,omitempty"`
271 DeactivateReason *string `json:"deactivate_reason,omitempty"`
272 BrandId *string `json:"brand_id,omitempty"`
273}
274
275type CouponTagInfo struct {
276 CouponTagList []UserProductCouponTag `json:"coupon_tag_list,omitempty"`
277 MemberTagInfo *MemberTagInfo `json:"member_tag_info,omitempty"`
278}
279
280type ProductCouponScope string
281
282func (e ProductCouponScope) Ptr() *ProductCouponScope {
283 return &e
284}
285
286const (
287 PRODUCTCOUPONSCOPE_ALL ProductCouponScope = "ALL"
288 PRODUCTCOUPONSCOPE_SINGLE ProductCouponScope = "SINGLE"
289 PRODUCTCOUPONSCOPE_CATEGORY ProductCouponScope = "CATEGORY"
290)
291
292type ProductCouponType string
293
294func (e ProductCouponType) Ptr() *ProductCouponType {
295 return &e
296}
297
298const (
299 PRODUCTCOUPONTYPE_NORMAL ProductCouponType = "NORMAL"
300 PRODUCTCOUPONTYPE_DISCOUNT ProductCouponType = "DISCOUNT"
301 PRODUCTCOUPONTYPE_EXCHANGE ProductCouponType = "EXCHANGE"
302)
303
304type UsageMode string
305
306func (e UsageMode) Ptr() *UsageMode {
307 return &e
308}
309
310const (
311 USAGEMODE_SINGLE UsageMode = "SINGLE"
312 USAGEMODE_PROGRESSIVE_BUNDLE UsageMode = "PROGRESSIVE_BUNDLE"
313)
314
315type SingleUsageInfo struct {
316 NormalCoupon *NormalCouponUsageRule `json:"normal_coupon,omitempty"`
317 DiscountCoupon *DiscountCouponUsageRule `json:"discount_coupon,omitempty"`
318}
319
320type ProgressiveBundleUsageInfo struct {
321 Count *int64 `json:"count,omitempty"`
322 IntervalDays *int64 `json:"interval_days,omitempty"`
323}
324
325type ProductCouponDisplayInfo struct {
326 Name *string `json:"name,omitempty"`
327 ImageUrl *string `json:"image_url,omitempty"`
328 BackgroundUrl *string `json:"background_url,omitempty"`
329 DetailImageUrlList []string `json:"detail_image_url_list,omitempty"`
330 OriginalPrice *int64 `json:"original_price,omitempty"`
331 ComboPackageList []ComboPackage `json:"combo_package_list,omitempty"`
332}
333
334type ProductCouponState string
335
336func (e ProductCouponState) Ptr() *ProductCouponState {
337 return &e
338}
339
340const (
341 PRODUCTCOUPONSTATE_AUDITING ProductCouponState = "AUDITING"
342 PRODUCTCOUPONSTATE_EFFECTIVE ProductCouponState = "EFFECTIVE"
343 PRODUCTCOUPONSTATE_DEACTIVATED ProductCouponState = "DEACTIVATED"
344)
345
346type CouponCodeMode string
347
348func (e CouponCodeMode) Ptr() *CouponCodeMode {
349 return &e
350}
351
352const (
353 COUPONCODEMODE_WECHATPAY CouponCodeMode = "WECHATPAY"
354 COUPONCODEMODE_UPLOAD CouponCodeMode = "UPLOAD"
355 COUPONCODEMODE_API_ASSIGN CouponCodeMode = "API_ASSIGN"
356)
357
358type CouponCodeCountInfo struct {
359 TotalCount *int64 `json:"total_count,omitempty"`
360 AvailableCount *int64 `json:"available_count,omitempty"`
361}
362
363type StockSendRule struct {
364 MaxCount *int64 `json:"max_count,omitempty"`
365 MaxCountPerDay *int64 `json:"max_count_per_day,omitempty"`
366 MaxCountPerUser *int64 `json:"max_count_per_user,omitempty"`
367}
368
369type SingleUsageRule struct {
370 CouponAvailablePeriod *CouponAvailablePeriod `json:"coupon_available_period,omitempty"`
371 NormalCoupon *NormalCouponUsageRule `json:"normal_coupon,omitempty"`
372 DiscountCoupon *DiscountCouponUsageRule `json:"discount_coupon,omitempty"`
373 ExchangeCoupon *ExchangeCouponUsageRule `json:"exchange_coupon,omitempty"`
374}
375
376type StockUsageRule struct {
377 CouponAvailablePeriod *CouponAvailablePeriod `json:"coupon_available_period,omitempty"`
378 NormalCoupon *NormalCouponUsageRule `json:"normal_coupon,omitempty"`
379 DiscountCoupon *DiscountCouponUsageRule `json:"discount_coupon,omitempty"`
380 ExchangeCoupon *ExchangeCouponUsageRule `json:"exchange_coupon,omitempty"`
381}
382
383type StockBundleInfo struct {
384 StockBundleId *string `json:"stock_bundle_id,omitempty"`
385 StockBundleIndex *int64 `json:"stock_bundle_index,omitempty"`
386}
387
388type UsageRuleDisplayInfo struct {
389 CouponUsageMethodList []CouponUsageMethod `json:"coupon_usage_method_list,omitempty"`
390 MiniProgramAppid *string `json:"mini_program_appid,omitempty"`
391 MiniProgramPath *string `json:"mini_program_path,omitempty"`
392 AppPath *string `json:"app_path,omitempty"`
393 UsageDescription *string `json:"usage_description,omitempty"`
394 CouponAvailableStoreInfo *CouponAvailableStoreInfo `json:"coupon_available_store_info,omitempty"`
395 AppJumpType *AppJumpType `json:"app_jump_type,omitempty"`
396 PasscodeLink *string `json:"passcode_link,omitempty"`
397}
398
399type CouponDisplayInfo struct {
400 CodeDisplayMode *CouponCodeDisplayMode `json:"code_display_mode,omitempty"`
401 BackgroundColor *string `json:"background_color,omitempty"`
402 EntranceMiniProgram *EntranceMiniProgram `json:"entrance_mini_program,omitempty"`
403 EntranceOfficialAccount *EntranceOfficialAccount `json:"entrance_official_account,omitempty"`
404}
405
406type NotifyConfig struct {
407 NotifyAppid *string `json:"notify_appid,omitempty"`
408}
409
410type StockStoreScope string
411
412func (e StockStoreScope) Ptr() *StockStoreScope {
413 return &e
414}
415
416const (
417 STOCKSTORESCOPE_NONE StockStoreScope = "NONE"
418 STOCKSTORESCOPE_ALL StockStoreScope = "ALL"
419 STOCKSTORESCOPE_SPECIFIC StockStoreScope = "SPECIFIC"
420)
421
422type StockSentCountInfo struct {
423 TotalCount *int64 `json:"total_count,omitempty"`
424 TodayCount *int64 `json:"today_count,omitempty"`
425}
426
427type StockState string
428
429func (e StockState) Ptr() *StockState {
430 return &e
431}
432
433const (
434 STOCKSTATE_AUDITING StockState = "AUDITING"
435 STOCKSTATE_SENDING StockState = "SENDING"
436 STOCKSTATE_PAUSED StockState = "PAUSED"
437 STOCKSTATE_STOPPED StockState = "STOPPED"
438 STOCKSTATE_DEACTIVATED StockState = "DEACTIVATED"
439)
440
441type UserProductCouponTag string
442
443func (e UserProductCouponTag) Ptr() *UserProductCouponTag {
444 return &e
445}
446
447const (
448 USERPRODUCTCOUPONTAG_MEMBER UserProductCouponTag = "MEMBER"
449 USERPRODUCTCOUPONTAG_MEMBER_ACTIVITY UserProductCouponTag = "MEMBER_ACTIVITY"
450)
451
452type MemberTagInfo struct {
453 MemberCardId *string `json:"member_card_id,omitempty"`
454}
455
456type NormalCouponUsageRule struct {
457 Threshold *int64 `json:"threshold,omitempty"`
458 DiscountAmount *int64 `json:"discount_amount,omitempty"`
459}
460
461type DiscountCouponUsageRule struct {
462 Threshold *int64 `json:"threshold,omitempty"`
463 PercentOff *int64 `json:"percent_off,omitempty"`
464}
465
466type ComboPackage struct {
467 Name *string `json:"name,omitempty"`
468 PickCount *int64 `json:"pick_count,omitempty"`
469 ChoiceList []ComboPackageChoice `json:"choice_list,omitempty"`
470}
471
472type CouponAvailablePeriod struct {
473 AvailableBeginTime *string `json:"available_begin_time,omitempty"`
474 AvailableEndTime *string `json:"available_end_time,omitempty"`
475 AvailableDays *int64 `json:"available_days,omitempty"`
476 WaitDaysAfterReceive *int64 `json:"wait_days_after_receive,omitempty"`
477 WeeklyAvailablePeriod *FixedWeekPeriod `json:"weekly_available_period,omitempty"`
478 IrregularAvailablePeriodList []TimePeriod `json:"irregular_available_period_list,omitempty"`
479 AvailableSeconds *int64 `json:"available_seconds,omitempty"`
480}
481
482type ExchangeCouponUsageRule struct {
483 Threshold *int64 `json:"threshold,omitempty"`
484 ExchangePrice *int64 `json:"exchange_price,omitempty"`
485}
486
487type CouponUsageMethod string
488
489func (e CouponUsageMethod) Ptr() *CouponUsageMethod {
490 return &e
491}
492
493const (
494 COUPONUSAGEMETHOD_OFFLINE CouponUsageMethod = "OFFLINE"
495 COUPONUSAGEMETHOD_MINI_PROGRAM CouponUsageMethod = "MINI_PROGRAM"
496 COUPONUSAGEMETHOD_APP CouponUsageMethod = "APP"
497 COUPONUSAGEMETHOD_PAYMENT_CODE CouponUsageMethod = "PAYMENT_CODE"
498)
499
500type CouponAvailableStoreInfo struct {
501 Description *string `json:"description,omitempty"`
502 MiniProgramAppid *string `json:"mini_program_appid,omitempty"`
503 MiniProgramPath *string `json:"mini_program_path,omitempty"`
504}
505
506type AppJumpType string
507
508func (e AppJumpType) Ptr() *AppJumpType {
509 return &e
510}
511
512const (
513 APPJUMPTYPE_H5 AppJumpType = "H5"
514 APPJUMPTYPE_PASSCODE_LINK AppJumpType = "PASSCODE_LINK"
515 APPJUMPTYPE_USAGE_GUIDE AppJumpType = "USAGE_GUIDE"
516)
517
518type CouponCodeDisplayMode string
519
520func (e CouponCodeDisplayMode) Ptr() *CouponCodeDisplayMode {
521 return &e
522}
523
524const (
525 COUPONCODEDISPLAYMODE_INVISIBLE CouponCodeDisplayMode = "INVISIBLE"
526 COUPONCODEDISPLAYMODE_BARCODE CouponCodeDisplayMode = "BARCODE"
527 COUPONCODEDISPLAYMODE_QRCODE CouponCodeDisplayMode = "QRCODE"
528)
529
530type EntranceMiniProgram struct {
531 Appid *string `json:"appid,omitempty"`
532 Path *string `json:"path,omitempty"`
533 EntranceWording *string `json:"entrance_wording,omitempty"`
534 GuidanceWording *string `json:"guidance_wording,omitempty"`
535}
536
537type EntranceOfficialAccount struct {
538 Appid *string `json:"appid,omitempty"`
539}
540
541type ComboPackageChoice struct {
542 Name *string `json:"name,omitempty"`
543 Price *int64 `json:"price,omitempty"`
544 Count *int64 `json:"count,omitempty"`
545 ImageUrl *string `json:"image_url,omitempty"`
546 MiniProgramAppid *string `json:"mini_program_appid,omitempty"`
547 MiniProgramPath *string `json:"mini_program_path,omitempty"`
548}
549
550type FixedWeekPeriod struct {
551 DayList []WeekEnum `json:"day_list,omitempty"`
552 DayPeriodList []PeriodOfTheDay `json:"day_period_list,omitempty"`
553}
554
555type TimePeriod struct {
556 BeginTime *string `json:"begin_time,omitempty"`
557 EndTime *string `json:"end_time,omitempty"`
558}
559
560type WeekEnum string
561
562func (e WeekEnum) Ptr() *WeekEnum {
563 return &e
564}
565
566const (
567 WEEKENUM_MONDAY WeekEnum = "MONDAY"
568 WEEKENUM_TUESDAY WeekEnum = "TUESDAY"
569 WEEKENUM_WEDNESDAY WeekEnum = "WEDNESDAY"
570 WEEKENUM_THURSDAY WeekEnum = "THURSDAY"
571 WEEKENUM_FRIDAY WeekEnum = "FRIDAY"
572 WEEKENUM_SATURDAY WeekEnum = "SATURDAY"
573 WEEKENUM_SUNDAY WeekEnum = "SUNDAY"
574)
575
576type PeriodOfTheDay struct {
577 BeginTime *int64 `json:"begin_time,omitempty"`
578 EndTime *int64 `json:"end_time,omitempty"`
579}
580