Merge branch 'feature-nxdev' of https://gitea.nxsir.cn/code/IM into feature-nxdev

This commit is contained in:
2026-02-03 22:46:34 +08:00
73 changed files with 1342 additions and 484 deletions
+4 -5
View File
@@ -1,6 +1,6 @@
using AutoMapper;
using IM_API.Domain.Events;
using IM_API.Dtos;
using IM_API.Dtos.Friend;
using IM_API.Exceptions;
using IM_API.Interface.Services;
using IM_API.Models;
@@ -117,15 +117,12 @@ namespace IM_API.Services
var friend = await _context.Friends.FirstOrDefaultAsync(
x => x.UserId == friendRequest.RequestUser && x.FriendId == friendRequest.ResponseUser
);
if (friend is null) throw new BaseException(CodeDefine.FRIEND_RELATION_NOT_FOUND);
if (friend.StatusEnum != FriendStatus.Pending) throw new BaseException(CodeDefine.FRIEND_REQUEST_EXISTS);
if (friend != null) throw new BaseException(CodeDefine.ALREADY_FRIENDS);
//处理好友请求操作
switch (requestDto.Action)
{
//拒绝后标记
case HandleFriendRequestAction.Reject:
friend.StatusEnum = FriendStatus.Declined;
friendRequest.StateEnum = FriendRequestState.Declined;
break;
@@ -141,6 +138,8 @@ namespace IM_API.Services
OperatorId = friendRequest.ResponseUser,
RequestInfo = _mapper.Map<FriendRequestDto>(friendRequest),
requestUserRemarkname = requestDto.RemarkName,
RequestUserId = friendRequest.RequestUser,
ResponseUserId = friendRequest.ResponseUser
});
break;