using System.Collections.Generic; using System.Threading.Tasks; using GxPress.Entity.Topic; using GxPress.EnumConst; using GxPress.Repository.Interface.Topic; using GxPress.Service.Interface.Topic; using GxPress.Common.Tools; namespace GxPress.Service.Implement.Topic { public class TopicGroupService : ITopicGroupService { private readonly ITopicGroupRepository topicGroupRepository; public TopicGroupService(ITopicGroupRepository topicGroupRepository) { this.topicGroupRepository = topicGroupRepository; } /// /// 根据用户ID获取分组 /// /// /// public async Task> GetTopicGroupsAsync(int userId) { var result = new List() { new TopicGroup {Id=TopicNotoGropConst.My.GetHashCode(),Name=TopicNotoGropConst.My.GetDescriptionOriginal()}, new TopicGroup {Id=TopicNotoGropConst.Work.GetHashCode(),Name=TopicNotoGropConst.Work.GetDescriptionOriginal()}, new TopicGroup {Id=TopicNotoGropConst.Recommend.GetHashCode(),Name=TopicNotoGropConst.Recommend.GetDescriptionOriginal() } , new TopicGroup {Id=TopicNotoGropConst.All.GetHashCode(),Name=TopicNotoGropConst.All.GetDescriptionOriginal()}}; result.AddRange(await topicGroupRepository.GetTopicGroupsAsync(userId)); return result; } /// /// 根据用户ID获取分组 /// /// /// public async Task> GetListTopicGroupsAsync(int userId) { var result = await topicGroupRepository.GetTopicGroupsAsync(userId); return result; } } }