Helius
2020-05-29 790a6e131faeeb3244490feb919bf59ebaecdc2a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package com.xcong.excoin.common.system.service.impl;
 
import cn.hutool.core.util.StrUtil;
import com.xcong.excoin.common.contants.AppContants;
import com.xcong.excoin.common.system.service.CommonService;
import com.xcong.excoin.utils.RedisUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
 
import javax.annotation.Resource;
 
/**
 * @author wzy
 * @date 2020-05-29
 **/
@Slf4j
@Service
public class CommonServiceImpl implements CommonService {
 
    @Resource
    private RedisUtils redisUtils;
 
    @Override
    public boolean verifyCode(String account, String code) {
        String cacheCode = redisUtils.getString(AppContants.VERIFY_CODE_PREFIX + account);
        if (StrUtil.isBlank(cacheCode)) {
            return false;
        }
 
        return code.equals(cacheCode);
    }
}