/*********************************************************************** * Project: CoreCms * ProjectName: 核心内容管理系统 * Web: https://www.corecms.net * Author: 大灰灰 * Email: jianweie@163.com * CreateTime: 2021/1/31 21:45:10 * Description: 暂无 ***********************************************************************/ using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using CoreCms.Net.Auth.HttpContextUser; using CoreCms.Net.Configuration; using CoreCms.Net.IServices; using CoreCms.Net.Model.Entities; using CoreCms.Net.Model.FromBody; using CoreCms.Net.Model.ViewModels.UI; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using SqlSugar; namespace CoreCms.Net.Web.WebApi.Controllers { /// /// 广告api控制器 /// [Route("api/[controller]/[action]")] [ApiController] public class AdvertController : ControllerBase { private IHttpContextUser _user; private readonly ICoreCmsArticleServices _articleServices; private readonly ICoreCmsAdvertPositionServices _advertPositionServices; private readonly ICoreCmsAdvertisementServices _advertisementServices; /// /// 构造函数 /// /// /// /// /// public AdvertController(IHttpContextUser user , ICoreCmsArticleServices articleServices , ICoreCmsAdvertPositionServices advertPositionServices , ICoreCmsAdvertisementServices advertisementServices ) { _user = user; _articleServices = articleServices; _advertPositionServices = advertPositionServices; _advertisementServices = advertisementServices; } #region 获取广告列表============================================================================= /// /// 获取广告列表 /// /// /// [HttpGet] public async Task GetAdvertList([FromQuery] string code) { if (string.IsNullOrEmpty(code)) { return null; } var jm = new WebApiDto(); var list = await _advertisementServices.QueryListByClauseAsync(p => p.code == code, p => p.createTime, OrderByType.Desc); jm.Code = 0; jm.Data = list; return jm; } #endregion } }