|
@@ -0,0 +1,61 @@
|
|
|
|
+using Microsoft.AspNetCore.Mvc;
|
|
|
|
+using GxPress.Service.Interface.Reply;
|
|
|
|
+using System.Threading.Tasks;
|
|
|
|
+using System.Collections.Generic;
|
|
|
|
+using GxPress.Request.Reply;
|
|
|
|
+using GxPress.Result.Reply;
|
|
|
|
+using GxPress.Auth;
|
|
|
|
+using Microsoft.AspNetCore.Authorization;
|
|
|
|
+using System.Linq;
|
|
|
|
+
|
|
|
|
+namespace GxPress.Api.AppControllers
|
|
|
|
+{
|
|
|
|
+ /// <summary>
|
|
|
|
+ /// 回复我的
|
|
|
|
+ /// </summary>
|
|
|
|
+ [Route("api/web/reply")]
|
|
|
|
+ [ApiController]
|
|
|
|
+ [Authorize]
|
|
|
|
+ public class WebReplyController : Controller
|
|
|
|
+ {
|
|
|
|
+ private readonly IReplyService replyService;
|
|
|
|
+ private readonly ILoginContext _loginContext;
|
|
|
|
+ public WebReplyController(IReplyService replyService, ILoginContext _loginContext)
|
|
|
|
+ {
|
|
|
|
+ this.replyService = replyService;
|
|
|
|
+ this._loginContext = _loginContext;
|
|
|
|
+ }
|
|
|
|
+ /// <summary>
|
|
|
|
+ /// 获取回复我的笔记或者话题
|
|
|
|
+ /// </summary>
|
|
|
|
+ /// <param name="request"></param>
|
|
|
|
+ /// <returns></returns>
|
|
|
|
+ [HttpPost("list")]
|
|
|
|
+ public async Task<ReplyPraiseCountResult> GetReplyNoteOrTopicResults(ReplyRequest request)
|
|
|
|
+ {
|
|
|
|
+ request.UserId = _loginContext.AccountId;
|
|
|
|
+ var result = new ReplyPraiseCountResult();
|
|
|
|
+ result.Item = await replyService.GetReplyResults(request);
|
|
|
|
+ result.PraiseCount = await replyService.GetUReadPraiseCountAsync(request.UserId);
|
|
|
|
+ return result;
|
|
|
|
+ }
|
|
|
|
+ /// <summary>
|
|
|
|
+ /// 获取我收到的赞
|
|
|
|
+ /// </summary>
|
|
|
|
+ /// <param name="request"></param>
|
|
|
|
+ /// <returns></returns>
|
|
|
|
+ [HttpPost("praise")]
|
|
|
|
+ public async Task<IEnumerable<ReplyResult>> GetPraiseAsync(ReplyRequest request)
|
|
|
|
+ {
|
|
|
|
+ request.UserId = _loginContext.AccountId;
|
|
|
|
+ var result = new List<ReplyResult>();
|
|
|
|
+ result.AddRange(await replyService.GetNotePraiseAsync(request));
|
|
|
|
+ result.AddRange(await replyService.GetCommentPraiseAsync(request));
|
|
|
|
+ result.AddRange(await replyService.GetNoticePraiseAsync(request));
|
|
|
|
+ result.AddRange(await replyService.GetTopicPraiseAsync(request));
|
|
|
|
+ result.OrderByDescending(n => n.CreatedDate);
|
|
|
|
+ await replyService.UpdateUReadPraiseAsync(request.UserId);
|
|
|
|
+ return result;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+}
|