|
@@ -1170,12 +1170,32 @@ public class CommunityArticleController extends BaseController {
|
|
|
if (Objects.isNull(collectionId)) {
|
|
|
return AjaxResult.error("参数异常!");
|
|
|
}
|
|
|
+
|
|
|
+ CommunityCollection collection;
|
|
|
+ try {
|
|
|
+ collection = communityCollectionMapper.selectOne(new QueryWrapper<CommunityCollection>()
|
|
|
+ .eq("id", collectionId)
|
|
|
+ .and(wrapper -> wrapper.ne("is_delete", true).or().isNull("is_delete")));
|
|
|
+ } catch (Exception e) {
|
|
|
+ return AjaxResult.error("查询失败,请稍后再试!");
|
|
|
+ }
|
|
|
+
|
|
|
+ if (collection == null) {
|
|
|
+ return AjaxResult.error("合集不存在或已删除!");
|
|
|
+ }
|
|
|
+
|
|
|
+ Long userId = SecurityUtils.getLoginUser().getUserId();
|
|
|
+ if (!collection.getCreateBy().equals(userId)) {
|
|
|
+ return AjaxResult.error("合集只能本人删除!");
|
|
|
+ }
|
|
|
+
|
|
|
try {
|
|
|
communityCollectionService.deleteCollectionById(collectionId);
|
|
|
} catch (Exception e) {
|
|
|
log.info(e.getMessage());
|
|
|
throw new ProjectException();
|
|
|
}
|
|
|
+
|
|
|
return AjaxResult.success("删除成功!");
|
|
|
}
|
|
|
|