企业微信登录

This commit is contained in:
bo.yang 2021-07-29 11:47:44 +08:00
parent e41f8c0b4d
commit ea88c55855
2 changed files with 3 additions and 3 deletions

View File

@ -19,7 +19,7 @@ server:
port: 80
servlet:
# 应用的访问路径
context-path: /it
context-path: /it_war
tomcat:
# tomcat的URI编码
uri-encoding: UTF-8

View File

@ -113,8 +113,8 @@ public class WechatApiServiceImpl implements IWechatApiService {
//获取访问用户身份ID
String url="https://qyapi.weixin.qq.com/cgi-bin/user/getuserinfo";
String param = "access_token="+wechatApiService.GetAccessToken()+"&code="+code;
//String userInfo = HttpUtils.sendGet(url,param); //测试已能正常返回UserInfo Json,正式使用时打开
String userInfo = "{\"UserId\":\"359\",\"DeviceId\":\"10000589102865WJ\",\"errcode\":0,\"errmsg\":\"ok\"}"; //为避免去微信获取code麻烦开发调试时打开
String userInfo = HttpUtils.sendGet(url,param); //测试已能正常返回UserInfo Json,正式使用时打开
//String userInfo = "{\"UserId\":\"359\",\"DeviceId\":\"10000589102865WJ\",\"errcode\":0,\"errmsg\":\"ok\"}"; //为避免去微信获取code麻烦开发调试时打开
JSONObject jsonObjectUserInfo = JSONObject.parseObject(userInfo);
//如果返回码不为0则输出错误信息并返回空值
if ( Integer.parseInt(jsonObjectUserInfo.getString("errcode")) != 0){