李昊 4 jaren geleden
bovenliggende
commit
8117a3517d
1 gewijzigde bestanden met toevoegingen van 51 en 0 verwijderingen
  1. 51 0
      gx_api/GxPress/Api/GxPress.Api/WebControllers/WebAnalyzeController.cs

+ 51 - 0
gx_api/GxPress/Api/GxPress.Api/WebControllers/WebAnalyzeController.cs

@@ -0,0 +1,51 @@
+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.WebControllers
+{
+    /// <summary>
+    ///  点赞 转发 收藏
+    /// </summary>
+    [Route("api/web/analyze")]
+    [ApiController]
+    [Authorize]
+    public class WebAnalyzeController : Controller
+    {
+        private readonly IAnalyzeService _analyzeService;
+        private readonly ILoginContext _loginContext;
+        public WebAnalyzeController(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);
+        }
+    }
+}