Commit c001062a417ad4912828521f1801cf048514a072
1 parent
de8ef9b8
Exists in
master
添加openid与userid互转换接口
Showing
2 changed files
with
23 additions
and
8 deletions
Show diff stats
README.md
... | ... | @@ -74,22 +74,26 @@ group_client.department.list |
74 | 74 | ## 成员 |
75 | 75 | |
76 | 76 | ```ruby |
77 | -<!-- 创建成员 --> | |
77 | +# 创建成员 | |
78 | 78 | group_client.user.create(user_id, name, options={}) |
79 | -<!-- 更新成员 --> | |
79 | +# 更新成员 | |
80 | 80 | group_client.user.update(user_id, options={}) |
81 | -<!-- 删除成员 --> | |
81 | +# 删除成员 | |
82 | 82 | group_client.user.delete(user_id) |
83 | -<!-- 批量删除成员 --> | |
83 | +# 批量删除成员 | |
84 | 84 | group_client.user.batch_delete(user_ids) |
85 | -<!-- 获取成员 --> | |
85 | +# 获取成员 | |
86 | 86 | group_client.user.get(user_id) |
87 | -<!-- 获取部门成员 --> | |
87 | +# 获取部门成员 | |
88 | 88 | group_client.user.simple_list(department_id, fetch_child=nil, status=nil) |
89 | -<!-- 获取部门成员(详情) --> | |
89 | +# 获取部门成员(详情) | |
90 | 90 | group_client.user.full_list(department_id, fetch_child=nil, status=nil) |
91 | -<!-- 邀请成员关注 --> | |
91 | +# 邀请成员关注 | |
92 | 92 | group_client.user.send_invitation(user_id, tips=nil) |
93 | +# userid转换成openid接口(企业支付需要使用到) | |
94 | +group_client.covert_to_open_id(user_id, agent_id="") | |
95 | +# openid转换成userid接口 | |
96 | +group_client.covert_to_user_id(open_id) | |
93 | 97 | ``` |
94 | 98 | |
95 | 99 | ## 标签 | ... | ... |
lib/qy_wechat_api/api/user.rb
... | ... | @@ -69,6 +69,17 @@ module QyWechatApi |
69 | 69 | http_post("/invite/send", payload, {waive_base_url: true}) |
70 | 70 | end |
71 | 71 | |
72 | + # userid转换成openid接口 | |
73 | + def covert_to_open_id(user_id, agent_id="") | |
74 | + payload = {userid: user_id, agentid: agent_id} | |
75 | + http_post("convert_to_openid", payload) | |
76 | + end | |
77 | + | |
78 | + # openid转换成userid接口 | |
79 | + def covert_to_user_id(open_id) | |
80 | + http_post("convert_to_userid", {openid: open_id}) | |
81 | + end | |
82 | + | |
72 | 83 | private |
73 | 84 | |
74 | 85 | def base_url | ... | ... |