diff --git a/YD_Event.Application/Banner/BannerService.cs b/YD_Event.Application/Banner/BannerService.cs
new file mode 100644
index 0000000..7c6641c
--- /dev/null
+++ b/YD_Event.Application/Banner/BannerService.cs
@@ -0,0 +1,169 @@
+using YD_Event.Application.Banner.Dtos;
+using YD_Event.Core.Entities;
+
+namespace YD_Event.Application.Banner;
+
+///
+/// 轮播图服务
+///
+public class BannerService : BaseService, ITransient
+{
+ private readonly ISqlSugarRepository _repository;
+ private readonly ISqlSugarRepository _configRepository;
+ private readonly ISqlSugarRepository _eventRepository;
+ private readonly IIdGenerator _idGenerator;
+
+ public BannerService(
+ ISqlSugarRepository repository,
+ ISqlSugarRepository configRepository,
+ ISqlSugarRepository eventRepository,
+ IIdGenerator idGenerator) : base(repository)
+ {
+ _repository = repository;
+ _configRepository = configRepository;
+ _eventRepository = eventRepository;
+ _idGenerator = idGenerator;
+ }
+
+ ///
+ /// 获取轮播图配置模式
+ ///
+ ///
+ public async Task GetConfig()
+ {
+ var config = await _configRepository.GetFirstAsync(x => true);
+ return new BannerConfigOutput { Mode = config?.Mode ?? 0 };
+ }
+
+ ///
+ /// 更新轮播图配置模式
+ ///
+ ///
+ ///
+ public async Task UpdateConfig(BannerConfigInput input)
+ {
+ var config = await _configRepository.GetFirstAsync(x => true);
+ if (config == null)
+ {
+ config = new BannerConfig { Id = _idGenerator.NextId(), Mode = input.Mode };
+ await _configRepository.InsertAsync(config);
+ }
+ else
+ {
+ config.Mode = input.Mode;
+ await _configRepository.UpdateAsync(config);
+ }
+ }
+
+ ///
+ /// 获取轮播图列表(前台展示用)
+ ///
+ ///
+ public async Task> GetList()
+ {
+ var config = await GetConfig();
+ if (config.Mode == 1) // 自动配置
+ {
+ // 获取最新的4场赛事
+ var events = await _eventRepository.AsQueryable()
+ .Where(x => !x.DeleteMark) // 假设EventInfo有DeleteMark
+ .OrderByDescending(x => x.CreatedTime)
+ .Take(4)
+ .Select(x => new BannerOutput
+ {
+ Id = x.Id,
+ Title = x.EventName,
+ ImageUrl = x.CoverImage,
+ LinkType = 1, // 赛事
+ LinkTarget = x.Id.ToString(),
+ Sort = 0,
+ Status = Core.Enum.AvailabilityStatus.Enable,
+ CreatedTime = x.CreatedTime
+ })
+ .ToListAsync();
+ return events;
+ }
+ else // 手动配置
+ {
+ return await _repository.AsQueryable()
+ .Where(x => x.Status == Core.Enum.AvailabilityStatus.Enable)
+ .OrderBy(x => x.Sort)
+ .Select(x => new BannerOutput
+ {
+ Id = x.Id,
+ Title = x.Title,
+ ImageUrl = x.ImageUrl,
+ LinkType = x.LinkType,
+ LinkTarget = x.LinkTarget,
+ Sort = x.Sort,
+ Status = x.Status,
+ Remark = x.Remark,
+ CreatedTime = x.CreatedTime
+ })
+ .ToListAsync();
+ }
+ }
+
+ ///
+ /// 分页查询(后台管理用)
+ ///
+ ///
+ ///
+ public async Task> Page(BannerQueryInput input)
+ {
+ var query = _repository.AsQueryable()
+ .WhereIF(!string.IsNullOrWhiteSpace(input.Title), x => x.Title.Contains(input.Title))
+ .OrderBy(x => x.Sort)
+ .Select(x => new BannerOutput
+ {
+ Id = x.Id,
+ Title = x.Title,
+ ImageUrl = x.ImageUrl,
+ LinkType = x.LinkType,
+ LinkTarget = x.LinkTarget,
+ Sort = x.Sort,
+ Status = x.Status,
+ Remark = x.Remark,
+ CreatedTime = x.CreatedTime
+ });
+
+ return await query.ToPagedListAsync(input);
+ }
+
+ ///
+ /// 添加轮播图
+ ///
+ ///
+ ///
+ public async Task Add(AddBannerInput input)
+ {
+ var entity = input.Adapt();
+ entity.Id = _idGenerator.NextId();
+ await _repository.InsertAsync(entity);
+ }
+
+ ///
+ /// 更新轮播图
+ ///
+ ///
+ ///
+ public async Task Update(UpdateBannerInput input)
+ {
+ var entity = await _repository.GetByIdAsync(input.Id);
+ if (entity == null) throw new InvalidOperationException("轮播图不存在");
+
+ input.Adapt(entity);
+ await _repository.UpdateAsync(entity);
+ }
+
+ ///
+ /// 删除轮播图
+ ///
+ ///
+ ///
+ public async Task Delete(List ids)
+ {
+ if (ids == null || !ids.Any()) return;
+ await _repository.DeleteAsync(x => ids.Contains(x.Id));
+ }
+}
diff --git a/YD_Event.Application/Banner/Dtos/BannerDtos.cs b/YD_Event.Application/Banner/Dtos/BannerDtos.cs
new file mode 100644
index 0000000..5077273
--- /dev/null
+++ b/YD_Event.Application/Banner/Dtos/BannerDtos.cs
@@ -0,0 +1,106 @@
+using SqlSugar;
+using System.ComponentModel.DataAnnotations;
+using YD_Event.Core.Enum;
+
+namespace YD_Event.Application.Banner.Dtos;
+
+///
+/// 添加轮播图输入参数
+///
+public class AddBannerInput
+{
+ ///
+ /// 标题
+ ///
+ public string Title { get; set; }
+
+ ///
+ /// 图片地址
+ ///
+ [Required(ErrorMessage = "图片地址不能为空")]
+ public string ImageUrl { get; set; }
+
+ ///
+ /// 跳转链接类型(0-图片/无跳转 1-赛事)
+ ///
+ public int LinkType { get; set; }
+
+ ///
+ /// 跳转目标(赛事ID或URL)
+ ///
+ public string LinkTarget { get; set; }
+
+ ///
+ /// 排序
+ ///
+ public int Sort { get; set; }
+
+ ///
+ /// 备注
+ ///
+ public string Remark { get; set; }
+}
+
+///
+/// 更新轮播图输入参数
+///
+public class UpdateBannerInput : AddBannerInput
+{
+ ///
+ /// Id
+ ///
+ [Required(ErrorMessage = "Id不能为空")]
+ public long Id { get; set; }
+
+ ///
+ /// 状态
+ ///
+ public AvailabilityStatus Status { get; set; }
+}
+
+///
+/// 轮播图查询参数
+///
+public class BannerQueryInput : Pagination
+{
+ ///
+ /// 标题
+ ///
+ public string Title { get; set; }
+}
+
+///
+/// 轮播图输出参数
+///
+public class BannerOutput
+{
+ public long Id { get; set; }
+ public string Title { get; set; }
+ public string ImageUrl { get; set; }
+ public int LinkType { get; set; }
+ public string LinkTarget { get; set; }
+ public int Sort { get; set; }
+ public AvailabilityStatus Status { get; set; }
+ public string Remark { get; set; }
+ public DateTime CreatedTime { get; set; }
+}
+
+///
+/// 轮播图配置输入参数
+///
+public class BannerConfigInput
+{
+ ///
+ /// 模式(0-手动配置 1-自动配置)
+ ///
+ [Required]
+ public int Mode { get; set; }
+}
+
+///
+/// 轮播图配置输出参数
+///
+public class BannerConfigOutput
+{
+ public int Mode { get; set; }
+}
diff --git a/YD_Event.Application/Setting/IRefundConfigService.cs b/YD_Event.Application/Setting/IRefundConfigService.cs
deleted file mode 100644
index c7e57ea..0000000
--- a/YD_Event.Application/Setting/IRefundConfigService.cs
+++ /dev/null
@@ -1,22 +0,0 @@
-using YD_Event.Application.Setting.Dtos;
-
-namespace YD_Event.Application.Setting;
-
-///
-/// 退款配置服务接口
-///
-public interface IRefundConfigService : ITransient
-{
- ///
- /// 获取退款配置
- ///
- ///
- Task GetConfig();
-
- ///
- /// 更新退款配置
- ///
- ///
- ///
- Task UpdateConfig(RefundConfigInput input);
-}
diff --git a/YD_Event.Application/Setting/RefundConfigService.cs b/YD_Event.Application/Setting/RefundConfigService.cs
index f679db8..cc3a4af 100644
--- a/YD_Event.Application/Setting/RefundConfigService.cs
+++ b/YD_Event.Application/Setting/RefundConfigService.cs
@@ -5,7 +5,7 @@ namespace YD_Event.Application.Setting;
///
/// 退款配置服务
///
-public class RefundConfigService : IRefundConfigService
+public class RefundConfigService : ITransient
{
private readonly ISqlSugarRepository _repository;
private readonly IIdGenerator _idGenerator;
diff --git a/YD_Event.Application/YD_Event.Application.xml b/YD_Event.Application/YD_Event.Application.xml
index 19ed6d4..fcf1020 100644
--- a/YD_Event.Application/YD_Event.Application.xml
+++ b/YD_Event.Application/YD_Event.Application.xml
@@ -105,6 +105,138 @@
验证码
+
+
+ 轮播图服务
+
+
+
+
+ 获取轮播图配置模式
+
+
+
+
+
+ 更新轮播图配置模式
+
+
+
+
+
+
+ 获取轮播图列表(前台展示用)
+
+
+
+
+
+ 分页查询(后台管理用)
+
+
+
+
+
+
+ 添加轮播图
+
+
+
+
+
+
+ 更新轮播图
+
+
+
+
+
+
+ 删除轮播图
+
+
+
+
+
+
+ 添加轮播图输入参数
+
+
+
+
+ 标题
+
+
+
+
+ 图片地址
+
+
+
+
+ 跳转链接类型(0-图片/无跳转 1-赛事)
+
+
+
+
+ 跳转目标(赛事ID或URL)
+
+
+
+
+ 排序
+
+
+
+
+ 备注
+
+
+
+
+ 更新轮播图输入参数
+
+
+
+
+ Id
+
+
+
+
+ 状态
+
+
+
+
+ 轮播图查询参数
+
+
+
+
+ 标题
+
+
+
+
+ 轮播图输出参数
+
+
+
+
+ 轮播图配置输入参数
+
+
+
+
+ 模式(0-手动配置 1-自动配置)
+
+
+
+
+ 轮播图配置输出参数
+
+
删除信息
@@ -1810,24 +1942,6 @@
退款配置输出参数
-
-
- 退款配置服务接口
-
-
-
-
- 获取退款配置
-
-
-
-
-
- 更新退款配置
-
-
-
-
退款配置服务
diff --git a/YD_Event.Core/Entities/Banner.cs b/YD_Event.Core/Entities/Banner.cs
new file mode 100644
index 0000000..4a39a8a
--- /dev/null
+++ b/YD_Event.Core/Entities/Banner.cs
@@ -0,0 +1,74 @@
+using SqlSugar;
+using System.ComponentModel.DataAnnotations;
+using YD_Event.Core.Enum;
+
+namespace YD_Event.Core.Entities;
+
+///
+/// 轮播图配置
+///
+[SugarTable("Banner")]
+public class Banner : Entity, ICreatedTime, IUpdatedTime, ISoftDelete, IAvailability, ISortable
+{
+ ///
+ /// 标题
+ ///
+ [SugarColumn(ColumnDescription = "标题", Length = 128, IsNullable = true)]
+ public string Title { get; set; }
+
+ ///
+ /// 图片地址
+ ///
+ [SugarColumn(ColumnDescription = "图片地址", Length = 512)]
+ [Required, MaxLength(512)]
+ public string ImageUrl { get; set; }
+
+ ///
+ /// 跳转链接类型(0-图片/无跳转 1-赛事)
+ ///
+ [SugarColumn(ColumnDescription = "跳转链接类型")]
+ public int LinkType { get; set; }
+
+ ///
+ /// 跳转目标(赛事ID或URL)
+ ///
+ [SugarColumn(ColumnDescription = "跳转目标", Length = 512, IsNullable = true)]
+ public string LinkTarget { get; set; }
+
+ ///
+ /// 排序
+ ///
+ [SugarColumn(ColumnDescription = "排序")]
+ public int Sort { get; set; }
+
+ ///
+ /// 状态(0-启用 1-禁用)
+ ///
+ [SugarColumn(ColumnDescription = "状态")]
+ public AvailabilityStatus Status { get; set; }
+
+ ///
+ /// 备注
+ ///
+ [SugarColumn(ColumnDescription = "备注", Length = 256, IsNullable = true)]
+ public string Remark { get; set; }
+
+ public DateTime CreatedTime { get; set; }
+ public DateTime? UpdatedTime { get; set; }
+ public bool DeleteMark { get; set; }
+}
+
+///
+/// 轮播图设置(存储手动/自动模式)
+///
+[SugarTable("BannerConfig")]
+public class BannerConfig : Entity, IUpdatedTime
+{
+ ///
+ /// 模式(0-手动配置 1-自动配置)
+ ///
+ [SugarColumn(ColumnDescription = "模式(0-手动配置 1-自动配置)")]
+ public int Mode { get; set; }
+
+ public DateTime? UpdatedTime { get; set; }
+}
diff --git a/YD_Event.Core/YD_Event.Core.xml b/YD_Event.Core/YD_Event.Core.xml
index b670966..ebb3927 100644
--- a/YD_Event.Core/YD_Event.Core.xml
+++ b/YD_Event.Core/YD_Event.Core.xml
@@ -499,6 +499,56 @@
创建时间
+
+
+ 轮播图配置
+
+
+
+
+ 标题
+
+
+
+
+ 图片地址
+
+
+
+
+ 跳转链接类型(0-图片/无跳转 1-赛事)
+
+
+
+
+ 跳转目标(赛事ID或URL)
+
+
+
+
+ 排序
+
+
+
+
+ 状态(0-启用 1-禁用)
+
+
+
+
+ 备注
+
+
+
+
+ 轮播图设置(存储手动/自动模式)
+
+
+
+
+ 模式(0-手动配置 1-自动配置)
+
+
文章栏目表
diff --git a/YD_Event.Web.Entry/Controllers/CouponController.cs b/YD_Event.Web.Entry/Controllers/CouponController.cs
deleted file mode 100644
index 44e4323..0000000
--- a/YD_Event.Web.Entry/Controllers/CouponController.cs
+++ /dev/null
@@ -1,75 +0,0 @@
-using Furion.DynamicApiController;
-using Microsoft.AspNetCore.Mvc;
-using YD_Event.Application.Coupon;
-using YD_Event.Application.Coupon.Dtos;
-
-namespace YD_Event.Web.Entry.Controllers;
-
-///
-/// 优惠券管理
-///
-[Route("api/coupon")]
-[ApiDescriptionSettings("优惠券管理")]
-public class CouponController : IDynamicApiController
-{
- private readonly ICouponService _couponService;
-
- public CouponController(ICouponService couponService)
- {
- _couponService = couponService;
- }
-
- ///
- /// 分页查询
- ///
- [HttpGet("page")]
- public async Task Page([FromQuery] CouponQueryInput input)
- {
- return await _couponService.Page(input);
- }
-
- ///
- /// 添加优惠券
- ///
- [HttpPost("add")]
- public async Task Add([FromBody] AddCouponInput input)
- {
- await _couponService.Add(input);
- }
-
- ///
- /// 编辑优惠券
- ///
- [HttpPut("edit")]
- public async Task Update([FromBody] UpdateCouponInput input)
- {
- await _couponService.Update(input);
- }
-
- ///
- /// 删除优惠券
- ///
- [HttpPost("delete")]
- public async Task Delete([FromBody] List ids)
- {
- await _couponService.Delete(ids);
- }
-
- ///
- /// 生成/获取兑换码
- ///
- [HttpPost("generateCode")]
- public async Task GenerateCode([FromBody] long id)
- {
- return await _couponService.GenerateCode(id);
- }
-
- ///
- /// 获取赛事列表
- ///
- [HttpGet("event/list")]
- public async Task> GetEventList()
- {
- return await _couponService.GetEventList();
- }
-}