实名认证提取魔法数字

This commit is contained in:
yanglei 2026-01-09 10:47:22 +08:00
parent 21ac49f83c
commit dfdabcbe1c
2 changed files with 11 additions and 4 deletions

View File

@ -43,6 +43,8 @@ public interface GlobalConstants {
String STATUS_FIVE = "5";
String REALNAME_VERIFY_SUCCESS_CODE = "10000";
// LONG 型常量
Long LONG_MINUS_ONE = -1L;

View File

@ -5,6 +5,7 @@ import com.cdp.product.security.exception.DecryptFailureException;
import com.cdp.product.security.exception.EncryptFailureException;
import com.cdp.product.security.exception.SignFailureException;
import com.cdp.product.security.strategyImpl.SM2StrategyImpl;
import com.cdzy.common.enums.GlobalConstants;
import com.cdzy.common.ex.EbikeException;
import com.cdzy.common.secure.SecureComponent;
import com.cdzy.common.secure.SecureSM2Component;
@ -37,7 +38,11 @@ import javax.crypto.spec.SecretKeySpec;
import java.nio.charset.StandardCharsets;
import java.security.Security;
import java.time.LocalDateTime;
import java.util.*;
import java.util.Base64;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import java.util.StringJoiner;
/**
* 验证工具类
@ -183,7 +188,7 @@ public class VerifyUtil {
throw new EbikeException("验证用户实名失败");
}
String code = result.has("code") ? result.get("code").asText() : "";
if (!"10000".equals(code)) {
if (!GlobalConstants.REALNAME_VERIFY_SUCCESS_CODE.equals(code)) {
String message = result.has("message") ? result.get("message").asText() : "未知错误";
log.error("验证用户实名失败, code: {}, message: {}", code, message);
throw new EbikeException(message.replace("(", "").replace(")", ""));