
1package main
2
3import (
4 "bytes"
5 "demo/wxpay_utility"
6 "encoding/json"
7 "fmt"
8 "net/http"
9 "net/url"
10 "time"
11)
12
13func main() {
14
15 config, err := wxpay_utility.CreateMchConfig(
16 "19xxxxxxxx",
17 "1DDE55AD98Exxxxxxxxxx",
18 "/path/to/apiclient_key.pem",
19 "PUB_KEY_ID_xxxxxxxxxxxxx",
20 "/path/to/wxp_pub.pem",
21 )
22 if err != nil {
23 fmt.Println(err)
24 return
25 }
26
27 request := &CreateProductCouponRequest{
28 OutRequestNo: wxpay_utility.String("12345_20250101_A3489"),
29 Scope: PRODUCTCOUPONSCOPE_ALL.Ptr(),
30 Type: PRODUCTCOUPONTYPE_DISCOUNT.Ptr(),
31 UsageMode: USAGEMODE_SINGLE.Ptr(),
32 SingleUsageInfo: &SingleUsageInfo{
33 DiscountCoupon: &DiscountCouponUsageRule{
34 Threshold: wxpay_utility.Int64(10000),
35 PercentOff: wxpay_utility.Int64(20),
36 },
37 },
38 DisplayInfo: &ProductCouponDisplayInfo{
39 Name: wxpay_utility.String("全场满100立打8折"),
40 ImageUrl: wxpay_utility.String("https://wxpaylogo.qpic.cn/wxpaylogo/xxxxx/xxx"),
41 BackgroundUrl: wxpay_utility.String("https://wxpaylogo.qpic.cn/wxpaylogo/xxxxx/xxx"),
42 DetailImageUrlList: []string{
43 "https://wxpaylogo.qpic.cn/wxpaylogo/xxxxx/xxx",
44 },
45 },
46 OutProductNo: wxpay_utility.String("Product_1234567890"),
47 Stock: &StockForCreate{
48 Remark: wxpay_utility.String("8月工作日有效批次"),
49 CouponCodeMode: COUPONCODEMODE_UPLOAD.Ptr(),
50 StockSendRule: &StockSendRule{
51 MaxCount: wxpay_utility.Int64(10000000),
52 MaxCountPerUser: wxpay_utility.Int64(1),
53 },
54 SingleUsageRule: &SingleUsageRule{
55 CouponAvailablePeriod: &CouponAvailablePeriod{
56 AvailableBeginTime: wxpay_utility.String("2025-08-01T00:00:00+08:00"),
57 AvailableEndTime: wxpay_utility.String("2025-08-31T23:59:59+08:00"),
58 AvailableDays: wxpay_utility.Int64(30),
59 WeeklyAvailablePeriod: &FixedWeekPeriod{
60 DayList: []WeekEnum{
61 WEEKENUM_MONDAY,
62 WEEKENUM_TUESDAY,
63 WEEKENUM_WEDNESDAY,
64 WEEKENUM_THURSDAY,
65 WEEKENUM_FRIDAY,
66 },
67 },
68 },
69 },
70 UsageRuleDisplayInfo: &UsageRuleDisplayInfo{
71 CouponUsageMethodList: []CouponUsageMethod{
72 COUPONUSAGEMETHOD_OFFLINE,
73 COUPONUSAGEMETHOD_MINI_PROGRAM,
74 COUPONUSAGEMETHOD_PAYMENT_CODE,
75 },
76 MiniProgramAppid: wxpay_utility.String("wx1234567890"),
77 MiniProgramPath: wxpay_utility.String("/pages/index/product"),
78 UsageDescription: wxpay_utility.String("工作日可用"),
79 CouponAvailableStoreInfo: &CouponAvailableStoreInfo{
80 Description: wxpay_utility.String("所有门店可用,可使用小程序查看门店列表"),
81 MiniProgramAppid: wxpay_utility.String("wx1234567890"),
82 MiniProgramPath: wxpay_utility.String("/pages/index/store-list"),
83 },
84 },
85 CouponDisplayInfo: &CouponDisplayInfo{
86 CodeDisplayMode: COUPONCODEDISPLAYMODE_QRCODE.Ptr(),
87 BackgroundColor: wxpay_utility.String("Color010"),
88 EntranceMiniProgram: &EntranceMiniProgram{
89 Appid: wxpay_utility.String("wx1234567890"),
90 Path: wxpay_utility.String("/pages/index/product"),
91 EntranceWording: wxpay_utility.String("欢迎选购"),
92 GuidanceWording: wxpay_utility.String("获取更多优惠"),
93 },
94 EntranceOfficialAccount: &EntranceOfficialAccount{
95 Appid: wxpay_utility.String("wx1234567890"),
96 },
97 EntranceFinder: &EntranceFinder{
98 FinderId: wxpay_utility.String("gh_12345678"),
99 FinderVideoId: wxpay_utility.String("UDFsdf24df34dD456Hdf34"),
100 FinderVideoCoverImageUrl: wxpay_utility.String("https://wxpaylogo.qpic.cn/wxpaylogo/xxxxx/xxx"),
101 },
102 },
103 NotifyConfig: &NotifyConfig{
104 NotifyAppid: wxpay_utility.String("wx4fd12345678"),
105 },
106 StoreScope: STOCKSTORESCOPE_NONE.Ptr(),
107 },
108 BrandId: wxpay_utility.String("120344"),
109 }
110
111 response, err := CreateProductCoupon(config, request)
112 if err != nil {
113 fmt.Printf("请求失败: %+v\n", err)
114
115 return
116 }
117
118
119 fmt.Printf("请求成功: %+v\n", response)
120}
121
122func CreateProductCoupon(config *wxpay_utility.MchConfig, request *CreateProductCouponRequest) (response *CreateProductCouponResponse, err error) {
123 const (
124 host = "https://api.mch.weixin.qq.com"
125 method = "POST"
126 path = "/v3/marketing/partner/product-coupon/product-coupons"
127 )
128
129 reqUrl, err := url.Parse(fmt.Sprintf("%s%s", host, path))
130 if err != nil {
131 return nil, err
132 }
133 reqBody, err := json.Marshal(request)
134 if err != nil {
135 return nil, err
136 }
137 httpRequest, err := http.NewRequest(method, reqUrl.String(), bytes.NewReader(reqBody))
138 if err != nil {
139 return nil, err
140 }
141 httpRequest.Header.Set("Accept", "application/json")
142 httpRequest.Header.Set("Wechatpay-Serial", config.WechatPayPublicKeyId())
143 httpRequest.Header.Set("Content-Type", "application/json")
144 authorization, err := wxpay_utility.BuildAuthorization(config.MchId(), config.CertificateSerialNo(), config.PrivateKey(), method, reqUrl.RequestURI(), reqBody)
145 if err != nil {
146 return nil, err
147 }
148 httpRequest.Header.Set("Authorization", authorization)
149
150 client := &http.Client{}
151 httpResponse, err := client.Do(httpRequest)
152 if err != nil {
153 return nil, err
154 }
155 respBody, err := wxpay_utility.ExtractResponseBody(httpResponse)
156 if err != nil {
157 return nil, err
158 }
159 if httpResponse.StatusCode >= 200 && httpResponse.StatusCode < 300 {
160
161 err = wxpay_utility.ValidateResponse(
162 config.WechatPayPublicKeyId(),
163 config.WechatPayPublicKey(),
164 &httpResponse.Header,
165 respBody,
166 )
167 if err != nil {
168 return nil, err
169 }
170 response := &CreateProductCouponResponse{}
171 if err := json.Unmarshal(respBody, response); err != nil {
172 return nil, err
173 }
174
175 return response, nil
176 } else {
177 return nil, wxpay_utility.NewApiException(
178 httpResponse.StatusCode,
179 httpResponse.Header,
180 respBody,
181 )
182 }
183}
184
185type CreateProductCouponRequest struct {
186 OutRequestNo *string `json:"out_request_no,omitempty"`
187 Scope *ProductCouponScope `json:"scope,omitempty"`
188 Type *ProductCouponType `json:"type,omitempty"`
189 UsageMode *UsageMode `json:"usage_mode,omitempty"`
190 SingleUsageInfo *SingleUsageInfo `json:"single_usage_info,omitempty"`
191 ProgressiveBundleUsageInfo *ProgressiveBundleUsageInfo `json:"progressive_bundle_usage_info,omitempty"`
192 DisplayInfo *ProductCouponDisplayInfo `json:"display_info,omitempty"`
193 OutProductNo *string `json:"out_product_no,omitempty"`
194 Stock *StockForCreate `json:"stock,omitempty"`
195 StockBundle *StockBundleForCreate `json:"stock_bundle,omitempty"`
196 BrandId *string `json:"brand_id,omitempty"`
197}
198
199type CreateProductCouponResponse struct {
200 ProductCouponId *string `json:"product_coupon_id,omitempty"`
201 Scope *ProductCouponScope `json:"scope,omitempty"`
202 Type *ProductCouponType `json:"type,omitempty"`
203 UsageMode *UsageMode `json:"usage_mode,omitempty"`
204 SingleUsageInfo *SingleUsageInfo `json:"single_usage_info,omitempty"`
205 ProgressiveBundleUsageInfo *ProgressiveBundleUsageInfo `json:"progressive_bundle_usage_info,omitempty"`
206 DisplayInfo *ProductCouponDisplayInfo `json:"display_info,omitempty"`
207 OutProductNo *string `json:"out_product_no,omitempty"`
208 State *ProductCouponState `json:"state,omitempty"`
209 Stock *StockEntity `json:"stock,omitempty"`
210 StockBundle *StockBundleEntity `json:"stock_bundle,omitempty"`
211 BrandId *string `json:"brand_id,omitempty"`
212}
213
214type ProductCouponScope string
215
216func (e ProductCouponScope) Ptr() *ProductCouponScope {
217 return &e
218}
219
220const (
221 PRODUCTCOUPONSCOPE_ALL ProductCouponScope = "ALL"
222 PRODUCTCOUPONSCOPE_SINGLE ProductCouponScope = "SINGLE"
223)
224
225type ProductCouponType string
226
227func (e ProductCouponType) Ptr() *ProductCouponType {
228 return &e
229}
230
231const (
232 PRODUCTCOUPONTYPE_NORMAL ProductCouponType = "NORMAL"
233 PRODUCTCOUPONTYPE_DISCOUNT ProductCouponType = "DISCOUNT"
234 PRODUCTCOUPONTYPE_EXCHANGE ProductCouponType = "EXCHANGE"
235)
236
237type UsageMode string
238
239func (e UsageMode) Ptr() *UsageMode {
240 return &e
241}
242
243const (
244 USAGEMODE_SINGLE UsageMode = "SINGLE"
245 USAGEMODE_PROGRESSIVE_BUNDLE UsageMode = "PROGRESSIVE_BUNDLE"
246)
247
248type SingleUsageInfo struct {
249 NormalCoupon *NormalCouponUsageRule `json:"normal_coupon,omitempty"`
250 DiscountCoupon *DiscountCouponUsageRule `json:"discount_coupon,omitempty"`
251}
252
253type ProgressiveBundleUsageInfo struct {
254 Count *int64 `json:"count,omitempty"`
255 IntervalDays *int64 `json:"interval_days,omitempty"`
256}
257
258type ProductCouponDisplayInfo struct {
259 Name *string `json:"name,omitempty"`
260 ImageUrl *string `json:"image_url,omitempty"`
261 BackgroundUrl *string `json:"background_url,omitempty"`
262 DetailImageUrlList []string `json:"detail_image_url_list,omitempty"`
263 OriginalPrice *int64 `json:"original_price,omitempty"`
264 ComboPackageList []ComboPackage `json:"combo_package_list,omitempty"`
265}
266
267type StockForCreate struct {
268 Remark *string `json:"remark,omitempty"`
269 CouponCodeMode *CouponCodeMode `json:"coupon_code_mode,omitempty"`
270 StockSendRule *StockSendRule `json:"stock_send_rule,omitempty"`
271 SingleUsageRule *SingleUsageRule `json:"single_usage_rule,omitempty"`
272 UsageRuleDisplayInfo *UsageRuleDisplayInfo `json:"usage_rule_display_info,omitempty"`
273 CouponDisplayInfo *CouponDisplayInfo `json:"coupon_display_info,omitempty"`
274 NotifyConfig *NotifyConfig `json:"notify_config,omitempty"`
275 StoreScope *StockStoreScope `json:"store_scope,omitempty"`
276}
277
278type StockBundleForCreate struct {
279 Remark *string `json:"remark,omitempty"`
280 CouponCodeMode *CouponCodeMode `json:"coupon_code_mode,omitempty"`
281 StockSendRule *StockSendRuleForBundle `json:"stock_send_rule,omitempty"`
282 ProgressiveBundleUsageRule *StockBundleUsageRule `json:"progressive_bundle_usage_rule,omitempty"`
283 UsageRuleDisplayInfo *UsageRuleDisplayInfo `json:"usage_rule_display_info,omitempty"`
284 CouponDisplayInfo *CouponDisplayInfo `json:"coupon_display_info,omitempty"`
285 NotifyConfig *NotifyConfig `json:"notify_config,omitempty"`
286 StoreScope *StockStoreScope `json:"store_scope,omitempty"`
287}
288
289type ProductCouponState string
290
291func (e ProductCouponState) Ptr() *ProductCouponState {
292 return &e
293}
294
295const (
296 PRODUCTCOUPONSTATE_AUDITING ProductCouponState = "AUDITING"
297 PRODUCTCOUPONSTATE_EFFECTIVE ProductCouponState = "EFFECTIVE"
298 PRODUCTCOUPONSTATE_DEACTIVATED ProductCouponState = "DEACTIVATED"
299)
300
301type StockEntity struct {
302 ProductCouponId *string `json:"product_coupon_id,omitempty"`
303 StockId *string `json:"stock_id,omitempty"`
304 Remark *string `json:"remark,omitempty"`
305 CouponCodeMode *CouponCodeMode `json:"coupon_code_mode,omitempty"`
306 CouponCodeCountInfo *CouponCodeCountInfo `json:"coupon_code_count_info,omitempty"`
307 StockSendRule *StockSendRule `json:"stock_send_rule,omitempty"`
308 SingleUsageRule *SingleUsageRule `json:"single_usage_rule,omitempty"`
309 UsageRuleDisplayInfo *UsageRuleDisplayInfo `json:"usage_rule_display_info,omitempty"`
310 CouponDisplayInfo *CouponDisplayInfo `json:"coupon_display_info,omitempty"`
311 NotifyConfig *NotifyConfig `json:"notify_config,omitempty"`
312 StoreScope *StockStoreScope `json:"store_scope,omitempty"`
313 SentCountInfo *StockSentCountInfo `json:"sent_count_info,omitempty"`
314 State *StockState `json:"state,omitempty"`
315 DeactivateRequestNo *string `json:"deactivate_request_no,omitempty"`
316 DeactivateTime *time.Time `json:"deactivate_time,omitempty"`
317 DeactivateReason *string `json:"deactivate_reason,omitempty"`
318 BrandId *string `json:"brand_id,omitempty"`
319}
320
321type StockBundleEntity struct {
322 StockBundleId *string `json:"stock_bundle_id,omitempty"`
323 StockList []StockEntityInBundle `json:"stock_list,omitempty"`
324}
325
326type NormalCouponUsageRule struct {
327 Threshold *int64 `json:"threshold,omitempty"`
328 DiscountAmount *int64 `json:"discount_amount,omitempty"`
329}
330
331type DiscountCouponUsageRule struct {
332 Threshold *int64 `json:"threshold,omitempty"`
333 PercentOff *int64 `json:"percent_off,omitempty"`
334}
335
336type ComboPackage struct {
337 Name *string `json:"name,omitempty"`
338 PickCount *int64 `json:"pick_count,omitempty"`
339 ChoiceList []ComboPackageChoice `json:"choice_list,omitempty"`
340}
341
342type CouponCodeMode string
343
344func (e CouponCodeMode) Ptr() *CouponCodeMode {
345 return &e
346}
347
348const (
349 COUPONCODEMODE_WECHATPAY CouponCodeMode = "WECHATPAY"
350 COUPONCODEMODE_UPLOAD CouponCodeMode = "UPLOAD"
351 COUPONCODEMODE_API_ASSIGN CouponCodeMode = "API_ASSIGN"
352)
353
354type StockSendRule struct {
355 MaxCount *int64 `json:"max_count,omitempty"`
356 MaxCountPerDay *int64 `json:"max_count_per_day,omitempty"`
357 MaxCountPerUser *int64 `json:"max_count_per_user,omitempty"`
358}
359
360type SingleUsageRule struct {
361 CouponAvailablePeriod *CouponAvailablePeriod `json:"coupon_available_period,omitempty"`
362 NormalCoupon *NormalCouponUsageRule `json:"normal_coupon,omitempty"`
363 DiscountCoupon *DiscountCouponUsageRule `json:"discount_coupon,omitempty"`
364 ExchangeCoupon *ExchangeCouponUsageRule `json:"exchange_coupon,omitempty"`
365}
366
367type UsageRuleDisplayInfo struct {
368 CouponUsageMethodList []CouponUsageMethod `json:"coupon_usage_method_list,omitempty"`
369 MiniProgramAppid *string `json:"mini_program_appid,omitempty"`
370 MiniProgramPath *string `json:"mini_program_path,omitempty"`
371 AppPath *string `json:"app_path,omitempty"`
372 UsageDescription *string `json:"usage_description,omitempty"`
373 CouponAvailableStoreInfo *CouponAvailableStoreInfo `json:"coupon_available_store_info,omitempty"`
374}
375
376type CouponDisplayInfo struct {
377 CodeDisplayMode *CouponCodeDisplayMode `json:"code_display_mode,omitempty"`
378 BackgroundColor *string `json:"background_color,omitempty"`
379 EntranceMiniProgram *EntranceMiniProgram `json:"entrance_mini_program,omitempty"`
380 EntranceOfficialAccount *EntranceOfficialAccount `json:"entrance_official_account,omitempty"`
381 EntranceFinder *EntranceFinder `json:"entrance_finder,omitempty"`
382}
383
384type NotifyConfig struct {
385 NotifyAppid *string `json:"notify_appid,omitempty"`
386}
387
388type StockStoreScope string
389
390func (e StockStoreScope) Ptr() *StockStoreScope {
391 return &e
392}
393
394const (
395 STOCKSTORESCOPE_NONE StockStoreScope = "NONE"
396 STOCKSTORESCOPE_ALL StockStoreScope = "ALL"
397 STOCKSTORESCOPE_SPECIFIC StockStoreScope = "SPECIFIC"
398)
399
400type StockSendRuleForBundle struct {
401 MaxCount *int64 `json:"max_count,omitempty"`
402 MaxCountPerDay *int64 `json:"max_count_per_day,omitempty"`
403 MaxCountPerUser *int64 `json:"max_count_per_user,omitempty"`
404}
405
406type StockBundleUsageRule struct {
407 CouponAvailablePeriod *CouponAvailablePeriod `json:"coupon_available_period,omitempty"`
408 NormalCouponList []NormalCouponUsageRule `json:"normal_coupon_list,omitempty"`
409 DiscountCouponList []DiscountCouponUsageRule `json:"discount_coupon_list,omitempty"`
410 ExchangeCouponList []ExchangeCouponUsageRule `json:"exchange_coupon_list,omitempty"`
411}
412
413type CouponCodeCountInfo struct {
414 TotalCount *int64 `json:"total_count,omitempty"`
415 AvailableCount *int64 `json:"available_count,omitempty"`
416}
417
418type StockSentCountInfo struct {
419 TotalCount *int64 `json:"total_count,omitempty"`
420 TodayCount *int64 `json:"today_count,omitempty"`
421}
422
423type StockState string
424
425func (e StockState) Ptr() *StockState {
426 return &e
427}
428
429const (
430 STOCKSTATE_AUDITING StockState = "AUDITING"
431 STOCKSTATE_SENDING StockState = "SENDING"
432 STOCKSTATE_PAUSED StockState = "PAUSED"
433 STOCKSTATE_STOPPED StockState = "STOPPED"
434 STOCKSTATE_DEACTIVATED StockState = "DEACTIVATED"
435)
436
437type StockEntityInBundle struct {
438 ProductCouponId *string `json:"product_coupon_id,omitempty"`
439 StockId *string `json:"stock_id,omitempty"`
440 Remark *string `json:"remark,omitempty"`
441 CouponCodeMode *CouponCodeMode `json:"coupon_code_mode,omitempty"`
442 CouponCodeCountInfo *CouponCodeCountInfo `json:"coupon_code_count_info,omitempty"`
443 StockSendRule *StockSendRule `json:"stock_send_rule,omitempty"`
444 ProgressiveBundleUsageRule *StockUsageRule `json:"progressive_bundle_usage_rule,omitempty"`
445 StockBundleInfo *StockBundleInfo `json:"stock_bundle_info,omitempty"`
446 UsageRuleDisplayInfo *UsageRuleDisplayInfo `json:"usage_rule_display_info,omitempty"`
447 CouponDisplayInfo *CouponDisplayInfo `json:"coupon_display_info,omitempty"`
448 NotifyConfig *NotifyConfig `json:"notify_config,omitempty"`
449 StoreScope *StockStoreScope `json:"store_scope,omitempty"`
450 SentCountInfo *StockSentCountInfo `json:"sent_count_info,omitempty"`
451 State *StockState `json:"state,omitempty"`
452 DeactivateRequestNo *string `json:"deactivate_request_no,omitempty"`
453 DeactivateTime *time.Time `json:"deactivate_time,omitempty"`
454 DeactivateReason *string `json:"deactivate_reason,omitempty"`
455 BrandId *string `json:"brand_id,omitempty"`
456}
457
458type ComboPackageChoice struct {
459 Name *string `json:"name,omitempty"`
460 Price *int64 `json:"price,omitempty"`
461 Count *int64 `json:"count,omitempty"`
462 ImageUrl *string `json:"image_url,omitempty"`
463 MiniProgramAppid *string `json:"mini_program_appid,omitempty"`
464 MiniProgramPath *string `json:"mini_program_path,omitempty"`
465}
466
467type CouponAvailablePeriod struct {
468 AvailableBeginTime *string `json:"available_begin_time,omitempty"`
469 AvailableEndTime *string `json:"available_end_time,omitempty"`
470 AvailableDays *int64 `json:"available_days,omitempty"`
471 WaitDaysAfterReceive *int64 `json:"wait_days_after_receive,omitempty"`
472 WeeklyAvailablePeriod *FixedWeekPeriod `json:"weekly_available_period,omitempty"`
473 IrregularAvailablePeriodList []TimePeriod `json:"irregular_available_period_list,omitempty"`
474}
475
476type ExchangeCouponUsageRule struct {
477 Threshold *int64 `json:"threshold,omitempty"`
478 ExchangePrice *int64 `json:"exchange_price,omitempty"`
479}
480
481type CouponUsageMethod string
482
483func (e CouponUsageMethod) Ptr() *CouponUsageMethod {
484 return &e
485}
486
487const (
488 COUPONUSAGEMETHOD_OFFLINE CouponUsageMethod = "OFFLINE"
489 COUPONUSAGEMETHOD_MINI_PROGRAM CouponUsageMethod = "MINI_PROGRAM"
490 COUPONUSAGEMETHOD_APP CouponUsageMethod = "APP"
491 COUPONUSAGEMETHOD_PAYMENT_CODE CouponUsageMethod = "PAYMENT_CODE"
492)
493
494type CouponAvailableStoreInfo struct {
495 Description *string `json:"description,omitempty"`
496 MiniProgramAppid *string `json:"mini_program_appid,omitempty"`
497 MiniProgramPath *string `json:"mini_program_path,omitempty"`
498}
499
500type CouponCodeDisplayMode string
501
502func (e CouponCodeDisplayMode) Ptr() *CouponCodeDisplayMode {
503 return &e
504}
505
506const (
507 COUPONCODEDISPLAYMODE_INVISIBLE CouponCodeDisplayMode = "INVISIBLE"
508 COUPONCODEDISPLAYMODE_BARCODE CouponCodeDisplayMode = "BARCODE"
509 COUPONCODEDISPLAYMODE_QRCODE CouponCodeDisplayMode = "QRCODE"
510)
511
512type EntranceMiniProgram struct {
513 Appid *string `json:"appid,omitempty"`
514 Path *string `json:"path,omitempty"`
515 EntranceWording *string `json:"entrance_wording,omitempty"`
516 GuidanceWording *string `json:"guidance_wording,omitempty"`
517}
518
519type EntranceOfficialAccount struct {
520 Appid *string `json:"appid,omitempty"`
521}
522
523type EntranceFinder struct {
524 FinderId *string `json:"finder_id,omitempty"`
525 FinderVideoId *string `json:"finder_video_id,omitempty"`
526 FinderVideoCoverImageUrl *string `json:"finder_video_cover_image_url,omitempty"`
527}
528
529type StockUsageRule struct {
530 CouponAvailablePeriod *CouponAvailablePeriod `json:"coupon_available_period,omitempty"`
531 NormalCoupon *NormalCouponUsageRule `json:"normal_coupon,omitempty"`
532 DiscountCoupon *DiscountCouponUsageRule `json:"discount_coupon,omitempty"`
533 ExchangeCoupon *ExchangeCouponUsageRule `json:"exchange_coupon,omitempty"`
534}
535
536type StockBundleInfo struct {
537 StockBundleId *string `json:"stock_bundle_id,omitempty"`
538 StockBundleIndex *int64 `json:"stock_bundle_index,omitempty"`
539}
540
541type FixedWeekPeriod struct {
542 DayList []WeekEnum `json:"day_list,omitempty"`
543 DayPeriodList []PeriodOfTheDay `json:"day_period_list,omitempty"`
544}
545
546type TimePeriod struct {
547 BeginTime *string `json:"begin_time,omitempty"`
548 EndTime *string `json:"end_time,omitempty"`
549}
550
551type WeekEnum string
552
553func (e WeekEnum) Ptr() *WeekEnum {
554 return &e
555}
556
557const (
558 WEEKENUM_MONDAY WeekEnum = "MONDAY"
559 WEEKENUM_TUESDAY WeekEnum = "TUESDAY"
560 WEEKENUM_WEDNESDAY WeekEnum = "WEDNESDAY"
561 WEEKENUM_THURSDAY WeekEnum = "THURSDAY"
562 WEEKENUM_FRIDAY WeekEnum = "FRIDAY"
563 WEEKENUM_SATURDAY WeekEnum = "SATURDAY"
564 WEEKENUM_SUNDAY WeekEnum = "SUNDAY"
565)
566
567type PeriodOfTheDay struct {
568 BeginTime *int64 `json:"begin_time,omitempty"`
569 EndTime *int64 `json:"end_time,omitempty"`
570}
571