Banner配置

This commit is contained in:
马梓彭 2026-04-12 17:39:19 +08:00
parent 47a6450e39
commit befa767c44
4 changed files with 11 additions and 11 deletions

View File

@ -62,7 +62,7 @@ public class BannerService : BaseService<YD_Event.Core.Entities.Banner>, ITransi
public async Task<List<BannerOutput>> GetList()
{
var config = await GetConfig();
if (config.Mode == 1) // 自动配置
if (config.Mode == 0) // 自动配置
{
// 获取最新的4场赛事
var events = await _eventRepository.AsQueryable()

View File

@ -136,7 +136,7 @@ public class BannerOutput
public class BannerConfigInput
{
/// <summary>
/// 模式(0-手动配置 1-自动配置)
/// 模式(0-自动配置 1-手动配置)
/// </summary>
[Required]
public int Mode { get; set; }
@ -148,7 +148,7 @@ public class BannerConfigInput
public class BannerConfigOutput
{
/// <summary>
/// 模式(0-手动配置 1-自动配置)
/// 模式(0-自动配置 1-手动配置)
/// </summary>
public int Mode { get; set; }
}

View File

@ -60,6 +60,7 @@ public class EventClientController : IDynamicApiController
private readonly IOptionsMonitor<WechatTenpayClientOptions> _wechatTenpayClientOptionsMonitor;
private readonly ILogger<EventClientController> _logger;
private readonly OrderNoGeneratorService _orderNoGeneratorService;
private readonly YD_Event.Application.Banner.BannerService _bannerService;
public EventClientController(
ISqlSugarRepository<EventInfo> eventRepository,
@ -93,7 +94,8 @@ public class EventClientController : IDynamicApiController
WeChatPayService weChatPayService,
IOptionsMonitor<WechatTenpayClientOptions> wechatTenpayClientOptionsMonitor,
ILogger<EventClientController> logger,
OrderNoGeneratorService orderNoGeneratorService)
OrderNoGeneratorService orderNoGeneratorService,
YD_Event.Application.Banner.BannerService bannerService)
{
_eventRepository = eventRepository;
_projectRepository = projectRepository;
@ -127,6 +129,7 @@ public class EventClientController : IDynamicApiController
_wechatTenpayClientOptionsMonitor = wechatTenpayClientOptionsMonitor;
_logger = logger;
_orderNoGeneratorService = orderNoGeneratorService;
_bannerService = bannerService;
}
private long GetCurrentUserId()
@ -148,10 +151,7 @@ public class EventClientController : IDynamicApiController
[DisplayName("获取轮播图列表")]
public async Task<List<BannerDto>> GetBannerList()
{
var list = await _bannerRepository.AsQueryable()
.Where(b => !b.DeleteMark && b.Status == AvailabilityStatus.Enable)
.OrderByDescending(b => b.Sort)
.ToListAsync();
var list = await _bannerService.GetList();
return list.Select(b => new BannerDto
{

View File

@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@ -13,9 +13,9 @@ namespace YD_Event.Core.Entities
public class BannerConfig : Entity<long>, ISoftDelete, ICreatedUserId, ICreatedTime, IUpdatedUserId, IUpdatedTime
{
/// <summary>
/// 模式(0-手动配置 1-自动配置)
/// 模式(0-自动配置 1-手动配置)
/// </summary>
[SugarColumn(ColumnDescription = "模式(0-手动配置 1-自动配置)")]
[SugarColumn(ColumnDescription = "模式(0-自动配置 1-手动配置)")]
public int Mode { get; set; }
/// <summary>