Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

更新推送小程序卡片需要的参数 #243

Open
wants to merge 2 commits into
base: v2
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 14 additions & 12 deletions mp/message/custom/msg.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,17 @@ import (
)

const (
MsgTypeText core.MsgType = "text" // 文本消息
MsgTypeImage core.MsgType = "image" // 图片消息
MsgTypeVoice core.MsgType = "voice" // 语音消息
MsgTypeVideo core.MsgType = "video" // 视频消息
MsgTypeMusic core.MsgType = "music" // 音乐消息
MsgTypeNews core.MsgType = "news" // 图文消息
MsgTypeMPNews core.MsgType = "mpnews" // 图文消息, 发送已经创建好的图文
MsgTypeWxCard core.MsgType = "wxcard" // 卡卷消息
MsgTypeText core.MsgType = "text" // 文本消息
MsgTypeImage core.MsgType = "image" // 图片消息
MsgTypeVoice core.MsgType = "voice" // 语音消息
MsgTypeVideo core.MsgType = "video" // 视频消息
MsgTypeMusic core.MsgType = "music" // 音乐消息
MsgTypeNews core.MsgType = "news" // 图文消息
MsgTypeMPNews core.MsgType = "mpnews" // 图文消息, 发送已经创建好的图文
MsgTypeWxCard core.MsgType = "wxcard" // 卡卷消息
MsgTypeWxMiniLink core.MsgType = "link" // 小程序客服消息:图文链接
MsgTypeWxMiniPage core.MsgType = "miniprogrampage" //小程序卡片
MsgTypeMenu core.MsgType = "msgmenu" // 小程序客服消息:菜单
MsgTypeWxMiniLink core.MsgType = "link" // 小程序客服消息:图文链接
)

type MsgHeader struct {
Expand Down Expand Up @@ -309,20 +310,21 @@ type WxMiniPage struct {
MsgHeader
MiniProgramPage struct {
Title string `json:"title"`
AppId string `json:"appid"`
PagePath string `json:"pagepath"`
ThumbMediaId string `json:"thumb_media_id"`
} `json:"miniprogrampage"`
CustomService *CustomService `json:"customservice,omitempty"`
}

func NewMiniPage(toUser, title, pagePath, thumbMediaId, kfAccount string) (page *WxMiniPage) {
func NewMiniPage(toUser,appId ,title, pagePath, thumbMediaId, kfAccount string) (page *WxMiniPage) {
page = &WxMiniPage{
MsgHeader: MsgHeader{
ToUser: toUser,
MsgType: MsgTypeWxMiniLink,
MsgType: MsgTypeWxMiniPage,
},
}

page.MiniProgramPage.AppId = appId
page.MiniProgramPage.Title = title
page.MiniProgramPage.PagePath = pagePath
page.MiniProgramPage.ThumbMediaId = thumbMediaId
Expand Down