李昊 4 年之前
父节点
当前提交
7feba0770b

+ 3 - 1
gx_api/GxPress/Model/GxPress.EnumConst/AllTypeConst.cs

@@ -7,7 +7,7 @@ namespace GxPress.EnumConst
     /// </summary>
     public enum AllTypeConst
     {
-         [Description("文本")]
+        [Description("文本")]
         Text = 1,
         [Description("文章")]
         Article = 100,
@@ -23,6 +23,8 @@ namespace GxPress.EnumConst
         Missive = 6,
         [Description("小组")]
         Group = 7,
+        [Description("信源")]
+        Wechat = 10,
         [Description("收藏文件夹")]
         CollectFolder = 12,
         [Description("笔记文件夹")]

+ 30 - 41
gx_api/GxPress/Service/GxPress.Service.Implement/Middle/MiddleService.cs

@@ -20,6 +20,7 @@ using GxPress.Service.Interface.UserMiddle;
 using GxPress.Repository.Interface.RecordFolder;
 using GxPress.Service.Interface.Analyze;
 using GxPress.Request.App.Analyze;
+using GxPress.EnumConst;
 
 namespace GxPress.Service.Implement.Middle
 {
@@ -208,16 +209,16 @@ namespace GxPress.Service.Implement.Middle
                 MiddleSonId = request.MiddleSonId,
                 IsAdmin = request.IsAdmin,
                 NoticeAddresseeType = request.NoticeAddresseeType,
-                Title=request.Title,
+                Title = request.Title,
                 IsRead = false,
                 IsUpload = false,
-                TitleLong=request.TitleLong,
-                Content="",
-                AddressUser=request.AddressUser,
-                CcUser=request.CcUser,
-                CcUserComplete=request.CcUserComplete,
-                AddressUserComplete=request.AddressUserComplete,
-                IsRecall=false
+                TitleLong = request.TitleLong,
+                Content = "",
+                AddressUser = request.AddressUser,
+                CcUser = request.CcUser,
+                CcUserComplete = request.CcUserComplete,
+                AddressUserComplete = request.AddressUserComplete,
+                IsRecall = false
             };
             if (request.AttributeValue == 0)
                 middle.AttributeValue = 1;
@@ -295,7 +296,7 @@ namespace GxPress.Service.Implement.Middle
                 var middles = await _middleRepository.FindAsync(Q.WhereIn(nameof(Entity.Middle.Middle.Id), request.MiddleIds));
                 var ids = middles.Select(n => n.MiddleId).ToList();
                 //收藏
-                if (request.FolderType == 3)
+                if (request.FolderType == AllTypeConst.Collect.GetHashCode())
                 {
                     //查询收藏
                     var collections = await _collectionRepository.GetAllAsync(Q.WhereIn(nameof(Entity.Collection.Id), ids));
@@ -306,59 +307,59 @@ namespace GxPress.Service.Implement.Middle
                         analyzeRequest.SourceId = item.CollectionDataId;
                         analyzeRequest.UserId = item.UserId;
                         //删除文章收藏
-                        if (item.CollectionType == 1)
+                        if (item.CollectionType == AllTypeConst.Article.GetHashCode())
                         {
-                            analyzeRequest.TypeValue = 0;
+                            analyzeRequest.TypeValue = item.CollectionType;
                             var analyze = await analyzeService.GetAnalyzeAsync(analyzeRequest);
                             if (analyze != null)
                                 await _analyzeRepository.DeleteAsync(analyze.Id);
                         }
                         //删除话题收藏
-                        if (item.CollectionType == 2)
+                        if (item.CollectionType == AllTypeConst.Topic.GetHashCode())
                         {
-                            analyzeRequest.TypeValue = 1;
+                            analyzeRequest.TypeValue = item.CollectionType;
                             var analyze = await analyzeService.GetAnalyzeAsync(analyzeRequest);
                             if (analyze != null)
                                 await _analyzeRepository.DeleteAsync(analyze.Id);
                         }
 
                         //删除笔记收藏
-                        if (item.CollectionType == 4)
+                        if (item.CollectionType == AllTypeConst.Note.GetHashCode())
                         {
-                            analyzeRequest.TypeValue = 3;
+                            analyzeRequest.TypeValue = item.CollectionType;
                             var analyze = await analyzeService.GetAnalyzeAsync(analyzeRequest);
                             if (analyze != null)
                                 await _analyzeRepository.DeleteAsync(analyze.Id);
                         }
 
                         //删除通知收藏
-                        if (item.CollectionType == 5)
+                        if (item.CollectionType == AllTypeConst.Notice.GetHashCode())
                         {
-                            analyzeRequest.TypeValue = 2;
+                            analyzeRequest.TypeValue = item.CollectionType;
                             var analyze = await analyzeService.GetAnalyzeAsync(analyzeRequest);
                             if (analyze != null)
                                 await _analyzeRepository.DeleteAsync(analyze.Id);
                             await _addresseeRepository.UpdateAsync(Q.Where(nameof(Entity.Addressee.UserId), request.UserId).WhereIn(nameof(Entity.Addressee.SourceId), ids).Set(nameof(Entity.Addressee.IsDelete), true));
                         }
                         //删除站内信收藏
-                        if (item.CollectionType == 6)
+                        if (item.CollectionType == AllTypeConst.Missive.GetHashCode())
                         {
-                            analyzeRequest.TypeValue = 4;
+                            analyzeRequest.TypeValue = item.CollectionType;
                             var analyze = await analyzeService.GetAnalyzeAsync(analyzeRequest);
                             if (analyze != null)
                                 await _analyzeRepository.DeleteAsync(analyze.Id);
                             await _addresseeRepository.UpdateAsync(Q.Where(nameof(Entity.Addressee.UserId), request.UserId).WhereIn(nameof(Entity.Addressee.SourceId), ids).Set(nameof(Entity.Addressee.IsDelete), true));
                         }
                         //删除收藏会议
-                        if (item.CollectionType == 8)
+                        if (item.CollectionType == AllTypeConst.Meeting.GetHashCode())
                         {
-                            analyzeRequest.TypeValue = 10;
+                            analyzeRequest.TypeValue = item.CollectionType;
                             var analyze = await analyzeService.GetAnalyzeAsync(analyzeRequest);
                             if (analyze != null)
                                 await _analyzeRepository.DeleteAsync(analyze.Id);
                         }
                         //收藏笔记文件夹
-                        if (item.CollectionType == 12 || item.CollectionType == 13)
+                        if (item.CollectionType == AllTypeConst.NoteFolder.GetHashCode() || item.CollectionType == AllTypeConst.CollectFolder.GetHashCode())
                         {
                             analyzeRequest.TypeValue = item.CollectionType;
                             var analyze = await analyzeService.GetAnalyzeAsync(analyzeRequest);
@@ -372,31 +373,19 @@ namespace GxPress.Service.Implement.Middle
                     await _collectionRepository.RecursionDeleteAsync(request.MiddleIds);
                 }
                 //删除笔记
-                if (request.FolderType == 4)
+                if (request.FolderType == AllTypeConst.Note.GetHashCode())
                 {
                     await _noteRepository.UpdateAsync(Q.WhereIn(nameof(Entity.Note.Note.Id), ids).Set(nameof(Entity.Note.Note.IsDelete), true));
                     //删除默认共享文件夹
                     await recordFolderRepository.DeleteAsync(request.FolderType, request.UserId, request.MiddleIds);
                 }
-                //站内信
-                // if (request.FolderType == 5)
-                //     await _missiveRepository.DeleteAsync(Q.WhereIn(nameof(Entity.Missive.Missive.Id), ids));
                 //小组
-                if (request.FolderType == 7)
+                if (request.FolderType == AllTypeConst.Group.GetHashCode())
                     await _groupRepository.DeleteAsync(Q.WhereIn(nameof(Entity.Group.Id), ids));
-                // //删除通知
-                // if (request.FolderType == 1 && request.IsDelete)
-                //     await _noticeRepository.DeleteAsync(Q.WhereIn(nameof(Entity.Notice.Id), middles.Select(n => n.MiddleId)));
-                // //删除站内信
-                // if (request.FolderType == 5 && request.IsDelete)
-                //     await _missiveRepository.DeleteAsync(Q.WhereIn(nameof(Entity.Missive.Missive.Id), middles.Select(n => n.MiddleId)));
-                //删除通知
-                if (request.FolderType == 1)
-                    await _addresseeRepository.UpdateAsync(Q.Where(nameof(Entity.Addressee.UserId), request.UserId).WhereIn(nameof(Entity.Addressee.SourceId), ids).Set(nameof(Entity.Addressee.IsDelete), true).Set(nameof(Entity.Addressee.IsRead), true));
-                //删除站内信
-                if (request.FolderType == 5)
+                //删除收件箱
+                if (request.FolderType == AllTypeConst.Inbox.GetHashCode())
                     await _addresseeRepository.UpdateAsync(Q.Where(nameof(Entity.Addressee.UserId), request.UserId).WhereIn(nameof(Entity.Addressee.SourceId), ids).Set(nameof(Entity.Addressee.IsDelete), true).Set(nameof(Entity.Addressee.IsRead), true));
-                if (request.FolderType == 1 || request.FolderType == 5)
+                if (request.FolderType == AllTypeConst.Inbox.GetHashCode())
                 {
                     foreach (var item in middles)
                     {
@@ -410,13 +399,13 @@ namespace GxPress.Service.Implement.Middle
                     }
                 }
                 //删除信源以及文件夹
-                if (request.FolderType == 10)
+                if (request.FolderType == AllTypeConst.Wechat.GetHashCode())
                 {
                     foreach (var middle in middles)
                     {
                         //判断是否文件夹
                         if (middle.AttributeValue == 2)
-                            await _middleRepository.UpdateAsync(Q.Set(nameof(Entity.Middle.Middle.ParentId), 0).Where(nameof(Entity.Middle.Middle.ParentId), middle.Id).Where(nameof(Entity.Middle.Middle.FolderType), 10));
+                            await _middleRepository.UpdateAsync(Q.Set(nameof(Entity.Middle.Middle.ParentId), 0).Where(nameof(Entity.Middle.Middle.ParentId), middle.Id).Where(nameof(Entity.Middle.Middle.FolderType), AllTypeConst.Wechat.GetHashCode()));
                     }
                 }
                 await _middleRepository.DeleteAsync(request);