mirror of
https://github.com/silenceper/wechat.git
synced 2026-02-11 16:22:26 +08:00
Compare commits
2 Commits
f0f35e2f77
...
v2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e4fc0bd615 | ||
|
|
20a8183e88 |
@@ -17,6 +17,8 @@ const (
|
|||||||
listContactWayURL = "https://qyapi.weixin.qq.com/cgi-bin/externalcontact/list_contact_way?access_token=%s"
|
listContactWayURL = "https://qyapi.weixin.qq.com/cgi-bin/externalcontact/list_contact_way?access_token=%s"
|
||||||
// delContactWayURL 删除企业已配置的「联系我」方式
|
// delContactWayURL 删除企业已配置的「联系我」方式
|
||||||
delContactWayURL = "https://qyapi.weixin.qq.com/cgi-bin/externalcontact/del_contact_way?access_token=%s"
|
delContactWayURL = "https://qyapi.weixin.qq.com/cgi-bin/externalcontact/del_contact_way?access_token=%s"
|
||||||
|
// closeTempChatURL 结束临时会话
|
||||||
|
closeTempChatURL = "https://qyapi.weixin.qq.com/cgi-bin/externalcontact/close_temp_chat?access_token=%s"
|
||||||
)
|
)
|
||||||
|
|
||||||
type (
|
type (
|
||||||
@@ -267,3 +269,26 @@ func (r *Client) DelContactWay(req *DelContactWayRequest) (*DelContactWayRespons
|
|||||||
err = util.DecodeWithError(response, result, "DelContactWay")
|
err = util.DecodeWithError(response, result, "DelContactWay")
|
||||||
return result, err
|
return result, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// CloseTempChatRequest 结束临时会话请求
|
||||||
|
type CloseTempChatRequest struct {
|
||||||
|
UserID string `json:"userid"`
|
||||||
|
ExternalUserID string `json:"external_userid"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// CloseTempChat 结束临时会话
|
||||||
|
// @see https://developer.work.weixin.qq.com/document/path/92228
|
||||||
|
func (r *Client) CloseTempChat(req *CloseTempChatRequest) error {
|
||||||
|
var (
|
||||||
|
accessToken string
|
||||||
|
err error
|
||||||
|
)
|
||||||
|
if accessToken, err = r.GetAccessToken(); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
var response []byte
|
||||||
|
if response, err = util.PostJSON(fmt.Sprintf(closeTempChatURL, accessToken), req); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return util.DecodeWithCommonError(response, "CloseTempChat")
|
||||||
|
}
|
||||||
|
|||||||
@@ -27,6 +27,10 @@ var (
|
|||||||
getUserInfoURL = "https://qyapi.weixin.qq.com/cgi-bin/auth/getuserinfo?access_token=%s&code=%s"
|
getUserInfoURL = "https://qyapi.weixin.qq.com/cgi-bin/auth/getuserinfo?access_token=%s&code=%s"
|
||||||
// getUserDetailURL 获取访问用户敏感信息
|
// getUserDetailURL 获取访问用户敏感信息
|
||||||
getUserDetailURL = "https://qyapi.weixin.qq.com/cgi-bin/auth/getuserdetail?access_token=%s"
|
getUserDetailURL = "https://qyapi.weixin.qq.com/cgi-bin/auth/getuserdetail?access_token=%s"
|
||||||
|
// getTfaInfoURL 获取用户二次验证信息
|
||||||
|
getTfaInfoURL = "https://qyapi.weixin.qq.com/cgi-bin/auth/get_tfa_info?access_token=%s"
|
||||||
|
// tfaSuccURL 使用二次验证
|
||||||
|
tfaSuccURL = "https://qyapi.weixin.qq.com/cgi-bin/user/tfa_succ?access_token=%s"
|
||||||
)
|
)
|
||||||
|
|
||||||
// NewOauth new init oauth
|
// NewOauth new init oauth
|
||||||
@@ -163,3 +167,57 @@ func (ctr *Oauth) GetUserDetail(req *GetUserDetailRequest) (*GetUserDetailRespon
|
|||||||
err = util.DecodeWithError(response, result, "GetUserDetail")
|
err = util.DecodeWithError(response, result, "GetUserDetail")
|
||||||
return result, err
|
return result, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetTfaInfoRequest 获取用户二次验证信息请求
|
||||||
|
type GetTfaInfoRequest struct {
|
||||||
|
Code string `json:"code"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetTfaInfoResponse 获取用户二次验证信息响应
|
||||||
|
type GetTfaInfoResponse struct {
|
||||||
|
util.CommonError
|
||||||
|
UserID string `json:"userid"`
|
||||||
|
TfaCode string `json:"tfa_code"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetTfaInfo 获取用户二次验证信息
|
||||||
|
// @see https://developer.work.weixin.qq.com/document/path/99499
|
||||||
|
func (ctr *Oauth) GetTfaInfo(req *GetTfaInfoRequest) (*GetTfaInfoResponse, error) {
|
||||||
|
var (
|
||||||
|
accessToken string
|
||||||
|
err error
|
||||||
|
)
|
||||||
|
if accessToken, err = ctr.GetAccessToken(); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
var response []byte
|
||||||
|
if response, err = util.PostJSON(fmt.Sprintf(getTfaInfoURL, accessToken), req); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
result := &GetTfaInfoResponse{}
|
||||||
|
err = util.DecodeWithError(response, result, "GetTfaInfo")
|
||||||
|
return result, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// TfaSuccRequest 使用二次验证请求
|
||||||
|
type TfaSuccRequest struct {
|
||||||
|
UserID string `json:"userid"`
|
||||||
|
TfaCode string `json:"tfa_code"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// TfaSucc 使用二次验证
|
||||||
|
// @see https://developer.work.weixin.qq.com/document/path/99500
|
||||||
|
func (ctr *Oauth) TfaSucc(req *TfaSuccRequest) error {
|
||||||
|
var (
|
||||||
|
accessToken string
|
||||||
|
err error
|
||||||
|
)
|
||||||
|
if accessToken, err = ctr.GetAccessToken(); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
var response []byte
|
||||||
|
if response, err = util.PostJSON(fmt.Sprintf(tfaSuccURL, accessToken), req); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return util.DecodeWithCommonError(response, "TfaSucc")
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user