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