记得上下班打卡 | 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
36559923
Commit
36559923
authored
Dec 10, 2024
by
zhoujianping
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
小家伙实名认证流量限制
parent
0d9a78eb
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
37 additions
and
4 deletions
+37
-4
SmileUserController.java
...com/liquidnet/service/controller/SmileUserController.java
+10
-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
bootstrap-test.yml
...-service-smile-impl/src/main/resources/bootstrap-test.yml
+1
-1
No files found.
liquidnet-bus-service/liquidnet-service-smile/liquidnet-service-smile-impl/src/main/java/com/liquidnet/service/controller/SmileUserController.java
View file @
36559923
...
@@ -164,6 +164,16 @@ public class SmileUserController {
...
@@ -164,6 +164,16 @@ public class SmileUserController {
String
userId
=
CurrentUtil
.
getCurrentUid
();
String
userId
=
CurrentUtil
.
getCurrentUid
();
/* String status=smileRedisUtils.getValidate(smileUserVO.getName(), smileUserVO.getIdCard());*/
/* String status=smileRedisUtils.getValidate(smileUserVO.getName(), smileUserVO.getIdCard());*/
log
.
info
(
"小家伙增加或者删除第二步实名认证开始userId={},ip={}"
,
userId
,
CurrentUtil
.
getCliIpAddr
());
log
.
info
(
"小家伙增加或者删除第二步实名认证开始userId={},ip={}"
,
userId
,
CurrentUtil
.
getCliIpAddr
());
//实名认证限制 每天10次
int
userValidateLimitNo
=
smileRedisUtils
.
getUserValidateLimitNo
(
userId
);
if
(
userValidateLimitNo
>=
10
){
return
ResponseDto
.
failure
(
"小家伙今日操作已达上限!"
);
}
if
(
userValidateLimitNo
==
-
1
)
{
smileRedisUtils
.
setUserValidateLimitNo
(
userId
);
}
else
{
smileRedisUtils
.
incrValidateLimitNo
(
userId
);
}
if
(
utils
.
validate
(
smileUserVO
.
getName
(),
smileUserVO
.
getIdCard
())){
if
(
utils
.
validate
(
smileUserVO
.
getName
(),
smileUserVO
.
getIdCard
())){
smileUserVO
.
setUid
(
userId
);
smileUserVO
.
setUid
(
userId
);
SmileUserVO
smileUserVORedis
=
smileRedisUtils
.
getSmileUserVo
(
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 @
36559923
...
@@ -9,6 +9,8 @@ import lombok.extern.slf4j.Slf4j;
...
@@ -9,6 +9,8 @@ import lombok.extern.slf4j.Slf4j;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
java.time.LocalDateTime
;
import
java.time.temporal.ChronoUnit
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.List
;
...
@@ -47,6 +49,24 @@ public class SmileRedisUtils {
...
@@ -47,6 +49,24 @@ public class SmileRedisUtils {
redisUtil
.
set
(
SmileRedisConst
.
SMILE_USER_VALIDATE
.
concat
(
realName
+
cardNo
),
type
);
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
)
{
public
SmileSellDataVO
getSellDataVo
(
String
userId
,
String
performanceId
)
{
return
(
SmileSellDataVO
)
redisUtil
.
get
(
SmileRedisConst
.
SELL_DATA
.
concat
(
userId
).
concat
(
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 @
36559923
...
@@ -7,6 +7,7 @@ import com.liquidnet.service.base.ErrorMapping;
...
@@ -7,6 +7,7 @@ import com.liquidnet.service.base.ErrorMapping;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
org.springframework.util.StringUtils
;
@Slf4j
@Slf4j
@Component
@Component
...
@@ -30,9 +31,11 @@ public class Utils {
...
@@ -30,9 +31,11 @@ public class Utils {
String
respStr
=
IdentityUtils
.
aliThird
(
realName
,
cardNo
),
respErrorCode
=
null
;
String
respStr
=
IdentityUtils
.
aliThird
(
realName
,
cardNo
),
respErrorCode
=
null
;
JsonNode
respJNode
=
JsonUtils
.
fromJson
(
respStr
,
JsonNode
.
class
);
JsonNode
respJNode
=
JsonUtils
.
fromJson
(
respStr
,
JsonNode
.
class
);
if
(
null
==
respJNode
||
!
"0"
.
equals
(
respErrorCode
=
String
.
valueOf
(
respJNode
.
get
(
"error_code"
))))
{
if
(
null
==
respJNode
||
!
"0"
.
equals
(
respErrorCode
=
String
.
valueOf
(
respJNode
.
get
(
"error_code"
))))
{
log
.
debug
(
"###实名认证失败[{}]"
,
respJNode
);
log
.
info
(
"###实名认证失败[{}]"
,
respJNode
);
ErrorMapping
.
ErrorMessage
errorMessage
=
ErrorMapping
.
get
(
"10102"
);
if
(!
StringUtils
.
isEmpty
(
respErrorCode
)
&&
org
.
apache
.
commons
.
lang3
.
StringUtils
.
indexOf
(
"3000290033"
,
respErrorCode
)
<
0
)
{
// 认证服务商'30002'、'90033'为运营商导致的失败,这里不做缓存标记
smileRedisUtils
.
setValidate
(
realName
,
cardNo
,
"1"
);
smileRedisUtils
.
setValidate
(
realName
,
cardNo
,
"1"
);
}
return
false
;
return
false
;
}
}
smileRedisUtils
.
setValidate
(
realName
,
cardNo
,
"2"
);
smileRedisUtils
.
setValidate
(
realName
,
cardNo
,
"2"
);
...
...
liquidnet-bus-service/liquidnet-service-smile/liquidnet-service-smile-impl/src/main/resources/bootstrap-test.yml
View file @
36559923
...
@@ -6,7 +6,7 @@ liquidnet:
...
@@ -6,7 +6,7 @@ liquidnet:
username
:
user
username
:
user
password
:
user123
password
:
user123
eureka
:
eureka
:
host
:
1
72.17.207.177
:7001
host
:
1
27.0.0.1
:7001
# end-test-这里是配置信息基本值
# end-test-这里是配置信息基本值
spring
:
spring
:
...
...
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