From 203a38491db27dd0e6c776d57722b1f4dd6b0cb5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=A9=AC=E6=A2=93=E5=BD=AD?= Date: Fri, 17 Apr 2026 13:51:27 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B5=9B=E4=BA=8B=E6=98=AF=E5=90=A6=E4=B9=9F?= =?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/UserEventRegistrationService.cs | 74 +++++++++++++++++++ YD_Event.Application/YD_Event.Application.xml | 40 ++++++++++ 2 files changed, 114 insertions(+) diff --git a/YD_Event.Application/Event/UserEventRegistrationService.cs b/YD_Event.Application/Event/UserEventRegistrationService.cs index cf4569e..b7e632b 100644 --- a/YD_Event.Application/Event/UserEventRegistrationService.cs +++ b/YD_Event.Application/Event/UserEventRegistrationService.cs @@ -1415,4 +1415,78 @@ public class UserEventRegistrationService : IDynamicApiController, ITransient return result; } + + /// + /// 验证用户是否已报名该赛事 + /// + [DisplayName("验证用户报名状态")] + [HttpPost("registration-status/check")] + public async Task CheckRegistrationStatus([FromBody] CheckRegistrationStatusInput input) + { + var userId = _authManager.UserId; + var result = new CheckRegistrationStatusOutput(); + + // 查询用户是否已报名该赛事 + var registration = await _registrationRepository.GetFirstAsync(x => + x.EventId == input.EventId && + x.CreatedUserId == userId && + !x.DeleteMark && + ( + (x.PaymentMethod == 1 && (x.PaymentStatus == 0 || x.PaymentStatus == 1)) || + (x.PaymentMethod == 2 && x.PaymentStatus == 1) + )); + + if (registration != null) + { + result.IsRegistered = true; + result.RegistrationId = registration.Id; + result.RegistrationStatus = GetPaymentStatusDesc(registration.PaymentStatus); + result.Message = "您已报名该赛事,请先取消报名后再重新报名"; + } + else + { + result.IsRegistered = false; + result.Message = "可以报名"; + } + + return result; + } + + /// + /// 验证用户报名状态输入 + /// + public class CheckRegistrationStatusInput + { + /// + /// 赛事ID + /// + [Required] + public long EventId { get; set; } + } + + /// + /// 验证用户报名状态输出 + /// + public class CheckRegistrationStatusOutput + { + /// + /// 是否已报名 + /// + public bool IsRegistered { get; set; } + + /// + /// 报名ID (如果已报名) + /// + public long? RegistrationId { get; set; } + + /// + /// 报名状态描述 + /// + public string? RegistrationStatus { get; set; } + + /// + /// 提示消息 + /// + public string? Message { get; set; } + } } diff --git a/YD_Event.Application/YD_Event.Application.xml b/YD_Event.Application/YD_Event.Application.xml index 03432e2..fb1580d 100644 --- a/YD_Event.Application/YD_Event.Application.xml +++ b/YD_Event.Application/YD_Event.Application.xml @@ -8487,6 +8487,46 @@ 检查组别选择限制 + + + 验证用户是否已报名该赛事 + + + + + 验证用户报名状态输入 + + + + + 赛事ID + + + + + 验证用户报名状态输出 + + + + + 是否已报名 + + + + + 报名ID (如果已报名) + + + + + 报名状态描述 + + + + + 提示消息 + + 日志分页查询输入