Documentation
¶
Index ¶
- Constants
- func GetRandStr(a int) string
- type AccessToken
- type Article
- type BassMessage
- type Comment
- type Customservice
- type Fans
- type Handler
- type Image
- type ImageMessage
- type Jsapi_ticket
- type KF
- type KfAccountList
- type Miniprogrampage
- type MiniprogrampageMessage
- type MpNews
- type MpNewsMessage
- type MpVideo
- type Music
- type MusicMessage
- type News
- type NewsArticle
- type NewsList
- type NewsMessage
- type PreviewImage
- type PreviewMpNews
- type PreviewMpVideo
- type PreviewText
- type PreviewVoice
- type Res
- type SendAllResp
- type Tag
- type Text
- type TextMessage
- type Trader
- func (t *Trader) AddConditionalMenu(menujson string) (menuid string, err error)
- func (t *Trader) AddImageMaterial(data []byte) (mediaId, url string, err error)
- func (t *Trader) AddKfAccount(kfaccount, nickname, password string) error
- func (t *Trader) AddNews(nl NewsList) (mediaId string, err error)
- func (t *Trader) AddThumbMaterial(data []byte) (mediaId, url string, err error)
- func (t *Trader) AddVideoMaterial(data []byte, title, introduction string) (mediaId string, err error)
- func (t *Trader) AddVoiceMaterial(data []byte) (mediaId string, err error)
- func (t *Trader) BatchCancelTag(useropenid []string, tagid int) (err error)
- func (t *Trader) BatchGetMaterial(materialtype string, offset int, count int) (data string, err error)
- func (t *Trader) BatchTagToUsers(useropenids []string, tagid int) (err error)
- func (t *Trader) CheckAccessTokenLive() (err error)
- func (t *Trader) CreateMenu(contentjson string) (err error)
- func (t *Trader) CreateTag(tagname string) (tagid int, err error)
- func (t *Trader) DelKfAccount(kfaccount, nickname, password string) error
- func (t *Trader) DelMaterial(mediaid string) (err error)
- func (t *Trader) DelMenu() (err error)
- func (t *Trader) DelTag(tagid int) (err error)
- func (t *Trader) DelTemplate(templateId string) (err error)
- func (t *Trader) DelconditionalMenu(menuid string) (err error)
- func (t *Trader) DeleteComment(msgdataid, index, usercommentid int) (err error)
- func (t *Trader) DeleteMass(msgid, index int) (err error)
- func (t *Trader) DeleteReplyComment(msgdataid, index, usercommentid int) (err error)
- func (t *Trader) FlushAccessToken() (err error)
- func (t *Trader) Get(surl string) (b []byte, err error)
- func (t *Trader) GetALLTemplate() (jsonstr string, err error)
- func (t *Trader) GetAccessToken() (a AccessToken, err error)
- func (t *Trader) GetCommentList(msgdataid, index, begin, count, commenttype int) (list []Comment, err error)
- func (t *Trader) GetFans(nextopenid string) (fans Fans, err error)
- func (t *Trader) GetIndustry() (jsonstr string, err error)
- func (t *Trader) GetJsapiTicket() (ticket string, err error)
- func (t *Trader) GetKfList() (list KfAccountList, err error)
- func (t *Trader) GetMassSpeed() (speedgrade, realspeed int, err error)
- func (t *Trader) GetMaterialCount() (newscount, imagecount, videocount, voicecount int, err error)
- func (t *Trader) GetMaterialInfo(mediaid string) (data []byte, err error)
- func (t *Trader) GetMenu() (menujson string, err error)
- func (t *Trader) GetSendAllStatus(msgid int) (status string, err error)
- func (t *Trader) GetTag() (tags []Tag, err error)
- func (t *Trader) GetTagsByUser(useropenid string) (tagids []int, err error)
- func (t *Trader) GetTemplateId(templateIdShort string) (templateId string, err error)
- func (t *Trader) GetUserByTag(tagid int, nextopenid string) (useropenid []string, lastopenid string, err error)
- func (t *Trader) GetUserInfo(openid string) (user UserInfo, err error)
- func (t *Trader) MarkelectComment(msgdataid, index, usercommentid int) (err error)
- func (t *Trader) OpenComment(bl bool, msgdataid int, index int) (err error)
- func (t *Trader) PostJson(surl, jsonstr string) (b []byte, err error)
- func (t *Trader) Preview(msgtype string, useropenid, mediaId string) (err error)
- func (t *Trader) ReplyComment(msgdataid, index, usercommentid int, content string) (err error)
- func (t *Trader) SendImageAll(tagId int, mediaId string) (msgid int, err error)
- func (t *Trader) SendImageMsg(touser, imgMediaId string) error
- func (t *Trader) SendMPNews(touser, mediaId string) error
- func (t *Trader) SendMiniProgrampageMsg(touser, title, appid, pagePath, thumbMediaId string) error
- func (t *Trader) SendMpNewsAll(tagId int, mediaId string) (msgid, msgdataid int, err error)
- func (t *Trader) SendMusicMsg(touser, title, description, musicurl, hqmusicurl, thumb_media_id string) error
- func (t *Trader) SendNewsMsg(touser string, articles []Article) error
- func (t *Trader) SendTemplateMsg(jsonContext string) (msgid int, err error)
- func (t *Trader) SendTextAll(tagId int, text string) (msgid int, err error)
- func (t *Trader) SendTextMsg(touser, text string) error
- func (t *Trader) SendVideoAll(tagId int, mediaId, title, description string) (msgid int, err error)
- func (t *Trader) SendVideoMsg(touser, videoMediaId, thumbMediaId, title, description string) error
- func (t *Trader) SendVoiceAll(tagId int, mediaId string) (msgid int, err error)
- func (t *Trader) SendVoiceMsg(touser, voiceMediaId string) error
- func (t *Trader) SendWxCardAll(tagId int, cardId string) (msgid int, err error)
- func (t *Trader) SendWxCardMsg(touser, cardId string) error
- func (t *Trader) SetIndustry(industryId1, industryId2 int) (err error)
- func (t *Trader) SetJsapiTicket(ticket string, Expires_in int64)
- func (t *Trader) SetKfAccountheadImg(kfaccount string, imgdata []byte) (err error)
- func (t *Trader) SetMassSpeed(speed int) (err error)
- func (t *Trader) SetRemark(useropenid string, remark string) (err error)
- func (t *Trader) Typing(touser string, b bool) (err error)
- func (t *Trader) UnMarkelectComment(msgdataid, index, usercommentid int) (err error)
- func (t *Trader) UpLoadImg(data []byte) (url string, err error)
- func (t *Trader) UpdateKfAccount(kfaccount, nickname, password string) error
- func (t *Trader) UpdateNews(mediaid string, index int, article NewsArticle) (err error)
- func (t *Trader) UpdateTag(tagid int, tagname string) (err error)
- func (t *Trader) UploadNews(articles []NewsArticle) (mediaId string, err error)
- func (t *Trader) WebConfig(url string) (wf WebConf, err error)
- type UserInfo
- type Video
- type VideoDesc
- type VideoMessage
- type Voice
- type VoiceMessage
- type WebConf
- type WxCard
- type WxCardMessage
Constants ¶
const ( MpVideoType = "mpvideo" AccessTokenURL = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=" UploadURL = "https://api.weixin.qq.com/cgi-bin/material/add_material?access_token=" AddNewsURL = "https://api.weixin.qq.com/cgi-bin/material/add_news?access_token=" SendMsgURL = "https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token=" CreateMenuURL = "https://api.weixin.qq.com/cgi-bin/menu/create?access_token=" MaterialURL = "https://api.weixin.qq.com/cgi-bin/material/" TypingURL = "https://api.weixin.qq.com/cgi-bin/message/custom/typing?access_token=" KFaccountURL = "https://api.weixin.qq.com/customservice/kfaccount/" SetKfAccountheadimgURL = "http://api.weixin.qq.com/customservice/kfaccount/uploadheadimg?" GetkfListURL = "https://api.weixin.qq.com/cgi-bin/customservice/getkflist?access_token=" Menu = "https://api.weixin.qq.com/cgi-bin/menu/" MediaURL = "https://api.weixin.qq.com/cgi-bin/media/" SendAllURL = "https://api.weixin.qq.com/cgi-bin/message/mass/sendall?access_token=" DeleteSendALLURL = "https://api.weixin.qq.com/cgi-bin/message/mass/delete?access_token=" PreviewURL = "https://api.weixin.qq.com/cgi-bin/message/mass/preview?access_token=" SendAllStatusURL = "https://api.weixin.qq.com/cgi-bin/message/mass/get?access_token=" MassSpeedURL = "https://api.weixin.qq.com/cgi-bin/message/mass/speed/" TemplateURL = "https://api.weixin.qq.com/cgi-bin/template/" TagsURL = "https://api.weixin.qq.com/cgi-bin/tags/" CommentURL = "https://api.weixin.qq.com/cgi-bin/comment/" )
Variables ¶
This section is empty.
Functions ¶
func GetRandStr ¶
Types ¶
type AccessToken ¶
type BassMessage ¶
type Comment ¶
type Comment struct { UserCommentID int `json:"user_comment_id "` OpenID string `json:"openid "` CreateTime int `json:"create_time "` Content string `json:"content "` CommentType int `json:"comment_type "` Reply struct { Content string `json:"content "` CreateTime int `json:"create_time "` } `json:"reply "` }
评论
type Customservice ¶
type Customservice struct {
KFaccount string `json:"kf_account"`
}
type Handler ¶
type Handler func() (AccessToken, error)
type ImageMessage ¶
type ImageMessage struct { BassMessage Image Image `json:"image"` Customservice Customservice `json:"customservice"` }
type Jsapi_ticket ¶
type KF ¶
type KF struct { KfAccount string `json:"kf_account"` KfNick string `json:"kf_nick"` KfId string `json:"kf_id"` KfHeadImgUrl string `json:"kf_headimgurl"` }
客服ZH账号
type Miniprogrampage ¶
type MiniprogrampageMessage ¶
type MiniprogrampageMessage struct { BassMessage Miniprogrampage Miniprogrampage `json:"miniprogrampage"` Customservice Customservice `json:"customservice"` }
type MpNewsMessage ¶
type MpNewsMessage struct { BassMessage MpNews MpNews `json:"mpnews"` Customservice Customservice `json:"customservice"` }
type MusicMessage ¶
type MusicMessage struct { BassMessage Music Music `json:"music"` Customservice Customservice `json:"customservice"` }
type NewsArticle ¶
type NewsArticle struct { Title string `json:"title"` ThumbMediaId string `json:"thumb_media_id"` Author string `json:"author"` Digest string `json:"digest"` ShowCoverPic int `json:"show_cover_pic"` Content string `json:"content"` ContentSourceUrl string `json:content_source_url` NeedOpenComment int `json:"need_open_comment"` OnlyFansCanComment int `json:"only_fans_can_comment"` }
type NewsList ¶
type NewsList struct {
Articles []NewsArticle `json:"articles"`
}
type NewsMessage ¶
type NewsMessage struct { BassMessage News News `json:"news"` Customservice Customservice `json:"customservice"` }
type PreviewImage ¶
type PreviewImage struct { ToUser string `json:"touser"` Image Image `json:"image"` MsgType string `json:"msgtype"` }
群发预览结构体
type PreviewMpNews ¶
type PreviewMpNews struct { ToUser string `json:"touser"` MpNews MpNews `json:"mpnews"` MsgType string `json:"msgtype"` }
群发预览结构体
type PreviewMpVideo ¶
type PreviewMpVideo struct { ToUser string `json:"touser"` MpVideo MpVideo `json:"mpvideo"` MsgType string `json:"msgtype"` }
群发预览结构体
type PreviewText ¶
type PreviewText struct { ToUser string `json:"touser"` Text Text `json:"text"` MsgType string `json:"msgtype"` }
群发预览结构体
type PreviewVoice ¶
type PreviewVoice struct { ToUser string `json:"touser"` Voice Voice `json:"voice"` MsgType string `json:"msgtype"` }
群发预览结构体
type SendAllResp ¶
type TextMessage ¶
type TextMessage struct { BassMessage Text Text `json:"text"` Customservice Customservice `json:"customservice"` }
type Trader ¶
type Trader struct { AppId string AppSecret string Accesstoken string ExpiresIn int64 JsapiTicket string JsapiTicketExpiresIn int64 AccessTokenHandler Handler // contains filtered or unexported fields }
func (*Trader) AddConditionalMenu ¶
创建个性化菜单
func (*Trader) AddImageMaterial ¶
func (*Trader) AddKfAccount ¶
添加客服账号
func (*Trader) AddThumbMaterial ¶
func (*Trader) AddVideoMaterial ¶
func (*Trader) AddVoiceMaterial ¶
func (*Trader) BatchCancelTag ¶
批量为用户取消标签
func (*Trader) BatchGetMaterial ¶
func (t *Trader) BatchGetMaterial(materialtype string, offset int, count int) (data string, err error)
获取素材列表详情
type 素材的类型,图片(image)、视频(video)、语音 (voice)、图文(news) offset 从全部素材的该偏移位置开始返回,0表示从第一个素材 返回 count 返回素材的数量,取值在1到20之间 data 返回的json字符串 需要自己解析
func (*Trader) BatchTagToUsers ¶
批量为用户打标签
func (*Trader) CheckAccessTokenLive ¶
func (*Trader) CreateMenu ¶
创建菜单 参数为菜单json字符串
func (*Trader) DelKfAccount ¶
删除客服账号
func (*Trader) DelconditionalMenu ¶
删除个性化菜单
func (*Trader) DeleteComment ¶
删除评论
func (*Trader) DeleteMass ¶
删除群发【订阅号与服务号认证后均可用】 index 第一篇编号为1,该字段填0会删除全部文章
func (*Trader) DeleteReplyComment ¶
删除回复
func (*Trader) FlushAccessToken ¶
func (*Trader) GetALLTemplate ¶
获取模板列表 return josn字符串
func (*Trader) GetAccessToken ¶
func (t *Trader) GetAccessToken() (a AccessToken, err error)
func (*Trader) GetCommentList ¶
func (t *Trader) GetCommentList(msgdataid, index, begin, count, commenttype int) (list []Comment, err error)
查看指定文章的评论数据
参数 说明 msg_data_id 群发返回的msg_data_id index 多图文时,用来指定第几篇图文,从0开始,不带默认返回该msg_data_id的第一篇图文 begin 起始位置 count 获取数目(>=50会被拒绝) type type=0 普通评论&精选评论type=1 普通评论 type=2 精选评论
func (*Trader) GetFans ¶
获取用户列表
nextopenid 第一个拉取的OPENID,填空默认从头开始拉取 附:关注者数量超过10000时 当公众号关注者数量超过10000时,可通过填写next_openid的值,从而多次拉取列表的方式来满足需求。
func (*Trader) GetJsapiTicket ¶
func (*Trader) GetMassSpeed ¶
获取群发速度
func (*Trader) GetMaterialCount ¶
获取素材总数
func (*Trader) GetMaterialInfo ¶
获取永久素材内容
func (*Trader) GetSendAllStatus ¶
查询群发消息发送状态【订阅号与服务号认证后均可用】 status 消息发送后的状态,SEND_SUCCESS表示发送成功,SENDING表示发送中,SEND_FAIL表示发送失败,DELETE表示已删除
func (*Trader) GetTagsByUser ¶
获取用户身上的标签列表
func (*Trader) GetTemplateId ¶
获得模板ID
func (*Trader) GetUserByTag ¶
func (t *Trader) GetUserByTag(tagid int, nextopenid string) (useropenid []string, lastopenid string, err error)
获取标签下粉丝列表
tagid 标签id, nextopenid 第一个拉取的OPENID,不填默认从头开始拉取
func (*Trader) GetUserInfo ¶
获取用户基本信息(包括UnionID机制)
func (*Trader) MarkelectComment ¶
将评论标记精选
func (*Trader) OpenComment ¶
打开/关闭已群发文章评论 msgdataid 由SendMpNewsAll返回的字段 bl ture为开启 fasle为关闭
func (*Trader) ReplyComment ¶
回复评论
func (*Trader) SendImageAll ¶
群发图片
func (*Trader) SendImageMsg ¶
func (*Trader) SendMPNews ¶
func (*Trader) SendMiniProgrampageMsg ¶
func (*Trader) SendMpNewsAll ¶
群发图文
func (*Trader) SendMusicMsg ¶
func (*Trader) SendTemplateMsg ¶
发送模板消息
func (*Trader) SendTextAll ¶
群发文本消息
func (*Trader) SendTextMsg ¶
func (*Trader) SendVideoAll ¶
群发视频
func (*Trader) SendVideoMsg ¶
func (*Trader) SendVoiceAll ¶
群发语音
func (*Trader) SendVoiceMsg ¶
func (*Trader) SendWxCardAll ¶
群发卡券消息
func (*Trader) SendWxCardMsg ¶
func (*Trader) SetIndustry ¶
设置所属行业
func (*Trader) SetJsapiTicket ¶
func (*Trader) SetKfAccountheadImg ¶
设置客服账号头像
func (*Trader) SetMassSpeed ¶
设置群发速度 speed 只能是0到4的整数
func (*Trader) UnMarkelectComment ¶
将评论取消精选
func (*Trader) UpdateKfAccount ¶
修改客服账号
func (*Trader) UpdateNews ¶
func (t *Trader) UpdateNews(mediaid string, index int, article NewsArticle) (err error)
修改永久图文素材 index:要更新的文章在图文消息中的位置(多图文消息时,此字段才有意义),第一篇为0
func (*Trader) UploadNews ¶
func (t *Trader) UploadNews(articles []NewsArticle) (mediaId string, err error)
上传图文消息素材【订阅号与服务号认证后均可用】
type UserInfo ¶
type UserInfo struct { Subscribe int `json:"subscribe"` Openid string `json:"openid"` NickName string `json:"nickname"` Sex int `json:"sex"` Language string `json:"language"` City string `json:"city"` Province string `json:"province"` Country string `json:"country"` HeadimgUrl string `json:"headimgurl"` SubscribeTime int64 `json:"subscribe_time"` Unionid string `json:"unionid"` Remark string `json:"remark"` Groupid int `json:"groupid"` TagidList []int `json:"tagid_list"` }
用户信息
type VideoMessage ¶
type VideoMessage struct { BassMessage Video Video `json:"video"` Customservice Customservice `json:"customservice"` }
type VoiceMessage ¶
type VoiceMessage struct { BassMessage Voice Voice `json:"voice"` Customservice Customservice `json:"customservice"` }
type WxCardMessage ¶
type WxCardMessage struct { BassMessage WxCard WxCard `json:"wxcard"` Customservice Customservice `json:"customservice"` }