From 369fed08f8861e66c03aac10e1649c2c14e973c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=A9=AC=E6=A2=93=E5=BD=AD?= Date: Thu, 26 Mar 2026 23:08:22 +0800 Subject: [PATCH] =?UTF-8?q?=E7=94=A8=E6=88=B7PC=20=E3=80=90=E8=B5=9B?= =?UTF-8?q?=E4=BA=8B=E7=AE=A1=E7=90=86=E3=80=91=E5=88=A4=E6=96=AD=E6=98=AF?= =?UTF-8?q?=E5=90=A6=E5=8F=AF=E4=BB=A5=E8=BF=9B=E8=A1=8C=E8=B5=9B=E4=BA=8B?= =?UTF-8?q?=E6=8A=A5=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Event/Dtos/UserCompetitionDtos.cs | 5 +++++ .../Event/UserEventRegistrationService.cs | 16 +++++++++++++++- YD_Event.Application/YD_Event.Application.xml | 5 +++++ 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/YD_Event.Application/Event/Dtos/UserCompetitionDtos.cs b/YD_Event.Application/Event/Dtos/UserCompetitionDtos.cs index d33db35..9354807 100644 --- a/YD_Event.Application/Event/Dtos/UserCompetitionDtos.cs +++ b/YD_Event.Application/Event/Dtos/UserCompetitionDtos.cs @@ -81,6 +81,11 @@ public class UserEventListOutput /// 比赛结束时间 /// public DateTime MatchEndTime { get; set; } + + /// + /// 当前用户是否可以报名参与该赛事 + /// + public bool CanRegister { get; set; } } /// diff --git a/YD_Event.Application/Event/UserEventRegistrationService.cs b/YD_Event.Application/Event/UserEventRegistrationService.cs index 8f0f1b6..42ebacc 100644 --- a/YD_Event.Application/Event/UserEventRegistrationService.cs +++ b/YD_Event.Application/Event/UserEventRegistrationService.cs @@ -42,6 +42,7 @@ public class UserEventRegistrationService : IDynamicApiController, ITransient private readonly ISqlSugarRepository _pointsRuleRepository; private readonly ISqlSugarRepository _orderRepository; private readonly ISqlSugarRepository _weChatPayConfigRepository; + private readonly ISqlSugarRepository _merchantRepository; private readonly AuthManager _authManager; private readonly IIdGenerator _idGenerator; private readonly WeChatPayService _weChatPayService; @@ -62,6 +63,7 @@ public class UserEventRegistrationService : IDynamicApiController, ITransient ISqlSugarRepository pointsRuleRepository, ISqlSugarRepository orderRepository, ISqlSugarRepository weChatPayConfigRepository, + ISqlSugarRepository merchantRepository, AuthManager authManager, IIdGenerator idGenerator, WeChatPayService weChatPayService, @@ -81,6 +83,7 @@ public class UserEventRegistrationService : IDynamicApiController, ITransient _pointsRuleRepository = pointsRuleRepository; _orderRepository = orderRepository; _weChatPayConfigRepository = weChatPayConfigRepository; + _merchantRepository = merchantRepository; _authManager = authManager; _idGenerator = idGenerator; _weChatPayService = weChatPayService; @@ -104,7 +107,7 @@ public class UserEventRegistrationService : IDynamicApiController, ITransient .WhereIF(input.EndTime.HasValue, x => x.MatchEndTime <= input.EndTime) .OrderByDescending(x => x.CreatedTime); - return await query.Select(x => new UserEventListOutput + var pageResult = await query.Select(x => new UserEventListOutput { Id = x.Id, Name = x.EventName, @@ -115,6 +118,17 @@ public class UserEventRegistrationService : IDynamicApiController, ITransient MatchStartTime = x.MatchStartTime, MatchEndTime = x.MatchEndTime }).ToPagedListAsync(input); + + var userId = _authManager.UserId; + var merchant = await _merchantRepository.GetFirstAsync(m => m.CreatedUserId == userId); + var canRegister = merchant != null && merchant.AuditStatus == AuditStatus.Pass; + + foreach (var item in pageResult.Rows) + { + item.CanRegister = canRegister; + } + + return pageResult; } /// diff --git a/YD_Event.Application/YD_Event.Application.xml b/YD_Event.Application/YD_Event.Application.xml index 4acf7e4..9d32ddf 100644 --- a/YD_Event.Application/YD_Event.Application.xml +++ b/YD_Event.Application/YD_Event.Application.xml @@ -4379,6 +4379,11 @@ 比赛结束时间 + + + 当前用户是否可以报名参与该赛事 + + 用户端赛事详情输出