ReplyController.cs 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. using Microsoft.AspNetCore.Mvc;
  2. using GxPress.Service.Interface.Reply;
  3. using System.Threading.Tasks;
  4. using System.Collections.Generic;
  5. using GxPress.Request.Reply;
  6. using GxPress.Result.Reply;
  7. using GxPress.Auth;
  8. using Microsoft.AspNetCore.Authorization;
  9. namespace GxPress.Api.AppControllers
  10. {
  11. /// <summary>
  12. /// 回复我的
  13. /// </summary>
  14. [Route("api/app/reply")]
  15. [ApiController]
  16. [Authorize]
  17. public class ReplyController : Controller
  18. {
  19. private readonly IReplyService replyService;
  20. private readonly ILoginContext _loginContext;
  21. public ReplyController(IReplyService replyService, ILoginContext _loginContext)
  22. {
  23. this.replyService = replyService;
  24. this._loginContext = _loginContext;
  25. }
  26. /// <summary>
  27. /// 获取回复我的笔记或者话题
  28. /// </summary>
  29. /// <param name="request"></param>
  30. /// <returns></returns>
  31. [HttpPost("list")]
  32. public async Task<IEnumerable<ReplyResult>> GetReplyNoteOrTopicResults(ReplyRequest request)
  33. {
  34. request.UserId = _loginContext.AccountId;
  35. return await replyService.GetReplyResults(request);
  36. }
  37. /// <summary>
  38. /// 获取我收到的赞
  39. /// </summary>
  40. /// <param name="request"></param>
  41. /// <returns></returns>
  42. [HttpPost("praise")]
  43. public async Task<IEnumerable<ReplyResult>> GetPraiseAsync(ReplyRequest request)
  44. {
  45. request.UserId = _loginContext.AccountId;
  46. return await replyService.GetPraiseAsync(request);
  47. }
  48. }
  49. }