lihao 4 years ago
parent
commit
3883a90804

+ 5 - 277
gx_api/GxPress/Repository/GxPress.Repository.Implement/TopicRepository.cs

@@ -209,306 +209,34 @@ namespace GxPress.Repository.Implement
             return resultData;
         }
         /// <summary>
-        ///最新 小组话题分页列表 匿名用户登录获取
-        /// </summary>
-        /// <param name="request"></param>
-        /// <returns></returns>
-        public async Task<PagedList<TopicListPageResult>> GetAnonymousGroupTopicPageAsync(TopicDetailListRequest request)
-        {
-            var topicConst = AllTypeConst.Topic.GetHashCode();
-            var result = new PagedList<TopicListPageResult>();
-            var sqlStr = @" AND a.GroupId IN (SELECT 
-                                                Id
-                                            FROM
-                                                tede_group
-                                            WHERE
-                                                IsShow = 1) ";
-            sqlStr += $" and a.IsDraft={(request.IsDraft == true ? 1 : 0)}";
-
-            if (!string.IsNullOrEmpty(request.Key))
-            {
-                sqlStr += $@"AND (a.Title LIKE '%{request.Key}%'
-                          OR a.TextContent LIKE '%{request.Key}%')";
-            }
-            string sql = $@"SELECT 
-                                a.Id,
-                                a.Title,
-                                a.UserId,
-                                a.ReadCount,
-                                a.CreatedDate,
-                                a.Content,
-                                a.GroupId,
-                                (SELECT 
-                                        COUNT(1)
-                                    FROM
-                                        tede_analyze
-                                    WHERE
-                                        TypeValue ={topicConst} AND SourceId = a.Id
-                                            AND AnalyzeType = 1) AS PraiseCount,
-                                (SELECT 
-                                        COUNT(1)
-                                    FROM
-                                        tede_analyze
-                                    WHERE
-                                        UserId ={request.UserId} AND TypeValue = {topicConst}
-                                            AND SourceId = a.Id
-                                            AND AnalyzeType = 1
-                                    LIMIT 0 , 1) AS IsPraise,
-                                (SELECT 
-                                        COUNT(1)
-                                    FROM
-                                        tede_comment
-                                    WHERE
-                                        ArticleId = a.Id AND pid = 0
-                                            AND TypeValue = 1) AS CommentCount,
-                                (SELECT 
-                                        COUNT(1)
-                                    FROM
-                                        tede_analyze
-                                    WHERE
-                                        UserId ={request.UserId} AND TypeValue ={topicConst}
-                                            AND SourceId = a.Id
-                                            AND AnalyzeType = 4) AS RetransmissionCount,
-                                (SELECT 
-                                        COUNT(1)
-                                    FROM
-                                        tede_analyze
-                                    WHERE
-                                        UserId ={request.UserId} AND TypeValue ={topicConst}
-                                            AND SourceId = a.Id
-                                            AND AnalyzeType = 4
-                                    LIMIT 0 , 1) AS IsRetransmission,
-                                (SELECT 
-                                        COUNT(1)
-                                    FROM
-                                        tede_analyze
-                                    WHERE
-                                        UserId ={request.UserId} AND TypeValue = {topicConst}
-                                            AND SourceId = a.Id
-                                            AND AnalyzeType = 4
-                                    LIMIT 0 , 1) AS IsCollect,
-                                (SELECT 
-                                        COUNT(1)
-                                    FROM
-                                        tede_analyze
-                                    WHERE
-                                        UserId ={request.UserId} AND TypeValue = {topicConst}
-                                            AND SourceId = a.Id
-                                            AND AnalyzeType = 4) AS CollectCount,
-                                b.Name as GroupName,
-                                c.Name as UserName,
-                                c.AvatarUrl,
-                                d.Id as DepartmentId,
-                                d.Name as DepartmentName
-                            FROM
-                                tede_topic a
-                                    INNER JOIN
-                                tede_group b ON a.GroupId = b.Id
-                                    INNER JOIN
-                                tede_user c ON c.Id = a.UserId
-                                  INNER JOIN
-                                tede_department d ON d.Id = c.DepartmentId
-                            WHERE
-                                a.GroupId > 0 and a.IsDraft=0
-                                    {sqlStr}
-                            ORDER BY a.CreatedDate DESC limit @page,@pageSize";
-            string countSql = $@"SELECT 
-                                count(1)
-                            FROM
-                                tede_topic a
-                                    INNER JOIN
-                                tede_group b ON a.GroupId = b.Id
-                                    INNER JOIN
-                                tede_user c ON c.Id = a.UserId
-                            WHERE
-                                a.GroupId > 0 and a.IsDraft=0
-                                   {sqlStr}
-                            ORDER BY a.CreatedDate DESC";
-            var databaseType = StringUtils.ToEnum<DatabaseType>(_databaseTypeStr, DatabaseType.MySql);
-            var database = new Database(databaseType, _connectionString);
-            var connection = database.GetConnection();
-            result.Items =
-                 await connection
-                      .QueryAsync<TopicListPageResult>(sql, new { page = (request.Page - 1) * request.PerPage, pageSize = request.PerPage });
-            foreach (var item in result.Items)
-            {
-                item.AvatarUrl = StringUtils.AddDomainMin(item.AvatarUrl);
-            }
-            result.Total = await connection.ExecuteScalarAsync<int>(countSql);
-            return result;
-        }
-
-
-        /// <summary>
         ///最新 小组话题分页列表
         /// </summary>
         /// <param name="request"></param>
         /// <returns></returns>
-        public async Task<PagedList<TopicListPageResult>> GetGroupTopicPageAsync(TopicDetailListRequest request)
+        public async Task<PagedList<TopicListPageResult>> GetGroupTopicPageAsync(SqlKata.Query query, SqlKata.Query countQuery,TopicDetailListRequest request)
         {
-            var topicConst = AllTypeConst.Topic.GetHashCode();
             var result = new PagedList<TopicListPageResult>();
-            var sqlStr = $" and a.IsDraft={(request.IsDraft == true ? 1 : 0)}";
-            if (request.IsDraft)
-                sqlStr += $" and a.UserId={request.UserId}";
-            if (request.GroupIds.Count() == 0)
-                request.GroupIds.Add(-1);
-            if (request.GroupIds.Count > 0)
-            {
-                var groupIds = new List<int>();
-                foreach (var item in request.GroupIds)
-                {
-                    if (item > 0)
-                        groupIds.Add(item);
-                    //全网
-                    if (item == -1)
-                        groupIds.AddRange(await GetPublicGroupAsync(request.UserId));
-                    //我的小组
-                    if (item == -2)
-                        groupIds.AddRange(await GetIntoGroupAsync(request.UserId));
-                }
-                var groupIdStr = string.Empty;
-                foreach (var item in groupIds)
-                    groupIdStr += $"{item},";
-                if (!string.IsNullOrEmpty(groupIdStr))
-                {
-                    groupIdStr = groupIdStr.Remove(groupIdStr.Length - 1, 1);
-                    sqlStr += $@" AND a.GroupId IN ({groupIdStr})";
-                }
-            }
-            if (!string.IsNullOrEmpty(request.Key))
-            {
-                sqlStr += $@"AND (a.Title LIKE '%{request.Key}%'
-                          OR a.TextContent LIKE '%{request.Key}%')";
-            }
-            string sql = $@"SELECT 
-                                a.Id,
-                                a.Title,
-                                a.UserId,
-                                a.ReadCount,
-                                a.CreatedDate,
-                                a.Content,
-                                a.GroupId,
-                                (SELECT 
-                                        COUNT(1)
-                                    FROM
-                                        tede_analyze
-                                    WHERE
-                                        TypeValue ={topicConst} AND SourceId = a.Id
-                                            AND AnalyzeType = 1) AS PraiseCount,
-                                (SELECT 
-                                        COUNT(1)
-                                    FROM
-                                        tede_analyze
-                                    WHERE
-                                        UserId ={request.UserId} AND TypeValue = {topicConst}
-                                            AND SourceId = a.Id
-                                            AND AnalyzeType = 1
-                                    LIMIT 0 , 1) AS IsPraise,
-                                (SELECT 
-                                        COUNT(1)
-                                    FROM
-                                        tede_comment
-                                    WHERE
-                                        ArticleId = a.Id AND pid = 0
-                                            AND TypeValue={topicConst}) AS CommentCount,
-                                (SELECT 
-                                        COUNT(1)
-                                    FROM
-                                        tede_analyze
-                                    WHERE
-                                        UserId ={request.UserId} AND TypeValue ={topicConst}
-                                            AND SourceId = a.Id
-                                            AND AnalyzeType = 4) AS RetransmissionCount,
-                                (SELECT 
-                                        COUNT(1)
-                                    FROM
-                                        tede_analyze
-                                    WHERE
-                                        UserId ={request.UserId} AND TypeValue ={topicConst}
-                                            AND SourceId = a.Id
-                                            AND AnalyzeType = 4
-                                    LIMIT 0 , 1) AS IsRetransmission,
-                                (SELECT 
-                                        COUNT(1)
-                                    FROM
-                                        tede_analyze
-                                    WHERE
-                                        UserId ={request.UserId} AND TypeValue = {topicConst}
-                                            AND SourceId = a.Id
-                                            AND AnalyzeType = 4
-                                    LIMIT 0 , 1) AS IsCollect,
-                                (SELECT 
-                                        COUNT(1)
-                                    FROM
-                                        tede_analyze
-                                    WHERE
-                                        UserId ={request.UserId} AND TypeValue = {topicConst}
-                                            AND SourceId = a.Id
-                                            AND AnalyzeType = 4) AS CollectCount,
-                                b.Name as GroupName,
-                                c.Name as UserName,
-                                c.AvatarUrl,
-                                (SELECT 
-                                        Name
-                                    FROM
-                                        tede_department
-                                    WHERE
-                                        Id IN (SELECT 
-                                                DepartmentId
-                                            FROM
-                                                tede_department_user
-                                            WHERE
-                                                userId = a.UserId)
-                                    LIMIT 1) as DepartmentName
-                            FROM
-                                tede_topic a
-                                    inner JOIN
-                                tede_group b ON a.GroupId = b.Id
-                                    inner JOIN
-                                tede_user c ON c.Id = a.UserId
-                            WHERE
-                                a.GroupId > 0 
-                                    {sqlStr}
-                            ORDER BY a.CreatedDate DESC limit {(request.Page - 1) * request.PerPage},{request.Page * request.PerPage}";
-            string countSql = $@"SELECT 
-                                count(1)
-                            FROM
-                                tede_topic a
-                                    inner JOIN
-                                tede_group b ON a.GroupId = b.Id
-                                    inner JOIN
-                                tede_user c ON c.Id = a.UserId
-                            WHERE
-                                a.GroupId > 0  
-                                   {sqlStr}";
-            var databaseType = StringUtils.ToEnum<DatabaseType>(_databaseTypeStr, DatabaseType.MySql);
-            var database = new Database(databaseType, _connectionString);
-            var connection = database.GetConnection();
-            result.Items = await connection.QueryAsync<TopicListPageResult>(sql);
+            result.Items = await _repository.GetAllAsync<TopicListPageResult>(query);
             foreach (var item in result.Items)
             {
                 item.AvatarUrl = StringUtils.AddDomainMin(item.AvatarUrl);
             }
-            result.Total = await connection.ExecuteScalarAsync<int>(countSql);
+            result.Total = await _repository.CountAsync(countQuery);
             //回去小组草稿数量
-            var query = Q.NewQuery();
+            query = Q.NewQuery();
             query.WhereIn(nameof(Entity.Topic.Topic.GroupId), request.GroupIds);
             query.Where(nameof(Entity.Topic.Topic.IsDraft), true);
             query.Where(nameof(Entity.Topic.Topic.UserId), request.UserId);
             result.DraftCount = await CountAsync(query);
             return result;
         }
-
-
-
         /// <summary>
         /// 获取共享小组
         /// </summary>
         /// <returns></returns>
         public async Task<IEnumerable<int>> GetPublicGroupAsync(int userId)
         {
-            string sql = $@"select Id from tede_group where (IsShow=1 or id in (select groupId FROM  tede_group_user where userId={userId}))";
+            string sql = $@"select Id from tede_group where (IsAdmin=1 or id in (select groupId FROM  tede_group_user where userId={userId}))";
             var databaseType = StringUtils.ToEnum<DatabaseType>(_databaseTypeStr, DatabaseType.MySql);
             var database = new Database(databaseType, _connectionString);
             var connection = database.GetConnection();

+ 8 - 7
gx_api/GxPress/Repository/GxPress.Repository.Interface/ITopicRepository.cs

@@ -57,13 +57,7 @@ namespace GxPress.Repository.Interface
         /// </summary>
         /// <param name="request"></param>
         /// <returns></returns>
-        Task<PagedList<TopicListPageResult>> GetGroupTopicPageAsync(TopicDetailListRequest request);
-        /// <summary>
-        ///最新 小组话题分页列表 匿名用户登录获取
-        /// </summary>
-        /// <param name="request"></param>
-        /// <returns></returns>
-        Task<PagedList<TopicListPageResult>> GetAnonymousGroupTopicPageAsync(TopicDetailListRequest request);
+        Task<PagedList<TopicListPageResult>> GetGroupTopicPageAsync(SqlKata.Query query, SqlKata.Query countQuery,TopicDetailListRequest request);
         /// <summary>
         /// 删除草稿箱
         /// </summary>
@@ -72,5 +66,12 @@ namespace GxPress.Repository.Interface
         /// <returns></returns>
         Task<bool> ClearDraftAsync(int userId, int groupId);
         Task<bool> UpdateTopicTextContentAsync();
+        Task<IEnumerable<int>> GetPublicGroupAsync(int userId);
+        /// <summary>
+        /// 我加入的小组
+        /// </summary>
+        /// <param name="userId"></param>
+        /// <returns></returns>
+        Task<IEnumerable<int>> GetIntoGroupAsync(int userId);
     }
 }

+ 8 - 8
gx_api/GxPress/Service/GxPress.Service.Implement/CommonSqlKata/CommonSqlKataService.cs

@@ -11,16 +11,16 @@ namespace GxPress.Service.Implement.CommonSqlKataService
         /// <param name="userId"></param>
         /// <param name="query"></param>
         /// <returns></returns>
-        public SqlKata.Query GetCommonQueryAsync(int noticeTypeValue, int userId, SqlKata.Query query)
+        public SqlKata.Query GetCommonQueryAsync(int noticeTypeValue, int userId, SqlKata.Query query, string whereColumnSql)
         {
             var PraiseCount = new SqlKata.Query("tede_analyze");
-            PraiseCount.WhereColumns("tede_analyze.SourceId", "=", "tede_middle.MiddleId");
+            PraiseCount.WhereColumns("tede_analyze.SourceId", "=", whereColumnSql);
             PraiseCount.Where("tede_analyze.TypeValue", noticeTypeValue);
             PraiseCount.Where("tede_analyze.AnalyzeType", 1);
             PraiseCount.AsCount();
             query.Select(PraiseCount, "PraiseCount");
             var IsLaud = new SqlKata.Query("tede_analyze");
-            IsLaud.WhereColumns("tede_analyze.SourceId", "=", "tede_middle.MiddleId");
+            IsLaud.WhereColumns("tede_analyze.SourceId", "=", whereColumnSql);
             IsLaud.Where("tede_analyze.TypeValue", noticeTypeValue);
             IsLaud.Where("tede_analyze.UserId", userId);
             IsLaud.Where("tede_analyze.AnalyzeType", 1);
@@ -28,20 +28,20 @@ namespace GxPress.Service.Implement.CommonSqlKataService
             IsLaud.AsCount();
             query.Select(IsLaud, "IsLaud");
             var CommentCount = new SqlKata.Query("tede_comment");
-            CommentCount.WhereColumns("tede_comment.ArticleId", "=", "tede_middle.MiddleId");
+            CommentCount.WhereColumns("tede_comment.ArticleId", "=", whereColumnSql);
             CommentCount.Where("tede_comment.pid", 0);
             CommentCount.Where("tede_comment.TypeValue", noticeTypeValue);
             CommentCount.AsCount();
             query.Select(CommentCount, "CommentCount");
             var RetransmissionCount = new SqlKata.Query("tede_analyze");
-            RetransmissionCount.WhereColumns("tede_analyze.SourceId", "=", "tede_middle.MiddleId");
+            RetransmissionCount.WhereColumns("tede_analyze.SourceId", "=", whereColumnSql);
             RetransmissionCount.Where("tede_analyze.TypeValue", noticeTypeValue);
             RetransmissionCount.Where("tede_analyze.UserId", userId);
             RetransmissionCount.Where("tede_analyze.AnalyzeType", 4);
             RetransmissionCount.AsCount();
             query.Select(RetransmissionCount, "RetransmissionCount");
             var IsRetransmission = new SqlKata.Query("tede_analyze");
-            IsRetransmission.WhereColumns("tede_analyze.SourceId", "=", "tede_middle.MiddleId");
+            IsRetransmission.WhereColumns("tede_analyze.SourceId", "=", whereColumnSql);
             IsRetransmission.Where("tede_analyze.TypeValue", noticeTypeValue);
             IsRetransmission.Where("tede_analyze.UserId", userId);
             IsRetransmission.Where("tede_analyze.AnalyzeType", 4);
@@ -49,7 +49,7 @@ namespace GxPress.Service.Implement.CommonSqlKataService
             IsRetransmission.AsCount();
             query.Select(IsRetransmission, "IsRetransmission");
             var IsCollect = new SqlKata.Query("tede_analyze");
-            IsCollect.WhereColumns("tede_analyze.SourceId", "=", "tede_middle.MiddleId");
+            IsCollect.WhereColumns("tede_analyze.SourceId", "=", whereColumnSql);
             IsCollect.Where("tede_analyze.TypeValue", noticeTypeValue);
             IsCollect.Where("tede_analyze.UserId", userId);
             IsCollect.Where("tede_analyze.AnalyzeType", 3);
@@ -57,7 +57,7 @@ namespace GxPress.Service.Implement.CommonSqlKataService
             IsCollect.AsCount();
             query.Select(IsCollect, "IsCollect");
             var CollectCount = new SqlKata.Query("tede_analyze");
-            CollectCount.WhereColumns("tede_analyze.SourceId", "=", "tede_middle.MiddleId");
+            CollectCount.WhereColumns("tede_analyze.SourceId", "=", whereColumnSql);
             CollectCount.Where("tede_analyze.TypeValue", noticeTypeValue);
             CollectCount.Where("tede_analyze.UserId", userId);
             CollectCount.Where("tede_analyze.AnalyzeType", 3);

+ 1 - 1
gx_api/GxPress/Service/GxPress.Service.Implement/Notice/NoticeService.cs

@@ -407,7 +407,7 @@ namespace GxPress.Service.Implement.Notice
             //收件箱
             query = commonSqlKataService.NoticeQueryAsync(query, request.UserId);
             //通用
-            query = commonSqlKataService.GetCommonQueryAsync(noticeTypeValue, request.UserId, query);
+            query = commonSqlKataService.GetCommonQueryAsync(noticeTypeValue, request.UserId, query, "tede_middle.MiddleId");
 
             query.OrderByDesc("tede_middle.AttributeValue");
             query.OrderByDesc("tede_middle.IsTop");

+ 2 - 0
gx_api/GxPress/Service/GxPress.Service.Implement/Topic/TopicService.Add.cs

@@ -58,6 +58,8 @@ namespace GxPress.Service.Implement.Topic
                         topic.Content = "[]";
                     }
                     var topicId = await _topicRepository.InsertAsync(topic);
+                    // //添加默认文件夹
+                    // await recordFolderRepository.AddAsync(AllTypeConst.TopicNote.GetHashCode(), request.UserId, request.FolderId);
                     //修改话题访问量
                     await _visitService.AddVisit(request.UserId, GxPress.EnumConst.AllTypeConst.Topic.GetHashCode(), topicId);
                     result = new AppResultJson<Entity.Topic.Topic>

+ 57 - 76
gx_api/GxPress/Service/GxPress.Service.Implement/Topic/TopicService.cs

@@ -24,6 +24,8 @@ using GxPress.Repository.Interface.DepartmentUser;
 using GxPress.EnumConst;
 using GxPress.Repository.Interface.Note;
 using GxPress.Result.Department;
+using GxPress.Service.Interface.CommonSqlKata;
+using GxPress.Repository.Interface.RecordFolder;
 
 namespace GxPress.Service.Implement.Topic
 {
@@ -47,6 +49,8 @@ namespace GxPress.Service.Implement.Topic
         private readonly IVisitService _visitService;
         private readonly INoteRepository noteRepository;
         private readonly IGroupRepository groupRepository;
+        private readonly ICommonSqlKataService commonSqlKataService;
+        private readonly IRecordFolderRepository recordFolderRepository;
         public TopicService(ITopicRepository topicRepository, IUserRepository userRepository,
             ITopicAddresseeRepository topicAddresseeRepository,
             ITopicGroupRepository topicGroupRepository,
@@ -57,7 +61,9 @@ namespace GxPress.Service.Implement.Topic
             IVisitRepository visitRepository, IVisitService visitService,
             IDepartmentUserRepository departmentUserRepository,
             INoteRepository noteRepository,
-            IGroupRepository groupRepository)
+            IGroupRepository groupRepository,
+            ICommonSqlKataService commonSqlKataService,
+            IRecordFolderRepository recordFolderRepository)
         {
             _topicRepository = topicRepository;
             _userRepository = userRepository;
@@ -77,6 +83,8 @@ namespace GxPress.Service.Implement.Topic
             this.departmentUserRepository = departmentUserRepository;
             this.noteRepository = noteRepository;
             this.groupRepository = groupRepository;
+            this.commonSqlKataService = commonSqlKataService;
+            this.recordFolderRepository=recordFolderRepository;
         }
 
 
@@ -111,11 +119,54 @@ namespace GxPress.Service.Implement.Topic
         /// <returns></returns>
         public async Task<PagedList<TopicListPageResult>> GetGroupTopicPageAsync(TopicDetailListRequest request)
         {
-            var result = new PagedList<TopicListPageResult>();
-            if (request.UserId <= 0)
-                result = await _topicRepository.GetAnonymousGroupTopicPageAsync(request);
-            else
-                result = await _topicRepository.GetGroupTopicPageAsync(request);
+            var query = new SqlKata.Query("tede_topic");
+            query.Join("tede_group", "tede_group.Id", "tede_topic.GroupId");
+            query.Join("tede_user", "tede_user.Id", "tede_topic.UserId");
+            query.Where("tede_topic.GroupId", ">", 0);
+            query.Where("tede_topic.IsDraft", request.IsDraft);
+            if (request.IsDraft)
+                query.Where("tede_group.UserId", request.UserId);
+            if (request.GroupIds.Count() == 0)
+                request.GroupIds.Add(-1);
+            if (request.GroupIds.Count > 0)
+            {
+                var groupIds = new List<int>();
+                foreach (var item in request.GroupIds)
+                {
+                    if (item > 0)
+                        groupIds.Add(item);
+                    //全网
+                    if (item == -1)
+                        groupIds.AddRange(await _topicRepository.GetPublicGroupAsync(request.UserId));
+                    //我的小组
+                    if (item == -2)
+                        groupIds.AddRange(await _topicRepository.GetIntoGroupAsync(request.UserId));
+                }
+                if (groupIds.Count > 0)
+                    query.WhereIn("tede_topic.GroupId", groupIds);
+            }
+            if (!string.IsNullOrEmpty(request.Key))
+                query.Where(n => n.OrWhereLike("tede_topic.Title", $"%{request.Key}%").OrWhereLike("tede_topic.TextContent", $"%{request.Key}%"));
+            //条数
+            var queryCount = query;
+            //公共
+            commonSqlKataService.GetCommonQueryAsync(AllTypeConst.Topic.GetHashCode(), request.UserId, query, "tede_topic.Id");
+            //获取用户所在部门
+            var departmentNameQuery = new SqlKata.Query("tede_department");
+            var departmentUserQuery = new SqlKata.Query("tede_department_user");
+            departmentUserQuery.WhereColumns("tede_department_user.UserId", "=", "tede_topic.UserId");
+            departmentUserQuery.Select("tede_department_user.DepartmentId");
+            departmentNameQuery.WhereIn("tede_department.Id", departmentUserQuery);
+            departmentNameQuery.Limit(1);
+            departmentNameQuery.Select("tede_department.Name");
+            query.Select(departmentNameQuery, "DepartmentName");
+            query.Select(
+                "tede_topic.{Id,Title,UserId,ReadCount,CreatedDate,Content,GroupId}",
+                "tede_group.{Name as GroupName}",
+                "tede_user.{Name as UserName,AvatarUrl}");
+            query.OrderByDesc("tede_topic.CreatedDate");
+            query.ForPage(request.Page, request.PerPage);
+            var result = await _topicRepository.GetGroupTopicPageAsync(query, queryCount, request);
             //判断是否小组成员
             if (request.GroupIds.Count == 1)
             {
@@ -201,76 +252,6 @@ namespace GxPress.Service.Implement.Topic
             }
             return result;
         }
-        /// <summary>
-        ///最新 小组话题分页列表 匿名用户
-        /// </summary>
-        /// <param name="request"></param>
-        /// <returns></returns>
-        public async Task<PagedList<TopicListPageResult>> GetAnonymousGroupTopicPageAsync(TopicDetailListRequest request)
-        {
-            var result = await _topicRepository.GetAnonymousGroupTopicPageAsync(request);
-            //获取数量
-            // result.Total = 10;
-            foreach (var item in result.Items)
-            {
-                if (string.IsNullOrEmpty(item.Title))
-                    item.Title = string.Empty;
-                if (string.IsNullOrWhiteSpace(item.UserName))
-                {
-                    item.Content = "[]";
-                    item.Data = JsonConvert.DeserializeObject<List<ContentJsonData>>(item.Content);
-                    item.Content = "";
-                    continue;
-                }
-                if (string.IsNullOrWhiteSpace(item.Content))
-                    item.Content = "[]";
-                var contentJsonData = JsonConvert.DeserializeObject<List<ContentJsonData>>(item.Content);
-                foreach (var contentJsonDataItem in contentJsonData)
-                    contentJsonDataItem.File = StringUtils.AddDomain(contentJsonDataItem.File);
-                if (contentJsonData.Count == 0)
-                    item.DataType = 1;
-                item.Content = "";
-                if (contentJsonData.Count > 0)
-                {
-                    var imgData = new List<ContentJsonData>();
-                    var FileData = new List<ContentJsonData>();
-                    var forCount = 1;
-                    var firstContent = string.Empty;
-                    foreach (var jsonData in contentJsonData)
-                    {
-                        if (jsonData.Type == AllTypeConst.Text.GetHashCode() && forCount == 1)
-                            //文本
-                            firstContent = jsonData.Text;
-                        else if (jsonData.Type == AllTypeConst.Text.GetHashCode() && forCount > 1)
-                            //文本
-                            continue;
-                        //图片
-                        else if (jsonData.Type == AllTypeConst.Image.GetHashCode() && FileData.Count == 0)
-                        {
-                            if (imgData.Count >= 9)
-                                break;
-                            imgData.Add(jsonData);
-                        }
-                        //附件
-                        else
-                        {
-                            FileData.Add(jsonData);
-                            break;
-                        }
-                        forCount++;
-                    }
-                    item.Content = string.IsNullOrWhiteSpace(firstContent) ? "" : firstContent;
-                    if (imgData.Count > 0) { item.DataType = 2; item.Data = imgData; }
-                    else if (FileData.Count > 0) { item.DataType = 3; item.Data = FileData; }
-                    else item.DataType = 1;
-                    var contType = new List<int> { AllTypeConst.Text.GetHashCode(), AllTypeConst.Image.GetHashCode() };
-                    item.FileCount = contentJsonData.Count(n => !contType.Contains(n.Type));
-                }
-                if (item.Data == null || item.Data.Count == 0)
-                    item.Data = new List<ContentJsonData>();
-            }
-            return result;
-        }
         public async Task<PagedList<TopicListPageResult>> GetTopicByGroupAsync(TopicPageSearchRequest request)
         {
             var result = await _topicRepository.GetTopicByGroupAsync(request);

+ 2 - 2
gx_api/GxPress/Service/GxPress.Service.Interface/CommonSqlKata/ICommonSqlKataService.cs

@@ -9,12 +9,12 @@ namespace GxPress.Service.Interface.CommonSqlKata
         /// <param name="userId"></param>
         /// <param name="query"></param>
         /// <returns></returns>
-        SqlKata.Query GetCommonQueryAsync(int noticeTypeValue, int userId, SqlKata.Query query);
+        SqlKata.Query GetCommonQueryAsync(int noticeTypeValue, int userId, SqlKata.Query query, string whereColumnSql);
         /// <summary>
         /// 收件箱
         /// </summary>
         /// <param name="query"></param>
         /// <returns></returns>
-         SqlKata.Query NoticeQueryAsync(SqlKata.Query query,int userId);
+        SqlKata.Query NoticeQueryAsync(SqlKata.Query query, int userId);
     }
 }

+ 0 - 6
gx_api/GxPress/Service/GxPress.Service.Interface/Topic/ITopicService.cs

@@ -90,11 +90,5 @@ namespace GxPress.Service.Interface.Topic
         /// <param name="request"></param>
         /// <returns></returns>
         Task<PagedList<TopicListPageResult>> GetGroupTopicPageAsync(TopicDetailListRequest request);
-        /// <summary>
-        ///最新 小组话题分页列表 匿名用户
-        /// </summary>
-        /// <param name="request"></param>
-        /// <returns></returns>
-        Task<PagedList<TopicListPageResult>> GetAnonymousGroupTopicPageAsync(TopicDetailListRequest request);
     }
 }