|
@@ -175,7 +175,7 @@ public class CommunityArticleController extends BaseController {
|
|
|
.eq("article_id", id)
|
|
|
.set("is_delete", true));
|
|
|
|
|
|
- if ( result1 && result2 >= 0 ) {
|
|
|
+ if (result1 && result2 >= 0) {
|
|
|
return success("删除成功!");
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
@@ -277,7 +277,19 @@ public class CommunityArticleController extends BaseController {
|
|
|
try {
|
|
|
//获取评论信息
|
|
|
CommunityArticleComment articleComment = communityArticleCommentMapper.selectById(communityArticleComment.getId());
|
|
|
- if (!articleComment.getCreateBy().equals(SecurityUtils.getUserId())) {
|
|
|
+ Long articleId = articleComment.getArticleId();
|
|
|
+ Long userId = SecurityUtils.getUserId();
|
|
|
+ if (articleId != null) {
|
|
|
+ CommunityArticle communityArticle = communityArticleService.getById(articleId);
|
|
|
+ if (communityArticle.getCreateBy().equals(userId)) {
|
|
|
+ //文章作者可以删除文章内的评论
|
|
|
+ //删除评论
|
|
|
+ communityArticleService.deleteComment(articleComment);
|
|
|
+ return AjaxResult.success("删除评论成功!");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!articleComment.getCreateBy().equals(userId)) {
|
|
|
return AjaxResult.error("不允许删除别人的评论!");
|
|
|
}
|
|
|
//删除评论
|
|
@@ -286,7 +298,7 @@ public class CommunityArticleController extends BaseController {
|
|
|
System.out.println(e.getMessage());
|
|
|
throw new ProjectException();
|
|
|
}
|
|
|
- return AjaxResult.success();
|
|
|
+ return AjaxResult.success("删除评论成功!");
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -696,7 +708,7 @@ public class CommunityArticleController extends BaseController {
|
|
|
int searchType = Convert.toInt(ServletUtils.getParameter("searchType"), 0);
|
|
|
List<CommunityUserLikeVo> communityUserLikeVos = null;
|
|
|
try {
|
|
|
- communityUserLikeVos = communityArticleService.selectCommunityUserLikeList(SecurityUtils.getLoginUser().getUserId(),userName,pageNum,pageSize,searchType);
|
|
|
+ communityUserLikeVos = communityArticleService.selectCommunityUserLikeList(SecurityUtils.getLoginUser().getUserId(), userName, pageNum, pageSize, searchType);
|
|
|
} catch (Exception e) {
|
|
|
System.out.println(e.getMessage());
|
|
|
throw new ProjectException();
|
|
@@ -707,7 +719,7 @@ public class CommunityArticleController extends BaseController {
|
|
|
|
|
|
@ApiOperation("获取粉丝列表")
|
|
|
@GetMapping("/userFans")
|
|
|
- public AjaxResult userFans(Long userId,String userName) {
|
|
|
+ public AjaxResult userFans(Long userId, String userName) {
|
|
|
if (Objects.isNull(userId)) {
|
|
|
userId = SecurityUtils.getLoginUser().getUserId();
|
|
|
}
|
|
@@ -717,7 +729,7 @@ public class CommunityArticleController extends BaseController {
|
|
|
List<CommunityUserLikeVo> communityUserLikeVos = null;
|
|
|
|
|
|
try {
|
|
|
- communityUserLikeVos = communityArticleService.selectUserFansList(userId,userName,pageNum,pageSize,searchType);
|
|
|
+ communityUserLikeVos = communityArticleService.selectUserFansList(userId, userName, pageNum, pageSize, searchType);
|
|
|
} catch (Exception e) {
|
|
|
System.out.println(e.getMessage());
|
|
|
throw new ProjectException();
|
|
@@ -735,7 +747,7 @@ public class CommunityArticleController extends BaseController {
|
|
|
|
|
|
List<CommunityUserLikeVo> communityUserLikeVos = null;
|
|
|
try {
|
|
|
- communityUserLikeVos = communityArticleService.selectMutualAttention(SecurityUtils.getLoginUser().getUserId(),userName,pageNum,pageSize,searchType);
|
|
|
+ communityUserLikeVos = communityArticleService.selectMutualAttention(SecurityUtils.getLoginUser().getUserId(), userName, pageNum, pageSize, searchType);
|
|
|
} catch (Exception e) {
|
|
|
System.out.println(e.getMessage());
|
|
|
throw new ProjectException();
|
|
@@ -801,7 +813,7 @@ public class CommunityArticleController extends BaseController {
|
|
|
|
|
|
List<CommunityCollectionVo> communityCollectionVos = null;
|
|
|
try {
|
|
|
- communityCollectionVos = communityCollectionService.selectUserCollection(userId, articleId,pageNum,pageSize,searchType);
|
|
|
+ communityCollectionVos = communityCollectionService.selectUserCollection(userId, articleId, pageNum, pageSize, searchType);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
System.out.println(e.getMessage());
|
|
@@ -881,6 +893,7 @@ public class CommunityArticleController extends BaseController {
|
|
|
|
|
|
/**
|
|
|
* 更新合集信息
|
|
|
+ *
|
|
|
* @param communityCollection
|
|
|
* @return
|
|
|
*/
|
|
@@ -904,7 +917,6 @@ public class CommunityArticleController extends BaseController {
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
/**
|
|
|
* 合集内新增文章
|
|
|
*
|
|
@@ -1118,7 +1130,7 @@ public class CommunityArticleController extends BaseController {
|
|
|
System.out.println(e.getMessage());
|
|
|
throw new ProjectException();
|
|
|
}
|
|
|
- return AjaxResult.success(communityArticleVos);
|
|
|
+ return AjaxResult.success(communityArticleVos);
|
|
|
}
|
|
|
|
|
|
@ApiOperation("个人收藏文章")
|
|
@@ -1136,7 +1148,7 @@ public class CommunityArticleController extends BaseController {
|
|
|
System.out.println(e.getMessage());
|
|
|
throw new ProjectException();
|
|
|
}
|
|
|
- return AjaxResult.success(communityArticleVos);
|
|
|
+ return AjaxResult.success(communityArticleVos);
|
|
|
}
|
|
|
|
|
|
@ApiOperation("个人陪伴信息")
|
|
@@ -1151,9 +1163,9 @@ public class CommunityArticleController extends BaseController {
|
|
|
try {
|
|
|
communityAccompany = communityAccompanyService.selectCommunityAccompanyById(userId);
|
|
|
} catch (Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
+ e.printStackTrace();
|
|
|
}
|
|
|
- return AjaxResult.success(communityAccompany);
|
|
|
+ return AjaxResult.success(communityAccompany);
|
|
|
}
|
|
|
|
|
|
}
|