From 84b79835678458cb3c656d0e41c0319f229c6687 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=A9=AC=E6=A2=93=E5=BD=AD?= Date: Wed, 6 May 2026 22:20:16 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B5=9B=E4=BA=8B=E8=AF=A6=E6=83=85=E4=B8=AA?= =?UTF-8?q?=E4=BA=BA=E9=A1=B9=E7=9B=AE=E9=99=90=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Event/Dtos/EventRecordDtos.cs | 10 ++++++ .../Event/UserEventRecordService.cs | 17 ++++++++- .../Merchant/MerchantCertificationService.cs | 36 ------------------- YD_Event.Application/YD_Event.Application.xml | 10 ++++++ 4 files changed, 36 insertions(+), 37 deletions(-) diff --git a/YD_Event.Application/Event/Dtos/EventRecordDtos.cs b/YD_Event.Application/Event/Dtos/EventRecordDtos.cs index 0467b81..02a2263 100644 --- a/YD_Event.Application/Event/Dtos/EventRecordDtos.cs +++ b/YD_Event.Application/Event/Dtos/EventRecordDtos.cs @@ -628,6 +628,16 @@ public class CancelExecuteOutput /// public string TeamName { get; set; } + /// + /// 报名结束时间 + /// + public DateTime RegistrationEndTime { get; set; } + + /// + /// 赛事状态 + /// + public int EventStatus { get; set; } + /// /// 项目列表 /// diff --git a/YD_Event.Application/Event/UserEventRecordService.cs b/YD_Event.Application/Event/UserEventRecordService.cs index 4b779d1..9defe0a 100644 --- a/YD_Event.Application/Event/UserEventRecordService.cs +++ b/YD_Event.Application/Event/UserEventRecordService.cs @@ -535,7 +535,9 @@ public class UserEventRecordService : IDynamicApiController, ITransient RegistrationId = registration.Id, EventId = registration.EventId, EventName = eventInfo?.EventName ?? "", - TeamName = registration.TeamName ?? "" + TeamName = registration.TeamName ?? "", + RegistrationEndTime = eventInfo.RegistrationEndTime, + EventStatus = (int)eventInfo.EventStatus }; foreach (var item in items) @@ -605,6 +607,19 @@ public class UserEventRecordService : IDynamicApiController, ITransient var eventInfo = await _eventRepository.GetFirstAsync(x => x.Id == registration.EventId); if (eventInfo == null) throw Oops.Bah("赛事信息不存在"); + // 检查报名时间是否已结束 + var now = DateTime.Now; + if (now > eventInfo.RegistrationEndTime) + { + throw Oops.Bah("赛事报名时间已结束,无法更换参赛队员"); + } + + // 检查赛事状态,只有报名中状态才允许更换队员 + if (eventInfo.EventStatus != EventStatus.Enrolling) + { + throw Oops.Bah("当前赛事状态不允许更换参赛队员"); + } + // 获取报名项目信息 var registrationItems = await _registrationItemRepository.GetListAsync(x => x.RegistrationId == input.RegistrationId); var eventProjectIds = registrationItems.Select(x => x.ProjectId).Distinct().ToList(); diff --git a/YD_Event.Application/Merchant/MerchantCertificationService.cs b/YD_Event.Application/Merchant/MerchantCertificationService.cs index 0020acf..93ada7d 100644 --- a/YD_Event.Application/Merchant/MerchantCertificationService.cs +++ b/YD_Event.Application/Merchant/MerchantCertificationService.cs @@ -163,42 +163,6 @@ public class MerchantCertificationService : BaseService, certification.AuditRemark = input.Remark; certification.UpdatedUserId = userId; certification.UpdatedTime = DateTime.Now; - - if (input.Status == AuditStatus.Pass) - { - var merchant = await _merchantRepository.GetFirstAsync(m => m.CreatedUserId == certification.UserId && !m.DeleteMark); - if (merchant == null) - { - merchant = new YD_Event.Core.Entities.Merchant - { - Id = _idGenerator.NextId(), - MerchantName = certification.MerchantName, - CreditCode = certification.CreditCode, - BusinessLicenseUrl = certification.BusinessLicenseUrl, - Address = certification.Address, - ContactPhone = certification.ContactPhone, - BankName = "", - AccountNumber = "", - AuditStatus = AuditStatus.Pass, - Status = AvailabilityStatus.Enable, - DeleteMark = false, - CreatedUserId = certification.UserId, - CreatedTime = DateTime.Now - }; - await _merchantRepository.InsertAsync(merchant); - } - else - { - merchant.MerchantName = certification.MerchantName; - merchant.CreditCode = certification.CreditCode; - merchant.BusinessLicenseUrl = certification.BusinessLicenseUrl; - merchant.Address = certification.Address; - merchant.ContactPhone = certification.ContactPhone; - merchant.UpdatedUserId = userId; - merchant.UpdatedTime = DateTime.Now; - await _merchantRepository.UpdateAsync(merchant); - } - } } await _repository.UpdateRangeAsync(certifications); diff --git a/YD_Event.Application/YD_Event.Application.xml b/YD_Event.Application/YD_Event.Application.xml index c754d8d..78504f8 100644 --- a/YD_Event.Application/YD_Event.Application.xml +++ b/YD_Event.Application/YD_Event.Application.xml @@ -5426,6 +5426,16 @@ 团队名称 + + + 报名结束时间 + + + + + 赛事状态 + + 项目列表