account

package
v0.0.0-...-ed8de99 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 10, 2023 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const BaseUrl = "https://api.weixin.qq.com"

Variables

This section is empty.

Functions

This section is empty.

Types

type WxAccount

type WxAccount struct {
	Options map[string]string
	// contains filtered or unexported fields
}

微信公众号实体

func NewWxAccount

func NewWxAccount(appId, appSecret string, options ...map[string]string) (*WxAccount, error)

func (WxAccount) AddCustomerSupport

func (w WxAccount) AddCustomerSupport(kfAccount string, nickname string) error

* 添加客服

func (WxAccount) AddMaterial

func (w WxAccount) AddMaterial(title, introduction, mediaType string, mediaFile *os.File) (*common.Material, error)

添加其他类型永久素材

func (WxAccount) AddNewsMaterial

func (w WxAccount) AddNewsMaterial(news []common.News) (string, error)

添加永久图文素材

func (WxAccount) AddTempMaterial

func (w WxAccount) AddTempMaterial(mediaType string, mediaFile *os.File) (*common.Material, error)

上传临时素材文件(只能上传 图片、视频、文字等)

func (WxAccount) AddTempNewsMaterial

func (w WxAccount) AddTempNewsMaterial(news []common.News) (*common.Material, error)

上传临时图文素材,该接口特殊,上传即群发

func (WxAccount) CheckAccessTokenValidFromWxServer

func (w WxAccount) CheckAccessTokenValidFromWxServer(accessToken, openId string) error

检查token是否有效,

func (WxAccount) CloseComment

func (w WxAccount) CloseComment(msgDataId int, index ...int) error

关闭评论

func (WxAccount) CloseCustomerSupportSession

func (w WxAccount) CloseCustomerSupportSession(kfAccount string, openId string) error

* 关闭会话

func (WxAccount) CreateConditionMenu

func (w WxAccount) CreateConditionMenu(m menu.Menu) error

创建个性化菜单

func (WxAccount) CreateMenu

func (w WxAccount) CreateMenu(menu menu.Menu) error

* 菜单管理

func (WxAccount) CreateQRLimitScene

func (w WxAccount) CreateQRLimitScene(sceneId int, expireSeconds ...int) (map[string]interface{}, error)

创建永久二维码

func (WxAccount) CreateQRLimitStrScene

func (w WxAccount) CreateQRLimitStrScene(sceneStr string, expireSeconds ...int) (map[string]interface{}, error)

创建永久二维码

func (WxAccount) CreateQRScene

func (w WxAccount) CreateQRScene(sceneId int, expireSeconds ...int) (map[string]interface{}, error)

* 二维码管理

创建临时二维码

func (WxAccount) CreateQRStrScene

func (w WxAccount) CreateQRStrScene(sceneStr string, expireSeconds ...int) (map[string]interface{}, error)

创建临时二维码

func (WxAccount) CreateUserTag

func (w WxAccount) CreateUserTag(tag user.WxUserTag) (*user.WxUserTag, error)

func (WxAccount) CustomerSupportTyping

func (w WxAccount) CustomerSupportTyping(openId string) error

更新正在输入状态

func (WxAccount) DeleteComment

func (w WxAccount) DeleteComment(msgDataId, index, userCommentId int) error

删除评论

func (WxAccount) DeleteConditionMenu

func (w WxAccount) DeleteConditionMenu(menuId string) error

删除个性化菜单

func (WxAccount) DeleteCustomerSupport

func (w WxAccount) DeleteCustomerSupport(kfAccount string) error

* 删除客服

func (WxAccount) DeleteMaterial

func (w WxAccount) DeleteMaterial(mediaId string) error

删除永久素材

func (WxAccount) DeleteMenu

func (w WxAccount) DeleteMenu() error

删除菜单

func (WxAccount) DeleteMsg

func (w WxAccount) DeleteMsg(msgId string, articleIndex ...int) error

删除群发

func (WxAccount) DeleteReply

func (w WxAccount) DeleteReply(msgDataId, index, userCommentId int, content string) error

删除回复

func (WxAccount) DeleteUserTag

func (w WxAccount) DeleteUserTag(tag user.WxUserTag) error

func (*WxAccount) FetchAccessToken

func (c *WxAccount) FetchAccessToken() error

远程获取access_token

func (WxAccount) GenerateAuthHandleFunc

func (w WxAccount) GenerateAuthHandleFunc(redirectUrl string, state string, isSilent bool) func(http.ResponseWriter, *http.Request)

生成处理授权跳转的handleFunc

func (WxAccount) GenerateAuthRedirectHandleFunc

func (w WxAccount) GenerateAuthRedirectHandleFunc(fn func(code, state string)) func(http.ResponseWriter, *http.Request)

生成处理回调的handleFunc

func (WxAccount) GenerateAuthUrl

func (w WxAccount) GenerateAuthUrl(redirectUrl string, state string, isSilent bool) string

* 用户相关操作

生成跳转url

func (*WxAccount) GetAccessToken

func (c *WxAccount) GetAccessToken() string

取出access_token,这里专门做成一个返回值的函数,忽略了拉去token的err,主要是为了方便直接使用

func (WxAccount) GetAllCustomerSupport

func (w WxAccount) GetAllCustomerSupport() ([]customerSupport.WxCustomerSupport, error)

* 获取所有客服

func (WxAccount) GetAllCustomerSupportSession

func (w WxAccount) GetAllCustomerSupportSession(kfAccount string) ([]customerSupport.WxCustomerSupportSession, error)

* 获取客服会话列表

func (WxAccount) GetAllMenu

func (w WxAccount) GetAllMenu() (menu.Menu, error)

获取所有菜单

func (*WxAccount) GetAppId

func (c *WxAccount) GetAppId() string

func (WxAccount) GetComment

func (w WxAccount) GetComment(msgDataId, index, begin, count, commentType int) (int, []common.Comment, error)

获取评论 index从0开始 type=0 普通评论&精选评论 type=1 普通评论 type=2 精选评论

func (WxAccount) GetCustomerSupportMsgRecord

func (w WxAccount) GetCustomerSupportMsgRecord(startTime, endTime, msgId, number int) (list []customerSupport.WxCustomerSupportMsgRecord, listNumber int, nextMsgId int, err error)

* 获取聊天记录

func (WxAccount) GetCustomerSupportSession

func (w WxAccount) GetCustomerSupportSession(openId string) (*customerSupport.WxCustomerSupportSession, error)

* 获取会话

func (WxAccount) GetMaterial

func (w WxAccount) GetMaterial(mediaId string) (*common.Material, error)

获取永久素材

func (WxAccount) GetMaterialBatch

func (w WxAccount) GetMaterialBatch(materialType string, offset, count int) ([]common.Material, int, int, error)

批量获取素材

func (WxAccount) GetMaterialCount

func (w WxAccount) GetMaterialCount() (map[string]int, error)

获取素材总数

func (WxAccount) GetMenu

func (w WxAccount) GetMenu() (*menu.Menu, []menu.Menu, error)

获取自定义菜单配置,只能获取通过api设置的菜单

func (WxAccount) GetMsgStatus

func (w WxAccount) GetMsgStatus(msgId string) (string, error)

查询消息群发状态

func (WxAccount) GetOnLineCustomerSupport

func (w WxAccount) GetOnLineCustomerSupport() ([]customerSupport.WxCustomerSupport, error)

* 获取在线客服

func (*WxAccount) GetServerIpList

func (c *WxAccount) GetServerIpList() ([]string, error)

获取微信服务器ip

func (WxAccount) GetSubscribeUser

func (w WxAccount) GetSubscribeUser(nextOpenId ...string) (map[string]interface{}, error)

获取关注用户列表

func (WxAccount) GetTagListOfUser

func (w WxAccount) GetTagListOfUser(user user.WxUser) ([]int, error)

获取用户身上的标签列表

func (WxAccount) GetTempMaterial

func (w WxAccount) GetTempMaterial(mediaId string) (*common.Material, error)

获取临时素材文件(只能获取,图片、视频、文字等)

func (WxAccount) GetUserAccessToken

func (w WxAccount) GetUserAccessToken(code string) (map[string]interface{}, error)

通过code获取用户accesstoken与openid

func (WxAccount) GetUserInfo

func (w WxAccount) GetUserInfo(oauthToken string, query WxUserQuery) (*WxUser, error)

拉取个人信息

func (WxAccount) GetUserInfoBatch

func (w WxAccount) GetUserInfoBatch(query []WxUserQuery) ([]WxUser, error)

批量获取用户信息

func (WxAccount) GetUserListOfTag

func (w WxAccount) GetUserListOfTag(tag user.WxUserTag, nextOpenId ...string) (map[string]interface{}, error)

获取标签下粉丝列表

func (WxAccount) GetUserTags

func (w WxAccount) GetUserTags() ([]user.WxUserTag, error)

func (WxAccount) GetWaitCustomerSupportSession

func (w WxAccount) GetWaitCustomerSupportSession() ([]customerSupport.WxCustomerSupportSession, int, error)

* 获取未接入会话列表

func (WxAccount) HandleMsg

func (w WxAccount) HandleMsg(content []byte) (string, error)

处理微信转发来的用户消息

func (WxAccount) InviteBind

func (w WxAccount) InviteBind(kfAccount string, inviteWx string) error

* 邀请绑定客服账号

func (WxAccount) IsAccessTokenValid

func (c WxAccount) IsAccessTokenValid() bool

验证access_token是否有效

func (WxAccount) MatchConditionMenu

func (w WxAccount) MatchConditionMenu(user user.WxUser) (*menu.Menu, error)

获取用户匹配的菜单

func (WxAccount) OpenComment

func (w WxAccount) OpenComment(msgDataId int, index ...int) error

开启评论

func (WxAccount) OpenCustomerSupportSession

func (w WxAccount) OpenCustomerSupportSession(kfAccount string, openId string) error

* 开启会话

func (WxAccount) PreviewCard

func (w WxAccount) PreviewCard(toUserOpenId string, cardId string, toWxName ...string) (msgId int, err error)

预览发卡券消息

func (WxAccount) PreviewImage

func (w WxAccount) PreviewImage(toUserOpenId string, mediaIds []string, recommend string, toWxName ...string) (msgId int, err error)

预览图片消息

func (WxAccount) PreviewNews

func (w WxAccount) PreviewNews(toUserOpenId string, mediaId string, toWxName ...string) (msgId int, err error)

预览图文消息

func (WxAccount) PreviewText

func (w WxAccount) PreviewText(toUserOpenId string, content string, toWxName ...string) (msgId int, err error)

预览文字消息

func (WxAccount) PreviewVideo

func (w WxAccount) PreviewVideo(toUserOpenId string, mediaId string, toWxName ...string) (msgId int, err error)

预览视频消息

func (WxAccount) PreviewVoice

func (w WxAccount) PreviewVoice(toUserOpenId string, mediaId string, toWxName ...string) (msgId int, err error)

预览语音消息

func (WxAccount) RecommendComment

func (w WxAccount) RecommendComment(msgDataId, index, userCommentId int) error

将评论标记为精选

func (WxAccount) RefreshUserAccessToken

func (w WxAccount) RefreshUserAccessToken(refreshToken string) (map[string]interface{}, error)

刷新accesstoken

func (WxAccount) RemarkUser

func (w WxAccount) RemarkUser(user WxUser) error

设置用户备注

func (WxAccount) ReplyComment

func (w WxAccount) ReplyComment(msgDataId, index, userCommentId int, content string) error

回复评论

func (WxAccount) Semantic

func (w WxAccount) Semantic(queryData map[string]interface{}, openId string) (map[string]interface{}, error)

* 语言理解

func (WxAccount) SendCardByOpenId

func (w WxAccount) SendCardByOpenId(toUserOpenIds []string, cardId string) (msgId int, err error)

根据openid群发卡券消息

func (WxAccount) SendCardByTag

func (w WxAccount) SendCardByTag(tagId int, cardId string) (msgId int, err error)

根据标签群发卡券消息

func (WxAccount) SendCustomerSupportMsg

func (w WxAccount) SendCustomerSupportMsg(msg customerSupport.WxCustomerSupportMsg) error

发送消息

func (WxAccount) SendImageByOpenId

func (w WxAccount) SendImageByOpenId(toUserOpenIds []string, mediaIds []string, recommend string, needOpenComment, onlyFansCanComment bool) (msgId int, err error)

根据openid群发图片消息

func (WxAccount) SendImageByTag

func (w WxAccount) SendImageByTag(tagId int, mediaIds []string, recommend string, needOpenComment, onlyFansCanComment bool) (msgId int, err error)

根据标签群发图片消息

func (WxAccount) SendNews

func (w WxAccount) SendNews(news []common.News) (*common.Material, error)

群发,同素材管理中的上传临时图文消息一样

func (WxAccount) SendNewsByOpenId

func (w WxAccount) SendNewsByOpenId(toUserOpenIds []string, mediaId string, sendIgnoreReprint bool) (msgId, msgDataId int, err error)

根据openid群发图文消息

func (WxAccount) SendNewsByTag

func (w WxAccount) SendNewsByTag(tagId int, mediaId string, sendIgnoreReprint bool) (msgId, msgDataId int, err error)

根据标签群发图文消息

func (WxAccount) SendTemplateMsg

func (w WxAccount) SendTemplateMsg(msg templateMsg.WxTemplateMsg) error

发送模版消息

func (WxAccount) SendTextByOpenId

func (w WxAccount) SendTextByOpenId(toUserOpenIds []string, content string) (msgId int, err error)

根据openid群发文字消息

func (WxAccount) SendTextByTag

func (w WxAccount) SendTextByTag(tagId int, content string) (msgId int, err error)

根据标签群发文字消息

func (WxAccount) SendVideoByOpenId

func (w WxAccount) SendVideoByOpenId(toUserOpenIds []string, mediaId string) (msgId int, err error)

根据openid群发视频消息

func (WxAccount) SendVideoByTag

func (w WxAccount) SendVideoByTag(tagId int, mediaId string) (msgId int, err error)

根据标签群发视频消息

func (WxAccount) SendVoiceByOpenId

func (w WxAccount) SendVoiceByOpenId(toUserOpenIds []string, mediaId string) (msgId int, err error)

根据openid群发语音消息

func (WxAccount) SendVoiceByTag

func (w WxAccount) SendVoiceByTag(tagId int, mediaId string) (msgId int, err error)

根据标签群发语音消息

func (*WxAccount) SetEventMsgHandleFunc

func (w *WxAccount) SetEventMsgHandleFunc(fn func(wxMsg *msg.WxMsg, xmlContent []byte) (*msg.WxRespMsg, error)) *WxAccount

设置地理位置类型事件消息处理方法

func (*WxAccount) SetImageMsgHandleFunc

func (w *WxAccount) SetImageMsgHandleFunc(fn func(wxMsg *msg.WxMsg, xmlContent []byte) (*msg.WxRespMsg, error)) *WxAccount

设置图片类型事件消息处理方法

func (*WxAccount) SetLocationMsgHandleFunc

func (w *WxAccount) SetLocationMsgHandleFunc(fn func(wxMsg *msg.WxMsg, xmlContent []byte) (*msg.WxRespMsg, error)) *WxAccount

设置地理位置类型事件消息处理方法

func (*WxAccount) SetShortVideoMsgHandleFunc

func (w *WxAccount) SetShortVideoMsgHandleFunc(fn func(wxMsg *msg.WxMsg, xmlContent []byte) (*msg.WxRespMsg, error)) *WxAccount

设置短视频类型事件消息处理方法

func (*WxAccount) SetTextMsgHandleFunc

func (w *WxAccount) SetTextMsgHandleFunc(fn func(wxMsg *msg.WxMsg, xmlContent []byte) (*msg.WxRespMsg, error)) *WxAccount

设置文字类型事件消息处理方法

func (*WxAccount) SetVideoMsgHandleFunc

func (w *WxAccount) SetVideoMsgHandleFunc(fn func(wxMsg *msg.WxMsg, xmlContent []byte) (*msg.WxRespMsg, error)) *WxAccount

设置视频类型事件消息处理方法

func (*WxAccount) SetVoiceMsgHandleFunc

func (w *WxAccount) SetVoiceMsgHandleFunc(fn func(wxMsg *msg.WxMsg, xmlContent []byte) (*msg.WxRespMsg, error)) *WxAccount

设置声音类型事件消息处理方法

func (WxAccount) ShortUrl

func (w WxAccount) ShortUrl(longUrl string) (string, error)

* 链接转化

func (WxAccount) TagUserBatch

func (w WxAccount) TagUserBatch(users []user.WxUser, tag user.WxUserTag) error

批量为用户打标签

func (WxAccount) TicketToQrCodeImgByte

func (w WxAccount) TicketToQrCodeImgByte(ticket string) ([]byte, error)

func (WxAccount) TicketToQrCodeImgFile

func (w WxAccount) TicketToQrCodeImgFile(ticket string) (*os.File, error)

将ticket转化为img

func (WxAccount) UnRecommendComment

func (w WxAccount) UnRecommendComment(msgDataId, index, userCommentId int) error

取消评论精选

func (WxAccount) UnTagUserBatch

func (w WxAccount) UnTagUserBatch(users []user.WxUser, tag user.WxUserTag) error

批量为用户取消标签

func (WxAccount) UpdateCustomerSupport

func (w WxAccount) UpdateCustomerSupport(kfAccount string, nickname string) error

* 更新客服

func (WxAccount) UpdateNewsMaterial

func (w WxAccount) UpdateNewsMaterial(mediaId string, index int, news common.News) error

修改永久图文素材

func (WxAccount) UpdateUserTag

func (w WxAccount) UpdateUserTag(tag user.WxUserTag) error

func (WxAccount) UploadCustomerSupportAvatar

func (w WxAccount) UploadCustomerSupportAvatar(kfAccount string, file *os.File) error

* 上传客服头像

func (WxAccount) UploadNewsMaterialImg

func (w WxAccount) UploadNewsMaterialImg(imgFile *os.File) (string, error)

上传图文素材中的图片

func (WxAccount) VerifyMsg

func (w WxAccount) VerifyMsg(signature, timestamp, nonce string) bool

验证消息是否来自微信服务器

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL