add(conversationSerivice):后端新增消息会话服务add(main):完善主面板

This commit is contained in:
2025-12-29 20:39:29 +08:00
parent 06410a75e7
commit cf09984056
21 changed files with 1146 additions and 444 deletions
@@ -0,0 +1,33 @@
using IM_API.Dtos;
using IM_API.Interface.Services;
using IM_API.Models;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using System.Security.Claims;
namespace IM_API.Controllers
{
[Route("api/[controller]/[action]")]
[Authorize]
[ApiController]
public class ConversationController : ControllerBase
{
private readonly IConversationService _conversationSerivice;
private readonly ILogger<ConversationController> _logger;
public ConversationController(IConversationService conversationSerivice, ILogger<ConversationController> logger)
{
_conversationSerivice = conversationSerivice;
_logger = logger;
}
[HttpGet]
public async Task<IActionResult> List()
{
var userIdStr = User.FindFirstValue(ClaimTypes.NameIdentifier);
var list = await _conversationSerivice.GetConversationsAsync(int.Parse(userIdStr));
var res = new BaseResponse<List<Conversation>>(list);
return Ok(res);
}
}
}