Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
P
pica-cloud-account
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
1
合并请求
1
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
Close sidebar
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
com.pica.cloud.account
pica-cloud-account
提交
a01c76f2
提交
a01c76f2
编写于
3月 25, 2020
作者:
Chongwen.jiang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
风控数据记录修改
上级
9dfce97f
流水线
#23457
已失败 于阶段
in 0 second
变更
5
流水线
1
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
28 行增加
和
18 行删除
+28
-18
AutoCodeController.java
...account/account/server/controller/AutoCodeController.java
+5
-3
AccountExceptionEnum.java
...ud/account/account/server/enums/AccountExceptionEnum.java
+1
-0
RcRepTypeEnum.java
...ica/cloud/account/account/server/enums/RcRepTypeEnum.java
+1
-0
AuthCodeService.java
...cloud/account/account/server/service/AuthCodeService.java
+2
-2
AuthCodeServiceImpl.java
...ount/account/server/service/impl/AuthCodeServiceImpl.java
+19
-13
未找到文件。
server/src/main/java/com/pica/cloud/account/account/server/controller/AutoCodeController.java
浏览文件 @
a01c76f2
...
@@ -136,13 +136,15 @@ public class AutoCodeController extends AccountBaseController {
...
@@ -136,13 +136,15 @@ public class AutoCodeController extends AccountBaseController {
AccountUtils
.
checkMobilePhone
(
request
.
getMobile
());
AccountUtils
.
checkMobilePhone
(
request
.
getMobile
());
// 拼图验证
// 拼图验证
authCodeService
.
validateJigsawCode
(
req
,
request
);
int
recordData
=
authCodeService
.
validateJigsawCode
(
req
,
request
);
// 发送短信验证码
// 发送短信验证码
processSysCode
(
request
.
getMobile
(),
request
.
getFlag
());
processSysCode
(
request
.
getMobile
(),
request
.
getFlag
());
// 记录风控数据(记录是h5端)
if
(
recordData
!=
-
1
)
{
authCodeService
.
recordRcData
(
req
,
request
,
super
.
getDeviceInfo
(
"device_ip"
));
// 记录风控数据(记录是h5端)
authCodeService
.
recordRcData
(
req
,
request
,
super
.
getDeviceInfo
(
"device_ip"
));
}
return
PicaResponse
.
toResponse
();
return
PicaResponse
.
toResponse
();
}
}
...
...
server/src/main/java/com/pica/cloud/account/account/server/enums/AccountExceptionEnum.java
浏览文件 @
a01c76f2
...
@@ -51,6 +51,7 @@ public enum AccountExceptionEnum {
...
@@ -51,6 +51,7 @@ public enum AccountExceptionEnum {
PICA_BIND_WECHAT_FAIL
(
"216543"
,
"绑定微信失败"
),
PICA_BIND_WECHAT_FAIL
(
"216543"
,
"绑定微信失败"
),
PICA_CAP_CODE_ERROR
(
"216544"
,
"拼图验证失败"
),
PICA_CAP_CODE_ERROR
(
"216544"
,
"拼图验证失败"
),
PICA_CAP_GET_INVOKE_ERROR
(
"216545"
,
"拼图获取失败"
),
PICA_CAP_GET_INVOKE_ERROR
(
"216545"
,
"拼图获取失败"
),
PICA_RC_BUSINESS_ERROR
(
"216546"
,
"参数格式错误"
),
xxx_xxx
(
""
,
""
);
xxx_xxx
(
""
,
""
);
...
...
server/src/main/java/com/pica/cloud/account/account/server/enums/RcRepTypeEnum.java
浏览文件 @
a01c76f2
...
@@ -11,6 +11,7 @@ package com.pica.cloud.account.account.server.enums;
...
@@ -11,6 +11,7 @@ package com.pica.cloud.account.account.server.enums;
public
enum
RcRepTypeEnum
{
public
enum
RcRepTypeEnum
{
// 风控禁止发送
// 风控禁止发送
RC_ALLOW_SEND_MSG
(
"1"
,
"允许发送"
),
RC_SEND_FAIL
(
"2"
,
"发送失败"
),
RC_SEND_FAIL
(
"2"
,
"发送失败"
),
RC_TRIGGER
(
"3"
,
"需要触发风控滑动验证"
),
RC_TRIGGER
(
"3"
,
"需要触发风控滑动验证"
),
// 账号、IP、设备在黑名单内,前端提示发送成功,后端不发送短信
// 账号、IP、设备在黑名单内,前端提示发送成功,后端不发送短信
...
...
server/src/main/java/com/pica/cloud/account/account/server/service/AuthCodeService.java
浏览文件 @
a01c76f2
...
@@ -16,11 +16,11 @@ import javax.servlet.http.HttpServletRequest;
...
@@ -16,11 +16,11 @@ import javax.servlet.http.HttpServletRequest;
*/
*/
public
interface
AuthCodeService
{
public
interface
AuthCodeService
{
Boolean
rcValidate
(
HttpServletRequest
request
,
BaseRequest
baseRequest
,
String
deviceInfoStr
,
Integer
sourceType
);
int
rcValidate
(
HttpServletRequest
request
,
BaseRequest
baseRequest
,
String
deviceInfoStr
,
Integer
sourceType
);
void
recordRcData
(
HttpServletRequest
req
,
BaseRequest
baseRequest
,
String
deviceIp
);
void
recordRcData
(
HttpServletRequest
req
,
BaseRequest
baseRequest
,
String
deviceIp
);
void
validateJigsawCode
(
HttpServletRequest
request
,
BaseRequest
req
);
int
validateJigsawCode
(
HttpServletRequest
request
,
BaseRequest
req
);
JigsawCodeModel
getJigsawCode
(
HttpServletRequest
request
,
Integer
sourceType
,
String
mobile
);
JigsawCodeModel
getJigsawCode
(
HttpServletRequest
request
,
Integer
sourceType
,
String
mobile
);
...
...
server/src/main/java/com/pica/cloud/account/account/server/service/impl/AuthCodeServiceImpl.java
浏览文件 @
a01c76f2
...
@@ -71,8 +71,8 @@ public class AuthCodeServiceImpl implements AuthCodeService {
...
@@ -71,8 +71,8 @@ public class AuthCodeServiceImpl implements AuthCodeService {
* @Return com.pica.cloud.account.account.server.resp.UnifiedVerificationResp
* @Return com.pica.cloud.account.account.server.resp.UnifiedVerificationResp
*/
*/
@Override
@Override
public
Boolean
rcValidate
(
HttpServletRequest
request
,
BaseRequest
baseRequest
,
String
deviceInfoStr
,
Integer
sourceType
)
{
public
int
rcValidate
(
HttpServletRequest
request
,
BaseRequest
baseRequest
,
String
deviceInfoStr
,
Integer
sourceType
)
{
Boolean
need
=
true
;
int
needCheck
=
1
;
// 调用风控接口
// 调用风控接口
PicaResponse
picaResponse
=
null
;
PicaResponse
picaResponse
=
null
;
try
{
try
{
...
@@ -129,21 +129,26 @@ public class AuthCodeServiceImpl implements AuthCodeService {
...
@@ -129,21 +129,26 @@ public class AuthCodeServiceImpl implements AuthCodeService {
if
(
remainTime
>
0
)
{
if
(
remainTime
>
0
)
{
throw
new
PicaWarnException
(
AccountExceptionEnum
.
PICA_RC_60_SECOND_LIMIT
.
getCode
(),
throw
new
PicaWarnException
(
AccountExceptionEnum
.
PICA_RC_60_SECOND_LIMIT
.
getCode
(),
AccountExceptionEnum
.
PICA_RC_60_SECOND_LIMIT
.
getMessage
().
replace
(
"{remainTime}"
,
String
.
valueOf
(
remainTime
)));
AccountExceptionEnum
.
PICA_RC_60_SECOND_LIMIT
.
getMessage
().
replace
(
"{remainTime}"
,
String
.
valueOf
(
remainTime
)));
}
else
{
needCheck
=
0
;
}
}
}
else
{
}
else
{
// 刚好60秒缓存时间过去了,也允许发送短信验证码
// 刚好60秒缓存时间过去了,也允许发送短信验证码
need
=
false
;
need
Check
=
0
;
}
}
}
else
{
}
else
if
(
RcRepTypeEnum
.
RC_ALLOW_SEND_MSG
.
getCode
().
equals
(
processCode
))
{
// processCode equals "1" (允许发送短信验证码)
// processCode equals "1" (允许发送短信验证码)
need
=
false
;
needCheck
=
-
1
;
}
else
{
throw
new
PicaWarnException
(
AccountExceptionEnum
.
PICA_RC_BUSINESS_ERROR
.
getCode
(),
AccountExceptionEnum
.
PICA_RC_BUSINESS_ERROR
.
getMessage
());
}
}
}
}
}
}
}
}
}
}
return
need
;
return
need
Check
;
}
}
/**
/**
...
@@ -182,7 +187,7 @@ public class AuthCodeServiceImpl implements AuthCodeService {
...
@@ -182,7 +187,7 @@ public class AuthCodeServiceImpl implements AuthCodeService {
* @Return void
* @Return void
*/
*/
@Override
@Override
public
void
validateJigsawCode
(
HttpServletRequest
request
,
BaseRequest
paramReq
)
{
public
int
validateJigsawCode
(
HttpServletRequest
request
,
BaseRequest
paramReq
)
{
if
(!
SourceTypeEnum
.
H5
.
getCode
().
equals
(
paramReq
.
getSourceType
()))
{
if
(!
SourceTypeEnum
.
H5
.
getCode
().
equals
(
paramReq
.
getSourceType
()))
{
logger
.
error
(
"validateJigsawCode-h5 sourceType error"
);
logger
.
error
(
"validateJigsawCode-h5 sourceType error"
);
throw
new
PicaWarnException
(
PicaResultCode
.
PARAM_IS_INVALID
.
code
(),
PicaResultCode
.
PARAM_IS_INVALID
.
message
());
throw
new
PicaWarnException
(
PicaResultCode
.
PARAM_IS_INVALID
.
code
(),
PicaResultCode
.
PARAM_IS_INVALID
.
message
());
...
@@ -190,10 +195,10 @@ public class AuthCodeServiceImpl implements AuthCodeService {
...
@@ -190,10 +195,10 @@ public class AuthCodeServiceImpl implements AuthCodeService {
// 1、调用风控服务,是否需要触发拼图验证
// 1、调用风控服务,是否需要触发拼图验证
BaseRequest
rcReq
=
new
BaseRequest
();
BaseRequest
rcReq
=
new
BaseRequest
();
rcReq
.
setMobile
(
paramReq
.
getMobile
());
rcReq
.
setMobile
(
paramReq
.
getMobile
());
Boolean
need
=
this
.
rcValidate
(
request
,
rcReq
,
"{}"
,
paramReq
.
getSourceType
());
int
needCheck
=
this
.
rcValidate
(
request
,
rcReq
,
"{}"
,
paramReq
.
getSourceType
());
if
(
!
need
)
{
if
(
needCheck
<=
0
)
{
// 不需要拼图验证,直接去发短信
// 不需要拼图验证,直接去发短信
return
;
return
needCheck
;
}
}
String
capCode
=
paramReq
.
getCapCode
();
String
capCode
=
paramReq
.
getCapCode
();
int
xPos
=
paramReq
.
getxPos
();
int
xPos
=
paramReq
.
getxPos
();
...
@@ -204,7 +209,7 @@ public class AuthCodeServiceImpl implements AuthCodeService {
...
@@ -204,7 +209,7 @@ public class AuthCodeServiceImpl implements AuthCodeService {
if
(
count
.
equals
(
99
))
{
if
(
count
.
equals
(
99
))
{
// a、不需要拼图验证
// a、不需要拼图验证
// b、本应需要拼图验证,但是在调用获取拼图数据接口时报错了,也直接去发送短信
// b、本应需要拼图验证,但是在调用获取拼图数据接口时报错了,也直接去发送短信
return
;
return
needCheck
;
}
}
}
}
...
@@ -239,6 +244,7 @@ public class AuthCodeServiceImpl implements AuthCodeService {
...
@@ -239,6 +244,7 @@ public class AuthCodeServiceImpl implements AuthCodeService {
}
}
}
}
return
needCheck
;
}
}
/**
/**
...
@@ -260,13 +266,13 @@ public class AuthCodeServiceImpl implements AuthCodeService {
...
@@ -260,13 +266,13 @@ public class AuthCodeServiceImpl implements AuthCodeService {
// 调用风控服务,是否需要触发拼图验证
// 调用风控服务,是否需要触发拼图验证
BaseRequest
req
=
new
BaseRequest
();
BaseRequest
req
=
new
BaseRequest
();
req
.
setMobile
(
mobile
);
req
.
setMobile
(
mobile
);
Boolean
need
=
this
.
rcValidate
(
request
,
req
,
"{}"
,
sourceType
);
int
needCheck
=
this
.
rcValidate
(
request
,
req
,
"{}"
,
sourceType
);
// 调用proof服务获取拼图数据
// 调用proof服务获取拼图数据
JigsawCodeModel
data
=
new
JigsawCodeModel
();
JigsawCodeModel
data
=
new
JigsawCodeModel
();
PicaResponse
picResp
=
null
;
PicaResponse
picResp
=
null
;
String
key
=
Constants
.
JIGSAW_CODE_KEY
.
replace
(
"{mobile}"
,
mobile
);
String
key
=
Constants
.
JIGSAW_CODE_KEY
.
replace
(
"{mobile}"
,
mobile
);
if
(
need
)
{
if
(
need
Check
>
0
)
{
try
{
try
{
picResp
=
sliderImageService
.
getPic
();
picResp
=
sliderImageService
.
getPic
();
logger
.
info
(
"getJigsawCode-getPic-code:{}"
,
picResp
.
getCode
());
logger
.
info
(
"getJigsawCode-getPic-code:{}"
,
picResp
.
getCode
());
...
...
写
预览
Markdown
格式
0%
请重试
or
附加一个文件
附加文件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录