add friend focus with updating fanscount and follow_count

main
wangqing 10 months ago
parent 6339c7d067
commit 80e4db53b6

@ -25,7 +25,7 @@ public class FriendController {
private UserClient userClient; private UserClient userClient;
/** /**
* * 12
* *
* @return * @return
*/ */
@ -38,13 +38,13 @@ public class FriendController {
return Result.unauthorized(null); return Result.unauthorized(null);
} }
String userid = claims.getId(); String userid = claims.getId();
//判断是添加好友还是非好友 //判断是添加好友还是非好友(判断是关注操作还是拉黑操作)
if (type != null) { if (type != null) {
if (type.equals("1")) { if (type.equals("1")) {
//添加好友 //添加好友
int flag = friendService.addFriend(userid,friendid); int flag = friendService.addFriend(userid,friendid);
if (flag == 0) { 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) { if (flag == 1) {
userClient.updatefanscountandfollowcount(userid,friendid,1); userClient.updatefanscountandfollowcount(userid,friendid,1);

@ -238,6 +238,7 @@ public class UserInfoService {
return null; return null;
} }
@Transactional
public void updatefanscountandfollowcount(int x, String userInfoid, String friendid) { public void updatefanscountandfollowcount(int x, String userInfoid, String friendid) {
userInfoDao.updatefanscount(x, friendid); userInfoDao.updatefanscount(x, friendid);
userInfoDao.updatefollowcount(x, userInfoid); userInfoDao.updatefollowcount(x, userInfoid);

Loading…
Cancel
Save