lihao 4 年之前
父節點
當前提交
7c647ffefa

+ 1 - 1
gx_api/GxPress/Api/GxPress.Api/AppControllers/GroupController.cs

@@ -116,7 +116,7 @@ namespace GxPress.Api.AppControllers
         /// <param name="request"></param>
         /// <returns></returns>
         [HttpPost("find")]
-        public async Task<PagedList<GroupUserFindResult>> FindGroupByGroupFolderId(GroupSearchRequest request)
+        public async Task<IEnumerable<GroupUserFindResult>> FindGroupByGroupFolderId(GroupSearchRequest request)
         {
             request.UserId = _loginContext.AccountId;
             return await _groupService.FindGroupByGroupFolderIdAsync(request);

+ 1 - 1
gx_api/GxPress/Api/GxPress.Api/WebControllers/WebGroupController.cs

@@ -136,7 +136,7 @@ namespace GxPress.Api.WebControllers
         /// <param name="request"></param>
         /// <returns></returns>
         [HttpPost("find")]
-        public async Task<PagedList<GroupUserFindResult>> FindGroupByGroupFolderId(GroupSearchRequest request)
+        public async Task<IEnumerable<GroupUserFindResult>> FindGroupByGroupFolderId(GroupSearchRequest request)
         {
             request.UserId = _loginContext.AccountId;
             return await _groupService.FindGroupByGroupFolderIdAsync(request);

+ 103 - 95
gx_api/GxPress/Repository/GxPress.Repository.Implement/GroupRepository.cs

@@ -31,7 +31,7 @@ namespace GxPress.Repository.Implement
         private readonly string _connectionString;
         private readonly string _databaseTypeStr;
         private readonly Repository<GroupUser> _groupUserRepository;
-
+        private readonly Repository<Entity.Middle.Middle> middleRepository;
         public GroupRepository(IOptionsMonitor<DatabaseOptions> dbOptionsAccessor, IMapper mapper,
             IWebHostEnvironment environment)
         {
@@ -42,6 +42,7 @@ namespace GxPress.Repository.Implement
             var database = new Database(databaseType, dbOptionsAccessor.CurrentValue.ConnectionString);
             _repository = new Repository<Entity.Group>(database);
             _groupUserRepository = new Repository<GroupUser>(database);
+            middleRepository = new Repository<Entity.Middle.Middle>(database);
             _environment = environment;
             _mapper = mapper;
         }
@@ -148,105 +149,112 @@ namespace GxPress.Repository.Implement
         /// </summary>
         /// <param name="request"></param>
         /// <returns></returns>
-        public async Task<PagedList<GroupUserFindResult>> FindGroupByGroupFolderId(GroupSearchRequest request)
+        public async Task<IEnumerable<GroupUserFindResult>> FindGroupByGroupFolderId(GroupSearchRequest request)
         {
-            var pagedList = new PagedList<GroupUserFindResult>();
+            //var pagedList = new PagedList<GroupUserFindResult>();
             var groupConst = AllTypeConst.Group.GetHashCode();
-            var sqlStr = string.Empty;
+            var query = new SqlKata.Query("tede_Middle");
+            query.LeftJoin("tede_group", "tede_group.Id", "tede_Middle.MiddleId");
             if (request.GroupFolderId > 0)
-                sqlStr += $" AND a.ParentId = {request.GroupFolderId}";
+                query.Where("tede_Middle.ParentId", request.GroupFolderId);
             if (!string.IsNullOrEmpty(request.Key))
-                sqlStr = $" and (a.FolderName like '%{request.Key}%' or b.Name like '%{request.Key}%')";
+                query.Where(n => n.OrWhereLike("tede_Middle.FolderName", $"%request.Key%").OrWhereLike("tede_group.Name", $"%{request.Key}%"));
             if (string.IsNullOrEmpty(request.Key) && request.GroupFolderId == 0)
-                sqlStr += $" AND a.ParentId = {request.GroupFolderId}";
-            string sql = $@"SELECT 
-                                a.Id,
-                                a.IsTop,
-                                a.FolderName,
-                                a.AttributeValue,
-                                (SELECT 
-                                        COUNT(1)
-                                    FROM
-                                        tede_group_user
-                                    WHERE
-                                        GroupId = a.MiddleId) AS TopicSharingCount,
-                                (SELECT 
-                                        COUNT(1)
-                                    FROM
-                                        tede_topic
-                                    WHERE
-                                        GroupId = a.MiddleId AND IsDraft = 0) AS TopicAllCount,
-                                (SELECT 
-                                        COUNT(1)
-                                    FROM
-                                        tede_middle
-                                    WHERE
-                                        parentId = a.Id) AS GroupCount,
-                                (SELECT 
-                                        COUNT(1)
-                                    FROM
-                                        tede_topic
-                                    WHERE
-                                        groupId = b.Id
-                                            AND LastModifiedDate > (SELECT 
-                                                ReadDate
-                                            FROM
-                                                tede_group_user
-                                            WHERE
-                                                groupId =  b.Id AND userId = {request.UserId})) AS UReadTopicCount,
-                                (SELECT 
-                                        FolderName
-                                    FROM
-                                        tede_middle
-                                    WHERE
-                                        id = a.ParentId) AS CategoryName,
-                                (SELECT 
-                                        COUNT(1)
-                                    FROM
-                                        tede_group
-                                    WHERE
-                                        id IN (SELECT 
-                                                MiddleId
-                                            FROM
-                                                tede_middle
-                                            WHERE
-                                                ParentId = a.Id)) AS FileCount,
-                                b.Id AS GroupId,
-                                b.AvatarUrl,
-                                b.Name AS GroupName
-                            FROM
-                                tede_Middle a
-                                    LEFT JOIN
-                                tede_group b ON a.MiddleId = b.Id
-                            WHERE
-                                1 = 1 {sqlStr}
-                                    AND a.UserId = {request.UserId}
-                                    AND a.FolderType = {groupConst}
-                                    AND a.IsDelete = 0
-                                    AND (b.id > 0 OR a.AttributeValue = 2)
-                            ORDER by a.IsTop DESC ,a.LastModifiedDate DESC,a.Sort DESC    
-                            LIMIT {(request.Page - 1) * request.PerPage} , {request.PerPage}";
-            var databaseType = StringUtils.ToEnum<DatabaseType>(_databaseTypeStr, DatabaseType.MySql);
-            var database = new Database(databaseType, _connectionString);
-            var connection = database.GetConnection();
-            var result = await connection.QueryAsync<GroupUserFindResult>(sql);
-            pagedList.Items = result;
-            foreach (var item in pagedList.Items)
-                item.AvatarUrl = StringUtils.AddDomainMin(item.AvatarUrl);
-            var sqlCount =
-                $@"SELECT count(1)
-                            FROM
-                                tede_Middle a
-                                    LEFT JOIN
-                                tede_group b ON a.MiddleId = b.Id
-                            WHERE
-                                1 = 1 {sqlStr}
-                                    AND a.UserId = {request.UserId}
-                                    AND a.FolderType = {groupConst}
-                                    AND a.IsDelete = 0
-                                    AND (b.id > 0 OR a.AttributeValue = 2)";
-            pagedList.Total = await FindGroupByGroupFolderIdCountAsync(sqlCount);
-            return pagedList;
+                query.Where("tede_Middle.ParentId", request.GroupFolderId);
+            query.Where("tede_Middle.UserId", request.UserId);
+            query.Where("tede_Middle.IsDelete", false);
+            query.Where("tede_Middle.FolderType", groupConst);
+            query.Where("tede_Middle.IsTop", true);
+            query.OrderByDesc("tede_Middle.IsTop");
+            query.OrderByDesc("tede_Middle.LastModifiedDate");
+            var topicSharingCountQuery = new SqlKata.Query("tede_group_user");
+            topicSharingCountQuery.WhereColumns("tede_group_user.GroupId", "=", "tede_Middle.MiddleId");
+            topicSharingCountQuery.AsCount();
+            query.Select(topicSharingCountQuery, "TopicSharingCount");
+            var topicAllCountQuery = new SqlKata.Query("tede_topic");
+            topicAllCountQuery.WhereColumns("tede_topic.GroupId", "=", "tede_Middle.MiddleId");
+            topicAllCountQuery.Where("tede_topic.IsDraft", false);
+            topicAllCountQuery.AsCount();
+            query.Select(topicAllCountQuery, "TopicAllCount");
+            var groupCountQuery = new SqlKata.Query("tede_middle as a");
+            groupCountQuery.WhereColumns("a.parentId", "=", "tede_Middle.Id");
+            groupCountQuery.AsCount();
+            query.Select(groupCountQuery, "GroupCount");
+            var uReadTopicCountQuery = new SqlKata.Query("tede_topic");
+            uReadTopicCountQuery.WhereColumns("tede_topic.groupId", "=", "tede_group.Id");
+            var groupUserQuery = new SqlKata.Query("tede_group_user");
+            groupUserQuery.WhereColumns("tede_group_user.groupId", "=", "tede_group.Id");
+            groupUserQuery.Where("tede_group_user.userId", request.UserId);
+            groupUserQuery.Select("ReadDate");
+            uReadTopicCountQuery.Where("tede_topic.LastModifiedDate", ">", groupUserQuery);
+            uReadTopicCountQuery.AsCount();
+            query.Select(uReadTopicCountQuery, "UReadTopicCount");
+            var categoryNameQuery = new SqlKata.Query("tede_middle as a");
+            categoryNameQuery.WhereColumns("a.Id", "=", "tede_Middle.ParentId");
+            categoryNameQuery.Select("a.FolderName");
+            query.Select(categoryNameQuery, "CategoryName");
+            var fileCountQuery = new SqlKata.Query("tede_group");
+            var middleQuery = new SqlKata.Query("tede_Middle as a");
+            middleQuery.WhereColumns("a.ParentId", "=", "tede_Middle.Id");
+            middleQuery.Select("a.MiddleId");
+            fileCountQuery.WhereIn("tede_group.Id", middleQuery);
+            fileCountQuery.AsCount();
+            query.Select(fileCountQuery, "FileCount");
+            query.Select("tede_Middle.{Id,IsTop,FolderName,AttributeValue}",
+                          "tede_group.{Id as GroupId,AvatarUrl,Name as GroupName}");
+            var result = new List<GroupUserFindResult>();
+            result.AddRange(await middleRepository.GetAllAsync<GroupUserFindResult>(query));
+
+            query = new SqlKata.Query("tede_Middle");
+            query.LeftJoin("tede_group", "tede_group.Id", "tede_Middle.MiddleId");
+            if (request.GroupFolderId > 0)
+                query.Where("tede_Middle.ParentId", request.GroupFolderId);
+            if (!string.IsNullOrEmpty(request.Key))
+                query.Where(n => n.OrWhereLike("tede_Middle.FolderName", $"%request.Key%").OrWhereLike("tede_group.Name", $"%{request.Key}%"));
+            if (string.IsNullOrEmpty(request.Key) && request.GroupFolderId == 0)
+                query.Where("tede_Middle.ParentId", request.GroupFolderId);
+            query.Where("tede_Middle.UserId", request.UserId);
+            query.Where("tede_Middle.IsDelete", false);
+            query.Where("tede_Middle.FolderType", groupConst);
+            query.Where("tede_Middle.IsTop", false);
+            query.OrderByDesc("tede_group.LastModifiedDate");
+            topicSharingCountQuery = new SqlKata.Query("tede_group_user");
+            topicSharingCountQuery.WhereColumns("tede_group_user.GroupId", "=", "tede_Middle.MiddleId");
+            topicSharingCountQuery.AsCount();
+            query.Select(topicSharingCountQuery, "TopicSharingCount");
+            topicAllCountQuery = new SqlKata.Query("tede_topic");
+            topicAllCountQuery.WhereColumns("tede_topic.GroupId", "=", "tede_Middle.MiddleId");
+            topicAllCountQuery.Where("tede_topic.IsDraft", false);
+            topicAllCountQuery.AsCount();
+            query.Select(topicAllCountQuery, "TopicAllCount");
+            groupCountQuery = new SqlKata.Query("tede_middle as a");
+            groupCountQuery.WhereColumns("a.parentId", "=", "tede_Middle.Id");
+            groupCountQuery.AsCount();
+            query.Select(groupCountQuery, "GroupCount");
+            uReadTopicCountQuery = new SqlKata.Query("tede_topic");
+            uReadTopicCountQuery.WhereColumns("tede_topic.groupId", "=", "tede_group.Id");
+            groupUserQuery = new SqlKata.Query("tede_group_user");
+            groupUserQuery.WhereColumns("tede_group_user.groupId", "=", "tede_group.Id");
+            groupUserQuery.Where("tede_group_user.userId", request.UserId);
+            groupUserQuery.Select("ReadDate");
+            uReadTopicCountQuery.Where("tede_topic.LastModifiedDate", ">", groupUserQuery);
+            uReadTopicCountQuery.AsCount();
+            query.Select(uReadTopicCountQuery, "UReadTopicCount");
+            categoryNameQuery = new SqlKata.Query("tede_middle as a");
+            categoryNameQuery.WhereColumns("a.Id", "=", "tede_Middle.ParentId");
+            categoryNameQuery.Select("a.FolderName");
+            query.Select(categoryNameQuery, "CategoryName");
+            fileCountQuery = new SqlKata.Query("tede_group");
+            middleQuery = new SqlKata.Query("tede_Middle as a");
+            middleQuery.WhereColumns("a.ParentId", "=", "tede_Middle.Id");
+            middleQuery.Select("a.MiddleId");
+            fileCountQuery.WhereIn("tede_group.Id", middleQuery);
+            fileCountQuery.AsCount();
+            query.Select(fileCountQuery, "FileCount");
+            query.Select("tede_Middle.{Id,IsTop,FolderName,AttributeValue}",
+                          "tede_group.{Id as GroupId,AvatarUrl,Name as GroupName}");
+            result.AddRange(await middleRepository.GetAllAsync<GroupUserFindResult>(query));
+            return result;
         }
 
         /// <summary>

+ 18 - 53
gx_api/GxPress/Repository/GxPress.Repository.Implement/Note/NoteRepository.cs

@@ -250,23 +250,13 @@ namespace GxPress.Repository.Implement.Note
                             FROM
                                 tede_middle
                             WHERE
-                                id = (SELECT 
-                                        ParentId
-                                    FROM
-                                        tede_middle
-                                    WHERE
-                                        MiddleId = a.Id AND FolderType ={noteTypeId})) AS FolderParentName,
+                                id =a.ParentId) AS FolderParentName,
                         (SELECT 
                                 Id
                             FROM
                                 tede_middle
                             WHERE
-                                id = (SELECT 
-                                        ParentId
-                                    FROM
-                                        tede_middle
-                                    WHERE
-                    MiddleId = a.Id AND FolderType = {noteTypeId})) AS FolderId
+                                id =a.ParentId ) AS FolderId
                     FROM tede_middle a  LEFT JOIN tede_note b ON a.MiddleId = b.Id 
                     left join tede_user c on c.Id=b.UserId 
                     left join tede_department d on d.Id=c.DepartmentId 
@@ -292,14 +282,9 @@ namespace GxPress.Repository.Implement.Note
                         WHERE
                         UserId = {request.UserId} AND MiddleId = {sqlStr}))";
                 if (request.TypeValue == 0)
-                    sql += "and  (a.RoleId in(2) or a.AttributeValue=1)";
+                    sql += "and (a.RoleId=2 or a.AttributeValue<>2)";
                 else
-                {
-                    if (request.FolderId != 0)
-                        sql += "and  (a.RoleId in(1,3) or a.AttributeValue=1)";
-                    else
-                        sql += "and  (a.RoleId in(1,3))";
-                }
+                    sql += "and  (a.RoleId in(1,3) or a.AttributeValue<>2)";
                 if (request.FolderId == 0 && !string.IsNullOrEmpty(request.SearchKey))
                     sql += $@" AND (b.Title LIKE '%{request.SearchKey}%' OR a.FolderName LIKE '%{request.SearchKey}%' or b.TextContent LIKE '%{request.SearchKey}%' or b.UserId in (select Id from tede_user where name like '%{request.SearchKey}%'))";
                 else if (!string.IsNullOrEmpty(request.SearchKey))
@@ -388,36 +373,21 @@ namespace GxPress.Repository.Implement.Note
                             FROM
                                 tede_middle
                             WHERE
-                                id = (SELECT 
-                                        ParentId
-                                    FROM
-                                        tede_middle
-                                    WHERE
-                                        MiddleId = a.Id AND FolderType ={noteTypeId})) AS FolderParentName,
+                                id =a.ParentId) AS FolderParentName,
                         (SELECT 
                                 Id
                             FROM
                                 tede_middle
                             WHERE
-                                id = (SELECT 
-                                        ParentId
-                                    FROM
-                                        tede_middle
-                                    WHERE
-                    MiddleId = a.Id AND FolderType = {noteTypeId})) AS FolderId
+                                id =a.ParentId ) AS FolderId
                     FROM tede_middle a  LEFT JOIN tede_note b ON a.MiddleId = b.Id 
                     left join tede_user c on c.Id=b.UserId 
                     left join tede_department d on d.Id=c.DepartmentId 
-                    WHERE a.UserId = {request.UserId} AND a.FolderType = {noteTypeId} AND a.IsDelete = 0 ";
+                    WHERE a.UserId = {request.UserId} AND a.IsDelete = 0 ";
                 if (request.TypeValue == 0)
-                    sql += "and  (a.RoleId in(2) or a.AttributeValue=1)";
+                    sql += "and (a.RoleId=2 or a.AttributeValue<>2)";
                 else
-                {
-                    if (request.FolderId != 0)
-                        sql += "and  (a.RoleId in(1,3) or a.AttributeValue=1)";
-                    else
-                        sql += "and  (a.RoleId in(1,3))";
-                }
+                    sql += "and  (a.RoleId in(1,3) or a.AttributeValue<>2)";
                 if (request.FolderId == 0 && !string.IsNullOrEmpty(request.SearchKey))
                     sql += $@" AND (b.Title LIKE '%{request.SearchKey}%' OR a.FolderName LIKE '%{request.SearchKey}%' or b.TextContent LIKE '%{request.SearchKey}%')";
                 else if (!string.IsNullOrEmpty(request.SearchKey))
@@ -453,7 +423,7 @@ namespace GxPress.Repository.Implement.Note
                     left join tede_user c on c.Id=b.UserId 
                     left join tede_department d on d.Id=c.DepartmentId 
                     WHERE
-                      a.FolderType = {noteTypeId} AND a.userId = {request.VisitUserId}
+                     a.userId = {request.VisitUserId}
                         AND a.IsDelete = 0
                         AND (a.UserId IN (SELECT 
                             Id
@@ -474,16 +444,13 @@ namespace GxPress.Repository.Implement.Note
                         WHERE
                         UserId = {request.UserId} AND MiddleId = {sqlStr}))";
                 if (request.TypeValue == 0)
-                    sql += "and  (a.RoleId in(2) or a.AttributeValue=1)";
+                    sql += "and  (a.RoleId in(2) or a.AttributeValue<>2)";
                 else
                 {
-                    if (request.FolderId != 0)
-                        sql += "and  (a.RoleId in(1,3) or a.AttributeValue=1)";
-                    else
-                        sql += "and  (a.RoleId in(1,3))";
+                    sql += "and  (a.RoleId in(1,3) or a.AttributeValue<>2)";
                 }
                 if (request.FolderId == 0 && !string.IsNullOrEmpty(request.SearchKey))
-                    sql += $@" and a.ParentId={request.FolderId}  AND(b.Title LIKE '%{request.SearchKey}%' OR a.FolderName LIKE '%{request.SearchKey}%' or b.TextContent LIKE '%{request.SearchKey}%')";
+                    sql += $@" AND(b.Title LIKE '%{request.SearchKey}%' OR a.FolderName LIKE '%{request.SearchKey}%' or b.TextContent LIKE '%{request.SearchKey}%')";
                 else if (!string.IsNullOrEmpty(request.SearchKey))
                     sql += $@" and a.ParentId={request.FolderId}  AND(b.Title LIKE '%{request.SearchKey}%' OR a.FolderName LIKE '%{request.SearchKey}%' or b.TextContent LIKE '%{request.SearchKey}%')";
                 else
@@ -492,18 +459,16 @@ namespace GxPress.Repository.Implement.Note
             else
             {
                 sql =
-                    $@"SELECT  count(1) FROM tede_middle a LEFT JOIN tede_note b ON a.MiddleId = b.Id left join tede_user c on c.Id=b.UserId left join tede_department d on d.Id=c.DepartmentId WHERE a.UserId = {request.UserId} AND a.FolderType ={noteTypeId} AND a.IsDelete = 0";
+                    $@"SELECT  count(1) FROM tede_middle a LEFT JOIN tede_note b ON a.MiddleId = b.Id left join tede_user c on c.Id=b.UserId left join tede_department d 
+                    on d.Id=c.DepartmentId WHERE a.UserId = {request.UserId} AND a.IsDelete = 0";
                 if (request.TypeValue == 0)
-                    sql += " and  (a.RoleId in(2) or a.AttributeValue=1)";
+                    sql += " and  (a.RoleId in(2) or a.AttributeValue<>2)";
                 else
                 {
-                    if (request.FolderId != 0)
-                        sql += " and  (a.RoleId in(1,3) or a.AttributeValue=1)";
-                    else
-                        sql += " and  (a.RoleId in(1,3))";
+                    sql += " and  (a.RoleId in(1,3) or a.AttributeValue<>2)";
                 }
                 if (request.FolderId == 0 && !string.IsNullOrEmpty(request.SearchKey))
-                    sql += $@" and a.ParentId={request.FolderId} AND(b.Title LIKE '%{request.SearchKey}%' OR a.FolderName LIKE '%{request.SearchKey}%' or b.TextContent LIKE '%{request.SearchKey}%')";
+                    sql += $@"  AND (b.Title LIKE '%{request.SearchKey}%' OR a.FolderName LIKE '%{request.SearchKey}%' or b.TextContent LIKE '%{request.SearchKey}%')";
                 else if (!string.IsNullOrEmpty(request.SearchKey))
                     sql += $@" and a.ParentId={request.FolderId}  AND(b.Title LIKE '%{request.SearchKey}%' OR a.FolderName LIKE '%{request.SearchKey}%' or b.TextContent LIKE '%{request.SearchKey}%')";
                 else

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

@@ -44,11 +44,6 @@ namespace GxPress.Repository.Implement
             _visitRepository = new Repository<Entity.Visit.Visit>(database);
             _mapper = mapper;
         }
-
-        public TopicRepository()
-        {
-        }
-
         public IDatabase Database => _repository.Database;
         public string TableName => _repository.TableName;
         public List<TableColumn> TableColumns => _repository.TableColumns;

+ 1 - 5
gx_api/GxPress/Repository/GxPress.Repository.Interface/IGroupRepository.cs

@@ -1,9 +1,5 @@
-using System;
 using System.Collections.Generic;
-using System.Text;
-using System.Text.RegularExpressions;
 using System.Threading.Tasks;
-using GxPress.Common.Page;
 using GxPress.Request.App.Group;
 using GxPress.Result.App.Group;
 using GxPress.Result.App.GroupUser;
@@ -20,7 +16,7 @@ namespace GxPress.Repository.Interface
         Task<bool> UpdateAsync(GroupUpRequest request);
         Task<bool> DeleteAsync(int id);
         Task<bool> DeleteAsync(SqlKata.Query query);
-        Task<PagedList<GroupUserFindResult>> FindGroupByGroupFolderId(GroupSearchRequest request);
+        Task<IEnumerable<GroupUserFindResult>> FindGroupByGroupFolderId(GroupSearchRequest request);
 
         Task<GroupDetailResult> GroupDetailAsync(GroupDetailRequest request);
 

+ 2 - 2
gx_api/GxPress/Service/GxPress.Service.Implement/Group/GroupService.cs

@@ -109,10 +109,10 @@ namespace GxPress.Service.Implement.Group
         /// </summary>
         /// <param name="request"></param>
         /// <returns></returns>
-        public async Task<PagedList<GroupUserFindResult>> FindGroupByGroupFolderIdAsync(GroupSearchRequest request)
+        public async Task<IEnumerable<GroupUserFindResult>> FindGroupByGroupFolderIdAsync(GroupSearchRequest request)
         {
             var result = await _groupRepository.FindGroupByGroupFolderId(request);
-            foreach (var item in result.Items)
+            foreach (var item in result)
             {
                 item.TypeId = UserlinkConst.System.GetHashCode();
                 if (item.AttributeValue == 2)

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

@@ -28,7 +28,6 @@ namespace GxPress.Service.Implement.Topic
             {
                 using (TransactionScope transactionScope = new TransactionScope())
                 {
-
                     //创建话题
                     var topic = new Entity.Topic.Topic
                     {
@@ -40,7 +39,6 @@ namespace GxPress.Service.Implement.Topic
                         FolderId = request.FolderId,
                         IsDraft = request.IsDraft
                     };
-
                     if (!string.IsNullOrEmpty(request.Content))
                     {
                         var contentJsonData = JsonConvert.DeserializeObject<List<ContentJsonData>>(request.Content);
@@ -58,6 +56,13 @@ namespace GxPress.Service.Implement.Topic
                         topic.Content = "[]";
                     }
                     var topicId = await _topicRepository.InsertAsync(topic);
+                    //修改小组
+                    if (request.GroupId > 0)
+                    {
+                        var group = await groupRepository.GetAsync(request.GroupId);
+                        group.LastModifiedDate = DateTime.Now;
+                        await groupRepository.UpdateAsync(group);
+                    }
                     // //添加默认文件夹
                     // await recordFolderRepository.AddAsync(AllTypeConst.TopicNote.GetHashCode(), request.UserId, request.FolderId);
                     //修改话题访问量

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

@@ -699,44 +699,6 @@ namespace GxPress.Service.Implement.Topic
             return result;
         }
         /// <summary>
-        /// APP列表显示用
-        /// </summary>
-        /// <param name="contentJsonDataList"></param>
-        /// <returns></returns>
-        public List<ContentJsonData> GetListAsync(List<ContentJsonData> contentJsonDataList)
-        {
-            var result = new List<ContentJsonData>();
-            if (contentJsonDataList.Count > 0)
-            {
-                //查询文本
-                var txtType = contentJsonDataList.FirstOrDefault(n => n.Type == 1);
-                if (txtType != null)
-                    result.Add(txtType);
-                //拼接图片
-                var imgType = contentJsonDataList.FindAll(n => n.Type == 2);
-                if (imgType.Any())
-                {
-                    foreach (var item in imgType)
-                    {
-                        //判断图片数量
-                        if (result.Count(n => n.Type == 2) > 8)
-                            break;
-                        result.Add(item);
-                    }
-                }
-                else
-                {
-                    var values = new List<int> { 1, 2 };
-                    var list = contentJsonDataList.FindAll(n => !values.Contains(n.Type));
-                    if (list.Any())
-                        result.Add(list.FirstOrDefault());
-                }
-            }
-            return result;
-        }
-
-
-        /// <summary>
         /// 添加话题分组成员
         /// </summary>
         /// <param name="userIds"></param>
@@ -864,34 +826,6 @@ namespace GxPress.Service.Implement.Topic
             var topicListPageResults = await _topicRepository.FindTopicByGroupIdAsync(request);
             foreach (var item in topicListPageResults.Items)
             {
-                // var analyzeRequest = new Request.App.Analyze.AnalyzeRequest();
-                // analyzeRequest.TypeValue = 1;
-                // analyzeRequest.AnalyzeType = 1;
-                // analyzeRequest.SourceId = item.Id;
-                // analyzeRequest.UserId = request.UserId;
-                // //点赞数量
-                // item.PraiseCount = await _analyzeService.CountAsync(analyzeRequest);
-                // //获取话题的评论数量
-                // var commentCount =
-                //     await _commentRepository.CountAsync(Q.Where(nameof(Entity.Comment.ArticleId), item.Id).Where(nameof(Entity.Comment.TypeValue), 1));
-                // item.CommentCount = commentCount;
-                // //获取话题的转发数量
-                // analyzeRequest.AnalyzeType = 4;
-                // var retransmissionCount = await _analyzeService.CountAsync(analyzeRequest);
-                // item.RetransmissionCount = retransmissionCount;
-                // item.IsRetransmission = await _analyzeService.ExistsAsync(analyzeRequest);
-                // //获取话题的收藏数量
-                // analyzeRequest.AnalyzeType = 3;
-                // var collectCount = await _analyzeService.CountAsync(analyzeRequest);
-                // item.CollectCount = collectCount;
-                // //是否收藏
-                // item.IsCollect = await _analyzeService.ExistsAsync(analyzeRequest);
-                // //获取话题的点赞数量
-                // analyzeRequest.AnalyzeType = 1;
-                // var praiseCount = await _analyzeService.CountAsync(analyzeRequest);
-                // item.PraiseCount = praiseCount;
-                // //是否点赞
-                // item.IsPraise = await _analyzeService.ExistsAsync(analyzeRequest);
                 if (string.IsNullOrWhiteSpace(item.Content))
                     item.Content = "[]";
                 var contentJsonData = JsonConvert.DeserializeObject<List<ContentJsonData>>(item.Content);

+ 1 - 1
gx_api/GxPress/Service/GxPress.Service.Interface/Group/IGroupService.cs

@@ -14,7 +14,7 @@ namespace GxPress.Service.Interface.Group
     public interface IGroupService : IService
     {
         Task<GroupDetailResult> InsertGroup(GroupInRequest request);
-        Task<PagedList<GroupUserFindResult>> FindGroupByGroupFolderIdAsync(GroupSearchRequest request);
+        Task<IEnumerable<GroupUserFindResult>> FindGroupByGroupFolderIdAsync(GroupSearchRequest request);
 
         Task<AppResult<Object>> InsertsAsync(GroupUserInRequest request);