记得上下班打卡 | git大法好,push需谨慎
Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
liquidnet-bus-v1
Project
Project
Details
Activity
Releases
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
董敬伟
liquidnet-bus-v1
Commits
872f86c6
Commit
872f86c6
authored
Dec 11, 2024
by
周建平
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '2024112_enter_log' into 'master'
小家伙实名认证流量限制 See merge request
!377
parents
354e784a
b394df3c
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
41 additions
and
4 deletions
+41
-4
SmileRedisConst.java
...om/liquidnet/service/goblin/constant/SmileRedisConst.java
+4
-1
SmileUserController.java
...com/liquidnet/service/controller/SmileUserController.java
+11
-0
SmileRedisUtils.java
...main/java/com/liquidnet/service/util/SmileRedisUtils.java
+20
-0
Utils.java
...-impl/src/main/java/com/liquidnet/service/util/Utils.java
+6
-3
No files found.
liquidnet-bus-api/liquidnet-service-smile-api/src/main/java/com/liquidnet/service/goblin/constant/SmileRedisConst.java
View file @
872f86c6
...
...
@@ -7,7 +7,10 @@ public class SmileRedisConst {
public
static
final
String
SMILE_USER
=
PREFIX
.
concat
(
"user"
);
//用户key
public
static
final
String
SMILE_USER_VALIDATE
=
PREFIX
.
concat
(
"user:validate2"
);
//用户key
/**
* 用户添加/编辑小家伙实名计数(N次/天)
*/
public
static
final
String
SMILE_USER_VALIDATE_LIMIT
=
PREFIX
.
concat
(
"user:validate:limit:"
);
//用户key
public
static
final
String
SMILE_SCHOOL
=
PREFIX
.
concat
(
"school"
);
//校园key
public
static
final
String
SMILE_SHOW
=
PREFIX
.
concat
(
"show"
);
//演出key
...
...
liquidnet-bus-service/liquidnet-service-smile/liquidnet-service-smile-impl/src/main/java/com/liquidnet/service/controller/SmileUserController.java
View file @
872f86c6
...
...
@@ -164,6 +164,17 @@ public class SmileUserController {
String
userId
=
CurrentUtil
.
getCurrentUid
();
/* String status=smileRedisUtils.getValidate(smileUserVO.getName(), smileUserVO.getIdCard());*/
log
.
info
(
"小家伙增加或者删除第二步实名认证开始userId={},ip={}"
,
userId
,
CurrentUtil
.
getCliIpAddr
());
//实名认证限制 每天10次
int
userValidateLimitNo
=
smileRedisUtils
.
getUserValidateLimitNo
(
userId
);
if
(
userValidateLimitNo
>=
10
){
log
.
info
(
"小家伙增加或者删除第二步实名认证已超出限制userId={},ip={}"
,
userId
,
CurrentUtil
.
getCliIpAddr
());
return
ResponseDto
.
failure
(
"小家伙今日操作已达上限!"
);
}
if
(
userValidateLimitNo
==
-
1
)
{
smileRedisUtils
.
setUserValidateLimitNo
(
userId
);
}
else
{
smileRedisUtils
.
incrValidateLimitNo
(
userId
);
}
if
(
utils
.
validate
(
smileUserVO
.
getName
(),
smileUserVO
.
getIdCard
())){
smileUserVO
.
setUid
(
userId
);
SmileUserVO
smileUserVORedis
=
smileRedisUtils
.
getSmileUserVo
(
userId
);
...
...
liquidnet-bus-service/liquidnet-service-smile/liquidnet-service-smile-impl/src/main/java/com/liquidnet/service/util/SmileRedisUtils.java
View file @
872f86c6
...
...
@@ -9,6 +9,8 @@ import lombok.extern.slf4j.Slf4j;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
java.time.LocalDateTime
;
import
java.time.temporal.ChronoUnit
;
import
java.util.ArrayList
;
import
java.util.List
;
...
...
@@ -47,6 +49,24 @@ public class SmileRedisUtils {
redisUtil
.
set
(
SmileRedisConst
.
SMILE_USER_VALIDATE
.
concat
(
realName
+
cardNo
),
type
);
}
/* - - - - - - - - - - - - -小家伙实名认证限制 - - - - - - - - - - - - - | */
public
boolean
setUserValidateLimitNo
(
String
uid
)
{
LocalDateTime
now
=
LocalDateTime
.
now
();
return
redisUtil
.
set
(
SmileRedisConst
.
SMILE_USER_VALIDATE_LIMIT
.
concat
(
uid
),
1
,
ChronoUnit
.
SECONDS
.
between
(
now
,
LocalDateTime
.
of
(
now
.
getYear
(),
now
.
getMonth
(),
now
.
getDayOfMonth
(),
23
,
59
,
59
)));
}
public
long
incrValidateLimitNo
(
String
uid
)
{
return
redisUtil
.
incr
(
SmileRedisConst
.
SMILE_USER_VALIDATE_LIMIT
.
concat
(
uid
),
1
);
}
public
int
getUserValidateLimitNo
(
String
uid
)
{
Object
o
=
redisUtil
.
get
(
SmileRedisConst
.
SMILE_USER_VALIDATE_LIMIT
.
concat
(
uid
));
return
null
==
o
?
-
1
:
(
int
)
o
;
}
/* ---------------------------------------- 销售数据 ---------------------------------------- */
public
SmileSellDataVO
getSellDataVo
(
String
userId
,
String
performanceId
)
{
return
(
SmileSellDataVO
)
redisUtil
.
get
(
SmileRedisConst
.
SELL_DATA
.
concat
(
userId
).
concat
(
performanceId
));
...
...
liquidnet-bus-service/liquidnet-service-smile/liquidnet-service-smile-impl/src/main/java/com/liquidnet/service/util/Utils.java
View file @
872f86c6
...
...
@@ -7,6 +7,7 @@ import com.liquidnet.service.base.ErrorMapping;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
org.springframework.util.StringUtils
;
@Slf4j
@Component
...
...
@@ -30,9 +31,11 @@ public class Utils {
String
respStr
=
IdentityUtils
.
aliThird
(
realName
,
cardNo
),
respErrorCode
=
null
;
JsonNode
respJNode
=
JsonUtils
.
fromJson
(
respStr
,
JsonNode
.
class
);
if
(
null
==
respJNode
||
!
"0"
.
equals
(
respErrorCode
=
String
.
valueOf
(
respJNode
.
get
(
"error_code"
))))
{
log
.
debug
(
"###实名认证失败[{}]"
,
respJNode
);
ErrorMapping
.
ErrorMessage
errorMessage
=
ErrorMapping
.
get
(
"10102"
);
log
.
info
(
"###实名认证失败[{}]"
,
respJNode
);
if
(!
StringUtils
.
isEmpty
(
respErrorCode
)
&&
org
.
apache
.
commons
.
lang3
.
StringUtils
.
indexOf
(
"3000290033"
,
respErrorCode
)
<
0
)
{
// 认证服务商'30002'、'90033'为运营商导致的失败,这里不做缓存标记
smileRedisUtils
.
setValidate
(
realName
,
cardNo
,
"1"
);
}
return
false
;
}
smileRedisUtils
.
setValidate
(
realName
,
cardNo
,
"2"
);
...
...
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