Skip to content

Commit

Permalink
客服消息新增两种类型
Browse files Browse the repository at this point in the history
  • Loading branch information
dcsunny committed Mar 6, 2019
1 parent 56db90e commit 3fea7eb
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 10 deletions.
47 changes: 37 additions & 10 deletions custom/custom.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,13 @@ import (
)

const (
customUrl = "https://api.weixin.qq.com/cgi-bin/message/custom/send"
CustomTypeText = "text"
CustomTypeImage = "image"
CustomTypeNews = "news"
CustomTypeMpNews = "mpnews"
customUrl = "https://api.weixin.qq.com/cgi-bin/message/custom/send"
CustomTypeText = "text"
CustomTypeImage = "image"
CustomTypeNews = "news"
CustomTypeMpNews = "mpnews"
CustomTypeMenu = "msgmenu"
CustomTypeMiniprogrampage = "miniprogrampage"
)

//客服消息
Expand All @@ -29,11 +31,36 @@ func NewCustom(context *context.Context) *Custom {
}

type Message struct {
Touser string `json:"touser"`
Msgtype string `json:"msgtype"`
Text *MessageText `json:"text,omitempty"`
Image *MessageImage `json:"image,omitempty"`
News *MessageNews `json:"news,omitempty"`
Touser string `json:"touser"`
Msgtype string `json:"msgtype"`
Customservice *MessageCustomservice `json:"customservice,omitempty"`
Text *MessageText `json:"text,omitempty"`
Image *MessageImage `json:"image,omitempty"`
News *MessageNews `json:"news,omitempty"`
Msgmenu *MessageMsgmenus `json:"msgmenu,omitempty"`
Miniprogrampage *MeesageMiniprogrampage `json:"miniprogrampage,omitempty"`
}

type MessageCustomservice struct {
KfAccount string `json:"kf_account"`
}

type MeesageMiniprogrampage struct {
Title string `json:"title"`
AppID string `json:"appid"`
PagePath string `json:"pagepath"`
ThumbMediaID string `json:"thumb_media_id"`
}

type MessageMsgmenus struct {
HeadContent string `json:"head_content"`
List []MessageMsgmenu `json:"list"`
TailContent string `json:"tail_content"`
}

type MessageMsgmenu struct {
ID string `json:"id"`
Content string `json:"content"`
}

type MessageText struct {
Expand Down
1 change: 1 addition & 0 deletions message/message.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ type MixMessage struct {
Title string `xml:"Title"`
Description string `xml:"Description"`
URL string `xml:"Url"`
Bizmsgmenuid string `xml:"bizmsgmenuid"`

//事件相关
Event EventType `xml:"Event"`
Expand Down

0 comments on commit 3fea7eb

Please sign in to comment.