fix issues 5 & issuese 6
This commit is contained in:
parent
cf6887d1f3
commit
ef131f68bd
@ -176,4 +176,8 @@
|
||||
|
||||
* 2015-03-06
|
||||
|
||||
+ 新增oauth授权接口
|
||||
+ **weixin4j-mp**: 新增oauth授权接口
|
||||
|
||||
* 2015-03-08
|
||||
|
||||
+ **weixin4j-qy**: 新增根据code获取成员信息接口
|
||||
@ -106,3 +106,7 @@ weixin4j-qy
|
||||
* 2015-01-15
|
||||
|
||||
+ **weixin4j-qy-api**: 新增邀请成员关注接口
|
||||
|
||||
* 2015-03-08
|
||||
|
||||
+ **weixin4j-qy-api**: 新增根据code获取成员信息接口
|
||||
|
||||
@ -71,3 +71,7 @@ weixin.properties说明
|
||||
* 2015-01-15
|
||||
|
||||
+ 新增邀请成员关注接口
|
||||
|
||||
* 2015-03-08
|
||||
|
||||
+ 新增根据code获取成员信息接口
|
||||
|
||||
@ -174,6 +174,26 @@ public class WeixinProxy {
|
||||
return userApi.getUser(userid);
|
||||
}
|
||||
|
||||
/**
|
||||
* code获取userid(管理员须拥有agent的使用权限;agentid必须和跳转链接时所在的企业应用ID相同。)
|
||||
*
|
||||
* @param code
|
||||
* 通过员工授权获取到的code,每次员工授权带上的code将不一样,code只能使用一次,5分钟未被使用自动过期
|
||||
* @param agentid
|
||||
* 跳转链接时所在的企业应用ID
|
||||
* @see com.foxinmy.weixin4j.qy.api.UserApi
|
||||
* @return 成员对象
|
||||
* @see {@link com.foxinmy.weixin4j.qy.WeixinProxy#getUser(String)}
|
||||
* @see <a
|
||||
* href="http://qydev.weixin.qq.com/wiki/index.php?title=%E4%BC%81%E4%B8%9A%E8%8E%B7%E5%8F%96code">企业获取code</a>
|
||||
* @see <a
|
||||
* href="http://qydev.weixin.qq.com/wiki/index.php?title=%E6%A0%B9%E6%8D%AEcode%E8%8E%B7%E5%8F%96%E6%88%90%E5%91%98%E4%BF%A1%E6%81%AF">根据code获取成员信息</a>
|
||||
* @throws WeixinException
|
||||
*/
|
||||
public User getUserByCode(String code, int agentid) throws WeixinException {
|
||||
return userApi.getUserByCode(code, agentid);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取部门成员
|
||||
*
|
||||
|
||||
@ -112,20 +112,21 @@ public class UserApi extends QyApi {
|
||||
* 通过员工授权获取到的code,每次员工授权带上的code将不一样,code只能使用一次,5分钟未被使用自动过期
|
||||
* @param agentid
|
||||
* 跳转链接时所在的企业应用ID
|
||||
* @return {"UserId":"员工UserID","DeviceId":"手机设备号(由微信在安装时随机生成)"}
|
||||
* @see com.foxinmy.weixin4j.qy.api.UserApi
|
||||
* @return 成员对象
|
||||
* @see {@link com.foxinmy.weixin4j.qy.api.UserApi#getUser(String)}
|
||||
* @see <a
|
||||
* href="http://qydev.weixin.qq.com/wiki/index.php?title=%E4%BC%81%E4%B8%9A%E8%8E%B7%E5%8F%96code">企业获取code</a>
|
||||
* @see <a
|
||||
* href="http://qydev.weixin.qq.com/wiki/index.php?title=%E6%A0%B9%E6%8D%AEcode%E8%8E%B7%E5%8F%96%E6%88%90%E5%91%98%E4%BF%A1%E6%81%AF">根据code获取成员信息</a>
|
||||
* @throws WeixinException
|
||||
*/
|
||||
public JSONObject getUserid(String code, int agentid)
|
||||
throws WeixinException {
|
||||
public User getUserByCode(String code, int agentid) throws WeixinException {
|
||||
String user_getid_uri = getRequestUri("user_getid_uri");
|
||||
Token token = tokenHolder.getToken();
|
||||
Response response = request.post(String.format(user_getid_uri,
|
||||
token.getAccessToken(), code, agentid));
|
||||
return response.getAsJson();
|
||||
return getUser(response.getAsJson().getString("UserId"));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -20,7 +20,7 @@ user_update_uri={api_base_url}/user/update?access_token=%s
|
||||
# \u83b7\u53d6\u6210\u5458\u4fe1\u606f
|
||||
user_get_uri={api_base_url}/user/get?access_token=%s&userid=%s
|
||||
# code\u83b7\u53d6\u6210\u5458\u4fe1\u606f
|
||||
user_getid_uri={api_base_url}/getuserinfo?access_token=%s&code=%s&agentid=%d
|
||||
user_getid_uri={api_base_url}/user/getuserinfo?access_token=%s&code=%s&agentid=%d
|
||||
# \u83b7\u53d6\u90e8\u95e8\u6210\u5458
|
||||
user_slist_uri={api_base_url}/user/simplelist?access_token=%s&department_id=%d&fetch_child=%d&status=%d
|
||||
# \u83b7\u53d6\u90e8\u95e8\u6210\u5458(\u8be6\u60c5)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user