Skip to content

Commit

Permalink
add CommonToken and MiniProgramMixMessage (#323)
Browse files Browse the repository at this point in the history
Co-authored-by: huangxiang <huangxiang@didichuxing.com>
  • Loading branch information
greatwhole and huangxiang authored Aug 29, 2020
1 parent 3014901 commit 0505969
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions miniprogram/message/consts.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package message

import "encoding/xml"

// MsgType 基本消息类型
type MsgType string

Expand All @@ -19,3 +21,37 @@ const (
//MsgTypeMiniProgramPage 小程序卡片
MsgTypeMiniProgramPage = "miniprogrampage"
)

// CommonToken 消息中通用的结构
type CommonToken struct {
XMLName xml.Name `xml:"xml"`
ToUserName string `xml:"ToUserName"`
FromUserName string `xml:"FromUserName"`
CreateTime int64 `xml:"CreateTime"`
MsgType MsgType `xml:"MsgType"`
}

// MiniProgramMixMessage 小程序回调的消息结构
type MiniProgramMixMessage struct {
CommonToken

MsgID int64 `xml:"MsgId"`

// 文本消息
Content string `xml:"Content"`

// 图片消息
PicURL string `xml:"PicUrl"`
MediaID string `xml:"MediaId"`

// 小程序卡片消息
Title string `xml:"Title"`
AppID string `xml:"AppId"`
PagePath string `xml:"PagePath"`
ThumbURL string `xml:"ThumbUrl"`
ThumbMediaID string `xml:"ThumbMediaId"`

// 进入会话事件
Event string `xml:"Event"`
SessionFrom string `xml:"SessionFrom"`
}

0 comments on commit 0505969

Please sign in to comment.