File tree Expand file tree Collapse file tree 2 files changed +48
-0
lines changed
Expand file tree Collapse file tree 2 files changed +48
-0
lines changed Original file line number Diff line number Diff line change @@ -68,6 +68,36 @@ type Location struct {
6868 } `json:"location"` // 地理位置消息
6969}
7070
71+ // Link 链接消息
72+ type Link struct {
73+ MsgType string `json:"msgtype"` // 消息类型,此时固定为:link
74+ Link struct {
75+ Title string `json:"title"` // 标题
76+ Desc string `json:"desc"` // 描述
77+ URL string `json:"url"` // 点击后跳转的链接
78+ PicURL string `json:"pic_url"` // 缩略图链接
79+ } `json:"link"` // 链接消息
80+ }
81+
82+ // BusinessCard 名片消息
83+ type BusinessCard struct {
84+ MsgType string `json:"msgtype"` // 消息类型,此时固定为:business_card
85+ BusinessCard struct {
86+ UserID string `json:"userid"` // 名片 userid
87+ } `json:"business_card"` // 名片消息
88+ }
89+
90+ // MiniProgram 小程序消息
91+ type MiniProgram struct {
92+ MsgType string `json:"msgtype"` // 消息类型,此时固定为:miniprogram
93+ MiniProgram struct {
94+ AppID string `json:"appid"` // 小程序appid,必须是关联到企业的小程序应用
95+ Title string `json:"title"` // 小程序消息标题,最多64个字节,超过会自动截断
96+ ThumbMediaID string `json:"thumb_media_id"` // 小程序消息封面的mediaid,封面图建议尺寸为520*416
97+ PagePath string `json:"pagepath"` // 点击消息卡片后进入的小程序页面路径
98+ } `json:"miniprogram"` // 小程序消息
99+ }
100+
71101// EventMessage 事件消息
72102type EventMessage struct {
73103 BaseMessage
Original file line number Diff line number Diff line change @@ -55,6 +55,24 @@ func (r Message) GetLocationMessage() (info Location, err error) {
5555 return info , err
5656}
5757
58+ // GetLinkMessage 获取链接消息
59+ func (r Message ) GetLinkMessage () (info Link , err error ) {
60+ err = json .Unmarshal (r .OriginData , & info )
61+ return info , err
62+ }
63+
64+ // GetBusinessCardMessage 获取名片消息
65+ func (r Message ) GetBusinessCardMessage () (info BusinessCard , err error ) {
66+ err = json .Unmarshal (r .OriginData , & info )
67+ return info , err
68+ }
69+
70+ // GetMiniProgramMessage 获取小程序消息
71+ func (r Message ) GetMiniProgramMessage () (info MiniProgram , err error ) {
72+ err = json .Unmarshal (r .OriginData , & info )
73+ return info , err
74+ }
75+
5876// GetEnterSessionEvent 用户进入会话事件
5977func (r Message ) GetEnterSessionEvent () (info EnterSessionEvent , err error ) {
6078 err = json .Unmarshal (r .OriginData , & info )
You can’t perform that action at this time.
0 commit comments