Commit d40ba4de by 吕明尚

验券接口

parent c8e3be05
package share.common.enums;
public enum VerifyResultsEnum {
//0 验卷成功
SUCCESS(0, "验卷成功"),
//2 券码已核销
COOKED(2, "券码已核销"),
//3 券码正在退款中(用户主动退款)
REFUNDING(3, "券码正在退款中(用户主动退款)"),
//4 券码已退款
REFUNDED(4, "券码已退款"),
//5 团购有效期尚未开始
GROUP_NOT_START(5, "团购有效期尚未开始"),
//6 券码已过期,系统将自动发起退款
EXPIRED(6, "券码已过期,系统将自动发起退款"),
//31 券码退款中(用户申请)
REFUNDING_31(31, "券码退款中(用户申请)"),
//32 券码退款中(过期自动退)
REFUNDING_32(32, "券码退款中(过期自动退)"),
;
private Integer code;
private String value;
VerifyResultsEnum() {
}
VerifyResultsEnum(Integer code, String value) {
this.code = code;
this.value = value;
}
public Integer getCode() {
return code;
}
public void setCode(Integer code) {
this.code = code;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
}
......@@ -5,15 +5,14 @@ import cn.hutool.core.date.DateUtil;
import cn.hutool.http.HttpRequest;
import cn.hutool.http.HttpUtil;
import cn.hutool.json.JSONObject;
import com.google.gson.JsonObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import share.common.core.redis.RedisUtil;
import share.common.enums.ErrorCodeEnum;
import share.common.enums.ReceiptRdeisEnum;
import share.common.enums.VerifyResultsEnum;
import share.system.service.TiktokService;
import java.util.Date;
......@@ -98,10 +97,10 @@ public class TiktokServiceImpl implements TiktokService {
JSONObject extra = entries.getJSONObject("extra");
if (data.getStr("error_code").equals(ErrorCodeEnum.SUCCESS.getCode()) && data.getJSONObject("verify_results").getStr("result").equals(ErrorCodeEnum.SUCCESS.getCode())) {
return "验卷成功";
} else if (data.getStr("error_code").equals("1208") || data.getJSONObject("verify_results").getStr("result").equals("2")) {
} else if (data.getStr("error_code").equals("1208") || data.getJSONObject("verify_results").getStr("result").equals(VerifyResultsEnum.COOKED.getCode())) {
return "验卷成功";
} else if (!data.getStr("error_code").equals(ErrorCodeEnum.SUCCESS.getCode())) {
return "验卷失败";
compensate(verifyToken, poiId, encryptedCodes);
}
return "验卷失败";
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment