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

feat(work): 企业微信接口增加 (#617)

* feat(work): 企业微信接口增加

群机器人 查询成员信息

* 变更

* fix(fix): 修复lint 报错

* fix: 删除注释多余字符
This commit is contained in:
chcthink
2022-09-23 09:14:54 +08:00
committed by GitHub
parent 9ad8981ff0
commit 5e0c31bfa9
7 changed files with 296 additions and 1 deletions

View File

@@ -17,6 +17,8 @@ type Oauth struct {
var (
// oauthTargetURL 企业微信内跳转地址
oauthTargetURL = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=%s&redirect_uri=%s&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect"
// oauthTargetURL 企业微信内跳转地址(获取成员的详细信息)
oauthTargetPrivateURL = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=%s&redirect_uri=%s&response_type=code&scope=snsapi_privateinfo&agentid=%s&state=STATE#wechat_redirect"
// oauthUserInfoURL 获取用户信息地址
oauthUserInfoURL = "https://qyapi.weixin.qq.com/cgi-bin/user/getuserinfo?access_token=%s&code=%s"
// oauthQrContentTargetURL 构造独立窗口登录二维码
@@ -40,6 +42,17 @@ func (ctr *Oauth) GetTargetURL(callbackURL string) string {
)
}
// GetTargetPrivateURL 获取个人信息授权地址
func (ctr *Oauth) GetTargetPrivateURL(callbackURL string, agentID string) string {
// url encode
return fmt.Sprintf(
oauthTargetPrivateURL,
ctr.CorpID,
url.QueryEscape(callbackURL),
agentID,
)
}
// GetQrContentTargetURL 构造独立窗口登录二维码
func (ctr *Oauth) GetQrContentTargetURL(callbackURL string) string {
// url encode