@@ -2,29 +2,30 @@ package card
2
2
3
3
import (
4
4
"fmt"
5
+ "strings"
6
+
5
7
"github.com/fideism/golang-wechat/officialaccount/context"
6
8
"github.com/fideism/golang-wechat/util"
7
- "strings"
8
9
)
9
10
10
- // Type 券类型
11
- type Type string
11
+ // CouponType 券类型
12
+ type CouponType string
12
13
13
14
const (
14
15
// Groupon 团购券类型
15
- Groupon Type = "GROUPON"
16
+ Groupon CouponType = "GROUPON"
16
17
// Cash 代金券类型
17
- Cash Type = "CASH"
18
+ Cash CouponType = "CASH"
18
19
// Discount 折扣券类型
19
- Discount Type = "DISCOUNT"
20
+ Discount CouponType = "DISCOUNT"
20
21
// Gift 兑换券类型
21
- Gift Type = "GIFT"
22
+ Gift CouponType = "GIFT"
22
23
// GeneralCoupon 通用券。
23
- GeneralCoupon Type = "GENERAL_COUPON"
24
+ GeneralCoupon CouponType = "GENERAL_COUPON"
24
25
// MemberCard 会员卡
25
- MemberCard Type = "MEMBER_CARD"
26
+ MemberCard CouponType = "MEMBER_CARD"
26
27
// GeneralCard 礼品卡
27
- GeneralCard Type = "GENERAL_CARD"
28
+ GeneralCard CouponType = "GENERAL_CARD"
28
29
)
29
30
30
31
// Status 卡券状态
@@ -57,7 +58,7 @@ func NewCard(context *context.Context) *Card {
57
58
}
58
59
59
60
// CreateCard 创建卡券
60
- func (card * Card ) CreateCard (t Type , attrs util.Params ) (cardID string , err error ) {
61
+ func (card * Card ) CreateCard (t CouponType , attrs util.Params ) (cardID string , err error ) {
61
62
var token string
62
63
token , err = card .GetAccessToken ()
63
64
if err != nil {
@@ -94,7 +95,7 @@ func (card *Card) CreateCard(t Type, attrs util.Params) (cardID string, err erro
94
95
}
95
96
96
97
// UpdateCard 修改卡券信息
97
- func (card * Card ) UpdateCard (cardID string , t Type , attrs util.Params ) (check bool , err error ) {
98
+ func (card * Card ) UpdateCard (cardID string , t CouponType , attrs util.Params ) (check bool , err error ) {
98
99
var token string
99
100
token , err = card .GetAccessToken ()
100
101
if err != nil {
@@ -270,14 +271,14 @@ func (card *Card) CreateCardQrcode(attr util.Params) (res Qrcode, err error) {
270
271
return
271
272
}
272
273
273
- // GetHtml 图文消息群发卡券
274
- func (card * Card ) GetHtml (cardID string ) (content string , err error ) {
274
+ // GetHTML 图文消息群发卡券
275
+ func (card * Card ) GetHTML (cardID string ) (content string , err error ) {
275
276
var token string
276
277
token , err = card .GetAccessToken ()
277
278
if err != nil {
278
279
return
279
280
}
280
- url := fmt .Sprintf (getHtmlURL , token )
281
+ url := fmt .Sprintf (getHTMLURL , token )
281
282
282
283
var response []byte
283
284
response , err = util .PostJSON (url , map [string ]interface {}{
0 commit comments