Skip to content

Commit

Permalink
删除无参数构造方法,精简接口
Browse files Browse the repository at this point in the history
  • Loading branch information
xuyuhui1993 committed Jan 21, 2016
1 parent 1ee5add commit d8b0486
Showing 1 changed file with 14 additions and 30 deletions.
44 changes: 14 additions & 30 deletions src/com/geetest/sdk/java/GeetestLib.java
Original file line number Diff line number Diff line change
Expand Up @@ -78,39 +78,22 @@ public class GeetestLib {
* 极验验证API服务状态Session Key
*/
public String gtServerStatusSessionKey = "gt_server_status";

/**
* 无参数构造函数
*/
public GeetestLib() {
}

/**
* 带参数构造函数
*
* @param captchaId
* @param privateKey
*/
public GeetestLib(String privateKey, String captchaId) {
this.privateKey = privateKey;
public GeetestLib(String captchaId, String privateKey) {
this.captchaId = captchaId;
}

public String getPrivateKey() {
return privateKey;
}

public void setPrivateKey(String privateKey) {
this.privateKey = privateKey;
}

public String getCaptchaId() {
return captchaId;
}

public void setCaptchaId(String captchaId) {
this.captchaId = captchaId;
}

/**
* 获取本次验证初始化返回字符串
*
* @return 初始化结果
*/
public String getResponseStr() {
return responseStr;
Expand All @@ -135,25 +118,24 @@ private String getFailPreProcessRes() {

return String.format(
"{\"success\":%s,\"gt\":\"%s\",\"challenge\":\"%s\"}", 0,
this.getCaptchaId(), challenge);
this.captchaId, challenge);
}

/**
* 预处理成功后的标准串
*
* @return
*/
private String getSuccessPreProcessRes() {

return String.format(
"{\"success\":%s,\"gt\":\"%s\",\"challenge\":\"%s\"}", 1,
this.getCaptchaId(), this.challenge);
this.captchaId, this.challenge);
}

/**
* 验证初始化预处理
*
* @return
* @return 1表示初始化成功,0表示初始化失败
*/
public int preProcess() {

Expand Down Expand Up @@ -279,7 +261,7 @@ private boolean resquestIsLegal(String challenge, String validate, String seccod
* @param challenge
* @param validate
* @param seccode
* @return
* @return 验证结果
*/
public String enhencedValidateRequest(String challenge, String validate, String seccode) {

Expand Down Expand Up @@ -326,8 +308,10 @@ public String enhencedValidateRequest(String challenge, String validate, String
/**
* failback使用的验证方式
*
* @param request
* @return
* @param challenge
* @param validate
* @param seccode
* @return 验证结果
*/
public String failbackValidateRequest(String challenge, String validate, String seccode) {

Expand Down

0 comments on commit d8b0486

Please sign in to comment.