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

企业微信-获取群发记录列表 #621

Merged
merged 35 commits into from
Oct 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
04a5e22
企业微信-客户联系-统计管理
Aug 5, 2022
1122d74
企业微信-客户联系-统计管理
Aug 5, 2022
12838fe
企业微信-客户联系-统计管理
Aug 5, 2022
64f2102
debug
Aug 6, 2022
db339cb
rollback
Aug 6, 2022
07a2f37
debug
Aug 6, 2022
68e6dc4
debug
Aug 6, 2022
4ca59ec
获取用户信息
Aug 7, 2022
1259cb0
token
Aug 8, 2022
62f6fd8
json.Marshal错误输出
Aug 8, 2022
0adc575
debug
Aug 9, 2022
3f9bb38
bugfix
Aug 9, 2022
c6c4e15
企业微信-通讯录管理相关接口
Aug 12, 2022
a41e877
Merge branch 'v2' into markwang
markwang1992 Aug 12, 2022
4a1f95e
企业微信-通讯录管理
Aug 12, 2022
4e7aacf
企业微信-通讯录管理
Aug 12, 2022
d86f2f4
企业微信-通讯录管理
Aug 14, 2022
8787a23
Merge branch 'v2' of github.com:markwang1992/wechat into v2
Aug 15, 2022
5c8a56e
企业微信-[联系我]方式新增和查询
Aug 19, 2022
f1fd649
企业微信-[联系我]方式新增和获取
Aug 19, 2022
8b50120
企业微信-[联系我]方式更新
Aug 22, 2022
1909183
Merge branch 'v2' into markwang
markwang1992 Aug 22, 2022
d1ab4bb
企业微信-[联系我]方式列表、删除
Aug 23, 2022
53d991f
Merge remote-tracking branch 'origin/v2' into markwang
Aug 23, 2022
72782c7
Merge branch 'v2' into markwang
markwang1992 Aug 23, 2022
24c856f
json.Marshal错误输出
Aug 24, 2022
8dbfc8d
已实现接口bug修改
Sep 6, 2022
9f7b54f
历史接口bugfix
Sep 14, 2022
2fdfc01
历史接口bugfix
Sep 25, 2022
e08ef42
comment
Sep 25, 2022
7fb4fbd
企业微信:客户联系-消息推送;素材管理-上传图片
Sep 27, 2022
d9aa5f1
Merge branch 'v2' into markwang
markwang1992 Sep 27, 2022
11aa16e
fix
Sep 27, 2022
7c9b8ae
企业微信-获取群发记录列表
Sep 29, 2022
3af8152
Merge branch 'v2' into markwang
markwang1992 Sep 29, 2022
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
1 change: 1 addition & 0 deletions doc/api/work.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ host: https://qyapi.weixin.qq.com/
| 获取企业已配置的「联系我」列表 | POST | /cgi-bin/externalcontact/list_contact_way | YES | (r *Client) ListContactWay | MARKWANG |
| 删除企业已配置的「联系我」方式 | POST | /cgi-bin/externalcontact/del_contact_way | YES | (r *Client) DelContactWay | MARKWANG |
| 创建企业群发 | POST | /cgi-bin/externalcontact/add_msg_template | YES | (r *Client) AddMsgTemplate | MARKWANG |
| 获取群发记录列表 | POST | /cgi-bin/externalcontact/get_groupmsg_list_v2 | YES | (r *Client) GetGroupMsgListV2 | MARKWANG |
| 获取群发成员发送任务列表 | POST | /cgi-bin/externalcontact/get_groupmsg_task | YES | (r *Client) GetGroupMsgTask | MARKWANG |
| 获取企业群发成员执行结果 | POST | /cgi-bin/externalcontact/get_groupmsg_send_result | YES | (r *Client) GetGroupMsgSendResult | MARKWANG |
| 发送新客户欢迎语 | POST | /cgi-bin/externalcontact/send_welcome_msg | YES | (r *Client) SendWelcomeMsg | MARKWANG |
Expand Down
55 changes: 53 additions & 2 deletions work/externalcontact/msg.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import (
const (
// AddMsgTemplateURL 创建企业群发
AddMsgTemplateURL = "https://qyapi.weixin.qq.com/cgi-bin/externalcontact/add_msg_template?access_token=%s"
// GetGroupMsgListV2URL 获取群发记录列表
GetGroupMsgListV2URL = "https://qyapi.weixin.qq.com/cgi-bin/externalcontact/get_groupmsg_list_v2?access_token=%s"
// GetGroupMsgTaskURL 获取群发成员发送任务列表
GetGroupMsgTaskURL = "https://qyapi.weixin.qq.com/cgi-bin/externalcontact/get_groupmsg_task?access_token=%s"
// GetGroupMsgSendResultURL 获取企业群发成员执行结果
Expand Down Expand Up @@ -98,6 +100,55 @@ func (r *Client) AddMsgTemplate(req *AddMsgTemplateRequest) (*AddMsgTemplateResp
return result, nil
}

// GetGroupMsgListV2Request 获取群发记录列表请求
type GetGroupMsgListV2Request struct {
ChatType string `json:"chat_type"`
StartTime int `json:"start_time"`
EndTime int `json:"end_time"`
Creator string `json:"creator,omitempty"`
FilterType int `json:"filter_type"`
Limit int `json:"limit"`
Cursor string `json:"cursor"`
}

// GetGroupMsgListV2Response 获取群发记录列表响应
type GetGroupMsgListV2Response struct {
util.CommonError
NextCursor string `json:"next_cursor"`
GroupMsgList []*GroupMsg `json:"group_msg_list"`
}

// GroupMsg 群发消息
type GroupMsg struct {
MsgID string `json:"msgid"`
Creator string `json:"creator"`
CreateTime int `json:"create_time"`
CreateType int `json:"create_type"`
Text MsgText `json:"text"`
Attachments []*Attachment `json:"attachments"`
}

// GetGroupMsgListV2 获取群发记录列表
// see https://developer.work.weixin.qq.com/document/path/93338#%E8%8E%B7%E5%8F%96%E7%BE%A4%E5%8F%91%E8%AE%B0%E5%BD%95%E5%88%97%E8%A1%A8
func (r *Client) GetGroupMsgListV2(req *GetGroupMsgListV2Request) (*GetGroupMsgListV2Response, error) {
var (
accessToken string
err error
)
if accessToken, err = r.GetAccessToken(); err != nil {
return nil, err
}
var response []byte
if response, err = util.PostJSON(fmt.Sprintf(GetGroupMsgListV2URL, accessToken), req); err != nil {
return nil, err
}
result := &GetGroupMsgListV2Response{}
if err = util.DecodeWithError(response, result, "GetGroupMsgListV2"); err != nil {
return nil, err
}
return result, nil
}

// GetGroupMsgTaskRequest 获取群发成员发送任务列表请求
type GetGroupMsgTaskRequest struct {
MsgID string `json:"msgid"`
Expand All @@ -120,7 +171,7 @@ type Task struct {
}

// GetGroupMsgTask 获取群发成员发送任务列表
// see https://developer.work.weixin.qq.com/document/path/93338
// see https://developer.work.weixin.qq.com/document/path/93338#%E8%8E%B7%E5%8F%96%E7%BE%A4%E5%8F%91%E6%88%90%E5%91%98%E5%8F%91%E9%80%81%E4%BB%BB%E5%8A%A1%E5%88%97%E8%A1%A8
func (r *Client) GetGroupMsgTask(req *GetGroupMsgTaskRequest) (*GetGroupMsgTaskResponse, error) {
var (
accessToken string
Expand Down Expand Up @@ -165,7 +216,7 @@ type Send struct {
}

// GetGroupMsgSendResult 获取企业群发成员执行结果
// see https://developer.work.weixin.qq.com/document/path/93338
// see https://developer.work.weixin.qq.com/document/path/93338#%E8%8E%B7%E5%8F%96%E4%BC%81%E4%B8%9A%E7%BE%A4%E5%8F%91%E6%88%90%E5%91%98%E6%89%A7%E8%A1%8C%E7%BB%93%E6%9E%9C
func (r *Client) GetGroupMsgSendResult(req *GetGroupMsgSendResultRequest) (*GetGroupMsgSendResultResponse, error) {
var (
accessToken string
Expand Down