Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
fzm-joying
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lei
fzm-joying
Commits
52816adc
Commit
52816adc
authored
Jul 12, 2021
by
tangtuo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改登录失败的异常处理
parent
45103940
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
5 deletions
+18
-5
jarRepositories.xml
.idea/jarRepositories.xml
+6
-0
GlobalExceptionHandler.java
.../fzm/common/exception/handler/GlobalExceptionHandler.java
+11
-4
UserMapper.xml
joying-common/src/main/resources/mapper/UserMapper.xml
+1
-1
No files found.
.idea/jarRepositories.xml
View file @
52816adc
...
...
@@ -56,5 +56,10 @@
<option
name=
"name"
value=
"local private nexus"
/>
<option
name=
"url"
value=
"http://maven.citydo.com.cn/repository/maven-public/"
/>
</remote-repository>
<remote-repository>
<option
name=
"id"
value=
"central"
/>
<option
name=
"name"
value=
"Central Repository"
/>
<option
name=
"url"
value=
"https://maven.aliyun.com/repository/public"
/>
</remote-repository>
</component>
</project>
\ No newline at end of file
joying-common/src/main/java/com/fzm/common/exception/handler/GlobalExceptionHandler.java
View file @
52816adc
package
com
.
fzm
.
common
.
exception
.
handler
;
import
cn.dev33.satoken.exception.
NotLoginException
;
import
cn.dev33.satoken.exception.
*
;
import
cn.dev33.satoken.stp.StpUtil
;
import
cn.hutool.core.date.DateUtil
;
import
cn.hutool.http.HttpStatus
;
...
...
@@ -46,10 +46,11 @@ public class GlobalExceptionHandler {
return
ResponseModel
.
fail
(
exception
);
}
@ExceptionHandler
(
value
=
NotLogi
nException
.
class
)
public
ResponseModel
<
String
>
handlerNotLoginException
(
NotLogi
nException
exception
)
{
@ExceptionHandler
(
value
=
SaToke
nException
.
class
)
public
ResponseModel
<
String
>
handlerNotLoginException
(
SaToke
nException
exception
)
{
log
.
error
(
exception
.
getMessage
(),
exception
);
response
.
setStatus
(
HttpStatus
.
HTTP_INTERNAL_ERROR
);
if
(
exception
instanceof
NotLoginException
)
{
if
(
exception
.
getMessage
().
contains
(
"token已被顶下线"
))
{
// 获取已过期的token
String
expireToken
=
StpUtil
.
getTokenValue
();
...
...
@@ -61,11 +62,17 @@ public class GlobalExceptionHandler {
String
format
=
DateUtil
.
format
(
createTime
,
"yyyy-MM-dd HH:mm:ss"
);
return
ResponseModel
.
fail
(
ResultCode
.
UNAUTHORIZED
,
String
.
format
(
"您的账号于 %s 登录另外一台设备,如非您本人所为,请立即修改密码"
,
format
));
}
else
{
return
ResponseModel
.
fail
(
ResultCode
.
UNAUTHORIZED
,
exception
.
getMessage
());
}
}
else
if
(
exception
instanceof
NotPermissionException
||
exception
instanceof
NotRoleException
||
exception
instanceof
StopMatchException
)
{
return
ResponseModel
.
fail
(
ResultCode
.
FORBIDDEN
,
ResultCode
.
FORBIDDEN
.
getMessage
());
}
else
{
return
ResponseModel
.
fail
(
exception
);
}
}
@ExceptionHandler
(
value
=
{
MethodArgumentNotValidException
.
class
})
public
ResponseModel
<
String
>
handleMethodArgumentNotValidException
(
MethodArgumentNotValidException
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);
...
...
joying-common/src/main/resources/mapper/UserMapper.xml
View file @
52816adc
...
...
@@ -8,7 +8,7 @@
u.nickname,
u.auth_type,
u.create_date AS registerDate,
(select count(0) from tb_nft n where u.id = n.user_id
) as publishCount
(select count(0) from tb_nft n where u.id = n.user_id and n.nft_hash != ''
) as publishCount
FROM tb_user u
where 1=1
<if
test=
"telephone != null and telephone != ''"
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment