评论接口更改返回状态44

This commit is contained in:
wucongxing8150 2025-08-05 11:27:17 +08:00
parent 5ba59aecf9
commit d8f1eb8d16
3 changed files with 15 additions and 45 deletions

View File

@ -147,23 +147,17 @@ public class CaseClinicalArticleService {
// 获取文章数据
CaseClinicalArticleModel article = caseClinicalArticleDao.selectById(articleId);
if (article == null) {
resultData.put("status", 0);
resultData.put("message", "非法文章");
return resultData;
throw new BusinessException("非法文章");
}
if (article.getArticleStatus() != 1){
resultData.put("status", 0);
resultData.put("message", "非法文章");
return resultData;
throw new BusinessException("非法文章");
}
// 处理评论内容
BasicSensitiveWordService.FilterResult result = basicSensitiveWordService.filter(request.getContent());
if (result.hasSensitive == 1){
resultData.put("status", 0);
resultData.put("message", "存在敏感词,请修改后提交");
return resultData;
throw new BusinessException("存在敏感词,请修改后提交");
}
// 新增评论
@ -187,18 +181,14 @@ public class CaseClinicalArticleService {
int res = userCommentClinicalArticleDao.insert(userCommentClinicalArticleData);
if (res <= 0){
resultData.put("status", 0);
resultData.put("message", "操作失败");
return resultData;
throw new BusinessException("操作失败");
}
// 新增文章的统计字段
boolean r = IncClinicalArticleStats(articleId,3,1);
if (!r){
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
resultData.put("status", 0);
resultData.put("message", "操作失败");
return resultData;
throw new BusinessException("操作失败");
}
// 获取发放积分次数

View File

@ -183,23 +183,17 @@ public class CaseClinicalVideoService {
// 获取视频数据
CaseClinicalVideoModel video = caseClinicalVideoDao.selectById(videoId);
if (video == null) {
resultData.put("status", 0);
resultData.put("message", "非法视频");
return resultData;
throw new BusinessException("非法视频");
}
if (video.getVideoStatus() != 1){
resultData.put("status", 0);
resultData.put("message", "非法视频");
return resultData;
throw new BusinessException("非法视频");
}
// 处理评论内容
BasicSensitiveWordService.FilterResult result = basicSensitiveWordService.filter(request.getContent());
if (result.hasSensitive == 1){
resultData.put("status", 0);
resultData.put("message", "存在敏感词,请修改后提交");
return resultData;
throw new BusinessException("存在敏感词,请修改后提交");
}
// 新增评论
@ -223,18 +217,14 @@ public class CaseClinicalVideoService {
int res = userCommentClinicalVideoDao.insert(userCommentClinicalVideoData);
if (res <= 0){
resultData.put("status", 0);
resultData.put("message", "操作失败");
return resultData;
throw new BusinessException("操作失败");
}
// 新增文章的统计字段
boolean r = IncClinicalVideoStats(videoId,3,1);
if (!r){
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
resultData.put("status", 0);
resultData.put("message", "操作失败");
return resultData;
throw new BusinessException("操作失败");
}
// 获取发放积分次数

View File

@ -444,23 +444,17 @@ public class CaseExchangeService {
// 获取病例交流数据
CaseExchangeModel article = caseExchangeDao.selectById(exchangeId);
if (article == null) {
resultData.put("status", 0);
resultData.put("message", "非法病例交流");
return resultData;
throw new BusinessException("非法病例交流");
}
if (article.getExchangeStatus() != 1){
resultData.put("status", 0);
resultData.put("message", "非法病例交流");
return resultData;
throw new BusinessException("非法病例交流");
}
// 处理评论内容
BasicSensitiveWordService.FilterResult result = basicSensitiveWordService.filter(request.getContent());
if (result.hasSensitive == 1){
resultData.put("status", 0);
resultData.put("message", "存在敏感词,请修改后提交");
return resultData;
throw new BusinessException("存在敏感词,请修改后提交");
}
// 新增评论
@ -484,18 +478,14 @@ public class CaseExchangeService {
int res = userCommentExchangeDao.insert(userCommentExchangeData);
if (res <= 0){
resultData.put("status", 0);
resultData.put("message", "");
return resultData;
throw new BusinessException("操作失败");
}
// 新增统计字段
boolean r = IncCaseExchangeStats(exchangeId,3);
if (!r){
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
resultData.put("status", 0);
resultData.put("message", "");
return resultData;
throw new BusinessException("操作失败");
}
// 获取发放积分次数