Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
X
xyqb-user2
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
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
head_group
xyqb-user2
Commits
4ff48c9c
Commit
4ff48c9c
authored
Dec 09, 2020
by
董建华
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
第一次错误只删除验证码缓存
parent
2a42a271
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
6 deletions
+15
-6
UserController.java
...n/quantgroup/xyqb/controller/external/UserController.java
+2
-4
ISmsService.java
...main/java/cn/quantgroup/xyqb/service/sms/ISmsService.java
+6
-0
SmsServiceImpl.java
...a/cn/quantgroup/xyqb/service/sms/impl/SmsServiceImpl.java
+7
-2
No files found.
src/main/java/cn/quantgroup/xyqb/controller/external/UserController.java
View file @
4ff48c9c
...
@@ -619,10 +619,8 @@ public class UserController implements IBaseController {
...
@@ -619,10 +619,8 @@ public class UserController implements IBaseController {
if
(
smsService
.
needResendCode
(
phoneNo
,
VERIFICATION_CODE_FINITE_COUNT_NEW
))
{
if
(
smsService
.
needResendCode
(
phoneNo
,
VERIFICATION_CODE_FINITE_COUNT_NEW
))
{
throw
new
VerificationCodeErrorException
(
"验证码失效,请重新获取"
);
throw
new
VerificationCodeErrorException
(
"验证码失效,请重新获取"
);
}
}
/**
* 删除
smsService
.
deleteOnlyCodeFromCache
(
phoneNo
);
*/
smsService
.
deleteCodeFromCache
(
phoneNo
);
log
.
info
(
"验证码校验失败,phoneNo:{} , verificationCode:{}"
,
phoneNo
,
verificationCode
);
log
.
info
(
"验证码校验失败,phoneNo:{} , verificationCode:{}"
,
phoneNo
,
verificationCode
);
throw
new
VerificationCodeErrorException
(
"短信验证码错误"
);
throw
new
VerificationCodeErrorException
(
"短信验证码错误"
);
...
...
src/main/java/cn/quantgroup/xyqb/service/sms/ISmsService.java
View file @
4ff48c9c
...
@@ -47,4 +47,10 @@ public interface ISmsService {
...
@@ -47,4 +47,10 @@ public interface ISmsService {
*/
*/
void
deleteCodeFromCache
(
String
phoneNo
);
void
deleteCodeFromCache
(
String
phoneNo
);
/**
* 只删除code缓存不删除尝试缓存
* @param phoneNo
*/
void
deleteOnlyCodeFromCache
(
String
phoneNo
);
}
}
src/main/java/cn/quantgroup/xyqb/service/sms/impl/SmsServiceImpl.java
View file @
4ff48c9c
...
@@ -133,10 +133,15 @@ public class SmsServiceImpl implements ISmsService {
...
@@ -133,10 +133,15 @@ public class SmsServiceImpl implements ISmsService {
@Override
@Override
public
void
deleteCodeFromCache
(
String
phoneNo
)
{
public
void
deleteCodeFromCache
(
String
phoneNo
)
{
String
verificationCountKey
=
Constants
.
REDIS_VERIFICATION_COUNT
+
phoneNo
;
String
verificationCountKey
=
Constants
.
REDIS_VERIFICATION_COUNT
+
phoneNo
;
String
key
=
Constants
.
REDIS_PREFIX_VERIFICATION_CODE
+
phoneNo
;
stringRedisTemplate
.
delete
(
key
);
stringRedisTemplate
.
opsForHash
().
delete
(
verificationCountKey
,
Constants
.
REDIS_VERIFICATION_COUNT
);
stringRedisTemplate
.
opsForHash
().
delete
(
verificationCountKey
,
Constants
.
REDIS_VERIFICATION_COUNT
);
deleteOnlyCodeFromCache
(
phoneNo
);
}
}
@Override
public
void
deleteOnlyCodeFromCache
(
String
phoneNo
)
{
String
key
=
Constants
.
REDIS_PREFIX_VERIFICATION_CODE
+
phoneNo
;
stringRedisTemplate
.
delete
(
key
);
}
}
}
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