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
36f1b783
Commit
36f1b783
authored
Feb 07, 2018
by
Java—红包—徐 然
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改
parent
db6c31d5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
3 deletions
+13
-3
GeetestCaptchaServiceImpl.java
.../xyqb/service/captcha/impl/GeetestCaptchaServiceImpl.java
+13
-3
No files found.
src/main/java/cn/quantgroup/xyqb/service/captcha/impl/GeetestCaptchaServiceImpl.java
View file @
36f1b783
...
...
@@ -4,20 +4,24 @@ import cn.quantgroup.xyqb.Constants;
import
cn.quantgroup.xyqb.model.ClientType
;
import
cn.quantgroup.xyqb.service.captcha.GeetestLib
;
import
cn.quantgroup.xyqb.service.captcha.IGeetestCaptchaService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Qualifier
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.data.redis.core.RedisTemplate
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.PostConstruct
;
import
javax.annotation.Resource
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.Objects
;
import
java.util.logging.Logger
;
/**
* @author xufei on 2018/1/30.
*/
@Service
@Slf4j
public
class
GeetestCaptchaServiceImpl
implements
IGeetestCaptchaService
{
@Resource
...
...
@@ -38,22 +42,28 @@ public class GeetestCaptchaServiceImpl implements IGeetestCaptchaService {
@Value
(
"${geetest.api.url}"
)
private
String
apiUrl
;
private
GeetestLib
gtSdk
;
@Override
public
Map
<
String
,
String
>
fetchGeetestCaptcha
(
String
markId
,
String
remoteIp
,
ClientType
clientType
)
{
GeetestLib
gtSdk
=
new
GeetestLib
(
captchaId
,
privateKey
,
newFailback
,
apiUrl
);
HashMap
<
String
,
String
>
param
=
getParam
(
markId
,
remoteIp
,
clientType
);
return
gtSdk
.
getResponseStr
(
param
);
log
.
info
(
"请求极验参数:{}"
,
param
);
return
getGeetestSdk
().
getResponseStr
(
param
);
}
@Override
public
boolean
validGeetestCaptcha
(
String
markId
,
String
remoteIp
,
ClientType
clientType
,
String
challenge
,
String
validate
,
String
seccode
)
{
HashMap
<
String
,
String
>
param
=
getParam
(
markId
,
remoteIp
,
clientType
);
return
Constants
.
GT_CAPTCHA_VALIDATE_SUCCESS
==
getGeetestSdk
().
enhencedValidateRequest
(
challenge
,
validate
,
seccode
,
param
);
log
.
info
(
"二次验证参数:{},challenge:{},validate:{},seccode;{}"
,
param
,
challenge
,
validate
,
seccode
);
int
gtResult
=
getGeetestSdk
().
enhencedValidateRequest
(
challenge
,
validate
,
seccode
,
param
);
log
.
info
(
"二次验证返回结果;{},版本信息:{}"
,
gtResult
);
return
Constants
.
GT_CAPTCHA_VALIDATE_SUCCESS
==
gtResult
;
}
private
GeetestLib
getGeetestSdk
()
{
return
new
GeetestLib
(
captchaId
,
privateKey
,
newFailback
,
apiUrl
);
return
gtSdk
=
new
GeetestLib
(
captchaId
,
privateKey
,
newFailback
,
apiUrl
);
}
private
HashMap
<
String
,
String
>
getParam
(
String
markId
,
String
remoteIp
,
ClientType
clientType
)
{
...
...
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