Commit 88cff9c8 authored by liwei's avatar liwei

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

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