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
3bbb4536
Commit
3bbb4536
authored
Feb 07, 2018
by
技术部-任文超
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更正GeetestLib
parent
76c3e748
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
15 deletions
+4
-15
GeetestLib.java
...n/java/cn/quantgroup/xyqb/service/captcha/GeetestLib.java
+1
-2
GeetestCaptchaServiceImpl.java
.../xyqb/service/captcha/impl/GeetestCaptchaServiceImpl.java
+3
-13
No files found.
src/main/java/cn/quantgroup/xyqb/service/captcha/GeetestLib.java
View file @
3bbb4536
...
@@ -56,7 +56,6 @@ public class GeetestLib {
...
@@ -56,7 +56,6 @@ public class GeetestLib {
*/
*/
public
boolean
debugCode
=
true
;
public
boolean
debugCode
=
true
;
/**
/**
* 带参数构造函数
* 带参数构造函数
*
*
...
@@ -96,7 +95,7 @@ public class GeetestLib {
...
@@ -96,7 +95,7 @@ public class GeetestLib {
private
Map
<
String
,
String
>
getSuccessPreProcessRes
(
String
challenge
)
{
private
Map
<
String
,
String
>
getSuccessPreProcessRes
(
String
challenge
)
{
gtlog
(
"challenge:"
+
challenge
);
gtlog
(
"challenge:"
+
challenge
);
Map
<
String
,
String
>
data
=
new
HashMap
<
String
,
String
>(
3
);
Map
<
String
,
String
>
data
=
new
HashMap
<
String
,
String
>(
3
);
data
.
put
(
"success"
,
"
0
"
);
data
.
put
(
"success"
,
"
1
"
);
data
.
put
(
"gt"
,
this
.
captchaId
);
data
.
put
(
"gt"
,
this
.
captchaId
);
data
.
put
(
"challenge"
,
challenge
);
data
.
put
(
"challenge"
,
challenge
);
return
data
;
return
data
;
...
...
src/main/java/cn/quantgroup/xyqb/service/captcha/impl/GeetestCaptchaServiceImpl.java
View file @
3bbb4536
...
@@ -10,12 +10,10 @@ import org.springframework.beans.factory.annotation.Value;
...
@@ -10,12 +10,10 @@ import org.springframework.beans.factory.annotation.Value;
import
org.springframework.data.redis.core.RedisTemplate
;
import
org.springframework.data.redis.core.RedisTemplate
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.PostConstruct
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.Objects
;
import
java.util.Objects
;
import
java.util.logging.Logger
;
/**
/**
* @author xufei on 2018/1/30.
* @author xufei on 2018/1/30.
...
@@ -42,30 +40,22 @@ public class GeetestCaptchaServiceImpl implements IGeetestCaptchaService {
...
@@ -42,30 +40,22 @@ public class GeetestCaptchaServiceImpl implements IGeetestCaptchaService {
@Value
(
"${geetest.api.url}"
)
@Value
(
"${geetest.api.url}"
)
private
String
apiUrl
;
private
String
apiUrl
;
private
GeetestLib
gtSdk
;
@Override
@Override
public
Map
<
String
,
String
>
fetchGeetestCaptcha
(
String
markId
,
String
remoteIp
,
ClientType
clientType
)
{
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
);
HashMap
<
String
,
String
>
param
=
getParam
(
markId
,
remoteIp
,
clientType
);
log
.
info
(
"请求极验参数:{}"
,
param
);
return
getGeetestSdk
().
getResponseStr
(
param
);
Map
<
String
,
String
>
gtMap
=
getGeetestSdk
().
getResponseStr
(
param
);
log
.
info
(
"请求极验返回:{}"
,
gtMap
);
return
gtMap
;
}
}
@Override
@Override
public
boolean
validGeetestCaptcha
(
String
markId
,
String
remoteIp
,
ClientType
clientType
,
String
challenge
,
String
validate
,
String
seccode
)
{
public
boolean
validGeetestCaptcha
(
String
markId
,
String
remoteIp
,
ClientType
clientType
,
String
challenge
,
String
validate
,
String
seccode
)
{
HashMap
<
String
,
String
>
param
=
getParam
(
markId
,
remoteIp
,
clientType
);
HashMap
<
String
,
String
>
param
=
getParam
(
markId
,
remoteIp
,
clientType
);
log
.
info
(
"二次验证参数:{},challenge:{},validate:{},seccode;{}"
,
param
,
challenge
,
validate
,
seccode
);
int
gtResult
=
getGeetestSdk
().
enhencedValidateRequest
(
challenge
,
validate
,
seccode
,
param
);
int
gtResult
=
getGeetestSdk
().
enhencedValidateRequest
(
challenge
,
validate
,
seccode
,
param
);
log
.
info
(
"二次验证返回结果;{},版本信息:{}"
,
gtResult
);
return
Constants
.
GT_CAPTCHA_VALIDATE_SUCCESS
==
gtResult
;
return
Constants
.
GT_CAPTCHA_VALIDATE_SUCCESS
==
gtResult
;
}
}
private
GeetestLib
getGeetestSdk
()
{
private
GeetestLib
getGeetestSdk
()
{
return
gtSdk
=
new
GeetestLib
(
captchaId
,
privateKey
,
newFailback
,
apiUrl
);
return
new
GeetestLib
(
captchaId
,
privateKey
,
newFailback
,
apiUrl
);
}
}
private
HashMap
<
String
,
String
>
getParam
(
String
markId
,
String
remoteIp
,
ClientType
clientType
)
{
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