|
|
@@ -7,6 +7,7 @@ import java.util.stream.Collectors;
|
|
|
import com.fs.common.core.domain.R;
|
|
|
import com.fs.common.utils.DateUtils;
|
|
|
import com.fs.course.mapper.FsUserVideoCommentLikeMapper;
|
|
|
+import com.fs.course.mapper.FsUserVideoMapper;
|
|
|
import com.fs.course.param.FsUserVideoCommentAddUParam;
|
|
|
import com.fs.course.param.FsUserVideoCommentDelUParam;
|
|
|
import com.fs.course.param.FsUserVideoCommentUParam;
|
|
|
@@ -48,6 +49,9 @@ public class FsUserVideoCommentServiceImpl implements IFsUserVideoCommentService
|
|
|
@Autowired
|
|
|
private FsUserMapper fsUserMapper;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private FsUserVideoMapper fsUserVideoMapper;
|
|
|
+
|
|
|
private static final String COMMENT_LIST_KEY_PREFIX = "comment:list:video:";
|
|
|
private static final String COMMENT_HASH_KEY_PREFIX = "comment:hash:video:";
|
|
|
private static final String REPLY_LIST_KEY_PREFIX = "reply:list:comment:";
|
|
|
@@ -60,6 +64,7 @@ public class FsUserVideoCommentServiceImpl implements IFsUserVideoCommentService
|
|
|
private static final String COMMENT_REPLY_COUNT_KEY_PREFIX = "reply:count:comment:";
|
|
|
private static final String VIDEO_COMMENT_COUNT_KEY_PREFIX = "comment:count:video:";
|
|
|
|
|
|
+
|
|
|
/**
|
|
|
* 查询课堂视频评论
|
|
|
*
|
|
|
@@ -193,6 +198,9 @@ public class FsUserVideoCommentServiceImpl implements IFsUserVideoCommentService
|
|
|
if (fsUserVideoCommentMapper.insertFsUserVideoComment(comment)>0){
|
|
|
return R.ok().put("data",comment);
|
|
|
};
|
|
|
+ // 更新对应的评论数
|
|
|
+ fsUserVideoMapper.addCommentCount(comment.getVideoId());
|
|
|
+
|
|
|
return R.error("新增评论失败");
|
|
|
}
|
|
|
|
|
|
@@ -485,12 +493,15 @@ public class FsUserVideoCommentServiceImpl implements IFsUserVideoCommentService
|
|
|
@Override
|
|
|
@Transactional
|
|
|
public R delComment(FsUserVideoCommentDelUParam param) {
|
|
|
- // 更新评论数
|
|
|
- if (param.getParentId() == null) {
|
|
|
- //除数据库中的回复
|
|
|
- fsUserVideoCommentMapper.deleteByParentId(param.getCommentId().toString());
|
|
|
- }
|
|
|
+ // 只删除自己的评论,回复保留
|
|
|
+// if (param.getParentId() == null) {
|
|
|
+// //除数据库中的回复
|
|
|
+// fsUserVideoCommentMapper.deleteByParentId(param.getCommentId().toString());
|
|
|
+// }
|
|
|
+
|
|
|
fsUserVideoCommentMapper.deleteByCommentId(param.getCommentId());
|
|
|
+ // 评论数减一
|
|
|
+ fsUserVideoMapper.delCommentCount(param.getVideoId());
|
|
|
return R.ok();
|
|
|
}
|
|
|
|