
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 },
98 NotifyConfig: &NotifyConfig{
99 NotifyAppid: wxpay_utility.String("wx4fd12345678"),
100 },
101 StoreScope: STOCKSTORESCOPE_NONE.Ptr(),
102 },
103 BrandId: wxpay_utility.String("120344"),
104 }
105
106 response, err := CreateProductCoupon(config, request)
107 if err != nil {
108 fmt.Printf("请求失败: %+v\n", err)
109
110 return
111 }
112
113
114 fmt.Printf("请求成功: %+v\n", response)
115}
116
117func CreateProductCoupon(config *wxpay_utility.MchConfig, request *CreateProductCouponRequest) (response *CreateProductCouponResponse, err error) {
118 const (
119 host = "https://api.mch.weixin.qq.com"
120 method = "POST"
121 path = "/v3/marketing/partner/product-coupon/product-coupons"
122 )
123
124 reqUrl, err := url.Parse(fmt.Sprintf("%s%s", host, path))
125 if err != nil {
126 return nil, err
127 }
128 reqBody, err := json.Marshal(request)
129 if err != nil {
130 return nil, err
131 }
132 httpRequest, err := http.NewRequest(method, reqUrl.String(), bytes.NewReader(reqBody))
133 if err != nil {
134 return nil, err
135 }
136 httpRequest.Header.Set("Accept", "application/json")
137 httpRequest.Header.Set("Wechatpay-Serial", config.WechatPayPublicKeyId())
138 httpRequest.Header.Set("Content-Type", "application/json")
139 authorization, err := wxpay_utility.BuildAuthorization(config.MchId(), config.CertificateSerialNo(), config.PrivateKey(), method, reqUrl.RequestURI(), reqBody)
140 if err != nil {
141 return nil, err
142 }
143 httpRequest.Header.Set("Authorization", authorization)
144
145 client := &http.Client{}
146 httpResponse, err := client.Do(httpRequest)
147 if err != nil {
148 return nil, err
149 }
150 respBody, err := wxpay_utility.ExtractResponseBody(httpResponse)
151 if err != nil {
152 return nil, err
153 }
154 if httpResponse.StatusCode >= 200 && httpResponse.StatusCode < 300 {
155
156 err = wxpay_utility.ValidateResponse(
157 config.WechatPayPublicKeyId(),
158 config.WechatPayPublicKey(),
159 &httpResponse.Header,
160 respBody,
161 )
162 if err != nil {
163 return nil, err
164 }
165 response := &CreateProductCouponResponse{}
166 if err := json.Unmarshal(respBody, response); err != nil {
167 return nil, err
168 }
169
170 return response, nil
171 } else {
172 return nil, wxpay_utility.NewApiException(
173 httpResponse.StatusCode,
174 httpResponse.Header,
175 respBody,
176 )
177 }
178}
179
180type CreateProductCouponRequest struct {
181 OutRequestNo *string `json:"out_request_no,omitempty"`
182 Scope *ProductCouponScope `json:"scope,omitempty"`
183 Type *ProductCouponType `json:"type,omitempty"`
184 UsageMode *UsageMode `json:"usage_mode,omitempty"`
185 SingleUsageInfo *SingleUsageInfo `json:"single_usage_info,omitempty"`
186 ProgressiveBundleUsageInfo *ProgressiveBundleUsageInfo `json:"progressive_bundle_usage_info,omitempty"`
187 DisplayInfo *ProductCouponDisplayInfo `json:"display_info,omitempty"`
188 OutProductNo *string `json:"out_product_no,omitempty"`
189 Stock *StockForCreate `json:"stock,omitempty"`
190 StockBundle *StockBundleForCreate `json:"stock_bundle,omitempty"`
191 BrandId *string `json:"brand_id,omitempty"`
192 ShowAsExchange *bool `json:"show_as_exchange,omitempty"`
193 AvailableProductNoList []string `json:"available_product_no_list,omitempty"`
194}
195
196type CreateProductCouponResponse struct {
197 ProductCouponId *string `json:"product_coupon_id,omitempty"`
198 Scope *ProductCouponScope `json:"scope,omitempty"`
199 Type *ProductCouponType `json:"type,omitempty"`
200 UsageMode *UsageMode `json:"usage_mode,omitempty"`
201 SingleUsageInfo *SingleUsageInfo `json:"single_usage_info,omitempty"`
202 ProgressiveBundleUsageInfo *ProgressiveBundleUsageInfo `json:"progressive_bundle_usage_info,omitempty"`
203 DisplayInfo *ProductCouponDisplayInfo `json:"display_info,omitempty"`
204 OutProductNo *string `json:"out_product_no,omitempty"`
205 State *ProductCouponState `json:"state,omitempty"`
206 Stock *StockEntity `json:"stock,omitempty"`
207 StockBundle *StockBundleEntity `json:"stock_bundle,omitempty"`
208 BrandId *string `json:"brand_id,omitempty"`
209 ShowAsExchange *bool `json:"show_as_exchange,omitempty"`
210 AvailableProductNoList []string `json:"available_product_no_list,omitempty"`
211}
212
213type ProductCouponScope string
214
215func (e ProductCouponScope) Ptr() *ProductCouponScope {
216 return &e
217}
218
219const (
220 PRODUCTCOUPONSCOPE_ALL ProductCouponScope = "ALL"
221 PRODUCTCOUPONSCOPE_SINGLE ProductCouponScope = "SINGLE"
222 PRODUCTCOUPONSCOPE_CATEGORY ProductCouponScope = "CATEGORY"
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 AppJumpType *AppJumpType `json:"app_jump_type,omitempty"`
375 PasscodeLink *string `json:"passcode_link,omitempty"`
376}
377
378type CouponDisplayInfo struct {
379 CodeDisplayMode *CouponCodeDisplayMode `json:"code_display_mode,omitempty"`
380 BackgroundColor *string `json:"background_color,omitempty"`
381 EntranceMiniProgram *EntranceMiniProgram `json:"entrance_mini_program,omitempty"`
382 EntranceOfficialAccount *EntranceOfficialAccount `json:"entrance_official_account,omitempty"`
383}
384
385type NotifyConfig struct {
386 NotifyAppid *string `json:"notify_appid,omitempty"`
387}
388
389type StockStoreScope string
390
391func (e StockStoreScope) Ptr() *StockStoreScope {
392 return &e
393}
394
395const (
396 STOCKSTORESCOPE_NONE StockStoreScope = "NONE"
397 STOCKSTORESCOPE_ALL StockStoreScope = "ALL"
398 STOCKSTORESCOPE_SPECIFIC StockStoreScope = "SPECIFIC"
399)
400
401type StockSendRuleForBundle struct {
402 MaxCount *int64 `json:"max_count,omitempty"`
403 MaxCountPerDay *int64 `json:"max_count_per_day,omitempty"`
404 MaxCountPerUser *int64 `json:"max_count_per_user,omitempty"`
405}
406
407type StockBundleUsageRule struct {
408 CouponAvailablePeriod *CouponAvailablePeriod `json:"coupon_available_period,omitempty"`
409 NormalCouponList []NormalCouponUsageRule `json:"normal_coupon_list,omitempty"`
410 DiscountCouponList []DiscountCouponUsageRule `json:"discount_coupon_list,omitempty"`
411 ExchangeCouponList []ExchangeCouponUsageRule `json:"exchange_coupon_list,omitempty"`
412}
413
414type CouponCodeCountInfo struct {
415 TotalCount *int64 `json:"total_count,omitempty"`
416 AvailableCount *int64 `json:"available_count,omitempty"`
417}
418
419type StockSentCountInfo struct {
420 TotalCount *int64 `json:"total_count,omitempty"`
421 TodayCount *int64 `json:"today_count,omitempty"`
422}
423
424type StockState string
425
426func (e StockState) Ptr() *StockState {
427 return &e
428}
429
430const (
431 STOCKSTATE_AUDITING StockState = "AUDITING"
432 STOCKSTATE_SENDING StockState = "SENDING"
433 STOCKSTATE_PAUSED StockState = "PAUSED"
434 STOCKSTATE_STOPPED StockState = "STOPPED"
435 STOCKSTATE_DEACTIVATED StockState = "DEACTIVATED"
436)
437
438type StockEntityInBundle struct {
439 ProductCouponId *string `json:"product_coupon_id,omitempty"`
440 StockId *string `json:"stock_id,omitempty"`
441 Remark *string `json:"remark,omitempty"`
442 CouponCodeMode *CouponCodeMode `json:"coupon_code_mode,omitempty"`
443 CouponCodeCountInfo *CouponCodeCountInfo `json:"coupon_code_count_info,omitempty"`
444 StockSendRule *StockSendRule `json:"stock_send_rule,omitempty"`
445 ProgressiveBundleUsageRule *StockUsageRule `json:"progressive_bundle_usage_rule,omitempty"`
446 StockBundleInfo *StockBundleInfo `json:"stock_bundle_info,omitempty"`
447 UsageRuleDisplayInfo *UsageRuleDisplayInfo `json:"usage_rule_display_info,omitempty"`
448 CouponDisplayInfo *CouponDisplayInfo `json:"coupon_display_info,omitempty"`
449 NotifyConfig *NotifyConfig `json:"notify_config,omitempty"`
450 StoreScope *StockStoreScope `json:"store_scope,omitempty"`
451 SentCountInfo *StockSentCountInfo `json:"sent_count_info,omitempty"`
452 State *StockState `json:"state,omitempty"`
453 DeactivateRequestNo *string `json:"deactivate_request_no,omitempty"`
454 DeactivateTime *time.Time `json:"deactivate_time,omitempty"`
455 DeactivateReason *string `json:"deactivate_reason,omitempty"`
456 BrandId *string `json:"brand_id,omitempty"`
457}
458
459type ComboPackageChoice struct {
460 Name *string `json:"name,omitempty"`
461 Price *int64 `json:"price,omitempty"`
462 Count *int64 `json:"count,omitempty"`
463 ImageUrl *string `json:"image_url,omitempty"`
464 MiniProgramAppid *string `json:"mini_program_appid,omitempty"`
465 MiniProgramPath *string `json:"mini_program_path,omitempty"`
466}
467
468type CouponAvailablePeriod struct {
469 AvailableBeginTime *string `json:"available_begin_time,omitempty"`
470 AvailableEndTime *string `json:"available_end_time,omitempty"`
471 AvailableDays *int64 `json:"available_days,omitempty"`
472 WaitDaysAfterReceive *int64 `json:"wait_days_after_receive,omitempty"`
473 WeeklyAvailablePeriod *FixedWeekPeriod `json:"weekly_available_period,omitempty"`
474 IrregularAvailablePeriodList []TimePeriod `json:"irregular_available_period_list,omitempty"`
475 AvailableSeconds *int64 `json:"available_seconds,omitempty"`
476}
477
478type ExchangeCouponUsageRule struct {
479 Threshold *int64 `json:"threshold,omitempty"`
480 ExchangePrice *int64 `json:"exchange_price,omitempty"`
481}
482
483type CouponUsageMethod string
484
485func (e CouponUsageMethod) Ptr() *CouponUsageMethod {
486 return &e
487}
488
489const (
490 COUPONUSAGEMETHOD_OFFLINE CouponUsageMethod = "OFFLINE"
491 COUPONUSAGEMETHOD_MINI_PROGRAM CouponUsageMethod = "MINI_PROGRAM"
492 COUPONUSAGEMETHOD_APP CouponUsageMethod = "APP"
493 COUPONUSAGEMETHOD_PAYMENT_CODE CouponUsageMethod = "PAYMENT_CODE"
494)
495
496type CouponAvailableStoreInfo struct {
497 Description *string `json:"description,omitempty"`
498 MiniProgramAppid *string `json:"mini_program_appid,omitempty"`
499 MiniProgramPath *string `json:"mini_program_path,omitempty"`
500}
501
502type AppJumpType string
503
504func (e AppJumpType) Ptr() *AppJumpType {
505 return &e
506}
507
508const (
509 APPJUMPTYPE_H5 AppJumpType = "H5"
510 APPJUMPTYPE_PASSCODE_LINK AppJumpType = "PASSCODE_LINK"
511 APPJUMPTYPE_USAGE_GUIDE AppJumpType = "USAGE_GUIDE"
512)
513
514type CouponCodeDisplayMode string
515
516func (e CouponCodeDisplayMode) Ptr() *CouponCodeDisplayMode {
517 return &e
518}
519
520const (
521 COUPONCODEDISPLAYMODE_INVISIBLE CouponCodeDisplayMode = "INVISIBLE"
522 COUPONCODEDISPLAYMODE_BARCODE CouponCodeDisplayMode = "BARCODE"
523 COUPONCODEDISPLAYMODE_QRCODE CouponCodeDisplayMode = "QRCODE"
524)
525
526type EntranceMiniProgram struct {
527 Appid *string `json:"appid,omitempty"`
528 Path *string `json:"path,omitempty"`
529 EntranceWording *string `json:"entrance_wording,omitempty"`
530 GuidanceWording *string `json:"guidance_wording,omitempty"`
531}
532
533type EntranceOfficialAccount struct {
534 Appid *string `json:"appid,omitempty"`
535}
536
537type StockUsageRule struct {
538 CouponAvailablePeriod *CouponAvailablePeriod `json:"coupon_available_period,omitempty"`
539 NormalCoupon *NormalCouponUsageRule `json:"normal_coupon,omitempty"`
540 DiscountCoupon *DiscountCouponUsageRule `json:"discount_coupon,omitempty"`
541 ExchangeCoupon *ExchangeCouponUsageRule `json:"exchange_coupon,omitempty"`
542}
543
544type StockBundleInfo struct {
545 StockBundleId *string `json:"stock_bundle_id,omitempty"`
546 StockBundleIndex *int64 `json:"stock_bundle_index,omitempty"`
547}
548
549type FixedWeekPeriod struct {
550 DayList []WeekEnum `json:"day_list,omitempty"`
551 DayPeriodList []PeriodOfTheDay `json:"day_period_list,omitempty"`
552}
553
554type TimePeriod struct {
555 BeginTime *string `json:"begin_time,omitempty"`
556 EndTime *string `json:"end_time,omitempty"`
557}
558
559type WeekEnum string
560
561func (e WeekEnum) Ptr() *WeekEnum {
562 return &e
563}
564
565const (
566 WEEKENUM_MONDAY WeekEnum = "MONDAY"
567 WEEKENUM_TUESDAY WeekEnum = "TUESDAY"
568 WEEKENUM_WEDNESDAY WeekEnum = "WEDNESDAY"
569 WEEKENUM_THURSDAY WeekEnum = "THURSDAY"
570 WEEKENUM_FRIDAY WeekEnum = "FRIDAY"
571 WEEKENUM_SATURDAY WeekEnum = "SATURDAY"
572 WEEKENUM_SUNDAY WeekEnum = "SUNDAY"
573)
574
575type PeriodOfTheDay struct {
576 BeginTime *int64 `json:"begin_time,omitempty"`
577 EndTime *int64 `json:"end_time,omitempty"`
578}
579