用户PC 【赛事管理】判断是否可以进行赛事报名
This commit is contained in:
parent
bf896352a3
commit
369fed08f8
@ -81,6 +81,11 @@ public class UserEventListOutput
|
|||||||
/// 比赛结束时间
|
/// 比赛结束时间
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public DateTime MatchEndTime { get; set; }
|
public DateTime MatchEndTime { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 当前用户是否可以报名参与该赛事
|
||||||
|
/// </summary>
|
||||||
|
public bool CanRegister { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@ -42,6 +42,7 @@ public class UserEventRegistrationService : IDynamicApiController, ITransient
|
|||||||
private readonly ISqlSugarRepository<PointsRule> _pointsRuleRepository;
|
private readonly ISqlSugarRepository<PointsRule> _pointsRuleRepository;
|
||||||
private readonly ISqlSugarRepository<YD_Event.Core.Entities.Order> _orderRepository;
|
private readonly ISqlSugarRepository<YD_Event.Core.Entities.Order> _orderRepository;
|
||||||
private readonly ISqlSugarRepository<WeChatPayConfig> _weChatPayConfigRepository;
|
private readonly ISqlSugarRepository<WeChatPayConfig> _weChatPayConfigRepository;
|
||||||
|
private readonly ISqlSugarRepository<YD_Event.Core.Entities.Merchant> _merchantRepository;
|
||||||
private readonly AuthManager _authManager;
|
private readonly AuthManager _authManager;
|
||||||
private readonly IIdGenerator _idGenerator;
|
private readonly IIdGenerator _idGenerator;
|
||||||
private readonly WeChatPayService _weChatPayService;
|
private readonly WeChatPayService _weChatPayService;
|
||||||
@ -62,6 +63,7 @@ public class UserEventRegistrationService : IDynamicApiController, ITransient
|
|||||||
ISqlSugarRepository<PointsRule> pointsRuleRepository,
|
ISqlSugarRepository<PointsRule> pointsRuleRepository,
|
||||||
ISqlSugarRepository<YD_Event.Core.Entities.Order> orderRepository,
|
ISqlSugarRepository<YD_Event.Core.Entities.Order> orderRepository,
|
||||||
ISqlSugarRepository<WeChatPayConfig> weChatPayConfigRepository,
|
ISqlSugarRepository<WeChatPayConfig> weChatPayConfigRepository,
|
||||||
|
ISqlSugarRepository<YD_Event.Core.Entities.Merchant> merchantRepository,
|
||||||
AuthManager authManager,
|
AuthManager authManager,
|
||||||
IIdGenerator idGenerator,
|
IIdGenerator idGenerator,
|
||||||
WeChatPayService weChatPayService,
|
WeChatPayService weChatPayService,
|
||||||
@ -81,6 +83,7 @@ public class UserEventRegistrationService : IDynamicApiController, ITransient
|
|||||||
_pointsRuleRepository = pointsRuleRepository;
|
_pointsRuleRepository = pointsRuleRepository;
|
||||||
_orderRepository = orderRepository;
|
_orderRepository = orderRepository;
|
||||||
_weChatPayConfigRepository = weChatPayConfigRepository;
|
_weChatPayConfigRepository = weChatPayConfigRepository;
|
||||||
|
_merchantRepository = merchantRepository;
|
||||||
_authManager = authManager;
|
_authManager = authManager;
|
||||||
_idGenerator = idGenerator;
|
_idGenerator = idGenerator;
|
||||||
_weChatPayService = weChatPayService;
|
_weChatPayService = weChatPayService;
|
||||||
@ -104,7 +107,7 @@ public class UserEventRegistrationService : IDynamicApiController, ITransient
|
|||||||
.WhereIF(input.EndTime.HasValue, x => x.MatchEndTime <= input.EndTime)
|
.WhereIF(input.EndTime.HasValue, x => x.MatchEndTime <= input.EndTime)
|
||||||
.OrderByDescending(x => x.CreatedTime);
|
.OrderByDescending(x => x.CreatedTime);
|
||||||
|
|
||||||
return await query.Select(x => new UserEventListOutput
|
var pageResult = await query.Select(x => new UserEventListOutput
|
||||||
{
|
{
|
||||||
Id = x.Id,
|
Id = x.Id,
|
||||||
Name = x.EventName,
|
Name = x.EventName,
|
||||||
@ -115,6 +118,17 @@ public class UserEventRegistrationService : IDynamicApiController, ITransient
|
|||||||
MatchStartTime = x.MatchStartTime,
|
MatchStartTime = x.MatchStartTime,
|
||||||
MatchEndTime = x.MatchEndTime
|
MatchEndTime = x.MatchEndTime
|
||||||
}).ToPagedListAsync(input);
|
}).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;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@ -4379,6 +4379,11 @@
|
|||||||
比赛结束时间
|
比赛结束时间
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="P:YD_Event.Application.Event.Dtos.UserEventListOutput.CanRegister">
|
||||||
|
<summary>
|
||||||
|
当前用户是否可以报名参与该赛事
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
<member name="T:YD_Event.Application.Event.Dtos.UserEventDetailOutput">
|
<member name="T:YD_Event.Application.Event.Dtos.UserEventDetailOutput">
|
||||||
<summary>
|
<summary>
|
||||||
用户端赛事详情输出
|
用户端赛事详情输出
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user