WebAnalyzeController.cs 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. using System.Threading.Tasks;
  2. using GxPress.Auth;
  3. using GxPress.Common.Page;
  4. using GxPress.Request.Analyze;
  5. using GxPress.Request.App.Analyze;
  6. using GxPress.Result.App.Analyze;
  7. using GxPress.Service.Interface.Analyze;
  8. using Microsoft.AspNetCore.Authorization;
  9. using Microsoft.AspNetCore.Mvc;
  10. namespace GxPress.Api.WebControllers
  11. {
  12. /// <summary>
  13. /// 点赞 转发 收藏
  14. /// </summary>
  15. [Route("api/web/analyze")]
  16. [ApiController]
  17. [Authorize]
  18. public class WebAnalyzeController : Controller
  19. {
  20. private readonly IAnalyzeService _analyzeService;
  21. private readonly ILoginContext _loginContext;
  22. public WebAnalyzeController(IAnalyzeService analyzeService, ILoginContext loginContext)
  23. {
  24. _analyzeService = analyzeService;
  25. _loginContext = loginContext;
  26. }
  27. /// <summary>
  28. /// 设置 点赞 转发 收藏
  29. /// </summary>
  30. /// <param name="request"></param>
  31. /// <returns></returns>
  32. [HttpPost("set")]
  33. public async Task<bool> SetAnalyzeAsync(AnalyzeRequest request)
  34. {
  35. request.UserId = _loginContext.AccountId;
  36. return await _analyzeService.SetAnalyzeAsync(request);
  37. }
  38. /// <summary>
  39. /// 获取点赞数据
  40. /// </summary>
  41. /// <param name="request"></param>
  42. /// <returns></returns>
  43. [HttpPost("list")]
  44. public async Task<PagedList<PraisePageResult>> GetPraisePageAsync(PraisePageSearchRequest request)
  45. {
  46. return await _analyzeService.GetPraisePageAsync(request);
  47. }
  48. }
  49. }