This commit is contained in:
张良(004796)
2024-01-26 13:51:04 +08:00
parent 01b44c98ec
commit 33038ad34a
5 changed files with 13 additions and 6 deletions

View File

@@ -58,6 +58,9 @@ public class UserFollowServiceImpl extends ServiceImpl<UserFollowMapper, UserFol
@Transactional(rollbackFor = Exception.class)
public boolean star(StarOrVisitorReq starOrVisitorReq) {
Long fromUserId = LoginHelper.getUserId();
if(starOrVisitorReq.getToUserId().equals(fromUserId)){
throw new ServiceException("不能关注自己哦");
}
this.remove(Wrappers.lambdaQuery(UserFollow.class)
.eq(UserFollow::getUserId,fromUserId)
.eq(UserFollow::getFollowUser, starOrVisitorReq.getToUserId()));