Banner配置
This commit is contained in:
parent
47a6450e39
commit
befa767c44
@ -62,7 +62,7 @@ public class BannerService : BaseService<YD_Event.Core.Entities.Banner>, ITransi
|
|||||||
public async Task<List<BannerOutput>> GetList()
|
public async Task<List<BannerOutput>> GetList()
|
||||||
{
|
{
|
||||||
var config = await GetConfig();
|
var config = await GetConfig();
|
||||||
if (config.Mode == 1) // 自动配置
|
if (config.Mode == 0) // 自动配置
|
||||||
{
|
{
|
||||||
// 获取最新的4场赛事
|
// 获取最新的4场赛事
|
||||||
var events = await _eventRepository.AsQueryable()
|
var events = await _eventRepository.AsQueryable()
|
||||||
|
|||||||
@ -136,7 +136,7 @@ public class BannerOutput
|
|||||||
public class BannerConfigInput
|
public class BannerConfigInput
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 模式(0-手动配置 1-自动配置)
|
/// 模式(0-自动配置 1-手动配置)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Required]
|
[Required]
|
||||||
public int Mode { get; set; }
|
public int Mode { get; set; }
|
||||||
@ -148,7 +148,7 @@ public class BannerConfigInput
|
|||||||
public class BannerConfigOutput
|
public class BannerConfigOutput
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 模式(0-手动配置 1-自动配置)
|
/// 模式(0-自动配置 1-手动配置)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int Mode { get; set; }
|
public int Mode { get; set; }
|
||||||
}
|
}
|
||||||
|
|||||||
@ -60,6 +60,7 @@ public class EventClientController : IDynamicApiController
|
|||||||
private readonly IOptionsMonitor<WechatTenpayClientOptions> _wechatTenpayClientOptionsMonitor;
|
private readonly IOptionsMonitor<WechatTenpayClientOptions> _wechatTenpayClientOptionsMonitor;
|
||||||
private readonly ILogger<EventClientController> _logger;
|
private readonly ILogger<EventClientController> _logger;
|
||||||
private readonly OrderNoGeneratorService _orderNoGeneratorService;
|
private readonly OrderNoGeneratorService _orderNoGeneratorService;
|
||||||
|
private readonly YD_Event.Application.Banner.BannerService _bannerService;
|
||||||
|
|
||||||
public EventClientController(
|
public EventClientController(
|
||||||
ISqlSugarRepository<EventInfo> eventRepository,
|
ISqlSugarRepository<EventInfo> eventRepository,
|
||||||
@ -93,7 +94,8 @@ public class EventClientController : IDynamicApiController
|
|||||||
WeChatPayService weChatPayService,
|
WeChatPayService weChatPayService,
|
||||||
IOptionsMonitor<WechatTenpayClientOptions> wechatTenpayClientOptionsMonitor,
|
IOptionsMonitor<WechatTenpayClientOptions> wechatTenpayClientOptionsMonitor,
|
||||||
ILogger<EventClientController> logger,
|
ILogger<EventClientController> logger,
|
||||||
OrderNoGeneratorService orderNoGeneratorService)
|
OrderNoGeneratorService orderNoGeneratorService,
|
||||||
|
YD_Event.Application.Banner.BannerService bannerService)
|
||||||
{
|
{
|
||||||
_eventRepository = eventRepository;
|
_eventRepository = eventRepository;
|
||||||
_projectRepository = projectRepository;
|
_projectRepository = projectRepository;
|
||||||
@ -127,6 +129,7 @@ public class EventClientController : IDynamicApiController
|
|||||||
_wechatTenpayClientOptionsMonitor = wechatTenpayClientOptionsMonitor;
|
_wechatTenpayClientOptionsMonitor = wechatTenpayClientOptionsMonitor;
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_orderNoGeneratorService = orderNoGeneratorService;
|
_orderNoGeneratorService = orderNoGeneratorService;
|
||||||
|
_bannerService = bannerService;
|
||||||
}
|
}
|
||||||
|
|
||||||
private long GetCurrentUserId()
|
private long GetCurrentUserId()
|
||||||
@ -148,10 +151,7 @@ public class EventClientController : IDynamicApiController
|
|||||||
[DisplayName("获取轮播图列表")]
|
[DisplayName("获取轮播图列表")]
|
||||||
public async Task<List<BannerDto>> GetBannerList()
|
public async Task<List<BannerDto>> GetBannerList()
|
||||||
{
|
{
|
||||||
var list = await _bannerRepository.AsQueryable()
|
var list = await _bannerService.GetList();
|
||||||
.Where(b => !b.DeleteMark && b.Status == AvailabilityStatus.Enable)
|
|
||||||
.OrderByDescending(b => b.Sort)
|
|
||||||
.ToListAsync();
|
|
||||||
|
|
||||||
return list.Select(b => new BannerDto
|
return list.Select(b => new BannerDto
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
@ -13,9 +13,9 @@ namespace YD_Event.Core.Entities
|
|||||||
public class BannerConfig : Entity<long>, ISoftDelete, ICreatedUserId, ICreatedTime, IUpdatedUserId, IUpdatedTime
|
public class BannerConfig : Entity<long>, ISoftDelete, ICreatedUserId, ICreatedTime, IUpdatedUserId, IUpdatedTime
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 模式(0-手动配置 1-自动配置)
|
/// 模式(0-自动配置 1-手动配置)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[SugarColumn(ColumnDescription = "模式(0-手动配置 1-自动配置)")]
|
[SugarColumn(ColumnDescription = "模式(0-自动配置 1-手动配置)")]
|
||||||
public int Mode { get; set; }
|
public int Mode { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user