Documentation ¶
Index ¶
- type CDATA
- type Code
- type CodeResponse
- type Comment
- type DelPush
- type Mp
- func (m *Mp) CallbackIp() (interface{}, error)
- func (m *Mp) CancelTagsUser(body []byte) (interface{}, error)
- func (m *Mp) CheckImg(file io.Reader, fileName string) (interface{}, error)
- func (m *Mp) CheckText(body []byte) (interface{}, error)
- func (m *Mp) CreateForeverAcode(actionName, scene string) (interface{}, error)
- func (m *Mp) CreateMoreAcode(actionName, scene string) (interface{}, error)
- func (m *Mp) CreateNews(news News) int64
- func (m *Mp) DelForeverMedia(body []byte) (interface{}, error)
- func (m *Mp) DelStyleMenu(body []byte) (interface{}, error)
- func (m *Mp) DelTemplateId(body []byte) (interface{}, error)
- func (a *Mp) Get(path string, params utils.Query, withAccessToken ...bool) ([]byte, error)
- func (m *Mp) GetAccessToken(reflush ...bool) *utils.Token
- func (m *Mp) GetAccessTokenWithHook(reflush ...bool) *utils.Token
- func (m *Mp) GetCommentList(msgDataId, index, begin, count, type_ int) (interface{}, error)
- func (m *Mp) GetConfig() utils.Config
- func (m *Mp) GetForeverMedia(mediaId string) ([]byte, error)
- func (m *Mp) GetForeverMediaCount() ([]byte, error)
- func (m *Mp) GetForeverMediaList(body []byte) (interface{}, error)
- func (m *Mp) GetIndustry() (interface{}, error)
- func (m *Mp) GetMenu() (interface{}, error)
- func (m *Mp) GetOauthAccessToken(code string) *OauthToken
- func (m *Mp) GetOauthUserInfo(token, openid string) (string, error)
- func (m *Mp) GetReplyRules() (interface{}, error)
- func (m *Mp) GetSelfMenu() (interface{}, error)
- func (m *Mp) GetShortUrl(longUrl string) (string, error)
- func (m *Mp) GetTags() (interface{}, error)
- func (m *Mp) GetTagsOneUser(body []byte) (interface{}, error)
- func (m *Mp) GetTagsUser(body []byte) (UserListResponse, error)
- func (m *Mp) GetTempMedia(mediaId string) ([]byte, error)
- func (m *Mp) GetTemplateId(body []byte) (interface{}, error)
- func (m *Mp) GetTemplateList() (interface{}, error)
- func (m *Mp) GetTicketAcode(ticket string) (interface{}, error)
- func (m *Mp) GetUserDetail(openId string) (string, error)
- func (m *Mp) GetUserList(nextOpenId string) (UserListResponse, error)
- func (m *Mp) GetUsersDetail(body []byte) (interface{}, error)
- func (m *Mp) InsertTags(body []byte) (interface{}, error)
- func (a *Mp) PostBody(path string, body []byte, withAccessToken ...bool) ([]byte, error)
- func (m *Mp) PushDel(msgId, articleIdx int) int64
- func (m *Mp) PushServerImage(news ServerSendImage) int64
- func (m *Mp) PushServerNews(news ServerSendNews) int64
- func (m *Mp) PushServerText(news ServerSendText) int64
- func (m *Mp) PushServerVoice(news ServerSendVoice) int64
- func (m *Mp) PushSubscribeTemplate(body []byte) (interface{}, error)
- func (m *Mp) PushTemplate(body []byte) (interface{}, error)
- func (m *Mp) RefreshOauthAccessToken(refreshToken string) (interface{}, error)
- func (m *Mp) RemoveMenu() (interface{}, error)
- func (m *Mp) RemoveTags(body []byte) (interface{}, error)
- func (m *Mp) SendCommandMsg(openid, command string) int64
- func (m *Mp) SendImageMsg(mediaId, openid string) int64
- func (m *Mp) SendMiniProgramMsg(openid, thumbMediaId, pagepath, appid, title string) int64
- func (m *Mp) SendMpnewsMsg(openid, mediaid string) int64
- func (m *Mp) SendMusicMsg(openid, thumbMediaId, musicurl, hqmusicurl, title, description string) int64
- func (m *Mp) SendNewsMsg(openid, title, description, url_, picurl string) int64
- func (m *Mp) SendPreviewImageMsg(mediaId, openid string) int64
- func (m *Mp) SendPreviewTextMsg(content, openid string) int64
- func (m *Mp) SendTextMsg(content, openid string) int64
- func (m *Mp) SendVideoMsg(mediaId, openid, thumbMediaId, title, description string) int64
- func (m *Mp) SendVoiceMsg(mediaId, openid string) int64
- func (m *Mp) Session(code string) (User, error)
- func (m *Mp) SetForeverNews(body []byte) (interface{}, error)
- func (m *Mp) SetIndustry(body []byte) (interface{}, error)
- func (m *Mp) SetMenu(body []byte) (interface{}, error)
- func (m *Mp) SetStyleMenu(body []byte) (interface{}, error)
- func (m *Mp) SetTagsUser(body []byte) (interface{}, error)
- func (m *Mp) SetUserRemark(openId, remark string) (interface{}, error)
- func (m *Mp) TestStyleMenu(body []byte) (interface{}, error)
- func (m *Mp) UpdateTags(body []byte) (interface{}, error)
- func (m *Mp) UploadForeverMedia(fileUrlPath, type_ string) (string, error)
- func (m *Mp) UploadImg(file io.Reader, fileName string) (interface{}, error)
- func (m *Mp) UploadTempMedia(fileUrlPath, type_ string) (string, error)
- func (m *Mp) UploadTempMediaBinary(file io.Reader, fileName string, type_ string) (interface{}, error)
- func (m *Mp) VerifyOauthToken(openid string) (interface{}, error)
- type News
- type OauthToken
- type Remark
- type SendArticle
- type SendArticleItem
- type SendCommand
- type SendJsonImage
- type SendJsonText
- type SendJsonVideo
- type SendJsonVoice
- type SendMini
- type SendMpNews
- type SendMsgMenu
- type SendMusic
- type SendNews
- type SendXmlImage
- type SendXmlText
- type SendXmlVideo
- type SendXmlVoice
- type ServerSendImage
- type ServerSendNews
- type ServerSendText
- type ServerSendVoice
- type SessionResponse
- type ShortUrl
- type Subscribe
- type TagPushImage
- type TagPushNews
- type TagPushText
- type TagPushVideo
- type TagPushVoice
- type Template
- type Text
- type TextResponse
- type User
- type UserListResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CodeResponse ¶
type Mp ¶
type Mp struct { Appid string Secret string Token *utils.Token Oauth2Token *OauthToken Hook utils.Hook }
func (*Mp) CancelTagsUser ¶
批量为用户取消标签 { "openid_list" : [//粉丝列表 "ocYxcuAEy30bX0NXmGn4ypqx3tI0", "ocYxcuBt0mRugKZ7tGAHPnUaOW7Y" ], "tagid" : 134 }
func (*Mp) CreateForeverAcode ¶
创建永久二维码 QR_LIMIT_SCENE QR_LIMIT_STR_SCENE
func (*Mp) CreateMoreAcode ¶
创建临时二维码 QR_SCENE QR_STR_SCENE
func (*Mp) CreateNews ¶
上传图文素材
{ "articles": [ { "thumb_media_id":"qI6_Ze_6PtV7svjolgs-rN6stStuHIjs9_DidOHaj0Q-mwvBelOXCFZiq2OsIU-p", "author":"xxx", "title":"Happy Day", "content_source_url":"www.qq.com", "content":"content", "digest":"digest", "show_cover_pic":1, "need_open_comment":1, "only_fans_can_comment":1 }, { "thumb_media_id":"qI6_Ze_6PtV7svjolgs-rN6stStuHIjs9_DidOHaj0Q-mwvBelOXCFZiq2OsIU-p", "author":"xxx", "title":"Happy Day", "content_source_url":"www.qq.com", "content":"content", "digest":"digest", "show_cover_pic":0, "need_open_comment":1, "only_fans_can_comment":1 }
] }
func (*Mp) GetAccessTokenWithHook ¶ added in v1.1.3
获取accessToken
func (*Mp) GetCommentList ¶
获取文章评论
func (*Mp) GetForeverMedia ¶
获取永久素材 type :媒体文件类型,分别有图片(image)、语音(voice)、视频(video)和缩略图(thumb)
func (*Mp) GetOauthAccessToken ¶
func (m *Mp) GetOauthAccessToken(code string) *OauthToken
GetOauthAccessToken 获取Oauth2accessToken(网页版本) //不可以缓存,每个用户的登陆凭证不一样
func (*Mp) GetOauthUserInfo ¶
GetOauthUserInfo 获取oauth用户真实信息
func (*Mp) GetTagsOneUser ¶
获取用户身上的标签 { "openid" : "ocYxcuBt0mRugKZ7tGAHPnUaOW7Y" }
func (*Mp) GetTagsUser ¶
func (m *Mp) GetTagsUser(body []byte) (UserListResponse, error)
获取标签下粉丝列表 { "tagid" : 134, "next_openid":""//第一个拉取的OPENID,不填默认从头开始拉取 }
func (*Mp) GetTempMedia ¶
获取临时素材 type :媒体文件类型,分别有图片(image)、语音(voice)、视频(video)和缩略图(thumb)
func (*Mp) GetTemplateId ¶
获得模板ID { "template_id_short":"TM00015" }
func (*Mp) GetTicketAcode ¶
通过ticket换取真的二维码
func (*Mp) GetUserDetail ¶
获取用户详细信息(unionid)
func (*Mp) GetUserList ¶
func (m *Mp) GetUserList(nextOpenId string) (UserListResponse, error)
获取用户列表
func (*Mp) GetUsersDetail ¶
批量获取用户详细信息
{ "user_list": [ { "openid": "otvxTs4dckWG7imySrJd6jSi0CWE", "lang": "zh_CN" }, { "openid": "otvxTs_JZ6SEiP0imdhpi50fuSZg", "lang": "zh_CN" } ] }
func (*Mp) InsertTags ¶
用户标签管理 增加tag { "tag" : { "name" : "广东"//标签名 } }
func (*Mp) PushServerImage ¶
func (m *Mp) PushServerImage(news ServerSendImage) int64
func (*Mp) PushServerNews ¶
func (m *Mp) PushServerNews(news ServerSendNews) int64
func (*Mp) PushServerText ¶
func (m *Mp) PushServerText(news ServerSendText) int64
func (*Mp) PushServerVoice ¶
func (m *Mp) PushServerVoice(news ServerSendVoice) int64
func (*Mp) PushSubscribeTemplate ¶
发送订阅消息
{ "touser":"OPENID", "template_id":"TEMPLATE_ID", "url":"URL", "miniprogram":{ "appid":"xiaochengxuappid12345", "pagepath":"index?foo=bar" },
"scene":"SCENE", "title":"TITLE", "data":{ "content":{ "value":"VALUE", "color":"COLOR" }
} }
func (*Mp) PushTemplate ¶
发送模版信息
{ "touser":"OPENID", "template_id":"ngqIpbwh8bUfcSsECmogfXcV14J0tQlEpBO27izEYtY", "url":"http://weixin.qq.com/download", "miniprogram":{ "appid":"xiaochengxuappid12345", "pagepath":"index?foo=bar" }, "data":{ "first": { "value":"恭喜你购买成功!", "color":"#173177" }, "keyword1":{ "value":"巧克力", "color":"#173177" }, "keyword2": { "value":"39.8元", "color":"#173177" }, "keyword3": { "value":"2014年9月22日", "color":"#173177" }, "remark":{ "value":"欢迎再次购买!", "color":"#173177" } } }
func (*Mp) RefreshOauthAccessToken ¶
RefreshOauthAccessToken 刷新Oauth2accessToken
func (*Mp) RemoveTags ¶
删除tag { "tag":{ "id" : 134 } }
func (*Mp) SendCommandMsg ¶
客服发送状态 command[ Typing CancelTyping ]
func (*Mp) SendMiniProgramMsg ¶
发送小程序
func (*Mp) SendMusicMsg ¶
func (m *Mp) SendMusicMsg(openid, thumbMediaId, musicurl, hqmusicurl, title, description string) int64
发送音乐
func (*Mp) SendNewsMsg ¶
发送外链图文信息
func (*Mp) SendPreviewImageMsg ¶
发送图片
func (*Mp) SendPreviewTextMsg ¶
发送文本消息
func (*Mp) SendVideoMsg ¶
发送视频
func (*Mp) SetIndustry ¶
设置行业信息 { "industry_id1":"1", "industry_id2":"4" }
func (*Mp) SetTagsUser ¶
批量为用户打标签
{ "openid_list" : [//粉丝列表 "ocYxcuAEy30bX0NXmGn4ypqx3tI0", "ocYxcuBt0mRugKZ7tGAHPnUaOW7Y" ], "tagid" : 134 }
func (*Mp) SetUserRemark ¶
为用户备注
func (*Mp) UpdateTags ¶
修改tag { "tag" : { "id" : 134, "name" : "广东人" } }
func (*Mp) UploadForeverMedia ¶
上传永久素材 type :媒体文件类型,分别有图片(image)、语音(voice)、视频(video)和缩略图(thumb)
func (*Mp) UploadTempMedia ¶
上传临时素材 type :媒体文件类型,分别有图片(image)、语音(voice)、视频(video)和缩略图(thumb)
func (*Mp) UploadTempMediaBinary ¶
func (m *Mp) UploadTempMediaBinary(file io.Reader, fileName string, type_ string) (interface{}, error)
上传临时素材Binary type :媒体文件类型,分别有图片(image)、语音(voice)、视频(video)和缩略图(thumb)
func (*Mp) VerifyOauthToken ¶
VerifyOauthToken 验证Oauth2accessToken是否有效
type News ¶
type News struct { Articles []struct { ThumbMediaID string `json:"thumb_media_id"` Author string `json:"author"` Title string `json:"title"` ContentSourceURL string `json:"content_source_url"` Content string `json:"content"` Digest string `json:"digest"` ShowCoverPic int `json:"show_cover_pic"` NeedOpenComment int `json:"need_open_comment"` OnlyFansCanComment int `json:"only_fans_can_comment"` } `json:"articles"` }
type OauthToken ¶
type SendArticle ¶
type SendArticle struct { XMLName xml.Name `xml:"xml"` ToUserName CDATA `xml:"ToUserName"` FromUserName CDATA `xml:"FromUserName"` CreateTime int `xml:"CreateTime"` MsgType CDATA `xml:"MsgType"` ArticleCount int `xml:"ArticleCount"` Articles []SendArticleItem `xml:"Articles>item"` }
<xml>
<ToUserName><![CDATA[toUser]]></ToUserName> <FromUserName><![CDATA[fromUser]]></FromUserName> <CreateTime>12345678</CreateTime> <MsgType><![CDATA[news]]></MsgType> <ArticleCount>1</ArticleCount> <Articles> <item> <Title><![CDATA[title1]]></Title> <Description><![CDATA[description1]]></Description> <PicUrl><![CDATA[picurl]]></PicUrl> <Url><![CDATA[url]]></Url> </item> </Articles>
</xml>
type SendArticleItem ¶
type SendCommand ¶
SendCommand 客服状态
type SendJsonImage ¶
type SendJsonText ¶
type SendJsonVideo ¶
type SendJsonVoice ¶
type SendMpNews ¶
type SendMsgMenu ¶
type SendMusic ¶
type SendMusic struct { Touser string `json:"touser"` Msgtype string `json:"msgtype"` Music struct { Musicurl string `json:"musicurl"` Hqmusicurl string `json:"hqmusicurl"` ThumbMediaId string `json:"thumb_media_id"` Title string `json:"title"` Description string `json:"description"` } `json:"music"` }
type SendXmlImage ¶
type SendXmlImage struct { XMLName xml.Name `xml:"xml"` ToUserName CDATA `xml:"ToUserName"` FromUserName CDATA `xml:"FromUserName"` CreateTime int `xml:"CreateTime"` MsgType CDATA `xml:"MsgType"` Image struct { MediaId CDATA `xml:"MediaId"` } `xml:"Image"` }
<xml>
<ToUserName><![CDATA[toUser]]></ToUserName> <FromUserName><![CDATA[fromUser]]></FromUserName> <CreateTime>12345678</CreateTime> <MsgType><![CDATA[image]]></MsgType> <Image> <MediaId><![CDATA[media_id]]></MediaId> </Image>
</xml>
type SendXmlText ¶
type SendXmlText struct { XMLName xml.Name `xml:"xml"` ToUserName CDATA `xml:"ToUserName"` FromUserName CDATA `xml:"FromUserName"` CreateTime int `xml:"CreateTime"` MsgType CDATA `xml:"MsgType"` Content CDATA `xml:"Content"` }
返回信息的结构体
<xml>
<ToUserName><![CDATA[toUser]]></ToUserName> <FromUserName><![CDATA[fromUser]]></FromUserName> <CreateTime>12345678</CreateTime> <MsgType><![CDATA[text]]></MsgType> <Content><![CDATA[你好]]></Content>
</xml>
type SendXmlVideo ¶
type SendXmlVideo struct { XMLName xml.Name `xml:"xml"` ToUserName CDATA `xml:"ToUserName"` FromUserName CDATA `xml:"FromUserName"` CreateTime int `xml:"CreateTime"` MsgType CDATA `xml:"MsgType"` Video struct { MediaId CDATA `xml:"MediaId"` Title CDATA `xml:"Title"` Description CDATA `xml:"Description"` } `xml:"Video"` }
<xml>
<ToUserName><![CDATA[toUser]]></ToUserName> <FromUserName><![CDATA[fromUser]]></FromUserName> <CreateTime>12345678</CreateTime> <MsgType><![CDATA[video]]></MsgType> <Video> <MediaId><![CDATA[media_id]]></MediaId> <Title><![CDATA[title]]></Title> <Description><![CDATA[description]]></Description> </Video>
</xml>
type SendXmlVoice ¶
type SendXmlVoice struct { XMLName xml.Name `xml:"xml"` ToUserName CDATA `xml:"ToUserName"` FromUserName CDATA `xml:"FromUserName"` CreateTime int `xml:"CreateTime"` MsgType CDATA `xml:"MsgType"` Voice struct { MediaId CDATA `xml:"MediaId"` } `xml:"Voice"` }
<xml>
<ToUserName><![CDATA[toUser]]></ToUserName> <FromUserName><![CDATA[fromUser]]></FromUserName> <CreateTime>12345678</CreateTime> <MsgType><![CDATA[voice]]></MsgType> <Voice> <MediaId><![CDATA[media_id]]></MediaId> </Voice>
</xml>
type ServerSendImage ¶
type ServerSendImage struct { Touser []string `json:"touser"` Images struct { MediaIds []string `json:"media_ids"` Recommend string `json:"recommend"` NeedOpenComment int `json:"need_open_comment"` OnlyFansCanComment int `json:"only_fans_can_comment"` } `json:"images"` Msgtype string `json:"msgtype"` }
type ServerSendNews ¶
type ServerSendNews struct { Touser []string `json:"touser"` Mpnews struct { MediaID string `json:"media_id"` } `json:"mpnews"` Msgtype string `json:"msgtype"` SendIgnoreReprint int `json:"send_ignore_reprint"` }
ServerSendNews 服务号结构体
type ServerSendText ¶
type ServerSendVoice ¶
type SessionResponse ¶
type TagPushImage ¶
type TagPushImage struct { Filter struct { IsToAll bool `json:"is_to_all"` TagID int `json:"tag_id"` } `json:"filter"` Images struct { MediaIds []string `json:"media_ids"` Recommend string `json:"recommend"` NeedOpenComment int `json:"need_open_comment"` OnlyFansCanComment int `json:"only_fans_can_comment"` } `json:"images"` Msgtype string `json:"msgtype"` }