123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154 |
- 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
- {
- /// <summary>
- /// APP频道
- /// </summary>
- [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;
- }
- /// <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/{channelTypeValye}")]
- public async Task<IEnumerable<AppChannelResult>> GetAllAsync(int channelTypeValye)
- {
- return await appChannelService.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.InsertAsync(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>
- /// <param name="request"></param>
- /// <returns></returns>
- [HttpPut("channel-category")]
- public async Task<bool> ChannelCategoryUpdateAsync(ChannelCategory request)
- {
- return await channelCategoryRepository.UpdateAsync(request);
- }
- /// <summary>
- /// 查询导航分类
- /// </summary>
- /// <returns></returns>
- [HttpGet("channel-category/list/{appChannelId}")]
- [AllowAnonymous]
- public async Task<IEnumerable<ChannelCategoryResult>> ChannelCategoryGetAllAsync(int appChannelId)
- {
- return await appChannelService.GetAllAsync(appChannelId);
- }
- /// <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);
- }
- }
- }
|