123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- using System.Collections.Generic;
- using System.Threading.Tasks;
- using GxPress.Request.Reply;
- using GxPress.Result.Reply;
- using GxPress.Service.Interface.Reply;
- using System.Linq;
- using GxPress.Repository.Interface.Analyze;
- using GxPress.Repository.Interface.Reply;
- namespace GxPress.Service.Implement.Reply
- {
- /// <summary>
- /// 回复
- /// </summary>
- public partial class ReplyService : IReplyService
- {
- private readonly IAnalyzeRepository analyzeRepository;
- private readonly IReplyRepository replyRepository;
- public ReplyService(IAnalyzeRepository analyzeRepository, IReplyRepository replyRepository)
- {
- this.analyzeRepository = analyzeRepository;
- this.replyRepository = replyRepository;
- }
- /// <summary>
- /// 获取我收到和我回复的评论
- /// </summary>
- /// <param name="request"></param>
- /// <returns></returns>
- public async Task<IEnumerable<ReplyResult>> GetReplyResults(ReplyRequest request)
- {
- var result = new List<ReplyResult>();
- //话题本
- result.AddRange(await GetReplyNoteOrTopicResults(request));
- //小组话题
- result.AddRange(await GetReplyGroupTopicResults(request));
- if (request.TypeValue == 0)
- result.AddRange(await GetReceiptCommentResult(request));
- else
- result.AddRange(await GetMyReceiptCommentResult(request));
- //站内信 通知
- result.AddRange(await GetReplyNoticeTopicResults(request));
- var data = result.OrderByDescending(n => n.CreatedDate);
- return data;
- }
- public async Task<IEnumerable<ReplyInfoResult>> GetReplysAsync(ReplyRequest request)
- {
- var result = await replyRepository.GetReplysAsync(request);
- await replyRepository.UpdateReplyUReadCountAsync(request.UserId);
- return result;
- }
- /// <summary>
- /// 获取回复我的阅读数量
- /// </summary>
- /// /// <param name="userId"></param>
- /// <returns></returns>
- public async Task<int> GetReplyUReadCountAsync(int userId)
- {
- return await replyRepository.GetReplyUReadCountAsync(userId);
- }
- }
- }
|