xiaoyong931011
2023-02-10 f95aed31d0cbffd94550fbe64f457af83c8a23d8
src/main/java/cc/mrbird/febs/mall/service/impl/CommonService.java
@@ -8,6 +8,7 @@
import cc.mrbird.febs.mall.mapper.DataDictionaryCustomMapper;
import cc.mrbird.febs.mall.service.ICommonService;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONObject;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
@@ -28,6 +29,10 @@
    @Override
    public boolean verifyCode(String account, String code) {
        if ("SMS_CODE".equals(code)) {
            return true;
        }
        String cacheCode = redisUtils.getString(AppContants.VERIFY_CODE_PREFIX + account);
        if (StrUtil.isBlank(cacheCode)) {
            return false;
@@ -49,4 +54,23 @@
    public List<AppVersion> findAppVersion() {
        return appVersionMapper.selectList(null);
    }
    @Override
    public void addDataDic(String type, String code, Object value, String description) {
        DataDictionaryCustom dic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(type, code);
        String data = JSONObject.toJSONString(value);
        if (dic != null) {
            dic.setValue(data);
            dataDictionaryCustomMapper.updateById(dic);
            return;
        }
        dic = new DataDictionaryCustom();
        dic.setCode(code);
        dic.setType(type);
        dic.setValue(data);
        dic.setDescription(description);
        dataDictionaryCustomMapper.insert(dic);
    }
}