From 36be00e0f3cbe0d559c646fd2977e6e3a74aa6f9 Mon Sep 17 00:00:00 2001 From: KKSU <15274802129@163.com> Date: Mon, 30 Sep 2024 16:57:22 +0800 Subject: [PATCH] Merge branch 'bea' of http://120.27.238.55:7000/r/exchange into bea --- src/main/java/com/xcong/excoin/common/system/service/impl/CommonServiceImpl.java | 30 ++++++++++++++++++++++++++++-- 1 files changed, 28 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/xcong/excoin/common/system/service/impl/CommonServiceImpl.java b/src/main/java/com/xcong/excoin/common/system/service/impl/CommonServiceImpl.java index 842de88..3530375 100644 --- a/src/main/java/com/xcong/excoin/common/system/service/impl/CommonServiceImpl.java +++ b/src/main/java/com/xcong/excoin/common/system/service/impl/CommonServiceImpl.java @@ -25,13 +25,39 @@ @Override public boolean verifyCode(String account, String code) { + if(StrUtil.isBlank(code)){ + return false; + } String cacheCode = redisUtils.getString(AppContants.VERIFY_CODE_PREFIX + account); - log.info("---->{}", cacheCode); if (StrUtil.isBlank(cacheCode)) { return false; } + if (code.equals(cacheCode)) { + redisUtils.del(AppContants.VERIFY_CODE_PREFIX + account); + return true; + } else { + return false; + } + } - return code.equals(cacheCode); + @Override + public boolean mutiVerifyCode(String email, String emailCode, String phone, String phoneCode) { + if (StrUtil.isBlank(emailCode) || StrUtil.isBlank(phoneCode)) { + return false; + } + + String cacheEmailCode = redisUtils.getString(AppContants.VERIFY_CODE_PREFIX + email); + String cachePhoneCode = redisUtils.getString(AppContants.VERIFY_CODE_PREFIX + phone); + if (StrUtil.isBlank(cacheEmailCode) || StrUtil.isBlank(cachePhoneCode)) { + return false; + } + + if (emailCode.equals(cacheEmailCode) && phoneCode.equals(cachePhoneCode)) { + redisUtils.del(AppContants.VERIFY_CODE_PREFIX + email); + redisUtils.del(AppContants.VERIFY_CODE_PREFIX + phone); + return true; + } + return false; } @Override -- Gitblit v1.9.1