Commit 88cff9c8 authored by liwei's avatar liwei

增加了用户详情点赞和关注自己对自己的判断

parent 44bc8b96
...@@ -633,6 +633,11 @@ public class MemInfoServiceImpl extends ServiceImpl<MemInfoRepository,MemInfo> ...@@ -633,6 +633,11 @@ public class MemInfoServiceImpl extends ServiceImpl<MemInfoRepository,MemInfo>
@Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.DEFAULT) @Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.DEFAULT)
@Override @Override
public CyPersistModel addFollow(MemFollowDTO followDTO){ public CyPersistModel addFollow(MemFollowDTO followDTO){
String userId = CyUserUtil.getAuthenBusinessId();
if (userId.equals(String.valueOf(followDTO.getTargetId()))){
//不能自己给自己点赞
throw new CyServiceException("不能关注自己!");
}
//添加到关注表 //添加到关注表
int line = baseMapper.addFollow(followDTO); int line = baseMapper.addFollow(followDTO);
return new CyPersistModel(line); return new CyPersistModel(line);
...@@ -669,8 +674,12 @@ public class MemInfoServiceImpl extends ServiceImpl<MemInfoRepository,MemInfo> ...@@ -669,8 +674,12 @@ public class MemInfoServiceImpl extends ServiceImpl<MemInfoRepository,MemInfo>
*/ */
@Override @Override
public CyPersistModel addLike(MemLikeDTO likeDTO) { public CyPersistModel addLike(MemLikeDTO likeDTO) {
//获取当前登录用户id //获取当前登录用户id 和 目标用户id
String userId = CyUserUtil.getAuthenBusinessId(); String userId = CyUserUtil.getAuthenBusinessId();
if (userId.equals(String.valueOf(likeDTO.getTargetId()))){
//不能自己给自己点赞
throw new CyServiceException("不能给自己点赞!");
}
//添加实名判断 //添加实名判断
userUtil.checkUserAuth("请先实名认证!"); userUtil.checkUserAuth("请先实名认证!");
//获取当前日期 例2025/2/20 获取02和20 用来存redis //获取当前日期 例2025/2/20 获取02和20 用来存redis
......
...@@ -653,6 +653,7 @@ public class OpmArticleServiceImpl extends ServiceImpl<OpmArticleRepository, Opm ...@@ -653,6 +653,7 @@ public class OpmArticleServiceImpl extends ServiceImpl<OpmArticleRepository, Opm
createDate = sdf.format(new Date()); createDate = sdf.format(new Date());
commentedUserId = Integer.valueOf(userId); commentedUserId = Integer.valueOf(userId);
} else { } else {
//发的是二级评论
createDate = String.valueOf(comment.getCreateDate()); createDate = String.valueOf(comment.getCreateDate());
commentedUserId = comment.getCreateBy(); commentedUserId = comment.getCreateBy();
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment