李昊 il y a 4 ans
Parent
commit
9ea07f6d1a

+ 3 - 2
gx_api/GxPress/Repository/GxPress.Repository.Implement/Note/NoteRepository.cs

@@ -7,6 +7,7 @@ using GxPress.Common.AppOptions;
 using GxPress.Common.Page;
 using GxPress.Common.Tools;
 using GxPress.Entity;
+using GxPress.EnumConst;
 using GxPress.Repository.Interface.Note;
 using GxPress.Request.App.Note;
 using GxPress.Request.Web;
@@ -113,7 +114,7 @@ namespace GxPress.Repository.Implement.Note
         public string GetCollectionSql(NoteSearchPageListRequest request)
         {
             string sql = "";
-            var noteTypeId = GxPress.EnumConst.AllTypeConst.Note.GetHashCode();
+            var noteTypeId = request.TypeValue == 0 ? AllTypeConst.Note.GetHashCode() : AllTypeConst.TopicNote.GetHashCode();
             if (request.VisitUserId > 0)
             {
                 sql =
@@ -734,7 +735,7 @@ namespace GxPress.Repository.Implement.Note
         /// </summary>
         /// <param name="userId"></param>
         /// <returns></returns>
-        public async Task<IEnumerable<int>> GetLatelyFolderIdAsync(int userId,bool isTopic)
+        public async Task<IEnumerable<int>> GetLatelyFolderIdAsync(int userId, bool isTopic)
         {
             var query = Q.NewQuery();
             query.Select(nameof(Entity.Note.Note.FolderId));

+ 1 - 1
gx_api/GxPress/Service/GxPress.Service.Implement/Middle/MiddleService.cs

@@ -804,7 +804,7 @@ namespace GxPress.Service.Implement.Middle
             var recordFolder = await recordFolderRepository.GetAsync(folderType, userId);
             var result = new MiddleDefaultResult();
             //获取笔记默认
-            if (recordFolder.Id == 0 && folderType == 21)
+            if (recordFolder.Id == 0 && folderType == AllTypeConst.TopicNote.GetHashCode())
             {
                 var middle = await _middleRepository.GetMiddleAsync(Q.Where(nameof(Entity.Middle.Middle.FolderType), AllTypeConst.Note.GetHashCode()).Where(nameof(Entity.Middle.Middle.AttributeValue), 2).Where(nameof(Entity.Middle.Middle.IsSystemDefault), true).Where(nameof(Entity.Middle.Middle.UserId), userId));
                 result.IsDefault = middle != null ? middle.IsSystemDefault : false;

+ 1 - 1
gx_api/GxPress/Service/GxPress.Service.Implement/Note/NoteService.cs

@@ -132,7 +132,7 @@ namespace GxPress.Service.Implement.Note
                     //修改话题访问量
                     await _visitService.AddVisit(request.UserId, AllTypeConst.Note.GetHashCode(), noteId);
                     //添加默认文件夹
-                    await recordFolderRepository.AddAsync(request.IsTopic ? 21 : AllTypeConst.Note.GetHashCode(), request.UserId, request.FolderId);
+                    await recordFolderRepository.AddAsync(request.FolderId, request.UserId, request.FolderId);
                     transactionScope.Complete();
                 }
             }