|
|
@@ -50,7 +50,7 @@ public class GitServiceImpl implements GitService { |
|
|
String req = httpUtils.sendPost(gitendpoint + "/oauth/token", null, JsonUtils.mapToJson(params)); |
|
|
String req = httpUtils.sendPost(gitendpoint + "/oauth/token", null, JsonUtils.mapToJson(params)); |
|
|
// 解析响应JSON |
|
|
// 解析响应JSON |
|
|
if (StringUtils.isEmpty(req)) { |
|
|
if (StringUtils.isEmpty(req)) { |
|
|
throw new RuntimeException("终止响应内容为空。"); |
|
|
|
|
|
|
|
|
throw new RuntimeException("gitlink用户信息出错"); |
|
|
} |
|
|
} |
|
|
// 将响应的JSON字符串转换为Map对象 |
|
|
// 将响应的JSON字符串转换为Map对象 |
|
|
Map<String, Object> runResMap = JsonUtils.jsonToMap(req); |
|
|
Map<String, Object> runResMap = JsonUtils.jsonToMap(req); |
|
|
@@ -61,7 +61,7 @@ public class GitServiceImpl implements GitService { |
|
|
//通过access_token获取用户信息 |
|
|
//通过access_token获取用户信息 |
|
|
String userReq = httpUtils.sendGetWithToken(gitendpoint + "/api/users/get_user_info.json", null, accessToken); |
|
|
String userReq = httpUtils.sendGetWithToken(gitendpoint + "/api/users/get_user_info.json", null, accessToken); |
|
|
if (StringUtils.isEmpty(userReq)) { |
|
|
if (StringUtils.isEmpty(userReq)) { |
|
|
throw new RuntimeException("终止响应内容为空。"); |
|
|
|
|
|
|
|
|
throw new RuntimeException("gitlink用户信息出错"); |
|
|
} |
|
|
} |
|
|
LoginUser loginUser = SecurityUtils.getLoginUser(); |
|
|
LoginUser loginUser = SecurityUtils.getLoginUser(); |
|
|
String ci4sUsername = loginUser.getUsername(); |
|
|
String ci4sUsername = loginUser.getUsername(); |
|
|
@@ -71,8 +71,7 @@ public class GitServiceImpl implements GitService { |
|
|
jedis.set(ci4sUsername + "_gitUserInfo", userReq); |
|
|
jedis.set(ci4sUsername + "_gitUserInfo", userReq); |
|
|
return accessToken; |
|
|
return accessToken; |
|
|
} catch (Exception e) { |
|
|
} catch (Exception e) { |
|
|
log.error("登录GitLink失败。", e); |
|
|
|
|
|
return null; |
|
|
|
|
|
|
|
|
throw new RuntimeException("gitlink用户信息出错"); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|