李昊 4 years ago
parent
commit
192b63f624

+ 17 - 0
gx_api/GxPress/Api/GxPress.Api/AppControllers/MediaController.cs

@@ -36,6 +36,23 @@ namespace GxPress.Api.AppControllers
             this.orderRepository = orderRepository;
         }
         /// <summary>
+        /// 详情
+        /// </summary>
+        /// <param name="id"></param>
+        /// <returns></returns>
+        [HttpGet("{id}")]
+        [AllowAnonymous]
+        public async Task<MediaResult> GetAsync(int id)
+        {
+
+            var result = await mediaService.GetAsync(id);
+            if (_loginContext.AccountId > 0 && result.FreeProportion == 0)
+                result.IsBuy = true;
+            else if (_loginContext.AccountId > 0)
+                result.IsBuy = await orderRepository.GetExistsAsync(_loginContext.AccountId, id);
+            return result;
+        }
+        /// <summary>
         /// 书籍详情
         /// /// </summary>
         /// <param name="id"></param>

+ 0 - 2
gx_api/GxPress/Api/GxPress.Api/AppControllers/NoticeController.cs

@@ -38,8 +38,6 @@ namespace GxPress.Api.AppControllers
         [HttpPut("add")]
         public async Task<bool> Insert(NoticeInRequest request)
         {
-            // request.HtmlContent = StringUtils.RemoveEmoji(request.HtmlContent);
-            // request.Content = StringUtils.RemoveEmoji(request.Content);
             request.UserId = _loginContext.AccountId;
             var boolValue = await _noticeService.InsertAsync(request);
             return boolValue;

+ 11 - 2
gx_api/GxPress/Model/GxPress.Entity/Notice.cs

@@ -44,14 +44,23 @@ namespace GxPress.Entity
         /// </summary>
         [DataColumn]
         public NoticeTypeConst NoticeType { get; set; }
-
+        /// <summary>
+        ///  5 通知 6站内信 15 我审批的 16 我发出的 17 抄送我的
+        /// </summary>
+        /// <value></value>
+        [DataColumn]
+        public int TypeValue { get; set; }
         /// <summary>
         /// 是否删除
         /// </summary>
         [DataColumn]
         public bool IsDelete { get; set; }
 
-
+        /// <summary>
+        /// 父级ID用于回复
+        /// </summary>
+        [DataColumn]
+        public int ParentId { get; set; }
 
         /// <summary>
         /// 是否置顶

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

@@ -27,6 +27,12 @@ namespace GxPress.EnumConst
         NoteFolder = 13,
         [Description("工作流审批")]
         Flow = 14,
+        [Description("我审批的")]
+        MyChecked = 15,
+        [Description("我发出的")]
+        MySubmitted = 16,
+        [Description("抄送我的")]
+        MyCc = 17,
         [Description("文件")]
         File = 300,
         [Description("图片")]
@@ -58,7 +64,9 @@ namespace GxPress.EnumConst
         [Description("公众号")]
         PublicNumber = 110,
         [Description("刊期")]
-        Magazine = 120
+        Magazine = 120,
+        [Description("收件箱")]
+        Inbox = 800,
     }
     /// <summary>
     /// App频道

+ 11 - 0
gx_api/GxPress/Model/GxPress.Request/Notice/NoticeInRequest.cs

@@ -80,5 +80,16 @@ namespace GxPress.Request.Notice
         /// </summary>
         /// <value></value>
         public int SoureId { get; set; }
+
+        /// <summary>
+        ///  5 通知 6站内信 15 我审批的 16 我发出的 17 抄送我的
+        /// </summary>
+        /// <value></value>
+        public int TypeValue { get; set; }
+        /// <summary>
+        /// 父级ID
+        /// </summary>
+        /// <value></value>
+        public int ParentId { get; set; }
     }
 }

+ 6 - 1
gx_api/GxPress/Model/GxPress.Result/Media/MediaResult.cs

@@ -388,6 +388,11 @@ namespace GxPress.Result.Media
         /// </summary>
         /// <value></value>
         public int IsExercises { get; set; }
+        /// <summary>
+        /// 是否购买
+        /// </summary>
+        /// <value></value>
+        public bool IsBuy { get; set; }
     }
     /// <summary>
     /// 书籍目录
@@ -604,6 +609,6 @@ namespace GxPress.Result.Media
         /// 明栏数据
         /// </summary>
         /// <value></value>
-        public IEnumerable<MediaCathedraResult> Items{ get; set; }
+        public IEnumerable<MediaCathedraResult> Items { get; set; }
     }
 }

+ 2 - 0
gx_api/GxPress/Repository/GxPress.Repository.Implement/NoticeRepository.cs

@@ -82,8 +82,10 @@ namespace GxPress.Repository.Implement
                     {
                         NoticeType = request.NoticeType.GetHashCode() == 0 ? NoticeTypeConst.Send : request.NoticeType,
                         UserId = request.UserId,
+                        TypeValue = request.TypeValue,
                         Content = request.Content,
                         Title = request.Title,
+                        ParentId = request.ParentId,
                         UserName = userEntity.Name,
                         HtmlContent = request.HtmlContent,
                         SourceId = request.SoureId,

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

@@ -31,14 +31,16 @@ namespace GxPress.Service.Implement.Notice
                     var middleId = 0;
                     var addresseeUsers = new List<User>();
                     var ccUsers = new List<User>();
+                    //添加通知
                     if (request.Id == 0)
                     {
                         noticeId = await _noticeRepository.InsertAsync(request);
+                        if (noticeId == 0) return false;
                         var middleInsertTypes = new MiddleInsertTypeRequest
                         {
                             FolderId = request.FolderId,
                             MiddleId = noticeId,
-                            FolderType = GxPress.EnumConst.FolderTypeConst.Notice.GetHashCode(),
+                            FolderType = GxPress.EnumConst.AllTypeConst.Inbox.GetHashCode(),
                             UserId = request.UserId,
                             MiddleSonId = 0,
                             NoticeAddresseeType = request.NoticeType,