From 80e4db53b63f3978b32d336915251517902375c4 Mon Sep 17 00:00:00 2001 From: wangqing <408564126@qq.com> Date: Thu, 25 Jan 2024 11:15:56 +0800 Subject: [PATCH] add friend focus with updating fanscount and follow_count --- .../java/com/luoo/friend/controller/FriendController.java | 6 +++--- .../main/java/com/luoo/user/service/UserInfoService.java | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/luoo_friend/src/main/java/com/luoo/friend/controller/FriendController.java b/luoo_friend/src/main/java/com/luoo/friend/controller/FriendController.java index 2f51878..f24a3c4 100644 --- a/luoo_friend/src/main/java/com/luoo/friend/controller/FriendController.java +++ b/luoo_friend/src/main/java/com/luoo/friend/controller/FriendController.java @@ -25,7 +25,7 @@ public class FriendController { private UserClient userClient; /** - * 添加好友或者添加非好友 + * 添加好友或者添加非好友(关注还是拉黑) 1是关注,2是拉黑 * * @return */ @@ -38,13 +38,13 @@ public class FriendController { return Result.unauthorized(null); } String userid = claims.getId(); - //判断是添加好友还是非好友 + //判断是添加好友还是非好友(判断是关注操作还是拉黑操作) if (type != null) { if (type.equals("1")) { //添加好友 int flag = friendService.addFriend(userid,friendid); if (flag == 0) { - return Result.failed(StatusCode.FRIEND_CAN_NOT_REPEAT_ADD_FRIEND); + return Result.failed(StatusCode.FRIEND_CAN_NOT_REPEAT_ADD_FRIEND); // 不能重复添加好友 } if (flag == 1) { userClient.updatefanscountandfollowcount(userid,friendid,1); diff --git a/luoo_user/src/main/java/com/luoo/user/service/UserInfoService.java b/luoo_user/src/main/java/com/luoo/user/service/UserInfoService.java index 1284b74..88d8c39 100644 --- a/luoo_user/src/main/java/com/luoo/user/service/UserInfoService.java +++ b/luoo_user/src/main/java/com/luoo/user/service/UserInfoService.java @@ -238,6 +238,7 @@ public class UserInfoService { return null; } + @Transactional public void updatefanscountandfollowcount(int x, String userInfoid, String friendid) { userInfoDao.updatefanscount(x, friendid); userInfoDao.updatefollowcount(x, userInfoid);