1
0
mirror of https://github.com/silenceper/wechat.git synced 2026-02-04 12:52:27 +08:00

企业微信-[联系我]方式更新 (#605)

* 企业微信-客户联系-统计管理

* 企业微信-客户联系-统计管理

* 企业微信-客户联系-统计管理

* debug

* rollback

* json.Marshal错误输出

* 企业微信-通讯录管理相关接口

* 企业微信-通讯录管理

* 企业微信-通讯录管理

* 企业微信-通讯录管理

* 企业微信-[联系我]方式新增和查询

* 企业微信-[联系我]方式新增和获取

* 企业微信-[联系我]方式更新

Co-authored-by: wang.yu <wangyu@uniondrug.com>
This commit is contained in:
markwang
2022-08-22 14:28:52 +08:00
committed by GitHub
parent 0160f99045
commit df62164811
2 changed files with 45 additions and 11 deletions

View File

@@ -69,17 +69,7 @@ host: https://qyapi.weixin.qq.com/
| 获取「群聊数据统计」数据 (按自然日聚合的方式) | POST | /cgi-bin/externalcontact/groupchat/statistic_group_by_day | YES | (r *Client) GetGroupChatStatByDay | MARKWANG |
| 配置客户联系「联系我」方式 | POST | /cgi-bin/externalcontact/add_contact_way | YES | (r *Client) AddContactWay | MARKWANG |
| 获取企业已配置的「联系我」方式 | POST | /cgi-bin/externalcontact/get_contact_way | YES | (r *Client) GetContactWay | MARKWANG |
## 通讯录管理
[官方文档](https://developer.work.weixin.qq.com/document/path/95350/90200)
| 名称 | 请求方式 | URL | 是否已实现 | 使用方法 | 贡献者 |
|:---------:|------|:----------------------------------------| ---------- | ------------------------------- |----------|
| 获取子部门ID列表 | GET | /cgi-bin/department/simplelist | YES | (r *Client) DepartmentSimpleList| MARKWANG |
| 获取部门成员 | GET | /cgi-bin/user/simplelist | YES | (r *Client) UserSimpleList | MARKWANG |
=======
| 更新企业已配置的「联系我」方式 | POST | /cgi-bin/externalcontact/update_contact_way | YES | (r *Client) UpdateContactWay | MARKWANG |
## 通讯录管理
[官方文档](https://developer.work.weixin.qq.com/document/path/95350/90200)

View File

@@ -11,6 +11,8 @@ const (
AddContactWayURL = "https://qyapi.weixin.qq.com/cgi-bin/externalcontact/add_contact_way?access_token=%s"
// GetContactWayURL 获取企业已配置的「联系我」方式
GetContactWayURL = "https://qyapi.weixin.qq.com/cgi-bin/externalcontact/get_contact_way?access_token=%s"
// UpdateContactWayURL 更新企业已配置的「联系我」方式
UpdateContactWayURL = "https://qyapi.weixin.qq.com/cgi-bin/externalcontact/update_contact_way?access_token=%s"
)
type (
@@ -152,3 +154,45 @@ func (r *Client) GetContactWay(req *GetContactWayRequest) (*GetContactWayRespons
}
return result, nil
}
type (
// UpdateContactWayRequest 更新企业已配置的「联系我」方式请求
UpdateContactWayRequest struct {
ConfigID string `json:"config_id"`
Remark string `json:"remark"`
SkipVerify bool `json:"skip_verify"`
Style int `json:"style"`
State string `json:"state"`
User []string `json:"user"`
Party []int `json:"party"`
ExpiresIn int `json:"expires_in"`
ChatExpiresIn int `json:"chat_expires_in"`
UnionID string `json:"unionid"`
Conclusions ConclusionsRequest `json:"conclusions"`
}
// UpdateContactWayResponse 更新企业已配置的「联系我」方式响应
UpdateContactWayResponse struct {
util.CommonError
}
)
// UpdateContactWay 更新企业已配置的「联系我」方式
// see https://developer.work.weixin.qq.com/document/path/92228
func (r *Client) UpdateContactWay(req *UpdateContactWayRequest) (*UpdateContactWayResponse, 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(UpdateContactWayURL, accessToken), req); err != nil {
return nil, err
}
result := &UpdateContactWayResponse{}
if err = util.DecodeWithError(response, result, "UpdateContactWay"); err != nil {
return nil, err
}
return result, nil
}