Commit 63d00c2bf268f385618ad293c2a0a6abbca2b8d1
1 parent
479af56a
✨ feat(im): 增加好友申请的逻辑(v1.1:增加各种 code review 注释)
Showing
1 changed file
with
2 additions
and
0 deletions
yudao-module-im/src/main/java/cn/iocoder/yudao/module/im/service/friend/ImFriendRequestServiceImpl.java
| ... | ... | @@ -69,6 +69,7 @@ public class ImFriendRequestServiceImpl implements ImFriendRequestService { |
| 69 | 69 | adminUserApi.validateUser(toUserId); |
| 70 | 70 | // 1.3 已是好友:直接幂等返回 |
| 71 | 71 | ImFriendDO friend = friendService.getFriend(fromUserId, toUserId); |
| 72 | + // TODO @AI:已经是好友,直接提示报错;不用触发; | |
| 72 | 73 | if (friend != null && CommonStatusEnum.isEnable(friend.getStatus())) { |
| 73 | 74 | return null; |
| 74 | 75 | } |
| ... | ... | @@ -80,6 +81,7 @@ public class ImFriendRequestServiceImpl implements ImFriendRequestService { |
| 80 | 81 | log.info("[applyFriend][fromUserId({}) 被 toUserId({}) 拉黑,静默忽略]", fromUserId, toUserId); |
| 81 | 82 | return null; |
| 82 | 83 | } |
| 84 | + // TODO @AI:如果是单向好友(对方没删除);我删除了;是不是直接更新状态就好了;(不然会被对方发现!) | |
| 83 | 85 | |
| 84 | 86 | // 2. 落库:复用最新一条未处理记录;否则新建 |
| 85 | 87 | ImFriendRequestDO request = friendRequestMapper.selectLatestByFromUserIdAndToUserId(fromUserId, toUserId); | ... | ... |