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 GxPress.Service.Interface.AppChannel; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; namespace GxPress.Api.AdminControllers { /// /// APP频道 /// [Route("api/admin/app-channel")] [ApiController] [Authorize] public class AdminAppChannelController : Controller { private readonly IChannelCategoryMediaRepository channelCategoryMediaRepository; private readonly IChannelCategoryRepository channelCategoryRepository; private readonly IAppChannelRepository appChannelRepository; private readonly IAppChannelService appChannelService; public AdminAppChannelController(IChannelCategoryMediaRepository channelCategoryMediaRepository, IChannelCategoryRepository channelCategoryRepository, IAppChannelRepository appChannelRepository, IAppChannelService appChannelService) { this.channelCategoryMediaRepository = channelCategoryMediaRepository; this.channelCategoryRepository = channelCategoryRepository; this.appChannelRepository = appChannelRepository; this.appChannelService = appChannelService; } /// /// 获取导航详情 /// /// /// [HttpGet("channel/{id}")] public async Task GetAsync(int id) { return await appChannelRepository.GetAsync(id); } /// /// 查询 公众号 700 视频 710 期刊杂志 720 图书 730 /// /// [HttpGet("channel/list/{channelTypeValye}")] public async Task> GetAllAsync(int channelTypeValye) { return await appChannelService.GetAllAsync((AppChannelConst)channelTypeValye); } /// /// 删除导航 /// /// /// [HttpDelete("channel/{id}")] public async Task DeleteAsync(int id) { return await appChannelRepository.DeleteAsync(id); } /// /// 修改导航 /// /// /// [HttpPut("channel")] public async Task UpdateAsync(Entity.tede2.AppChannel.AppChannel request) { return await appChannelRepository.UpdateAsync(request); } /// /// 添加导航 /// /// /// [HttpPost("channel")] public async Task InsertAsync(Entity.tede2.AppChannel.AppChannel model) { return await appChannelRepository.InsertAsync(model); } /// /// 获取导航分类详情 /// /// /// [HttpGet("channel-category/{id}")] public async Task ChannelCategoryGetAsync(int id) { return await channelCategoryRepository.GetAsync(id); } /// ///修改导航分类 /// /// /// [HttpPut("channel-category")] public async Task ChannelCategoryUpdateAsync(ChannelCategory request) { return await channelCategoryRepository.UpdateAsync(request); } /// /// 查询导航分类 /// /// [HttpGet("channel-category/list/{appChannelId}")] [AllowAnonymous] public async Task> ChannelCategoryGetAllAsync(int appChannelId) { return await appChannelService.GetAllAsync(appChannelId); } /// /// 删除导航分类 /// /// /// [HttpDelete("channel-category/{id}")] public async Task ChannelCategoryDeleteAsync(int id) { return await channelCategoryRepository.DeleteAsync(id); } /// /// 添加导航分类 /// /// /// [HttpPost("channel-category")] public async Task InsertAsync(ChannelCategory request) { return await channelCategoryRepository.InsertAsync(request); } /// /// 删除导航媒体 /// /// /// [HttpDelete("channel-category-media/{id}")] public async Task ChannelCategoryMediaDeleteAsync(int id) { return await channelCategoryMediaRepository.DeleteAsync(id); } /// /// 添加导航媒体 /// /// /// [HttpPost("channel-category-media")] public async Task ChannelCategoryMediaInsertAsync(ChannelCategoryMediaInRequest request) { return await channelCategoryMediaRepository.InsertAsync(request); } } }