记得上下班打卡 | git大法好,push需谨慎

Commit 8987c844 authored by zhanggb's avatar zhanggb

~api:nft账号开通+认证失败缓存校验;

parent d4aa10f8
......@@ -43,8 +43,8 @@ public class GoblinNFTUserController {
@PostMapping(value = "open/account")
public ResponseDto<GoblinUserNftAccInfoVo> openAccount(@Pattern(regexp = "\\b(NFT_ZX)\\b", message = "业务码无效")
@RequestParam String bizCode,
@RequestParam(required = true) String name,
@RequestParam(required = true) String idCard) {
@RequestParam String name,
@RequestParam String idCard) {
if (!java.util.regex.Pattern.matches(LnsRegex.Valid.CN_HANZI, name)) {
return ResponseDto.failure(ErrorMapping.get("140013"));
}
......@@ -54,10 +54,18 @@ public class GoblinNFTUserController {
if (IDCardUtil.getAge(idCard) < 18) {
return ResponseDto.failure(ErrorMapping.get("140010"));
}
try {
String currentUid = CurrentUtil.getCurrentUid();
String mobile = (String) CurrentUtil.getTokenClaims().get(CurrentUtil.TOKEN_MOBILE);
try {
if (goblinRedisUtils.isCertmetaJunk(1, idCard, name, mobile)) {// 实名认证失败缓存命中
return ResponseDto.failure(ErrorMapping.get("140016"));
}
GoblinUserNftAccInfoVo openAccountInfo = goblinRedisUtils.getOpenAccountInfo(currentUid);
if (null != openAccountInfo) {// 已申请开通或开通处理中
return ResponseDto.success(openAccountInfo);
}
return goblinNftUserService.openNftAccount(currentUid, bizCode, name, idCard, mobile);
} catch (Exception e) {
if (e instanceof LiquidnetServiceException) {
......
......@@ -33,8 +33,7 @@ public class GoblinNftUserServiceImpl implements IGoblinNftUserService {
@Override
public ResponseDto<GoblinUserNftAccInfoVo> openNftAccount(String uid, String bizCode, String name, String idCard, String mobile) {
GoblinUserNftAccInfoVo openAccountInfo = goblinRedisUtils.getOpenAccountInfo(uid);
if (null != openAccountInfo) return ResponseDto.success(openAccountInfo);
GoblinUserNftAccInfoVo openAccountInfo;
switch (bizCode) {
case "NFT_ZX":
GalaxyUserRegisterReqDto userRegisterReqDto = GalaxyUserRegisterReqDto.getNew();
......
......@@ -8,7 +8,6 @@ import com.liquidnet.commons.lang.util.JsonUtils;
import com.liquidnet.commons.lang.util.RandomUtil;
import com.liquidnet.service.goblin.constant.GoblinRedisConst;
import com.liquidnet.service.goblin.constant.GoblinStatusConst;
import com.liquidnet.service.goblin.constant.NftAccStatusEnum;
import com.liquidnet.service.goblin.dto.GoblinStoreMarketDto;
import com.liquidnet.service.goblin.dto.GoblinUserNftAccInfoVo;
import com.liquidnet.service.goblin.dto.manage.vo.GoblinGoodsAnticipateValueVo;
......@@ -1913,6 +1912,29 @@ public class GoblinRedisUtils {
}
}
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | NFT三要素认证缓存的<ID_TYPE+ID_NO, "ID_NAME,MOBILE"> */
public boolean setCertmetaJunk(int idType, String idNo, String idName, String mobile) {
return redisUtil.set(GoblinRedisConst.REDIS_GOBLIN_NFT_CERTMETA_JUNK + idType + idNo, idName.concat(",").concat(mobile), 604800);
}
public boolean isCertmetaJunk(int idType, String idNo, String idName, String mobile) {
String val = (String) redisUtil.get(GoblinRedisConst.REDIS_GOBLIN_NFT_CERTMETA_JUNK + idType + idNo);
return !StringUtils.isEmpty(val) && val.equals(idName.concat(",").concat(mobile));
}
public boolean setCertmeta(int idType, String idNo, String idName, String mobile) {
return redisUtil.set(GoblinRedisConst.REDIS_GOBLIN_NFT_CERTMETA + idType + idNo, idName.concat(",").concat(mobile));
}
public int isCertmeta(int idType, String idNo, String idName, String mobile) {
String o = (String) redisUtil.get(GoblinRedisConst.REDIS_GOBLIN_NFT_CERTMETA + idType + idNo);
if (StringUtils.isEmpty(o)) {
return -1;
}
return o.equals(idName.concat(",").concat(mobile)) ? 1 : 0;
}
/* ---------------------------------------- ---------------------------------------- */
/* ---------------------------------------- ---------------------------------------- */
}
......@@ -16,6 +16,7 @@
140013=\u8EAB\u4EFD\u8BC1\u59D3\u540D\u4E0D\u5408\u89C4
140014=\u8EAB\u4EFD\u8BC1\u53F7\u7801\u4E0D\u5408\u89C4
140015=\u8D26\u53F7\u5F00\u901A\u5931\u8D25\uFF0C\u8BF7\u8054\u7CFB\u5BA2\u670D
140016=\u8BC1\u4EF6\u4FE1\u606F\u6216\u624B\u673A\u53F7\u4E0D\u4E00\u81F4
......
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