Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
I
ibzuaa
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
ibiz4jteam
ibzuaa
提交
64fca33d
提交
64fca33d
编写于
8月 06, 2020
作者:
laizhilong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
修改第三方授权应用信息获取方式
上级
f2f6aee0
变更
6
显示空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
86 行增加
和
68 行删除
+86
-68
UserDingtalkRegisterService.java
...e/uaa/extensions/service/UserDingtalkRegisterService.java
+5
-5
UserQQRegisterService.java
...ab/core/uaa/extensions/service/UserQQRegisterService.java
+8
-8
UserWechatRegisterService.java
...ore/uaa/extensions/service/UserWechatRegisterService.java
+6
-6
UserDingtalkRegisterResource.java
...lab/api/rest/extensions/UserDingtalkRegisterResource.java
+22
-16
UserQQRegisterResource.java
...n/ibizlab/api/rest/extensions/UserQQRegisterResource.java
+22
-17
UserWechatRegisterResource.java
...izlab/api/rest/extensions/UserWechatRegisterResource.java
+23
-16
未找到文件。
ibzuaa-core/src/main/java/cn/ibizlab/core/uaa/extensions/service/UserDingtalkRegisterService.java
浏览文件 @
64fca33d
...
...
@@ -69,24 +69,24 @@ public class UserDingtalkRegisterService {
*
* @param code
* @param currentTimeMillis
* @param
dingTalkA
ppId
* @param
dingTalkA
ppSecret
* @param
a
ppId
* @param
a
ppSecret
* @return
*/
public
JSONObject
requestDingtalkUserByCode
(
String
code
,
long
currentTimeMillis
,
String
dingTalkAppId
,
String
dingTalkA
ppSecret
)
{
public
JSONObject
requestDingtalkUserByCode
(
String
code
,
long
currentTimeMillis
,
String
appId
,
String
a
ppSecret
)
{
JSONObject
returnObj
=
null
;
CloseableHttpClient
client
=
null
;
try
{
// 根据timestamp, appSecret计算签名值
String
stringToSign
=
String
.
valueOf
(
currentTimeMillis
);
Mac
mac
=
Mac
.
getInstance
(
"HmacSHA256"
);
mac
.
init
(
new
SecretKeySpec
(
dingTalkA
ppSecret
.
getBytes
(
"UTF-8"
),
"HmacSHA256"
));
mac
.
init
(
new
SecretKeySpec
(
a
ppSecret
.
getBytes
(
"UTF-8"
),
"HmacSHA256"
));
byte
[]
signatureBytes
=
mac
.
doFinal
(
stringToSign
.
getBytes
(
"UTF-8"
));
String
signature
=
new
String
(
Base64
.
encodeBase64
(
signatureBytes
));
String
urlEncodeSignature
=
URLEncoder
.
encode
(
signature
,
"UTF-8"
);
// 通过临时授权码Code获取用户信息,临时授权码只能使用一次
String
url
=
"https://oapi.dingtalk.com/sns/getuserinfo_bycode?accessKey="
+
dingTalkA
ppId
String
url
=
"https://oapi.dingtalk.com/sns/getuserinfo_bycode?accessKey="
+
a
ppId
+
"×tamp="
+
currentTimeMillis
+
"&signature="
+
urlEncodeSignature
;
...
...
ibzuaa-core/src/main/java/cn/ibizlab/core/uaa/extensions/service/UserQQRegisterService.java
浏览文件 @
64fca33d
...
...
@@ -55,21 +55,21 @@ public class UserQQRegisterService {
* 通过code获取QQ用户信息
*
* @param code
* @param
qqR
edirectUri
* @param
qqAppi
d
* @param
qqAppkey
* @param
r
edirectUri
* @param
appI
d
* @param
appSecret
* @return
*/
public
JSONObject
requestQQUserByCode
(
String
code
,
String
qqRedirectUri
,
String
qqAppid
,
String
qqAppkey
)
{
public
JSONObject
requestQQUserByCode
(
String
code
,
String
redirectUri
,
String
appId
,
String
appSecret
)
{
JSONObject
returnObj
=
null
;
try
{
// 1.根据code获取access_token
String
getAccessTokenUrl
=
"https://graph.qq.com/oauth2.0/token?"
+
"grant_type=authorization_code"
+
"&client_id="
+
qqAppi
d
+
"&client_secret="
+
qqAppkey
+
"&client_id="
+
appI
d
+
"&client_secret="
+
appSecret
+
"&code="
+
code
+
"&redirect_uri="
+
qqR
edirectUri
;
"&redirect_uri="
+
r
edirectUri
;
String
responserStr
=
HttpUtils
.
get
(
getAccessTokenUrl
,
null
,
null
);
JSONObject
responseObj
=
new
JSONObject
();
if
(
StringUtils
.
isEmpty
(
responserStr
))
{
...
...
@@ -108,7 +108,7 @@ public class UserQQRegisterService {
// 3.使用access_token以及OpenID来访问和修改用户数据
String
getQQUserInfoUrl
=
"https://graph.qq.com/user/get_user_info?"
+
"access_token="
+
access_token
+
"&oauth_consumer_key="
+
qqAppi
d
+
"&oauth_consumer_key="
+
appI
d
+
"&openid="
+
openid
;
returnObj
=
JSONObject
.
parseObject
(
HttpUtils
.
get
(
getQQUserInfoUrl
,
null
,
null
));
if
(
StringUtils
.
isEmpty
(
returnObj
))
{
...
...
ibzuaa-core/src/main/java/cn/ibizlab/core/uaa/extensions/service/UserWechatRegisterService.java
浏览文件 @
64fca33d
...
...
@@ -57,17 +57,17 @@ public class UserWechatRegisterService {
*
* @param code
* @param state
* @param
wechatA
ppId
* @param
wechatapps
ecret
* @param
a
ppId
* @param
appS
ecret
* @return
*/
public
JSONObject
requestWechatUserByCode
(
String
code
,
String
state
,
String
wechatAppId
,
String
wechatapps
ecret
)
{
public
JSONObject
requestWechatUserByCode
(
String
code
,
String
state
,
String
appId
,
String
appS
ecret
)
{
JSONObject
returnObj
=
null
;
try
{
// 1.根据code获取access_token、openid、refresh_token
String
getAccessTokenUrl
=
"https://api.weixin.qq.com/sns/oauth2/access_token?"
+
"appid="
+
wechatA
ppId
+
"&secret="
+
wechatapps
ecret
+
"appid="
+
a
ppId
+
"&secret="
+
appS
ecret
+
"&code="
+
code
+
"&grant_type=authorization_code"
;
JSONObject
responseObj
=
JSONObject
.
parseObject
(
HttpUtils
.
get
(
getAccessTokenUrl
,
null
,
null
));
...
...
@@ -86,7 +86,7 @@ public class UserWechatRegisterService {
if
(
responseObj2
.
getInteger
(
"errcode"
)
!=
0
)
{
// access_token已失效,使用refresh_token刷新access_token
String
refreshAccess_token
=
"https://api.weixin.qq.com/sns/oauth2/refresh_token?"
+
"appid="
+
wechatA
ppId
+
"appid="
+
a
ppId
+
"&grant_type=refresh_token"
+
"&refresh_token="
+
refresh_token
;
JSONObject
responseObj3
=
JSONObject
.
parseObject
(
HttpUtils
.
get
(
refreshAccess_token
,
null
,
null
));
...
...
ibzuaa-provider/ibzuaa-provider-api/src/main/java/cn/ibizlab/api/rest/extensions/UserDingtalkRegisterResource.java
浏览文件 @
64fca33d
package
cn
.
ibizlab
.
api
.
rest
.
extensions
;
import
cn.ibizlab.core.uaa.domain.SysOpenAccess
;
import
cn.ibizlab.core.uaa.domain.SysUserAuth
;
import
cn.ibizlab.core.uaa.extensions.service.UserDingtalkRegisterService
;
import
cn.ibizlab.core.uaa.service.ISysOpenAccessService
;
import
cn.ibizlab.core.uaa.service.ISysUserAuthService
;
import
cn.ibizlab.util.domain.IBZUSER
;
import
cn.ibizlab.util.errors.BadRequestAlertException
;
...
...
@@ -14,7 +16,6 @@ import com.alibaba.fastjson.JSONObject;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Qualifier
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.util.StringUtils
;
import
org.springframework.web.bind.annotation.GetMapping
;
...
...
@@ -22,7 +23,6 @@ import org.springframework.web.bind.annotation.PostMapping;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.List
;
import
java.util.UUID
;
...
...
@@ -40,11 +40,8 @@ public class UserDingtalkRegisterResource {
@Autowired
@Qualifier
(
"UAAUserService"
)
private
AuthenticationUserService
userDetailsService
;
@Value
(
"${ibiz.auth.dingtalk.appid:}"
)
// 个人应用开发过程中的唯一性标识AppId,最好在配置文件进行初始化
private
String
DingtalkAppid
;
@Value
(
"${ibiz.auth.dingtalk.appsecret:}"
)
// 个人应用AppSecret,最好在配置文件进行初始化
private
String
DingtalkAppSecret
;
@Autowired
private
ISysOpenAccessService
openAccessService
;
/**
* 获取钉钉开放平台创建的网站应用appid
...
...
@@ -52,9 +49,12 @@ public class UserDingtalkRegisterResource {
@GetMapping
(
value
=
"/uaa/getDingtalkAppId"
)
public
ResponseEntity
<
JSONObject
>
getDingtalkAppId
()
{
JSONObject
obj
=
new
JSONObject
();
String
appid
=
DingtalkAppid
;
if
(!
StringUtils
.
isEmpty
(
appid
))
{
obj
.
put
(
"appid"
,
appid
);
SysOpenAccess
openAccess
=
openAccessService
.
getOne
(
Wrappers
.<
SysOpenAccess
>
query
().
eq
(
"open_type"
,
"dingtalk"
));
if
(!
"1"
.
equals
(
openAccess
.
getDisabled
()))
{
String
appId
=
openAccess
.
getAccessKey
();
if
(!
StringUtils
.
isEmpty
(
appId
))
{
obj
.
put
(
"appid"
,
appId
);
}
}
return
ResponseEntity
.
ok
(
obj
);
...
...
@@ -75,11 +75,19 @@ public class UserDingtalkRegisterResource {
if
(
StringUtils
.
isEmpty
(
code
))
throw
new
BadRequestAlertException
(
"code为空"
,
"UserDingtalkRegisterResource"
,
""
);
// 从数据库中获取钉钉授权应用信息
SysOpenAccess
openAccess
=
openAccessService
.
getOne
(
Wrappers
.<
SysOpenAccess
>
query
().
eq
(
"open_type"
,
"dingtalk"
));
if
(
"1"
.
equals
(
openAccess
.
getDisabled
())
||
StringUtils
.
isEmpty
(
openAccess
))
{
throw
new
BadRequestAlertException
(
"未获得钉钉授权"
,
"UserDingtalkRegisterResource"
,
""
);
}
String
appId
=
openAccess
.
getAccessKey
();
// 个人应用开发过程中的唯一性标识AppId
String
appSecret
=
openAccess
.
getSecretKey
();
// 个人应用AppSecret
// 通过code获取钉钉用户信息
String
openid
=
null
;
String
nickname
=
null
;
long
currentTimeMillis
=
System
.
currentTimeMillis
();
JSONObject
returnObj
=
userDingtalkRegisterService
.
requestDingtalkUserByCode
(
code
,
currentTimeMillis
,
DingtalkAppid
,
DingtalkA
ppSecret
);
JSONObject
returnObj
=
userDingtalkRegisterService
.
requestDingtalkUserByCode
(
code
,
currentTimeMillis
,
appId
,
a
ppSecret
);
if
(!
StringUtils
.
isEmpty
(
returnObj
)
&&
!
returnObj
.
containsKey
(
"errcode"
))
{
openid
=
returnObj
.
getString
(
"openid"
);
nickname
=
returnObj
.
getString
(
"nick"
);
...
...
@@ -88,11 +96,10 @@ public class UserDingtalkRegisterResource {
}
// 根据openid查用户授权信息
List
<
SysUserAuth
>
sysUserAuths
=
sysUserAuthService
.
list
(
Wrappers
.<
SysUserAuth
>
query
().
eq
(
"identifier"
,
openid
));
SysUserAuth
userAuth
=
sysUserAuthService
.
getOne
(
Wrappers
.<
SysUserAuth
>
query
().
eq
(
"identifier"
,
openid
));
// 该钉钉用户注册过账号,登录系统
if
(
sysUserAuths
.
size
()>
0
)
{
SysUserAuth
userauth
=
sysUserAuths
.
get
(
0
);
IBZUSER
ibzuser
=
ibzuserService
.
getById
(
userauth
.
getUserid
());
if
(!
StringUtils
.
isEmpty
(
userAuth
))
{
IBZUSER
ibzuser
=
ibzuserService
.
getById
(
userAuth
.
getUserid
());
JSONObject
ibzuserObj
=
new
JSONObject
();
ibzuserObj
.
put
(
"loginname"
,
ibzuser
.
getLoginname
());
ibzuserObj
.
put
(
"password"
,
ibzuser
.
getPassword
());
...
...
@@ -153,7 +160,6 @@ public class UserDingtalkRegisterResource {
userAuth
.
setIdentityType
(
"dingtalk"
);
userDingtalkRegisterService
.
toCreateUserAuth
(
userAuth
);
// 注册成功,登录系统
if
(!
StringUtils
.
isEmpty
(
ibzuser
))
{
JSONObject
ibzuserObj
=
new
JSONObject
();
...
...
ibzuaa-provider/ibzuaa-provider-api/src/main/java/cn/ibizlab/api/rest/extensions/UserQQRegisterResource.java
浏览文件 @
64fca33d
package
cn
.
ibizlab
.
api
.
rest
.
extensions
;
import
cn.ibizlab.core.uaa.domain.SysOpenAccess
;
import
cn.ibizlab.core.uaa.domain.SysUserAuth
;
import
cn.ibizlab.core.uaa.extensions.service.UserQQRegisterService
;
import
cn.ibizlab.core.uaa.service.ISysOpenAccessService
;
import
cn.ibizlab.core.uaa.service.ISysUserAuthService
;
import
cn.ibizlab.util.domain.IBZUSER
;
import
cn.ibizlab.util.errors.BadRequestAlertException
;
...
...
@@ -14,7 +16,6 @@ import com.alibaba.fastjson.JSONObject;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Qualifier
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.util.StringUtils
;
import
org.springframework.web.bind.annotation.GetMapping
;
...
...
@@ -40,14 +41,8 @@ public class UserQQRegisterResource {
@Autowired
@Qualifier
(
"UAAUserService"
)
private
AuthenticationUserService
userDetailsService
;
@Value
(
"${ibiz.auth.qq.appid:}"
)
// qq互联appid,在配置文件进行初始化
private
String
qqAppId
;
@Value
(
"${ibiz.auth.qq.appkey:}"
)
// qq互联appkey,在配置文件进行初始化
private
String
qqAppKey
;
@Value
(
"${ibiz.auth.qq.redirect_uri:}"
)
// qq互联应用回调地址,在配置文件进行初始化
private
String
qqRedirectUri
;
@Autowired
private
ISysOpenAccessService
openAccessService
;
/**
* 获取QQ互联平台创建的网站应用appid
...
...
@@ -55,9 +50,12 @@ public class UserQQRegisterResource {
@GetMapping
(
value
=
"/uaa/getQQAppId"
)
public
ResponseEntity
<
JSONObject
>
getQQAppId
()
{
JSONObject
obj
=
new
JSONObject
();
String
appid
=
qqAppId
;
if
(!
StringUtils
.
isEmpty
(
appid
))
{
obj
.
put
(
"appid"
,
appid
);
SysOpenAccess
openAccess
=
openAccessService
.
getOne
(
Wrappers
.<
SysOpenAccess
>
query
().
eq
(
"open_type"
,
"qq"
));
if
(!
"1"
.
equals
(
openAccess
.
getDisabled
()))
{
String
appId
=
openAccess
.
getAccessKey
();
// qq互联appid
if
(!
StringUtils
.
isEmpty
(
appId
))
{
obj
.
put
(
"appid"
,
appId
);
}
}
return
ResponseEntity
.
ok
(
obj
);
...
...
@@ -76,11 +74,19 @@ public class UserQQRegisterResource {
String
code
=
param
.
getString
(
"code"
);
if
(
StringUtils
.
isEmpty
(
code
))
throw
new
BadRequestAlertException
(
"code为空"
,
"UserQQRegisterResource"
,
""
);
// 从数据库中获取qq互联信息
SysOpenAccess
openAccess
=
openAccessService
.
getOne
(
Wrappers
.<
SysOpenAccess
>
query
().
eq
(
"open_type"
,
"qq"
));
if
(
"1"
.
equals
(
openAccess
.
getDisabled
())
||
StringUtils
.
isEmpty
(
openAccess
))
{
throw
new
BadRequestAlertException
(
"未获得qq授权"
,
"UserQQRegisterResource"
,
""
);
}
String
appId
=
openAccess
.
getAccessKey
();
// qq互联appid
String
appSecret
=
openAccess
.
getSecretKey
();
// qq互联appkey
String
redirectUri
=
openAccess
.
getRedirectUri
();
// qq互联应用回调地址
// 通过code获取QQ用户信息
String
openid
=
null
;
String
nickname
=
null
;
JSONObject
returnObj
=
userQQRegisterService
.
requestQQUserByCode
(
code
,
qqRedirectUri
,
qqAppId
,
qqAppKey
);
JSONObject
returnObj
=
userQQRegisterService
.
requestQQUserByCode
(
code
,
redirectUri
,
appId
,
appSecret
);
if
(!
StringUtils
.
isEmpty
(
returnObj
)
&&
!
returnObj
.
containsKey
(
"errcode"
))
{
openid
=
returnObj
.
getString
(
"openid"
);
nickname
=
returnObj
.
getString
(
"nickname"
);
...
...
@@ -89,11 +95,10 @@ public class UserQQRegisterResource {
}
// 根据openid查用户授权信息
List
<
SysUserAuth
>
sysUserAuths
=
sysUserAuthService
.
list
(
Wrappers
.<
SysUserAuth
>
query
().
eq
(
"identifier"
,
openid
));
SysUserAuth
userAuth
=
sysUserAuthService
.
getOne
(
Wrappers
.<
SysUserAuth
>
query
().
eq
(
"identifier"
,
openid
));
// 该QQ用户注册过账号,登录系统
if
(
sysUserAuths
.
size
()>
0
)
{
SysUserAuth
userauth
=
sysUserAuths
.
get
(
0
);
IBZUSER
ibzuser
=
ibzuserService
.
getById
(
userauth
.
getUserid
());
if
(!
StringUtils
.
isEmpty
(
userAuth
))
{
IBZUSER
ibzuser
=
ibzuserService
.
getById
(
userAuth
.
getUserid
());
JSONObject
ibzuserObj
=
new
JSONObject
();
ibzuserObj
.
put
(
"loginname"
,
ibzuser
.
getLoginname
());
ibzuserObj
.
put
(
"password"
,
ibzuser
.
getPassword
());
...
...
ibzuaa-provider/ibzuaa-provider-api/src/main/java/cn/ibizlab/api/rest/extensions/UserWechatRegisterResource.java
浏览文件 @
64fca33d
package
cn
.
ibizlab
.
api
.
rest
.
extensions
;
import
cn.ibizlab.core.uaa.domain.SysOpenAccess
;
import
cn.ibizlab.core.uaa.domain.SysUserAuth
;
import
cn.ibizlab.core.uaa.extensions.service.UserWechatRegisterService
;
import
cn.ibizlab.core.uaa.service.ISysOpenAccessService
;
import
cn.ibizlab.core.uaa.service.ISysUserAuthService
;
import
cn.ibizlab.util.domain.IBZUSER
;
import
cn.ibizlab.util.errors.BadRequestAlertException
;
...
...
@@ -14,7 +16,6 @@ import com.alibaba.fastjson.JSONObject;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Qualifier
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.util.StringUtils
;
import
org.springframework.web.bind.annotation.GetMapping
;
...
...
@@ -40,12 +41,8 @@ public class UserWechatRegisterResource {
@Autowired
@Qualifier
(
"UAAUserService"
)
private
AuthenticationUserService
userDetailsService
;
@Value
(
"${ibiz.auth.wechat.appID:}"
)
// 微信开放平台appid,最好在配置文件进行初始化
private
String
WechatAppid
;
@Value
(
"${ibiz.auth.wechat.appsecret:}"
)
// 微信开放平台appsecret,最好在配置文件进行初始化
private
String
WechatAppsecret
;
@Autowired
private
ISysOpenAccessService
openAccessService
;
/**
* 获取微信开放平台创建的网站应用appid
...
...
@@ -53,9 +50,12 @@ public class UserWechatRegisterResource {
@GetMapping
(
value
=
"/uaa/getWechatAppId"
)
public
ResponseEntity
<
JSONObject
>
getWechatAppId
()
{
JSONObject
obj
=
new
JSONObject
();
String
appid
=
WechatAppid
;
if
(!
StringUtils
.
isEmpty
(
appid
))
{
obj
.
put
(
"appid"
,
appid
);
SysOpenAccess
openAccess
=
openAccessService
.
getOne
(
Wrappers
.<
SysOpenAccess
>
query
().
eq
(
"open_type"
,
"webchart"
));
if
(!
"1"
.
equals
(
openAccess
.
getDisabled
()))
{
String
appId
=
openAccess
.
getAccessKey
();
if
(!
StringUtils
.
isEmpty
(
appId
))
{
obj
.
put
(
"appid"
,
appId
);
}
}
return
ResponseEntity
.
ok
(
obj
);
...
...
@@ -74,12 +74,20 @@ public class UserWechatRegisterResource {
// 空校验
String
code
=
param
.
getString
(
"code"
);
if
(
StringUtils
.
isEmpty
(
code
))
throw
new
BadRequestAlertException
(
"code为空"
,
"UserRegisterResource"
,
""
);
throw
new
BadRequestAlertException
(
"code为空"
,
"UserWechatRegisterResource"
,
""
);
// 从数据库中获取微信授权应用信息
SysOpenAccess
openAccess
=
openAccessService
.
getOne
(
Wrappers
.<
SysOpenAccess
>
query
().
eq
(
"open_type"
,
"webchart"
));
if
(
"1"
.
equals
(
openAccess
.
getDisabled
())
||
StringUtils
.
isEmpty
(
openAccess
))
{
throw
new
BadRequestAlertException
(
"未获得微信授权"
,
"UserWechatRegisterResource"
,
""
);
}
String
appId
=
openAccess
.
getAccessKey
();
// 微信开放平台appid
String
appSecret
=
openAccess
.
getSecretKey
();
// 微信开放平台appsecret
// 通过code获取微信用户信息
String
openid
=
null
;
String
nickname
=
null
;
JSONObject
returnObj
=
userWechatRegisterService
.
requestWechatUserByCode
(
code
,
null
,
WechatAppid
,
WechatApps
ecret
);
JSONObject
returnObj
=
userWechatRegisterService
.
requestWechatUserByCode
(
code
,
null
,
appId
,
appS
ecret
);
if
(!
StringUtils
.
isEmpty
(
returnObj
)
&&
!
returnObj
.
containsKey
(
"errcode"
))
{
openid
=
returnObj
.
getString
(
"openid"
);
nickname
=
returnObj
.
getString
(
"nickname"
);
...
...
@@ -88,11 +96,10 @@ public class UserWechatRegisterResource {
}
// 根据openid查用户授权信息
List
<
SysUserAuth
>
sysUserAuths
=
sysUserAuthService
.
list
(
Wrappers
.<
SysUserAuth
>
query
().
eq
(
"identifier"
,
openid
));
SysUserAuth
userAuth
=
sysUserAuthService
.
getOne
(
Wrappers
.<
SysUserAuth
>
query
().
eq
(
"identifier"
,
openid
));
// 该微信用户注册过账号,登录系统
if
(
sysUserAuths
.
size
()>
0
)
{
SysUserAuth
userauth
=
sysUserAuths
.
get
(
0
);
IBZUSER
ibzuser
=
ibzuserService
.
getById
(
userauth
.
getUserid
());
if
(!
StringUtils
.
isEmpty
(
userAuth
))
{
IBZUSER
ibzuser
=
ibzuserService
.
getById
(
userAuth
.
getUserid
());
JSONObject
ibzuserObj
=
new
JSONObject
();
ibzuserObj
.
put
(
"loginname"
,
ibzuser
.
getLoginname
());
ibzuserObj
.
put
(
"password"
,
ibzuser
.
getPassword
());
...
...
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录