李昊 4 yıl önce
ebeveyn
işleme
b03ed6db72
18 değiştirilmiş dosya ile 750 ekleme ve 9 silme
  1. 140 0
      gx_api/GxPress/Api/GxPress.Api/AdminControllers/AdminAppChannelController.cs
  2. 12 3
      gx_api/GxPress/Api/GxPress.Api/AdminControllers/AdminUtilsController.cs
  3. 46 0
      gx_api/GxPress/Model/GxPress.Entity/tede2/AppChannel/AppChannel.cs
  4. 42 0
      gx_api/GxPress/Model/GxPress.Entity/tede2/AppChannel/ChannelCategory.cs
  5. 24 0
      gx_api/GxPress/Model/GxPress.Entity/tede2/AppChannel/ChannelCategoryMedia.cs
  6. 14 0
      gx_api/GxPress/Model/GxPress.EnumConst/AllTypeConst.cs
  7. 25 0
      gx_api/GxPress/Model/GxPress.Request/AppChannel/AppChannelRequest.cs
  8. 2 2
      gx_api/GxPress/Model/GxPress.Request/Media/MediaRequest.cs
  9. 51 0
      gx_api/GxPress/Model/GxPress.Result/AppChannel/AppChannelResult.cs
  10. 87 0
      gx_api/GxPress/Repository/GxPress.Repository.Implement/AppChannel/AppChannelRepository.cs
  11. 84 0
      gx_api/GxPress/Repository/GxPress.Repository.Implement/AppChannel/ChannelCategoryMediaRepository.cs
  12. 79 0
      gx_api/GxPress/Repository/GxPress.Repository.Implement/AppChannel/ChannelCategoryRepository.cs
  13. 4 4
      gx_api/GxPress/Repository/GxPress.Repository.Implement/Media/MediaRepository.cs
  14. 41 0
      gx_api/GxPress/Repository/GxPress.Repository.Interface/AppChannel/IAppChannelRepository.cs
  15. 34 0
      gx_api/GxPress/Repository/GxPress.Repository.Interface/AppChannel/IChannelCategoryMediaRepository.cs
  16. 36 0
      gx_api/GxPress/Repository/GxPress.Repository.Interface/AppChannel/IChannelCategoryRepository.cs
  17. 22 0
      gx_api/GxPress/Service/GxPress.Service.Implement/AppChannel/AppChannelService.cs
  18. 7 0
      gx_api/GxPress/Service/GxPress.Service.Interface/AppChannel/IAppChannelService.cs

+ 140 - 0
gx_api/GxPress/Api/GxPress.Api/AdminControllers/AdminAppChannelController.cs

@@ -0,0 +1,140 @@
+using System.Collections.Generic;
+using System.Threading.Tasks;
+using GxPress.Entity.tede2.AppChannel;
+using GxPress.EnumConst;
+using GxPress.Repository.Interface.AppChannel;
+using GxPress.Request.AppChannel;
+using GxPress.Result.AppChannel;
+using Microsoft.AspNetCore.Authorization;
+using Microsoft.AspNetCore.Mvc;
+
+namespace GxPress.Api.AdminControllers
+{
+    /// <summary>
+    /// 文章组
+    /// </summary>
+    [Route("api/admin/app-channel")]
+    [ApiController]
+    [Authorize]
+    public class AdminAppChannelController : Controller
+    {
+        private readonly IChannelCategoryMediaRepository channelCategoryMediaRepository;
+        private readonly IChannelCategoryRepository channelCategoryRepository;
+        private readonly IAppChannelRepository appChannelRepository;
+
+        public AdminAppChannelController(IChannelCategoryMediaRepository channelCategoryMediaRepository, IChannelCategoryRepository channelCategoryRepository, IAppChannelRepository appChannelRepository)
+        {
+            this.channelCategoryMediaRepository = channelCategoryMediaRepository;
+            this.channelCategoryRepository = channelCategoryRepository;
+            this.appChannelRepository = appChannelRepository;
+        }
+        /// <summary>
+        /// 获取导航详情
+        /// </summary>
+        /// <param name="id"></param>
+        /// <returns></returns>
+        [HttpGet("channel/{id}")]
+        public async Task<Entity.tede2.AppChannel.AppChannel> GetAsync(int id)
+        {
+            return await appChannelRepository.GetAsync(id);
+        }
+        /// <summary>
+        /// 查询 公众号 700 视频 710 期刊杂志 720 图书 730
+        /// </summary>
+        /// <returns></returns>
+        [HttpGet("channel/list/{id}")]
+        public async Task<IEnumerable<Entity.tede2.AppChannel.AppChannel>> GetAllAsync(int channelTypeValye)
+        {
+            return await appChannelRepository.GetAllAsync((AppChannelConst)channelTypeValye);
+        }
+        /// <summary>
+        /// 删除导航
+        /// </summary>
+        /// <param name="id"></param>
+        /// <returns></returns>
+        [HttpDelete("channel/{id}")]
+        public async Task<bool> DeleteAsync(int id)
+        {
+            return await appChannelRepository.DeleteAsync(id);
+        }
+        /// <summary>
+        /// 修改导航
+        /// </summary>
+        /// <param name="request"></param>
+        /// <returns></returns>
+        [HttpPut("channel")]
+        public async Task<bool> UpdateAsync(Entity.tede2.AppChannel.AppChannel request)
+        {
+            return await appChannelRepository.UpdateAsync(request);
+        }
+        /// <summary>
+        /// 添加导航
+        /// </summary>
+        /// <param name="model"></param>
+        /// <returns></returns>
+        [HttpPost("channel")]
+        public async Task<bool> InsertAsync(Entity.tede2.AppChannel.AppChannel model)
+        {
+            return await appChannelRepository.UpdateAsync(model);
+        }
+        /// <summary>
+        /// 获取导航分类详情
+        /// </summary>
+        /// <param name="id"></param>
+        /// <returns></returns>
+        [HttpGet("channel-category/{id}")]
+        public async Task<Entity.tede2.AppChannel.ChannelCategory> ChannelCategoryGetAsync(int id)
+        {
+            return await channelCategoryRepository.GetAsync(id);
+        }
+        /// <summary>
+        /// 查询导航分类
+        /// </summary>
+        /// <returns></returns>
+        [HttpGet("channel-category/list/{channelTypeValye}")]
+        public async Task<IEnumerable<ChannelCategoryResult>> ChannelCategoryGetAllAsync(int channelTypeValye)
+        {
+            return await channelCategoryRepository.GetAllAsync((AppChannelConst)channelTypeValye);
+        }
+        /// <summary>
+        /// 删除导航分类
+        /// </summary>
+        /// <param name="id"></param>
+        /// <returns></returns>
+        [HttpDelete("channel-category/{id}")]
+        public async Task<bool> ChannelCategoryDeleteAsync(int id)
+        {
+            return await channelCategoryRepository.DeleteAsync(id);
+        }
+        /// <summary>
+        /// 添加导航分类
+        /// </summary>
+        /// <param name="request"></param>
+        /// <returns></returns>
+        [HttpPost("channel-category")]
+        public async Task<bool> InsertAsync(ChannelCategory request)
+        {
+            return await channelCategoryRepository.InsertAsync(request);
+        }
+        /// <summary>
+        /// 删除导航媒体
+        /// </summary>
+        /// <param name="id"></param>
+        /// <returns></returns>
+        [HttpDelete("channel-category-media/{id}")]
+        public async Task<bool> ChannelCategoryMediaDeleteAsync(int id)
+        {
+            return await channelCategoryMediaRepository.DeleteAsync(id);
+        }
+        /// <summary>
+        /// 添加导航媒体
+        /// </summary>
+        /// <param name="request"></param>
+        /// <returns></returns>
+        [HttpPost("channel-category-media")]
+        public async Task<bool> ChannelCategoryMediaInsertAsync(ChannelCategoryMediaInRequest request)
+        {
+            return await channelCategoryMediaRepository.InsertAsync(request);
+        }
+    }
+}

Dosya farkı çok büyük olduğundan ihmal edildi
+ 12 - 3
gx_api/GxPress/Api/GxPress.Api/AdminControllers/AdminUtilsController.cs


+ 46 - 0
gx_api/GxPress/Model/GxPress.Entity/tede2/AppChannel/AppChannel.cs

@@ -0,0 +1,46 @@
+using Datory.Annotations;
+
+namespace GxPress.Entity.tede2.AppChannel
+{
+    /// <summary>
+    /// app频道
+    /// </summary>
+    [DataTable("tede_app_channel")]
+    public class AppChannel : Datory.Entity
+    {
+        /// <summary>
+        /// 标题图片
+        /// </summary>
+        [DataColumn]
+        public string ImageUrls { get; set; }
+        /// <summary>
+        /// 名称
+        /// </summary>
+        /// <value></value>
+        [DataColumn]
+        public string Name { get; set; }
+        /// <summary>
+        /// 类型 公众号  视频 期刊杂志 图书
+        /// </summary>
+        /// <value></value>
+        [DataColumn]
+        public GxPress.EnumConst.AppChannelConst ChannelTypeValye { get; set; }
+        /// <summary>
+        /// 排序
+        /// </summary>
+        [DataColumn]
+        public int Sort { get; set; }
+        /// <summary>
+        /// 是否禁用
+        /// </summary>
+        /// <value></value>
+        [DataColumn]
+        public bool IsDisable { get; set; }
+        /// <summary>
+        /// 1 普通 2 没有导航 3 sku
+        /// </summary>
+        /// <value></value>
+        [DataColumn]
+        public int TypeValue { get; set; }
+    }
+}

+ 42 - 0
gx_api/GxPress/Model/GxPress.Entity/tede2/AppChannel/ChannelCategory.cs

@@ -0,0 +1,42 @@
+using Datory.Annotations;
+
+namespace GxPress.Entity.tede2.AppChannel
+{
+    /// <summary>
+    /// app频道导航
+    /// </summary>
+    [DataTable("tede_app_channel_category")]
+    public class ChannelCategory : Datory.Entity
+    {
+        /// <summary>
+        /// 名称
+        /// </summary>
+        /// <value></value>
+        [DataColumn]
+        public string Name { get; set; }
+        /// <summary>
+        /// 扩展名称
+        /// </summary>
+        /// <value></value>
+        [DataColumn]
+        public string ExpandName { get; set; }
+        /// <summary>
+        /// 父级ID
+        /// </summary>
+        /// <value></value>
+        [DataColumn]
+        public int ParentId { get; set; }
+
+        /// <summary>
+        /// 排序
+        /// </summary>
+        [DataColumn]
+        public int Sort { get; set; }
+        /// <summary>
+        /// 类型 公众号  视频 期刊杂志 图书
+        /// </summary>
+        /// <value></value>
+        [DataColumn]
+        public GxPress.EnumConst.AppChannelConst ChannelTypeValye { get; set; }
+    }
+}

+ 24 - 0
gx_api/GxPress/Model/GxPress.Entity/tede2/AppChannel/ChannelCategoryMedia.cs

@@ -0,0 +1,24 @@
+using Datory.Annotations;
+
+namespace GxPress.Entity.tede2.AppChannel
+{
+    /// <summary>
+    /// app频道导航
+    /// </summary>
+    [DataTable("tede_channel_category_media")]
+    public class ChannelCategoryMedia : Datory.Entity
+    {
+        /// <summary>
+        /// 导航ID
+        /// </summary>
+        /// <value></value>
+        [DataColumn]
+        public int ChannelCategoryId { get; set; }
+        /// <summary>
+        /// 资源ID
+        /// </summary>
+        /// <value></value>
+        [DataColumn]
+        public int MediaId { get; set; }
+    }
+}

+ 14 - 0
gx_api/GxPress/Model/GxPress.EnumConst/AllTypeConst.cs

@@ -60,4 +60,18 @@ namespace GxPress.EnumConst
         [Description("刊期")]
         Magazine = 120
     }
+    /// <summary>
+    /// App频道
+    /// </summary>
+    public enum AppChannelConst
+    {
+        [Description("公众号")]
+        PublicNumebr = 700,
+        [Description("视频")]
+        Video = 710,
+        [Description("期刊杂志")]
+        Periodical = 720,
+        [Description("图书")]
+        Books = 730,
+    }
 }

+ 25 - 0
gx_api/GxPress/Model/GxPress.Request/AppChannel/AppChannelRequest.cs

@@ -0,0 +1,25 @@
+using System.Collections.Generic;
+
+namespace GxPress.Request.AppChannel
+{
+    public class AppChannelRequest
+    {
+
+    }
+    /// <summary>
+    /// 添加
+    /// </summary>
+    public class ChannelCategoryMediaInRequest
+    {
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <value></value>
+        public int CategoryId { get; set; }
+        /// <summary>
+        /// 资源ID
+        /// </summary>
+        /// <value></value>
+        public List<int> MediaIds { get; set; }
+    }
+}

+ 2 - 2
gx_api/GxPress/Model/GxPress.Request/Media/MediaRequest.cs

@@ -310,7 +310,7 @@ namespace GxPress.Request.Media
         /// 作者ID
         /// </summary>
         /// <value></value>
-        public int AuthorId { get; set; }
+        public List<int> AuthorId { get; set; }
         /// <summary>
         /// 开始时间
         /// </summary>
@@ -325,7 +325,7 @@ namespace GxPress.Request.Media
         /// 出版社
         /// </summary>
         /// <value></value>
-        public string Press { get; set; }
+        public List<string> Press { get; set; }
     }
 
     /// <summary>

+ 51 - 0
gx_api/GxPress/Model/GxPress.Result/AppChannel/AppChannelResult.cs

@@ -0,0 +1,51 @@
+using System.Collections.Generic;
+
+namespace GxPress.Result.AppChannel
+{
+    /// <summary>
+    /// app导航
+    /// </summary>
+    public class AppChannelResult
+    {
+
+    }
+    /// <summary>
+    /// 导航类别
+    /// </summary>
+    public class ChannelCategoryResult
+    {
+        /// <summary>
+        /// id
+        /// </summary>
+        /// <value></value>
+        public int Id { get; set; }
+        /// <summary>
+        /// 名称
+        /// </summary>
+        /// <value></value>
+
+        public string Name { get; set; }
+        /// <summary>
+        /// 扩展名称
+        /// </summary>
+        /// <value></value>
+
+        public string ExpandName { get; set; }
+        /// <summary>
+        /// 父级ID
+        /// </summary>
+        /// <value></value>
+
+        public int ParentId { get; set; }
+        /// <summary>
+        /// 是否存在子集
+        /// </summary>
+        /// <value></value>
+        public bool Ischildren { get; set; }
+        /// <summary>
+        /// 子集
+        /// </summary>
+        /// <value></value>
+        public IEnumerable<ChannelCategoryResult> Children { get; set; }
+    }
+}

+ 87 - 0
gx_api/GxPress/Repository/GxPress.Repository.Implement/AppChannel/AppChannelRepository.cs

@@ -0,0 +1,87 @@
+using System.Collections.Generic;
+using System.Threading.Tasks;
+using AutoMapper;
+using Datory;
+using GxPress.Common.AppOptions;
+using GxPress.Common.Tools;
+using GxPress.EnumConst;
+using GxPress.Repository.Interface.AppChannel;
+using Microsoft.Extensions.Options;
+
+namespace GxPress.Repository.Implement.AppChannel
+{
+    public class AppChannelRepository : IAppChannelRepository
+    {
+        private readonly Repository<Entity.tede2.AppChannel.AppChannel> _repository;
+        private readonly IMapper _mapper;
+
+        public AppChannelRepository(IOptionsMonitor<DatabaseOptions> dbOptionsAccessor, IMapper mapper)
+        {
+            var databaseType = StringUtils.ToEnum<DatabaseType>(dbOptionsAccessor.CurrentValue.DatabaseType, DatabaseType.MySql);
+            var database = new Database(databaseType, dbOptionsAccessor.CurrentValue.ConnectionString);
+            _repository = new Repository<Entity.tede2.AppChannel.AppChannel>(database);
+            _mapper = mapper;
+        }
+
+        public IDatabase Database => _repository.Database;
+        public string TableName => _repository.TableName;
+        public List<TableColumn> TableColumns => _repository.TableColumns;
+        /// <summary>
+        /// 获取详情
+        /// </summary>
+        /// <param name="id"></param>
+        /// <returns></returns>
+        public async Task<Entity.tede2.AppChannel.AppChannel> GetAsync(int id)
+        {
+            var result = await _repository.GetAsync(id);
+            if (result != null)
+                result.ImageUrls = StringUtils.AddDomain(result.ImageUrls);
+            return result;
+        }
+
+        /// <summary>
+        /// 查询
+        /// </summary>
+        /// <returns></returns>
+        public async Task<IEnumerable<Entity.tede2.AppChannel.AppChannel>> GetAllAsync(AppChannelConst channelTypeValye)
+        {
+            var result = await _repository.GetAllAsync(Q.Where(nameof(Entity.tede2.AppChannel.AppChannel.ChannelTypeValye), channelTypeValye).OrderBy(nameof(Entity.tede2.AppChannel.AppChannel.Sort)));
+            foreach (var item in result)
+            {
+                item.ImageUrls = StringUtils.AddDomain(item.ImageUrls);
+            }
+            return result;
+        }
+        /// <summary>
+        /// 删除
+        /// </summary>
+        /// <param name="id"></param>
+        /// <returns></returns>
+        public async Task<bool> DeleteAsync(int id)
+        {
+            return await _repository.DeleteAsync(id);
+        }
+        /// <summary>
+        /// 修改
+        /// </summary>
+        /// <param name="model"></param>
+        /// <returns></returns>
+        public async Task<bool> UpdateAsync(Entity.tede2.AppChannel.AppChannel request)
+        {
+            var model = await _repository.GetAsync(request.Id);
+            if (!string.IsNullOrEmpty(request.ImageUrls))
+                model.ImageUrls = StringUtils.RemoveDomain(request.ImageUrls);
+            model.IsDisable = request.IsDisable;
+            return await _repository.UpdateAsync(model);
+        }
+        /// <summary>
+        /// 添加
+        /// </summary>
+        /// <param name="model"></param>
+        /// <returns></returns>
+        public async Task<bool> InsertAsync(Entity.tede2.AppChannel.AppChannel model)
+        {
+            return await _repository.InsertAsync(model) > 0;
+        }
+    }
+}

+ 84 - 0
gx_api/GxPress/Repository/GxPress.Repository.Implement/AppChannel/ChannelCategoryMediaRepository.cs

@@ -0,0 +1,84 @@
+using System.Collections.Generic;
+using System.Threading.Tasks;
+using AutoMapper;
+using Datory;
+using GxPress.Common.AppOptions;
+using GxPress.Common.Tools;
+using GxPress.Repository.Interface.AppChannel;
+using GxPress.Request.AppChannel;
+using Microsoft.Extensions.Options;
+using System.Transactions;
+namespace GxPress.Repository.Implement.AppChannel
+{
+    public class ChannelCategoryMediaRepository : IChannelCategoryMediaRepository
+    {
+        private readonly Repository<Entity.tede2.AppChannel.ChannelCategoryMedia> _repository;
+        private readonly IMapper _mapper;
+        public ChannelCategoryMediaRepository(IOptionsMonitor<DatabaseOptions> dbOptionsAccessor, IMapper mapper)
+        {
+            var databaseType = StringUtils.ToEnum<DatabaseType>(dbOptionsAccessor.CurrentValue.DatabaseType, DatabaseType.MySql);
+            var database = new Database(databaseType, dbOptionsAccessor.CurrentValue.ConnectionString);
+            _repository = new Repository<Entity.tede2.AppChannel.ChannelCategoryMedia>(database);
+            _mapper = mapper;
+        }
+        public IDatabase Database => _repository.Database;
+        public string TableName => _repository.TableName;
+        public List<TableColumn> TableColumns => _repository.TableColumns;
+
+        /// <summary>
+        /// 获取详情
+        /// </summary>
+        /// <param name="id"></param>
+        /// <returns></returns>
+        public async Task<Entity.tede2.AppChannel.ChannelCategoryMedia> GetAsync(int id)
+        {
+            var result = await _repository.GetAsync(id);
+            return result;
+        }
+        /// <summary>
+        /// 查询 获取MediaId
+        /// </summary>
+        /// <returns></returns>
+        public async Task<IEnumerable<int>> GetAllAsync(int categoryId)
+        {
+            var query = Q.NewQuery();
+            query.Select(nameof(Entity.tede2.AppChannel.ChannelCategoryMedia.MediaId));
+            query.Where(nameof(Entity.tede2.AppChannel.ChannelCategoryMedia.ChannelCategoryId), categoryId);
+            var result = await _repository.GetAllAsync<int>(query);
+            return result;
+        }
+        /// <summary>
+        /// 删除
+        /// </summary>
+        /// <param name="id"></param>
+        /// <returns></returns>
+        public async Task<bool> DeleteAsync(int id)
+        {
+            return await _repository.DeleteAsync(id);
+        }
+        /// <summary>
+        /// 添加
+        /// </summary>
+        /// <param name="model"></param>
+        /// <returns></returns>
+        public async Task<bool> InsertAsync(ChannelCategoryMediaInRequest request)
+        {
+            try
+            {
+                using (var tran = new TransactionScope())
+                {
+                    foreach (var item in request.MediaIds)
+                    {
+                        await _repository.InsertAsync(new Entity.tede2.AppChannel.ChannelCategoryMedia { ChannelCategoryId = request.CategoryId, MediaId = item });
+                    }
+                    tran.Complete();
+                }
+            }
+            catch
+            {
+                return false;
+            }
+            return true;
+        }
+    }
+}

+ 79 - 0
gx_api/GxPress/Repository/GxPress.Repository.Implement/AppChannel/ChannelCategoryRepository.cs

@@ -0,0 +1,79 @@
+using GxPress.Repository.Interface.AppChannel;
+using System.Collections.Generic;
+using AutoMapper;
+using Datory;
+using GxPress.Common.AppOptions;
+using GxPress.Common.Tools;
+using Microsoft.Extensions.Options;
+using System.Threading.Tasks;
+using GxPress.Entity.tede2.AppChannel;
+using GxPress.Result.AppChannel;
+using GxPress.EnumConst;
+using System.Linq;
+
+namespace GxPress.Repository.Implement.AppChannel
+{
+    public class ChannelCategoryRepository : IChannelCategoryRepository
+    {
+        private readonly Repository<Entity.tede2.AppChannel.ChannelCategory> _repository;
+        private readonly IMapper _mapper;
+
+        public ChannelCategoryRepository(IOptionsMonitor<DatabaseOptions> dbOptionsAccessor, IMapper mapper)
+        {
+            var databaseType = StringUtils.ToEnum<DatabaseType>(dbOptionsAccessor.CurrentValue.DatabaseType, DatabaseType.MySql);
+            var database = new Database(databaseType, dbOptionsAccessor.CurrentValue.ConnectionString);
+            _repository = new Repository<Entity.tede2.AppChannel.ChannelCategory>(database);
+            _mapper = mapper;
+        }
+        public IDatabase Database => _repository.Database;
+        public string TableName => _repository.TableName;
+        public List<TableColumn> TableColumns => _repository.TableColumns;
+        /// <summary>
+        /// 获取详情
+        /// </summary>
+        /// <param name="id"></param>
+        /// <returns></returns>
+        public async Task<Entity.tede2.AppChannel.ChannelCategory> GetAsync(int id)
+        {
+            var result = await _repository.GetAsync(id);
+            return result;
+        }
+        /// <summary>
+        /// 查询 获取MediaId
+        /// </summary>
+        /// <returns></returns>
+        public async Task<IEnumerable<ChannelCategoryResult>> GetAllAsync(AppChannelConst channelTypeValye)
+        {
+            var result = new List<ChannelCategoryResult>();
+            var query = Q.NewQuery();
+            query.Where(nameof(Entity.tede2.AppChannel.ChannelCategory.ChannelTypeValye), channelTypeValye);
+            var items = await _repository.GetAllAsync<ChannelCategoryResult>(query);
+            result.AddRange(items.Where(n => n.ParentId == 0));
+            foreach (var item in result)
+            {
+                item.Ischildren = items.Any(n => n.ParentId == item.Id);
+                if (item.Ischildren)
+                    item.Children = items.Where(n => n.ParentId == item.Id);
+            }
+            return result;
+        }
+        /// <summary>
+        /// 删除
+        /// </summary>
+        /// <param name="id"></param>
+        /// <returns></returns>
+        public async Task<bool> DeleteAsync(int id)
+        {
+            return await _repository.DeleteAsync(id);
+        }
+        /// <summary>
+        /// 添加
+        /// </summary>
+        /// <param name="model"></param>
+        /// <returns></returns>
+        public async Task<bool> InsertAsync(ChannelCategory request)
+        {
+            return await _repository.InsertAsync(request) > 0;
+        }
+    }
+}

+ 4 - 4
gx_api/GxPress/Repository/GxPress.Repository.Implement/Media/MediaRepository.cs

@@ -791,17 +791,17 @@ namespace GxPress.Repository.Implement.Media
             query.Where(nameof(Entity.tede2.Media.Media.MediaType), GxPress.EnumConst.AllTypeConst.Book.GetHashCode());
             if (request.MediaIds.Count() > 0)
                 query.WhereIn(nameof(Entity.tede2.Media.Media.Id), request.MediaIds);
-            if (request.AuthorId > 0)
-                query.Where(nameof(Entity.tede2.Media.Media.TeacherId), request.AuthorId);
+            if (request.AuthorId != null && request.AuthorId.Count > 0)
+                query.OrWhereIn(nameof(Entity.tede2.Media.Media.TeacherId), request.AuthorId);
             resut.Total = await _repository.CountAsync(query);
             if (!string.IsNullOrEmpty(request.BeginTime) && !string.IsNullOrEmpty(request.EndTime))
             {
                 query.Where(nameof(Entity.tede2.Media.Media.AddDate), ">=", request.BeginTime);
                 query.Where(nameof(Entity.tede2.Media.Media.AddDate), "<=", request.EndTime);
             }
-            if (!string.IsNullOrEmpty(request.Press))
+            if (request.AuthorId != null && request.Press.Count > 0)
             {
-                query.Where(nameof(Entity.tede2.Media.Media.Press), request.Press);
+                query.OrWhereIn(nameof(Entity.tede2.Media.Media.Press), request.Press);
             }
             if (!string.IsNullOrEmpty(request.Sort))
             {

+ 41 - 0
gx_api/GxPress/Repository/GxPress.Repository.Interface/AppChannel/IAppChannelRepository.cs

@@ -0,0 +1,41 @@
+using System.Collections.Generic;
+using System.Threading.Tasks;
+using Datory;
+using GxPress.EnumConst;
+
+namespace GxPress.Repository.Interface.AppChannel
+{
+    public interface IAppChannelRepository : IRepository
+    {
+        /// <summary>
+        /// 获取详情
+        /// </summary>
+        /// <param name="id"></param>
+        /// <returns></returns>
+        Task<Entity.tede2.AppChannel.AppChannel> GetAsync(int id);
+
+        /// <summary>
+        /// 查询
+        /// </summary>
+        /// <returns></returns>
+        Task<IEnumerable<Entity.tede2.AppChannel.AppChannel>> GetAllAsync(AppChannelConst channelTypeValye);
+        /// <summary>
+        /// 删除
+        /// </summary>
+        /// <param name="id"></param>
+        /// <returns></returns>
+        Task<bool> DeleteAsync(int id);
+        /// <summary>
+        /// 修改
+        /// </summary>
+        /// <param name="model"></param>
+        /// <returns></returns>
+        Task<bool> UpdateAsync(Entity.tede2.AppChannel.AppChannel request);
+        /// <summary>
+        /// 添加
+        /// </summary>
+        /// <param name="model"></param>
+        /// <returns></returns>
+        Task<bool> InsertAsync(Entity.tede2.AppChannel.AppChannel model);
+    }
+}

+ 34 - 0
gx_api/GxPress/Repository/GxPress.Repository.Interface/AppChannel/IChannelCategoryMediaRepository.cs

@@ -0,0 +1,34 @@
+using System.Collections.Generic;
+using System.Threading.Tasks;
+using Datory;
+using GxPress.Request.AppChannel;
+
+namespace GxPress.Repository.Interface.AppChannel
+{
+    public interface IChannelCategoryMediaRepository:IRepository
+    {
+          /// <summary>
+        /// 获取详情
+        /// </summary>
+        /// <param name="id"></param>
+        /// <returns></returns>
+        Task<Entity.tede2.AppChannel.ChannelCategoryMedia> GetAsync(int id);
+        /// <summary>
+        /// 查询 获取MediaId
+        /// </summary>
+        /// <returns></returns>
+        Task<IEnumerable<int>> GetAllAsync(int categoryId);
+        /// <summary>
+        /// 删除
+        /// </summary>
+        /// <param name="id"></param>
+        /// <returns></returns>
+        Task<bool> DeleteAsync(int id);
+        /// <summary>
+        /// 添加
+        /// </summary>
+        /// <param name="model"></param>
+        /// <returns></returns>
+        Task<bool> InsertAsync(ChannelCategoryMediaInRequest request);
+    }
+}

+ 36 - 0
gx_api/GxPress/Repository/GxPress.Repository.Interface/AppChannel/IChannelCategoryRepository.cs

@@ -0,0 +1,36 @@
+using System.Collections.Generic;
+using System.Threading.Tasks;
+using Datory;
+using GxPress.Entity.tede2.AppChannel;
+using GxPress.EnumConst;
+using GxPress.Result.AppChannel;
+
+namespace GxPress.Repository.Interface.AppChannel
+{
+    public interface IChannelCategoryRepository : IRepository
+    {
+        /// <summary>
+        /// 获取详情
+        /// </summary>
+        /// <param name="id"></param>
+        /// <returns></returns>
+        Task<Entity.tede2.AppChannel.ChannelCategory> GetAsync(int id);
+        /// <summary>
+        /// 查询 获取MediaId
+        /// </summary>
+        /// <returns></returns>
+        Task<IEnumerable<ChannelCategoryResult>> GetAllAsync(AppChannelConst channelTypeValye);
+        /// <summary>
+        /// 删除
+        /// </summary>
+        /// <param name="id"></param>
+        /// <returns></returns>
+        Task<bool> DeleteAsync(int id);
+        /// <summary>
+        /// 添加
+        /// </summary>
+        /// <param name="model"></param>
+        /// <returns></returns>
+        Task<bool> InsertAsync(ChannelCategory request);
+    }
+}

+ 22 - 0
gx_api/GxPress/Service/GxPress.Service.Implement/AppChannel/AppChannelService.cs

@@ -0,0 +1,22 @@
+using GxPress.Repository.Interface.AppChannel;
+using GxPress.Service.Interface.AppChannel;
+
+namespace GxPress.Service.Implement.AppChannel
+{
+    /// <summary>
+    /// app频道
+    /// </summary>
+    public class AppChannelService : IAppChannelService
+    {
+        private readonly IChannelCategoryMediaRepository channelCategoryMediaRepository;
+        private readonly IChannelCategoryRepository channelCategoryRepository;
+        private readonly IAppChannelRepository appChannelRepository;
+        public AppChannelService(IChannelCategoryMediaRepository channelCategoryMediaRepository, IChannelCategoryRepository channelCategoryRepository, IAppChannelRepository appChannelRepository)
+        {
+            this.channelCategoryMediaRepository = channelCategoryMediaRepository;
+            this.channelCategoryRepository = channelCategoryRepository;
+            this.appChannelRepository = appChannelRepository;
+        }
+
+    }
+}

+ 7 - 0
gx_api/GxPress/Service/GxPress.Service.Interface/AppChannel/IAppChannelService.cs

@@ -0,0 +1,7 @@
+namespace GxPress.Service.Interface.AppChannel
+{
+    public interface IAppChannelService:IService
+    {
+         
+    }
+}