Helius
2021-06-15 1410c2c53a44f66a3dd06b5fc3d9e8152a1d4bf1
src/main/java/com/xcong/excoin/common/system/service/impl/CommonServiceImpl.java
@@ -25,12 +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);
        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