|
|
@ -25,7 +25,7 @@ public class FriendController {
|
|
|
|
private UserClient userClient;
|
|
|
|
private UserClient userClient;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 添加好友或者添加非好友
|
|
|
|
* 添加好友或者添加非好友(关注还是拉黑) 1是关注,2是拉黑
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @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);
|
|
|
|