🎨 解决Issue #IY2OH
This commit is contained in:
2
pom.xml
2
pom.xml
@@ -6,7 +6,7 @@
|
||||
|
||||
<groupId>me.zhyd.oauth</groupId>
|
||||
<artifactId>JustAuth</artifactId>
|
||||
<version>1.6.0-beta</version>
|
||||
<version>1.6.1-beta</version>
|
||||
|
||||
<name>JustAuth</name>
|
||||
<url>https://gitee.com/yadong.zhang/JustAuth</url>
|
||||
|
||||
@@ -67,14 +67,17 @@ public class AuthAlipayRequest extends BaseAuthRequest {
|
||||
if (!response.isSuccess()) {
|
||||
throw new AuthException(response.getSubMsg());
|
||||
}
|
||||
|
||||
String province = response.getProvince(),
|
||||
city = response.getCity();
|
||||
String location = String.format("%s %s", StringUtils.isEmpty(province) ? "" : province, StringUtils.isEmpty(city) ? "" : city);
|
||||
|
||||
return AuthUser.builder()
|
||||
.uuid(response.getUserId())
|
||||
.username(StringUtils.isEmpty(response.getUserName()) ? response.getNickName() : response.getUserName())
|
||||
.nickname(response.getNickName())
|
||||
.avatar(response.getAvatar())
|
||||
.location(String.format("%s %s", StringUtils.isEmpty(province) ? "" : province, StringUtils.isEmpty(city) ? "" : city))
|
||||
.location(location)
|
||||
.gender(AuthUserGender.getRealGender(response.getGender()))
|
||||
.token(authToken)
|
||||
.source(AuthSource.ALIPAY)
|
||||
|
||||
@@ -45,6 +45,7 @@ public class AuthCodingRequest extends BaseAuthRequest {
|
||||
if (object.getIntValue("code") != 0) {
|
||||
throw new AuthException(object.getString("msg"));
|
||||
}
|
||||
|
||||
object = object.getJSONObject("data");
|
||||
return AuthUser.builder()
|
||||
.uuid(object.getString("id"))
|
||||
|
||||
@@ -59,11 +59,13 @@ public class AuthQqRequest extends BaseAuthRequest {
|
||||
if (StringUtils.isEmpty(avatar)) {
|
||||
avatar = object.getString("figureurl_qq_1");
|
||||
}
|
||||
|
||||
String location = String.format("%s-%s", object.getString("province"), object.getString("city"));
|
||||
return AuthUser.builder()
|
||||
.username(object.getString("nickname"))
|
||||
.nickname(object.getString("nickname"))
|
||||
.avatar(avatar)
|
||||
.location(object.getString("province") + "-" + object.getString("city"))
|
||||
.location(location)
|
||||
.uuid(openId)
|
||||
.gender(AuthUserGender.getRealGender(object.getString("gender")))
|
||||
.token(authToken)
|
||||
|
||||
@@ -42,11 +42,12 @@ public class AuthWeChatRequest extends BaseAuthRequest {
|
||||
|
||||
this.checkResponse(object);
|
||||
|
||||
String location = String.format("%s-%s-%s", object.getString("country"), object.getString("province"), object.getString("city"));
|
||||
return AuthUser.builder()
|
||||
.username(object.getString("nickname"))
|
||||
.nickname(object.getString("nickname"))
|
||||
.avatar(object.getString("headimgurl"))
|
||||
.location(object.getString("country") + "-" + object.getString("province") + "-" + object.getString("city"))
|
||||
.location(location)
|
||||
.uuid(openId)
|
||||
.gender(AuthUserGender.getRealGender(object.getString("sex")))
|
||||
.token(authToken)
|
||||
@@ -73,6 +74,7 @@ public class AuthWeChatRequest extends BaseAuthRequest {
|
||||
throw new AuthException(object.getIntValue("errcode"), object.getString("errmsg"));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取token,适用于获取access_token和刷新token
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user