|
@@ -19,6 +19,7 @@ import com.ruoyi.generator.domain.Community.*;
|
|
import com.ruoyi.generator.mapper.community.*;
|
|
import com.ruoyi.generator.mapper.community.*;
|
|
import com.ruoyi.generator.service.*;
|
|
import com.ruoyi.generator.service.*;
|
|
import com.ruoyi.generator.vo.*;
|
|
import com.ruoyi.generator.vo.*;
|
|
|
|
+import com.ruoyi.system.mapper.SysUserMapper;
|
|
import com.ruoyi.system.service.ISysUserService;
|
|
import com.ruoyi.system.service.ISysUserService;
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiOperation;
|
|
@@ -128,6 +129,11 @@ public class CommunityArticleController extends BaseController {
|
|
@Autowired
|
|
@Autowired
|
|
private CommunityArticleRecommendMapper recommendMapper;
|
|
private CommunityArticleRecommendMapper recommendMapper;
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ private CommunityReportController communityReportController;
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private SysUserMapper sysUserMapper;
|
|
|
|
|
|
/**
|
|
/**
|
|
* 生成唯一的缓存键(基于请求参数)
|
|
* 生成唯一的缓存键(基于请求参数)
|
|
@@ -182,6 +188,26 @@ public class CommunityArticleController extends BaseController {
|
|
if (communityArticle.getClassIds().isEmpty()) {
|
|
if (communityArticle.getClassIds().isEmpty()) {
|
|
return AjaxResult.error("板块不能为空");
|
|
return AjaxResult.error("板块不能为空");
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ //判断当前用户有没有被禁言
|
|
|
|
+ SysUser sysUser = sysUserMapper.selectUserById(SecurityUtils.getUserId());
|
|
|
|
+ if (sysUser != null){
|
|
|
|
+ String userState = sysUser.getUserState();
|
|
|
|
+ Date reportTime = sysUser.getReportTime();
|
|
|
|
+ if ("2".equals(userState) && reportTime != null) {
|
|
|
|
+ // 获取当前时间
|
|
|
|
+ Date currentTime = new Date();
|
|
|
|
+ System.out.println(reportTime);
|
|
|
|
+ System.out.println(currentTime);
|
|
|
|
+ // 检查 reportTime 小于当前时间
|
|
|
|
+ if (currentTime.before(reportTime)) {
|
|
|
|
+ // 返回封号的提示
|
|
|
|
+ return AjaxResult.success("当前用户已被禁言!");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
String title = communityArticle.getTitle();
|
|
String title = communityArticle.getTitle();
|
|
String content = communityArticle.getContent();
|
|
String content = communityArticle.getContent();
|
|
boolean isSensitiveTitle = SensitiveWordUtil.containsSensitiveWord(title);
|
|
boolean isSensitiveTitle = SensitiveWordUtil.containsSensitiveWord(title);
|
|
@@ -374,6 +400,21 @@ public class CommunityArticleController extends BaseController {
|
|
if (null == communityArticleComment.getArticleId()) {
|
|
if (null == communityArticleComment.getArticleId()) {
|
|
return AjaxResult.error("文章不存在或异常!");
|
|
return AjaxResult.error("文章不存在或异常!");
|
|
}
|
|
}
|
|
|
|
+ //判断当前用户有没有被禁言
|
|
|
|
+ SysUser sysUser = sysUserMapper.selectUserById(SecurityUtils.getUserId());
|
|
|
|
+ if (sysUser != null){
|
|
|
|
+ String userState = sysUser.getUserState();
|
|
|
|
+ Date reportTime = sysUser.getReportTime();
|
|
|
|
+ if ("2".equals(userState) && reportTime != null) {
|
|
|
|
+ // 获取当前时间
|
|
|
|
+ Date currentTime = new Date();
|
|
|
|
+ // 检查 reportTime 小于当前时间
|
|
|
|
+ if (currentTime.before(reportTime)) {
|
|
|
|
+ // 返回封号的提示
|
|
|
|
+ return AjaxResult.success("当前用户已被禁言!");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
|
|
//判断敏感词汇
|
|
//判断敏感词汇
|
|
boolean isSensitive = SensitiveWordUtil.containsSensitiveWord(communityArticleComment.getContent());
|
|
boolean isSensitive = SensitiveWordUtil.containsSensitiveWord(communityArticleComment.getContent());
|