Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yanxuan-wx-store-sharer
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
wx
yanxuan-wx-store-sharer
Commits
522d39a1
Commit
522d39a1
authored
May 16, 2025
by
fanjiaxin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
短信限制调整
parent
4532c692
Pipeline
#75700
passed with stages
in 1 minute 14 seconds
Changes
3
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
2 additions
and
26 deletions
+2
-26
SmsServiceImpl.java
...xuan/wx/store/sharer/biz/service/impl/SmsServiceImpl.java
+1
-20
SmsConfig.java
...yanxuan/wx/store/sharer/integration/config/SmsConfig.java
+1
-1
SmsCodeScenesConfigBO.java
...arer/integration/meta/model/bo/SmsCodeScenesConfigBO.java
+0
-5
No files found.
yanxuan-wx-store-sharer-biz/src/main/java/com/netease/yanxuan/wx/store/sharer/biz/service/impl/SmsServiceImpl.java
View file @
522d39a1
...
...
@@ -52,10 +52,6 @@ public class SmsServiceImpl implements ISmsService {
@Override
public
void
verifySmsCode
(
String
scenes
,
String
phone
,
String
code
)
{
// 检查每日校验次数上限
if
(!
validateVerifyCodeVerifyCount
(
scenes
,
phone
))
{
throw
new
BizException
(
"验证码校验达到次数上限"
);
}
// 对比验证码
String
codeKey
=
String
.
format
(
SmsConstant
.
SMS_CODE_KEY
,
scenes
,
phone
);
String
originCode
=
redisClient
.
getStr
(
codeKey
);
...
...
@@ -77,7 +73,7 @@ public class SmsServiceImpl implements ISmsService {
private
Boolean
sendCode
(
String
scenes
,
String
mobilePhone
)
{
log
.
info
(
"[op:sendSmsCode] sendCode..."
);
SmsCodeScenesConfigBO
scenesConfigBO
=
smsConfig
.
getScenesConfig
(
scenes
);
if
(
null
==
scenesConfigBO
)
{
if
(
null
==
scenesConfigBO
)
{
throw
new
BizException
(
"短信配置错误"
);
}
// 生成6位随机数字
...
...
@@ -152,21 +148,6 @@ public class SmsServiceImpl implements ISmsService {
return
smsConfig
.
getScenesConfig
(
scenes
).
getSendMaxCount
()
>=
(
sendCount
==
null
?
1
:
sendCount
);
}
/**
* 验证码每日校验次数上限
*
* @param scenes 场景
* @param mobilePhone 手机号
* @return true: 未达上限,false: 到了上限
*/
public
Boolean
validateVerifyCodeVerifyCount
(
String
scenes
,
String
mobilePhone
)
{
String
key
=
String
.
format
(
SmsConstant
.
SMS_VERIFY_COUNT_KEY
,
scenes
,
mobilePhone
,
getToday
());
BoundValueOperations
<
String
,
Object
>
operations
=
redisClient
.
boundValueOps
(
key
);
Long
verifyCount
=
operations
.
increment
();
operations
.
expire
(
1
,
TimeUnit
.
DAYS
);
return
smsConfig
.
getScenesConfig
(
scenes
).
getVerifyCodeMaxCount
()
>=
(
verifyCount
==
null
?
1
:
verifyCount
);
}
private
String
getToday
()
{
// 获取当前日期
LocalDate
today
=
LocalDate
.
now
();
...
...
yanxuan-wx-store-sharer-integration/src/main/java/com/netease/yanxuan/wx/store/sharer/integration/config/SmsConfig.java
View file @
522d39a1
...
...
@@ -21,7 +21,7 @@ public class SmsConfig {
* 场景验证码配置
* key: 业务场景标识
*/
@ValueMapping
(
"${scenes.config.map:{\"REAL_NAME_AUTHENTICATED\":{\"sendIntervalSeconds\":60,\"codeValidMinutes\":5,\"messageFormat\":\"【网易】验证码:%s,您正在实名认证,%s分钟内输入有效(若非本人操作,请删除本短信)\",\"sendMaxCount\":10
,\"verifyCodeMaxCount\":10
}}}"
)
@ValueMapping
(
"${scenes.config.map:{\"REAL_NAME_AUTHENTICATED\":{\"sendIntervalSeconds\":60,\"codeValidMinutes\":5,\"messageFormat\":\"【网易】验证码:%s,您正在实名认证,%s分钟内输入有效(若非本人操作,请删除本短信)\",\"sendMaxCount\":10}}}"
)
private
Map
<
String
,
SmsCodeScenesConfigBO
>
scenesConfigMap
;
...
...
yanxuan-wx-store-sharer-integration/src/main/java/com/netease/yanxuan/wx/store/sharer/integration/meta/model/bo/SmsCodeScenesConfigBO.java
View file @
522d39a1
...
...
@@ -34,9 +34,4 @@ public class SmsCodeScenesConfigBO implements Serializable {
* 验证码发送最大次数
*/
private
Integer
sendMaxCount
;
/**
* 验证码每日校验次数上限
*/
private
Integer
verifyCodeMaxCount
;
}
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