mirror of
https://github.com/silenceper/wechat.git
synced 2026-02-13 17:22:26 +08:00
与origin代码同步
This commit is contained in:
@@ -14,19 +14,19 @@ const (
|
|||||||
messageDelURL = "https://api.weixin.qq.com/cgi-bin/message/recall"
|
messageDelURL = "https://api.weixin.qq.com/cgi-bin/message/recall"
|
||||||
)
|
)
|
||||||
|
|
||||||
//App 应用消息
|
// Client 应用消息
|
||||||
type App struct {
|
type Client struct {
|
||||||
*context.Context
|
*context.Context
|
||||||
}
|
}
|
||||||
|
|
||||||
//NewApp 实例化
|
// NewClient 实例化
|
||||||
func NewApp(context *context.Context) *App {
|
func NewClient(ctx *context.Context) *Client {
|
||||||
tpl := new(App)
|
return &Client{
|
||||||
tpl.Context = context
|
ctx,
|
||||||
return tpl
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//AppMessage 发送的模板消息内容
|
// AppMessage 发送的模板消息内容
|
||||||
type AppMessage struct {
|
type AppMessage struct {
|
||||||
ToUser string `json:"touser"` // 必须, 成员ID列表(多个接收者用‘|’分隔,最多支持1000个 ,指定为”@all”,则向该企业应用的全部成员发送
|
ToUser string `json:"touser"` // 必须, 成员ID列表(多个接收者用‘|’分隔,最多支持1000个 ,指定为”@all”,则向该企业应用的全部成员发送
|
||||||
Toparty string `json:"toparty"` //部门ID列表,当touser为”@all”时忽略本参数
|
Toparty string `json:"toparty"` //部门ID列表,当touser为”@all”时忽略本参数
|
||||||
@@ -70,8 +70,8 @@ type resTemplateSend struct {
|
|||||||
ResponseCode string `json:"response_code"` //仅消息类型为“按钮交互型”,“投票选择型”和“多项选择型”的模板卡片消息返回,应用可使用response_code调用更新模版卡片消息接口,24小时内有效,且只能使用一次
|
ResponseCode string `json:"response_code"` //仅消息类型为“按钮交互型”,“投票选择型”和“多项选择型”的模板卡片消息返回,应用可使用response_code调用更新模版卡片消息接口,24小时内有效,且只能使用一次
|
||||||
}
|
}
|
||||||
|
|
||||||
//Send 发送应用消息
|
// Send 发送应用消息
|
||||||
func (tpl *App) Send(msg *AppMessage) (msgID string, responseCode string, err error) {
|
func (tpl *Client) Send(msg *AppMessage) (msgID string, responseCode string, err error) {
|
||||||
var accessToken string
|
var accessToken string
|
||||||
accessToken, err = tpl.GetAccessToken()
|
accessToken, err = tpl.GetAccessToken()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -100,7 +100,7 @@ func (tpl *App) Send(msg *AppMessage) (msgID string, responseCode string, err er
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
//TemplateUpdate 更新模版卡片消息内容
|
// TemplateUpdate 更新模版卡片消息内容
|
||||||
type TemplateUpdate struct {
|
type TemplateUpdate struct {
|
||||||
Userids []string `json:"userids"`
|
Userids []string `json:"userids"`
|
||||||
Partyids []int `json:"partyids"`
|
Partyids []int `json:"partyids"`
|
||||||
@@ -112,8 +112,8 @@ type TemplateUpdate struct {
|
|||||||
*TemplateCard
|
*TemplateCard
|
||||||
}
|
}
|
||||||
|
|
||||||
//UpdateTemplate 更新模版卡片消息
|
// UpdateTemplate 更新模版卡片消息
|
||||||
func (tpl *App) UpdateTemplate(msg *TemplateUpdate) (msgID string, err error) {
|
func (tpl *Client) UpdateTemplate(msg *TemplateUpdate) (msgID string, err error) {
|
||||||
var accessToken string
|
var accessToken string
|
||||||
accessToken, err = tpl.GetAccessToken()
|
accessToken, err = tpl.GetAccessToken()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -142,8 +142,8 @@ type ReqRecall struct {
|
|||||||
MsgID int64 `json:"msgid"`
|
MsgID int64 `json:"msgid"`
|
||||||
}
|
}
|
||||||
|
|
||||||
//Recall 撤回应用消息
|
// Recall 撤回应用消息
|
||||||
func (tpl *App) Recall(msgID int64) (err error) {
|
func (tpl *Client) Recall(msgID int64) (err error) {
|
||||||
var accessToken string
|
var accessToken string
|
||||||
accessToken, err = tpl.GetAccessToken()
|
accessToken, err = tpl.GetAccessToken()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -83,8 +83,8 @@ func (wk *Work) GetExternalContact() *externalcontact.Client {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// GetMessageApp 发送应用消息
|
// GetMessageApp 发送应用消息
|
||||||
func (wk *Work) GetMessageApp() *message.App {
|
func (wk *Work) GetMessageApp() *message.Client {
|
||||||
return message.NewApp(wk.ctx)
|
return message.NewClient(wk.ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetAddressList get address_list
|
// GetAddressList get address_list
|
||||||
|
|||||||
Reference in New Issue
Block a user