赛事详情

This commit is contained in:
马梓彭 2026-04-27 11:23:47 +08:00
parent 3b53312c27
commit 9beafeb1b0
6 changed files with 96 additions and 30 deletions

View File

@ -134,14 +134,14 @@ public class UserEventDetailOutput
public string Status { get; set; }
/// <summary>
/// 赛事类型
/// 赛事类型 (int: 0-线上, 1-线下)
/// </summary>
public string Type { get; set; }
public int Type { get; set; }
/// <summary>
/// 报名方式
/// 报名方式 (int: 0-个人报名, 1-团队报名, 2-个人/团队报名)
/// </summary>
public string RegistrationType { get; set; }
public int RegistrationType { get; set; }
/// <summary>
/// 积分规则名称
@ -189,7 +189,22 @@ public class UserEventDetailOutput
public string Description { get; set; }
/// <summary>
/// 地址
/// 省份名称
/// </summary>
public string ProvinceName { get; set; }
/// <summary>
/// 城市名称
/// </summary>
public string CityName { get; set; }
/// <summary>
/// 区县名称
/// </summary>
public string DistrictName { get; set; }
/// <summary>
/// 详细地址
/// </summary>
public string Address { get; set; }
@ -251,9 +266,9 @@ public class UserEventLimitOutput
public class UserEventFeeOutput
{
/// <summary>
/// 收费模式
/// 收费模式 (int: 0-免费, 1-定价(赛事), 2-单价(赛事), 3-单价(项目))
/// </summary>
public string ChargeMode { get; set; }
public int ChargeMode { get; set; }
/// <summary>
/// 价格
@ -897,6 +912,7 @@ public class UploadVoucherInput
/// 支付金额
/// </summary>
[Required]
[Range(0.01, double.MaxValue, ErrorMessage = "支付金额必须大于0")]
public decimal PayAmount { get; set; }
/// <summary>
@ -904,13 +920,6 @@ public class UploadVoucherInput
/// </summary>
[Required]
public DateTime PayTime { get; set; }
/// <summary>
/// 交易流水号 (可选)
/// </summary>
public string? TransactionId { get; set; }
}
/// <summary>

View File

@ -160,7 +160,7 @@ public class UnifiedRegistrationService : ITransient
private async Task<EventRegistration> GetOrCreateRegistrationAsync(UnifiedRegistrationInput input)
{
var existingRegistration = await _registrationRepository.GetFirstAsync(
r => r.EventId == input.EventId && r.CreatedUserId == input.CreatedUserId && (r.PaymentStatus != 4 || r.PaymentStatus != 3));
r => r.EventId == input.EventId && r.CreatedUserId == input.CreatedUserId && r.PaymentStatus != 4 && r.PaymentStatus != 3);
if (existingRegistration != null)
{

View File

@ -273,7 +273,33 @@ public class UserEventRecordService : IDynamicApiController, ITransient
var registration = await _registrationRepository.GetFirstAsync(x => x.Id == registrationId && x.CreatedUserId == userId);
if (registration == null) throw Oops.Bah("报名记录不存在");
// 允许的文件类型
var allowedFileTypes = new[] { "image/jpeg", "image/jpg", "image/png", "application/pdf" };
// 允许的文件扩展名
var allowedFileExtensions = new[] { ".jpg", ".jpeg", ".png", ".pdf" };
// 最大文件大小 5MB
const long maxFileSize = 5 * 1024 * 1024;
// 验证文件类型
var fileName = input.File.FileName.ToLower();
var hasValidExtension = allowedFileExtensions.Any(ext => fileName.EndsWith(ext));
var hasValidType = allowedFileTypes.Contains(input.File.ContentType);
if (!hasValidExtension && !hasValidType)
{
throw Oops.Bah("仅支持jpg、jpeg、png、pdf格式的文件");
}
// 验证文件大小
if (input.File.Length > maxFileSize)
{
throw Oops.Bah("文件大小不能超过5MB");
}
// 验证支付金额
if (input.PayAmount <= 0)
{
throw Oops.Bah("支付金额必须大于0");
}
var uploadResult = await _fileService.Upload(input.File);
var fileInfo = uploadResult.First();

View File

@ -209,11 +209,32 @@ public class UserEventRegistrationService : IDynamicApiController, ITransient
output.Description = eventInfo.EventIntroduction;
output.Address = eventInfo.DetailAddress;
output.EventVideo = eventInfo.EventVideo;
output.RegistrationType = eventInfo.RegistrationType.ToString();
// 直接赋值 int 类型
output.Type = (int)eventInfo.EventType;
output.RegistrationType = (int)eventInfo.RegistrationType;
output.IsNeedMaterial = eventInfo.IsNeedMaterial;
output.MaterialRemark = eventInfo.MaterialRemark;
output.MaterialUploadEndTime = eventInfo.MaterialUploadEndTime;
// 查询省市区名称
if (eventInfo.ProvinceId.HasValue)
{
var province = await _db.Queryable<SysProvince>().FirstAsync(x => x.Id == eventInfo.ProvinceId.Value && !x.DeleteMark);
output.ProvinceName = province?.ProvinceName ?? "";
}
if (eventInfo.CityId.HasValue)
{
var city = await _db.Queryable<SysCity>().FirstAsync(x => x.Id == eventInfo.CityId.Value && !x.DeleteMark);
output.CityName = city?.CityName ?? "";
}
if (eventInfo.DistrictId.HasValue)
{
var district = await _db.Queryable<SysDistrict>().FirstAsync(x => x.Id == eventInfo.DistrictId.Value && !x.DeleteMark);
output.DistrictName = district?.DistrictName ?? "";
}
if (eventInfo.PointsRuleId.HasValue)
{
var rule = await _pointsRuleRepository.GetByIdAsync(eventInfo.PointsRuleId.Value);
@ -238,7 +259,7 @@ public class UserEventRegistrationService : IDynamicApiController, ITransient
{
var feeConfig = new UserEventFeeOutput
{
ChargeMode = fee.ChargeMode.ToString(),
ChargeMode = (int)fee.ChargeMode,
Price = fee.Price
};

View File

@ -6623,12 +6623,12 @@
</member>
<member name="P:YD_Event.Application.Event.Dtos.UserEventDetailOutput.Type">
<summary>
赛事类型
赛事类型 (int: 0-线上, 1-线下)
</summary>
</member>
<member name="P:YD_Event.Application.Event.Dtos.UserEventDetailOutput.RegistrationType">
<summary>
报名方式
报名方式 (int: 0-个人报名, 1-团队报名, 2-个人/团队报名)
</summary>
</member>
<member name="P:YD_Event.Application.Event.Dtos.UserEventDetailOutput.PointsRuleName">
@ -6676,9 +6676,24 @@
赛事简介/规则
</summary>
</member>
<member name="P:YD_Event.Application.Event.Dtos.UserEventDetailOutput.ProvinceName">
<summary>
省份名称
</summary>
</member>
<member name="P:YD_Event.Application.Event.Dtos.UserEventDetailOutput.CityName">
<summary>
城市名称
</summary>
</member>
<member name="P:YD_Event.Application.Event.Dtos.UserEventDetailOutput.DistrictName">
<summary>
区县名称
</summary>
</member>
<member name="P:YD_Event.Application.Event.Dtos.UserEventDetailOutput.Address">
<summary>
地址
详细地址
</summary>
</member>
<member name="P:YD_Event.Application.Event.Dtos.UserEventDetailOutput.Remark">
@ -6738,7 +6753,7 @@
</member>
<member name="P:YD_Event.Application.Event.Dtos.UserEventFeeOutput.ChargeMode">
<summary>
收费模式
收费模式 (int: 0-免费, 1-定价(赛事), 2-单价(赛事), 3-单价(项目))
</summary>
</member>
<member name="P:YD_Event.Application.Event.Dtos.UserEventFeeOutput.Price">
@ -7366,11 +7381,6 @@
支付时间
</summary>
</member>
<member name="P:YD_Event.Application.Event.Dtos.UploadVoucherInput.TransactionId">
<summary>
交易流水号 (可选)
</summary>
</member>
<member name="T:YD_Event.Application.Event.Dtos.VoucherDTO">
<summary>
支付凭证输出

View File

@ -37,8 +37,8 @@
{
"ConfigId": 1,
"DbType": "SqlServer", // MySql、SqlServer、Sqlite、Oracle、PostgreSQL、Dm、Kdbndp、Oscar、MySqlConnector、Access、OpenGauss、QuestDB、HG、ClickHouse、GBase、Odbc、Custom
//"ConnectionString": "Data Source=rm-uf64b8oxdt19pfyxfao.sqlserver.rds.aliyuncs.com;Database=EventServerDB_QA;User ID=qa;Password=Admin@123;Connect Timeout=500;Encrypt=True;TrustServerCertificate=True;",
"ConnectionString": "Data Source=rm-uf64b8oxdt19pfyxfao.sqlserver.rds.aliyuncs.com;Database=EventServerDB;User ID=yd;Password=Admin@123456;Connect Timeout=500;Encrypt=True;TrustServerCertificate=True;",
"ConnectionString": "Data Source=rm-uf64b8oxdt19pfyxfao.sqlserver.rds.aliyuncs.com;Database=EventServerDB_QA;User ID=qa;Password=Admin@123;Connect Timeout=500;Encrypt=True;TrustServerCertificate=True;",
//"ConnectionString": "Data Source=rm-uf64b8oxdt19pfyxfao.sqlserver.rds.aliyuncs.com;Database=EventServerDB;User ID=yd;Password=Admin@123456;Connect Timeout=500;Encrypt=True;TrustServerCertificate=True;",
"IsAutoCloseConnection": true,
"EnableInitDb": false // 启用数据库以及数据表初始化(首次运行项目时开启可以自动创建数据库和初始化项目运行的基础数据)
}
@ -53,8 +53,8 @@
"SleepMs": 300,
"dbconfig": {
"ConnectionStrings": [
//"8.153.108.90,Password=yd708090,SyncTimeout=15000,ConnectTimeout=15000,ResponseTimeout=15000,defaultDatabase=7,poolsize=100,ssl=false,writeBuffer=10240,idleTimeout=30000,connectRetry=3,asyncPipeline=false",
"8.153.108.90,Password=yd708090,SyncTimeout=15000,ConnectTimeout=15000,ResponseTimeout=15000,defaultDatabase=8,poolsize=100,ssl=false,writeBuffer=10240,idleTimeout=30000,connectRetry=3,asyncPipeline=false"
"8.153.108.90,Password=yd708090,SyncTimeout=15000,ConnectTimeout=15000,ResponseTimeout=15000,defaultDatabase=7,poolsize=100,ssl=false,writeBuffer=10240,idleTimeout=30000,connectRetry=3,asyncPipeline=false",
//"8.153.108.90,Password=yd708090,SyncTimeout=15000,ConnectTimeout=15000,ResponseTimeout=15000,defaultDatabase=8,poolsize=100,ssl=false,writeBuffer=10240,idleTimeout=30000,connectRetry=3,asyncPipeline=false"
],
//"Sentinels": [
// "192.169.1.10:26379",