From 351ddb5c244cbb92b847abdf725b12b74a98ae8f Mon Sep 17 00:00:00 2001 From: zpc Date: Tue, 2 Sep 2025 11:21:11 +0800 Subject: [PATCH] 333 --- .../Controllers/AdvertController.cs | 48 +++++-------------- 1 file changed, 11 insertions(+), 37 deletions(-) diff --git a/CoreCms.Net.Web.WebApi/Controllers/AdvertController.cs b/CoreCms.Net.Web.WebApi/Controllers/AdvertController.cs index 1c1f57f..8842666 100644 --- a/CoreCms.Net.Web.WebApi/Controllers/AdvertController.cs +++ b/CoreCms.Net.Web.WebApi/Controllers/AdvertController.cs @@ -12,14 +12,17 @@ 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 @@ -62,51 +65,22 @@ namespace CoreCms.Net.Web.WebApi.Controllers /// /// /// - [HttpPost] - public async Task GetAdvertList([FromBody] FMPageByIntId entity) + [HttpGet] + public async Task GetAdvertList([FromQuery] string code) { - var jm = new WebApiCallBack(); - - var list = await _advertisementServices.QueryPageAsync(p => p.code == entity.where, p => p.createTime, OrderByType.Desc, - entity.page, entity.limit); - jm.status = true; - jm.data = list; - - return jm; - - } - #endregion - - #region 获取广告位置信息============================================================================= - /// - /// 获取广告位置信息 - /// - /// - /// - [HttpPost] - public async Task GetPositionList([FromBody] WxAdvert entity) - { - var jm = new WebApiCallBack(); - - var position = await _advertPositionServices.QueryListByClauseAsync(p => p.isEnable && p.code == entity.codes); - if (!position.Any()) + if (string.IsNullOrEmpty(code)) { - return jm; + return null; } - var ids = position.Select(p => p.id).ToList(); - var isement = await _advertisementServices.QueryListByClauseAsync(p => ids.Contains(p.positionId)); + var jm = new WebApiDto(); - Dictionary> list = new Dictionary>(); - list.Add(entity.codes, isement); - - jm.status = true; - jm.data = list; + var list = await _advertisementServices.QueryListByClauseAsync(p => p.code == code, p => p.createTime, OrderByType.Desc); + jm.Code = 0; + jm.Data = list; return jm; } #endregion - - } }