提交 c0dd700b 编写于 作者: 智布道's avatar 智布道 👁

🎨 解决Issue #IY2OH

上级 f32c341b
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<groupId>me.zhyd.oauth</groupId> <groupId>me.zhyd.oauth</groupId>
<artifactId>JustAuth</artifactId> <artifactId>JustAuth</artifactId>
<version>1.6.0-beta</version> <version>1.6.1-beta</version>
<name>JustAuth</name> <name>JustAuth</name>
<url>https://gitee.com/yadong.zhang/JustAuth</url> <url>https://gitee.com/yadong.zhang/JustAuth</url>
......
...@@ -67,14 +67,17 @@ public class AuthAlipayRequest extends BaseAuthRequest { ...@@ -67,14 +67,17 @@ public class AuthAlipayRequest extends BaseAuthRequest {
if (!response.isSuccess()) { if (!response.isSuccess()) {
throw new AuthException(response.getSubMsg()); throw new AuthException(response.getSubMsg());
} }
String province = response.getProvince(), String province = response.getProvince(),
city = response.getCity(); city = response.getCity();
String location = String.format("%s %s", StringUtils.isEmpty(province) ? "" : province, StringUtils.isEmpty(city) ? "" : city);
return AuthUser.builder() return AuthUser.builder()
.uuid(response.getUserId()) .uuid(response.getUserId())
.username(StringUtils.isEmpty(response.getUserName()) ? response.getNickName() : response.getUserName()) .username(StringUtils.isEmpty(response.getUserName()) ? response.getNickName() : response.getUserName())
.nickname(response.getNickName()) .nickname(response.getNickName())
.avatar(response.getAvatar()) .avatar(response.getAvatar())
.location(String.format("%s %s", StringUtils.isEmpty(province) ? "" : province, StringUtils.isEmpty(city) ? "" : city)) .location(location)
.gender(AuthUserGender.getRealGender(response.getGender())) .gender(AuthUserGender.getRealGender(response.getGender()))
.token(authToken) .token(authToken)
.source(AuthSource.ALIPAY) .source(AuthSource.ALIPAY)
......
...@@ -45,6 +45,7 @@ public class AuthCodingRequest extends BaseAuthRequest { ...@@ -45,6 +45,7 @@ public class AuthCodingRequest extends BaseAuthRequest {
if (object.getIntValue("code") != 0) { if (object.getIntValue("code") != 0) {
throw new AuthException(object.getString("msg")); throw new AuthException(object.getString("msg"));
} }
object = object.getJSONObject("data"); object = object.getJSONObject("data");
return AuthUser.builder() return AuthUser.builder()
.uuid(object.getString("id")) .uuid(object.getString("id"))
......
...@@ -59,11 +59,13 @@ public class AuthQqRequest extends BaseAuthRequest { ...@@ -59,11 +59,13 @@ public class AuthQqRequest extends BaseAuthRequest {
if (StringUtils.isEmpty(avatar)) { if (StringUtils.isEmpty(avatar)) {
avatar = object.getString("figureurl_qq_1"); avatar = object.getString("figureurl_qq_1");
} }
String location = String.format("%s-%s", object.getString("province"), object.getString("city"));
return AuthUser.builder() return AuthUser.builder()
.username(object.getString("nickname")) .username(object.getString("nickname"))
.nickname(object.getString("nickname")) .nickname(object.getString("nickname"))
.avatar(avatar) .avatar(avatar)
.location(object.getString("province") + "-" + object.getString("city")) .location(location)
.uuid(openId) .uuid(openId)
.gender(AuthUserGender.getRealGender(object.getString("gender"))) .gender(AuthUserGender.getRealGender(object.getString("gender")))
.token(authToken) .token(authToken)
......
...@@ -42,11 +42,12 @@ public class AuthWeChatRequest extends BaseAuthRequest { ...@@ -42,11 +42,12 @@ public class AuthWeChatRequest extends BaseAuthRequest {
this.checkResponse(object); this.checkResponse(object);
String location = String.format("%s-%s-%s", object.getString("country"), object.getString("province"), object.getString("city"));
return AuthUser.builder() return AuthUser.builder()
.username(object.getString("nickname")) .username(object.getString("nickname"))
.nickname(object.getString("nickname")) .nickname(object.getString("nickname"))
.avatar(object.getString("headimgurl")) .avatar(object.getString("headimgurl"))
.location(object.getString("country") + "-" + object.getString("province") + "-" + object.getString("city")) .location(location)
.uuid(openId) .uuid(openId)
.gender(AuthUserGender.getRealGender(object.getString("sex"))) .gender(AuthUserGender.getRealGender(object.getString("sex")))
.token(authToken) .token(authToken)
...@@ -73,6 +74,7 @@ public class AuthWeChatRequest extends BaseAuthRequest { ...@@ -73,6 +74,7 @@ public class AuthWeChatRequest extends BaseAuthRequest {
throw new AuthException(object.getIntValue("errcode"), object.getString("errmsg")); throw new AuthException(object.getIntValue("errcode"), object.getString("errmsg"));
} }
} }
/** /**
* 获取token,适用于获取access_token和刷新token * 获取token,适用于获取access_token和刷新token
* *
......
### 2019/06/18
1. 解决Issue [#IY2HW](https://gitee.com/yadong.zhang/JustAuth/issues/IY2HW)
1. 解决Issue [#IY2OH](https://gitee.com/yadong.zhang/JustAuth/issues/IY2OH)
### 2019/06/06 ### 2019/06/06
1. 增加今日头条的授权登陆 1. 增加今日头条的授权登陆
2. 发布1.6.0-beta版本,今日头条开发者暂时不能认证, 所以无法做测试,等测试通过后,正式发布release版本 2. 发布1.6.0-beta版本,今日头条开发者暂时不能认证, 所以无法做测试,等测试通过后,正式发布release版本
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册