using System.Threading.Tasks; using GxPress.Auth; using GxPress.Common.Page; using GxPress.Request.Analyze; using GxPress.Request.App.Analyze; using GxPress.Result.App.Analyze; using GxPress.Service.Interface.Analyze; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; namespace GxPress.Api.AppControllers { [Route("api/app/analyze")] [ApiController] [Authorize] public class AnalyzeController : ControllerBase { private readonly IAnalyzeService _analyzeService; private readonly ILoginContext _loginContext; public AnalyzeController(IAnalyzeService analyzeService,ILoginContext loginContext) { _analyzeService = analyzeService; _loginContext=loginContext; } /// <summary> /// 设置 点赞 转发 收藏 /// </summary> /// <param name="request"></param> /// <returns></returns> [HttpPost("set")] public async Task<bool> SetAnalyzeAsync(AnalyzeRequest request) { request.UserId=_loginContext.AccountId; return await _analyzeService.SetAnalyzeAsync(request); } /// <summary> /// 获取点赞数据 /// </summary> /// <param name="request"></param> /// <returns></returns> [HttpPost("list")] public async Task<PagedList<PraisePageResult>> GetPraisePageAsync(PraisePageSearchRequest request) { return await _analyzeService.GetPraisePageAsync(request); } } }