From 4c35924b8cb121e3047fd48c28577a803c6ea24d Mon Sep 17 00:00:00 2001 From: huangx Date: Tue, 25 Aug 2020 19:41:53 +0800 Subject: [PATCH] =?UTF-8?q?feature:=20=E5=85=AC=E4=BC=97=E5=8F=B7=E5=AE=A2?= =?UTF-8?q?=E6=9C=8D=E6=B6=88=E6=81=AF=E5=A2=9E=E5=8A=A0=E3=80=8C=E5=B0=8F?= =?UTF-8?q?=E7=A8=8B=E5=BA=8F=E5=8D=A1=E7=89=87=E6=B6=88=E6=81=AF=E3=80=8D?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B=EF=BC=9B=E6=B7=BB=E5=8A=A0=20GetCustomerMess?= =?UTF-8?q?ageManager=20=20(#320)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix officialaccount customer_message * fix golint comment Co-authored-by: huangxiang --- officialaccount/message/customer_message.go | 16 +++++++++++++++- officialaccount/message/message.go | 2 ++ officialaccount/officialaccount.go | 5 +++++ 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/officialaccount/message/customer_message.go b/officialaccount/message/customer_message.go index c7abb65..9c64cb0 100644 --- a/officialaccount/message/customer_message.go +++ b/officialaccount/message/customer_message.go @@ -73,6 +73,20 @@ func NewCustomerVoiceMessage(toUser, mediaID string) *CustomerMessage { } } +//NewCustomerMiniprogrampageMessage 小程序卡片消息的构造方法 +func NewCustomerMiniprogrampageMessage(toUser, title, appID, pagePath, thumbMediaID string) *CustomerMessage { + return &CustomerMessage{ + ToUser: toUser, + Msgtype: MsgTypeMiniprogrampage, + Miniprogrampage: &MediaMiniprogrampage{ + Title: title, + AppID: appID, + Pagepath: pagePath, + ThumbMediaID: thumbMediaID, + }, + } +} + //MediaText 文本消息的文字 type MediaText struct { Content string `json:"content"` @@ -134,7 +148,7 @@ type MediaWxcard struct { //MediaMiniprogrampage 小程序消息 type MediaMiniprogrampage struct { Title string `json:"title"` - Appid string `json:"appid"` + AppID string `json:"appid"` Pagepath string `json:"pagepath"` ThumbMediaID string `json:"thumb_media_id"` } diff --git a/officialaccount/message/message.go b/officialaccount/message/message.go index ecb6f20..b151ab4 100644 --- a/officialaccount/message/message.go +++ b/officialaccount/message/message.go @@ -24,6 +24,8 @@ const ( MsgTypeVoice = "voice" //MsgTypeVideo 表示视频消息 MsgTypeVideo = "video" + //MsgTypeMiniprogrampage 表示小程序卡片消息 + MsgTypeMiniprogrampage = "miniprogrampage" //MsgTypeShortVideo 表示短视频消息[限接收] MsgTypeShortVideo = "shortvideo" //MsgTypeLocation 表示坐标消息[限接收] diff --git a/officialaccount/officialaccount.go b/officialaccount/officialaccount.go index d9226ac..ff5b399 100644 --- a/officialaccount/officialaccount.go +++ b/officialaccount/officialaccount.go @@ -93,6 +93,11 @@ func (officialAccount *OfficialAccount) GetTemplate() *message.Template { return message.NewTemplate(officialAccount.ctx) } +// GetCustomerMessageManager 客服消息接口 +func (officialAccount *OfficialAccount) GetCustomerMessageManager() *message.Manager { + return message.NewMessageManager(officialAccount.ctx) +} + // GetDevice 获取智能设备的实例 func (officialAccount *OfficialAccount) GetDevice() *device.Device { return device.NewDevice(officialAccount.ctx)