Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
涂亚平
/
subsidy
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit bd14e7b3
authored
Jul 12, 2022
by
涂亚平
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
拦截器先验证时间
1 parent
858a7caf
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
11 deletions
src/main/java/com/subsidy/common/interceptor/AuthenticationInterceptor.java
src/main/java/com/subsidy/controller/MemberController.java
src/main/java/com/subsidy/common/interceptor/AuthenticationInterceptor.java
View file @
bd14e7b
...
...
@@ -57,6 +57,16 @@ public class AuthenticationInterceptor implements HandlerInterceptor {
HandlerMethod
handlerMethod
=
(
HandlerMethod
)
handler
;
Method
method
=
handlerMethod
.
getMethod
();
TimeRequired
timeRequired
=
method
.
getAnnotation
(
TimeRequired
.
class
);
if
(
timeRequired
!=
null
){
Calendar
calendar
=
Calendar
.
getInstance
();
int
hour
=
calendar
.
get
(
Calendar
.
HOUR_OF_DAY
);
if
(
hour
<
6
){
throw
new
HttpException
(
17001
);
}
}
LoginRequired
methodAnnotation
=
method
.
getAnnotation
(
LoginRequired
.
class
);
if
(
methodAnnotation
!=
null
)
{
String
authorization
=
request
.
getHeader
(
"Authorization"
);
...
...
@@ -102,14 +112,7 @@ public class AuthenticationInterceptor implements HandlerInterceptor {
throw
new
HttpException
(
1010
);
}
TimeRequired
timeRequired
=
method
.
getAnnotation
(
TimeRequired
.
class
);
if
(
timeRequired
!=
null
){
Calendar
calendar
=
Calendar
.
getInstance
();
int
hour
=
calendar
.
get
(
Calendar
.
HOUR_OF_DAY
);
if
(
hour
<
6
){
throw
new
HttpException
(
17001
);
}
}
return
true
;
}
...
...
src/main/java/com/subsidy/controller/MemberController.java
View file @
bd14e7b
...
...
@@ -63,14 +63,12 @@ public class MemberController {
@PostMapping
(
value
=
"/login"
)
@ApiOperation
(
"手机端:登录:telephone/手机号, verifyCode/验证码"
)
@TimeRequired
public
ResponseVO
login
(
@RequestBody
VerifyCodeDTO
verifyCodeDTO
)
{
return
ResponseData
.
generateCreatedResponse
(
0
,
memberService
.
login
(
verifyCodeDTO
));
}
@PostMapping
(
"passwordLogin"
)
@ApiOperation
(
"手机端:密码登录 { companyId accountName password}"
)
@TimeRequired
public
ResponseVO
passwordLogin
(
@RequestBody
PasswordLoginDTO
passwordLoginDTO
){
return
ResponseData
.
generateCreatedResponse
(
0
,
memberService
.
passwordLogin
(
passwordLoginDTO
));
}
...
...
@@ -89,7 +87,6 @@ public class MemberController {
return
ResponseData
.
generateCreatedResponse
(
0
,
memberService
.
kunchiLogin
(
qingxuetangLoginDTO
));
}
@PostMapping
(
"updatePassword"
)
@ApiOperation
(
"修改密码 {id password}"
)
@LoginRequired
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment