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
09014788
Commit
09014788
authored
Aug 29, 2017
by
Java—红包—徐 然
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改短信语音文案
parent
534a8130
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
6 deletions
+12
-6
Constants.java
src/main/java/cn/quantgroup/xyqb/Constants.java
+4
-0
SmsController.java
...uantgroup/xyqb/controller/internal/sms/SmsController.java
+8
-6
No files found.
src/main/java/cn/quantgroup/xyqb/Constants.java
View file @
09014788
...
...
@@ -31,6 +31,10 @@ public interface Constants {
String
REDIS_SMS_CODE_COUNT
=
"SMS_verification_code_count:"
;
String
REDIS_SMS_IP_COUNT
=
"SMS_verification_code_count:"
;
String
REDIS_SMS_DEVICE_COUNT
=
"SMS_verification_code_count:"
;
String
REDIS_VOICE_CODE_COUNT
=
"Voice_verification_code_count:"
;
String
REDIS_VOICE_IP_COUNT
=
"Voice_verification_code_count:"
;
String
REDIS_VOICE_DEVICE_COUNT
=
"Voice_verification_code_count:"
;
/**
* redis中token的key值前缀
*/
...
...
src/main/java/cn/quantgroup/xyqb/controller/internal/sms/SmsController.java
View file @
09014788
...
...
@@ -224,9 +224,10 @@ public class SmsController implements IBaseController {
}
String
verificationIPCountKey
=
getIp
();
if
(!
StringUtils
.
isEmpty
(
verificationIPCountKey
))
{
verificationIPCountKey
=
Constants
.
REDIS_SMS_IP_COUNT
+
verificationIPCountKey
;
Long
getIPVerificationCount
=
redisTemplate
.
opsForHash
().
increment
(
verificationIPCountKey
,
Constants
.
REDIS_SMS_IP_COUNT
,
1
);
if
(
getIPVerificationCount
>
5000
)
{
return
JsonResult
.
buildErrorStateResult
(
"您当前ip已经达到获取今天验证码上
线
"
,
null
);
return
JsonResult
.
buildErrorStateResult
(
"您当前ip已经达到获取今天验证码上
限
"
,
null
);
}
}
...
...
@@ -234,7 +235,7 @@ public class SmsController implements IBaseController {
String
verificationDeviceCountKey
=
Constants
.
REDIS_SMS_DEVICE_COUNT
+
deviceId
;
Long
getDeviceVerificationCount
=
redisTemplate
.
opsForHash
().
increment
(
verificationDeviceCountKey
,
Constants
.
REDIS_SMS_DEVICE_COUNT
,
1
);
if
(
getDeviceVerificationCount
>
20
)
{
return
JsonResult
.
buildErrorStateResult
(
"您
当前ip已经达到获取今天验证码上线
"
,
null
);
return
JsonResult
.
buildErrorStateResult
(
"您
设备已经达到获取今天短信验证码上限
"
,
null
);
}
}
...
...
@@ -276,17 +277,18 @@ public class SmsController implements IBaseController {
}
String
verificationIPCountKey
=
getIp
();
if
(!
StringUtils
.
isEmpty
(
verificationIPCountKey
))
{
Long
getIPVerificationCount
=
redisTemplate
.
opsForHash
().
increment
(
verificationIPCountKey
,
Constants
.
REDIS_SMS_IP_COUNT
,
1
);
verificationIPCountKey
=
Constants
.
REDIS_VOICE_IP_COUNT
+
verificationIPCountKey
;
Long
getIPVerificationCount
=
redisTemplate
.
opsForHash
().
increment
(
verificationIPCountKey
,
Constants
.
REDIS_VOICE_IP_COUNT
,
1
);
if
(
getIPVerificationCount
>
5000
)
{
return
JsonResult
.
buildErrorStateResult
(
"您当前ip已经达到获取今天
验证码上线
"
,
null
);
return
JsonResult
.
buildErrorStateResult
(
"您当前ip已经达到获取今天
语音验证码上限
"
,
null
);
}
}
if
(!
StringUtils
.
isEmpty
(
deviceId
))
{
String
verificationDeviceCountKey
=
Constants
.
REDIS_SMS_DEVICE_COUNT
+
deviceId
;
Long
getDeviceVerificationCount
=
redisTemplate
.
opsForHash
().
increment
(
verificationDeviceCountKey
,
Constants
.
REDIS_
SMS
_DEVICE_COUNT
,
1
);
Long
getDeviceVerificationCount
=
redisTemplate
.
opsForHash
().
increment
(
verificationDeviceCountKey
,
Constants
.
REDIS_
VOICE
_DEVICE_COUNT
,
1
);
if
(
getDeviceVerificationCount
>
20
)
{
return
JsonResult
.
buildErrorStateResult
(
"您
当前ip已经达到获取今天验证码上线
"
,
null
);
return
JsonResult
.
buildErrorStateResult
(
"您
设备已经达到获取今天语音验证码上限
"
,
null
);
}
}
...
...
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