InboxController.cs 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. using System.Collections.Generic;
  2. using System.Threading.Tasks;
  3. using GxPress.Request.Inbox;
  4. using Microsoft.AspNetCore.Authorization;
  5. using Microsoft.AspNetCore.Mvc;
  6. using GxPress.Repository.Interface;
  7. using GxPress.Auth;
  8. namespace GxPress.Api.AppControllers
  9. {
  10. /// <summary>
  11. /// 收件箱
  12. /// </summary>
  13. [Route("api/app/inbox")]
  14. [ApiController]
  15. [Authorize]
  16. public class InboxController : ControllerBase
  17. {
  18. private readonly IMiddleRepository middleRepository;
  19. private readonly ILoginContext _loginContext;
  20. public InboxController(IMiddleRepository middleRepository, ILoginContext loginContext)
  21. {
  22. this.middleRepository = middleRepository;
  23. _loginContext = loginContext;
  24. }
  25. /// <summary>
  26. /// 搜索
  27. /// </summary>
  28. /// <param name="request"></param>
  29. /// <returns></returns>
  30. [HttpPost("search")]
  31. public async Task<IEnumerable<Entity.Middle.Middle>> Search(InboxSearchRequest request)
  32. {
  33. request.UserId = _loginContext.AccountId;
  34. return await middleRepository.FindAsync(request);
  35. }
  36. }
  37. }