条款、服务协议、隐私政策 这些长text字段,为减缓宽带消耗,放到oss中加载
This commit is contained in:
@@ -2,6 +2,7 @@ package com.sqx.modules.common.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import cn.hutool.core.util.ArrayUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
@@ -66,6 +67,7 @@ public class CommonInfoServiceImpl extends ServiceImpl<CommonInfoDao, CommonInfo
|
||||
}
|
||||
commonInfoDao.updateById(commonInfo);
|
||||
cleanAppKv();
|
||||
cleanAppOssKv(commonInfo.getType());
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@@ -77,6 +79,10 @@ public class CommonInfoServiceImpl extends ServiceImpl<CommonInfoDao, CommonInfo
|
||||
@CacheEvict(key = "#id")
|
||||
@Override
|
||||
public Result delete(long id) {
|
||||
CommonInfo commonInfo = commonInfoDao.selectById(id);
|
||||
if(commonInfo != null){
|
||||
cleanAppOssKv(commonInfo.getType());
|
||||
}
|
||||
commonInfoDao.deleteById(id);
|
||||
cleanAppKv();
|
||||
return Result.success();
|
||||
@@ -86,7 +92,9 @@ public class CommonInfoServiceImpl extends ServiceImpl<CommonInfoDao, CommonInfo
|
||||
@Override
|
||||
public Result updateBody(CommonInfo commonInfo) {
|
||||
commonInfoDao.updateById(commonInfo);
|
||||
|
||||
cleanAppKv();
|
||||
cleanAppOssKv(commonInfo.getType());
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@@ -122,10 +130,16 @@ public class CommonInfoServiceImpl extends ServiceImpl<CommonInfoDao, CommonInfo
|
||||
@Override
|
||||
public void cleanAppKv() {
|
||||
cacheManager.getCache("commonInfoAppKv").clear();
|
||||
redisUtils.delete(SYS_OSS_CONFIG_JSON_URL_KEY);
|
||||
}
|
||||
|
||||
private void cleanAppOssKv(Integer key) {
|
||||
if (ArrayUtil.contains(PUT_OSS_KEYS, key)) {
|
||||
redisUtils.delete(SYS_OSS_CONFIG_JSON_URL_KEY);
|
||||
}
|
||||
}
|
||||
|
||||
private static final String SYS_OSS_CONFIG_JSON_URL_KEY = "SYS_OSS_CONFIG_JSON_URL";
|
||||
private static final Integer[] PUT_OSS_KEYS = {154, 155, 246};
|
||||
|
||||
@Override
|
||||
public String putOss() {
|
||||
@@ -135,7 +149,7 @@ public class CommonInfoServiceImpl extends ServiceImpl<CommonInfoDao, CommonInfo
|
||||
}
|
||||
List<CommonInfo> list = commonInfoDao.selectList(Wrappers.<CommonInfo>lambdaQuery()
|
||||
.eq(CommonInfo::getIsAppUse, 1)
|
||||
.in(CommonInfo::getType, 154, 155, 246));
|
||||
.in(CommonInfo::getType, PUT_OSS_KEYS));
|
||||
if (CollUtil.isEmpty(list)) {
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -180,7 +180,9 @@ public class DiscSpinningController {
|
||||
Integer i = recordService.countDraw(userId);
|
||||
if ((i != null && i.equals(2)) || !source.equals(1)) {
|
||||
boolean auth = userInfoService.isAuth(userId);
|
||||
if(!auth) return Result.error("剩余抽奖活动需要实名认证后进行");
|
||||
if(!auth) {
|
||||
return Result.error("剩余抽奖活动需要实名认证后进行");
|
||||
}
|
||||
}
|
||||
if (source == null || source.equals(1)) {
|
||||
source = 1;
|
||||
|
||||
Reference in New Issue
Block a user