未验证 提交 a962c96a 编写于 作者: 智布道's avatar 智布道 👁 提交者: GitHub

Merge pull request #14 from xkcoding/refactor-v1.6.0-beta

🏗 架构调整,简化代码
...@@ -24,7 +24,8 @@ public class AuthBaiduRequest extends BaseAuthRequest { ...@@ -24,7 +24,8 @@ public class AuthBaiduRequest extends BaseAuthRequest {
@Override @Override
protected AuthToken getAccessToken(String code) { protected AuthToken getAccessToken(String code) {
String accessTokenUrl = UrlBuilder.getBaiduAccessTokenUrl(config.getClientId(), config.getClientSecret(), code, config.getRedirectUri()); String accessTokenUrl = UrlBuilder.getBaiduAccessTokenUrl(config.getClientId(), config.getClientSecret(), code, config
.getRedirectUri());
HttpResponse response = HttpRequest.post(accessTokenUrl).execute(); HttpResponse response = HttpRequest.post(accessTokenUrl).execute();
JSONObject accessTokenObject = JSONObject.parseObject(response.body()); JSONObject accessTokenObject = JSONObject.parseObject(response.body());
AuthBaiduErrorCode errorCode = AuthBaiduErrorCode.getErrorCode(accessTokenObject.getString("error")); AuthBaiduErrorCode errorCode = AuthBaiduErrorCode.getErrorCode(accessTokenObject.getString("error"));
......
...@@ -62,7 +62,8 @@ public class AuthWeiboRequest extends BaseAuthRequest { ...@@ -62,7 +62,8 @@ public class AuthWeiboRequest extends BaseAuthRequest {
.uuid(object.getString("id")) .uuid(object.getString("id"))
.username(object.getString("name")) .username(object.getString("name"))
.avatar(object.getString("profile_image_url")) .avatar(object.getString("profile_image_url"))
.blog(StringUtils.isEmpty(object.getString("url")) ? "https://weibo.com/" + object.getString("profile_url") : object.getString("url")) .blog(StringUtils.isEmpty(object.getString("url")) ? "https://weibo.com/" + object.getString("profile_url") : object
.getString("url"))
.nickname(object.getString("screen_name")) .nickname(object.getString("screen_name"))
.location(object.getString("location")) .location(object.getString("location"))
.remark(object.getString("description")) .remark(object.getString("description"))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册