前端:
1、会话列表、消息界面展示与后端打通 后端: 1、修复会话和消息服务现存问题 2、会话对象不再返回Message对象,而是使用MessageBaseDto替代 3、修改查询会话列表和会话信息的逻辑 4、新增消息列表查询 文档: 后端代码规范文档新增从数据库同步到模型的命令
This commit is contained in:
@@ -28,6 +28,14 @@ namespace IM_API.Controllers
|
||||
var res = new BaseResponse<List<ConversationDto>>(list);
|
||||
return Ok(res);
|
||||
}
|
||||
[HttpGet]
|
||||
public async Task<IActionResult> Get([FromQuery]int conversationId)
|
||||
{
|
||||
var userIdStr = User.FindFirstValue(ClaimTypes.NameIdentifier);
|
||||
var conversation = await _conversationSerivice.GetConversationByIdAsync(int.Parse(userIdStr), conversationId);
|
||||
var res = new BaseResponse<ConversationDto>(conversation);
|
||||
return Ok(res);
|
||||
}
|
||||
[HttpPost]
|
||||
public async Task<IActionResult> Clear()
|
||||
{
|
||||
|
||||
@@ -3,6 +3,7 @@ using IM_API.Interface.Services;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Security.Claims;
|
||||
|
||||
namespace IM_API.Controllers
|
||||
@@ -33,5 +34,13 @@ namespace IM_API.Controllers
|
||||
await _messageService.SendGroupMessageAsync(int.Parse(userIdstr), dto.ReceiverId, dto);
|
||||
return Ok(new BaseResponse<object?>());
|
||||
}
|
||||
[HttpGet]
|
||||
public async Task<IActionResult> GetMessageList([Required]int conversationId, int? msgId, int? pageSize)
|
||||
{
|
||||
var userIdStr = User.FindFirstValue(ClaimTypes.NameIdentifier);
|
||||
var msgList = await _messageService.GetMessagesAsync(int.Parse(userIdStr), conversationId, msgId, pageSize, false);
|
||||
var res = new BaseResponse<List<MessageBaseDto>>(msgList);
|
||||
return Ok(res);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user