修复bug
This commit is contained in:
parent
532ad46ca0
commit
5afa939e14
@ -171,8 +171,9 @@ public class AppUserService : BaseService<AppUserEntity>, ITransient
|
|||||||
&& !x.DeleteMark)
|
&& !x.DeleteMark)
|
||||||
.FirstAsync();
|
.FirstAsync();
|
||||||
|
|
||||||
AppUserEntity entity;
|
AppUserEntity? entity = null;
|
||||||
bool isUnitTransfer = false;
|
bool isUnitTransfer = false;
|
||||||
|
bool isNewRecord = false;
|
||||||
long? originalMerchantId = null;
|
long? originalMerchantId = null;
|
||||||
|
|
||||||
if (existingInOtherUnit != null)
|
if (existingInOtherUnit != null)
|
||||||
@ -182,6 +183,29 @@ public class AppUserService : BaseService<AppUserEntity>, ITransient
|
|||||||
entity = existingInOtherUnit;
|
entity = existingInOtherUnit;
|
||||||
originalMerchantId = entity.MerchantCertificationId;
|
originalMerchantId = entity.MerchantCertificationId;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// 检查是否存在相同手机号但还未加入任何单位的记录(小程序注册的用户)
|
||||||
|
var existingWithoutUnit = await _appUserRep.AsQueryable()
|
||||||
|
.Where(x => x.Mobile == input.Mobile
|
||||||
|
&& x.PersonType == input.PersonType
|
||||||
|
&& x.MerchantCertificationId == null
|
||||||
|
&& !x.DeleteMark)
|
||||||
|
.FirstAsync();
|
||||||
|
|
||||||
|
if (existingWithoutUnit != null)
|
||||||
|
{
|
||||||
|
// 找到已存在但未加入任何单位的记录,复用该记录
|
||||||
|
entity = existingWithoutUnit;
|
||||||
|
entity.UpdatedUserId = _authManager.UserId;
|
||||||
|
entity.UpdatedTime = DateTime.Now;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// 没有找到任何记录,标记为新增
|
||||||
|
isNewRecord = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (input.Id.HasValue)
|
if (input.Id.HasValue)
|
||||||
{
|
{
|
||||||
@ -206,7 +230,7 @@ public class AppUserService : BaseService<AppUserEntity>, ITransient
|
|||||||
entity.UpdatedUserId = _authManager.UserId;
|
entity.UpdatedUserId = _authManager.UserId;
|
||||||
entity.UpdatedTime = DateTime.Now;
|
entity.UpdatedTime = DateTime.Now;
|
||||||
}
|
}
|
||||||
else
|
else if (isNewRecord)
|
||||||
{
|
{
|
||||||
// 新增模式:检查本单位内是否有相同手机号且相同类型的记录
|
// 新增模式:检查本单位内是否有相同手机号且相同类型的记录
|
||||||
var existingInSameUnit = await _appUserRep.AsQueryable()
|
var existingInSameUnit = await _appUserRep.AsQueryable()
|
||||||
|
|||||||
@ -14,7 +14,7 @@ public class EventClientQueryInput : Pagination
|
|||||||
public string? Keyword { get; set; }
|
public string? Keyword { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 状态筛选:0-全部 1-报名中 2-比赛中 3-已结束
|
/// 状态筛选:0-全部 1-报名中 3-比赛中 4-已结束
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int Status { get; set; } = 0;
|
public int Status { get; set; } = 0;
|
||||||
|
|
||||||
|
|||||||
@ -185,21 +185,8 @@ public class EventClientController : IDynamicApiController
|
|||||||
.Where(e => !e.DeleteMark && e.Status == AvailabilityStatus.Enable)
|
.Where(e => !e.DeleteMark && e.Status == AvailabilityStatus.Enable)
|
||||||
.WhereIF(!string.IsNullOrEmpty(input.Keyword), e => e.EventName.Contains(input.Keyword))
|
.WhereIF(!string.IsNullOrEmpty(input.Keyword), e => e.EventName.Contains(input.Keyword))
|
||||||
.WhereIF(input.EventType.HasValue, e => e.EventType == input.EventType)
|
.WhereIF(input.EventType.HasValue, e => e.EventType == input.EventType)
|
||||||
.WhereIF(input.ChargeMode.HasValue, e => e.ChargeMode == input.ChargeMode);
|
.WhereIF(input.ChargeMode.HasValue, e => e.ChargeMode == input.ChargeMode)
|
||||||
|
.WhereIF(input.Status > 0, e => e.EventStatus == (EventStatus)input.Status);
|
||||||
var now = DateTime.Now;
|
|
||||||
if (input.Status == 1)
|
|
||||||
{
|
|
||||||
query = query.Where(e => now >= e.RegistrationStartTime && now <= e.RegistrationEndTime);
|
|
||||||
}
|
|
||||||
else if (input.Status == 2)
|
|
||||||
{
|
|
||||||
query = query.Where(e => now >= e.MatchStartTime && now <= e.MatchEndTime);
|
|
||||||
}
|
|
||||||
else if (input.Status == 3)
|
|
||||||
{
|
|
||||||
query = query.Where(e => now > e.MatchEndTime);
|
|
||||||
}
|
|
||||||
|
|
||||||
query = query.OrderByDescending(e => e.CreatedTime);
|
query = query.OrderByDescending(e => e.CreatedTime);
|
||||||
|
|
||||||
@ -243,7 +230,7 @@ public class EventClientController : IDynamicApiController
|
|||||||
Id = e.Id,
|
Id = e.Id,
|
||||||
EventName = e.EventName,
|
EventName = e.EventName,
|
||||||
CoverImage = e.CoverImage,
|
CoverImage = e.CoverImage,
|
||||||
EventStatus = CalculateEventStatus(e),
|
EventStatus = e.EventStatus,
|
||||||
RegistrationStartTime = e.RegistrationStartTime,
|
RegistrationStartTime = e.RegistrationStartTime,
|
||||||
RegistrationEndTime = e.RegistrationEndTime,
|
RegistrationEndTime = e.RegistrationEndTime,
|
||||||
MatchStartTime = e.MatchStartTime,
|
MatchStartTime = e.MatchStartTime,
|
||||||
@ -465,7 +452,7 @@ public class EventClientController : IDynamicApiController
|
|||||||
Id = evt.Id,
|
Id = evt.Id,
|
||||||
EventName = evt.EventName,
|
EventName = evt.EventName,
|
||||||
CoverImage = evt.CoverImage,
|
CoverImage = evt.CoverImage,
|
||||||
EventStatus = CalculateEventStatus(evt),
|
EventStatus = evt.EventStatus,
|
||||||
RegistrationStartTime = evt.RegistrationStartTime,
|
RegistrationStartTime = evt.RegistrationStartTime,
|
||||||
RegistrationEndTime = evt.RegistrationEndTime,
|
RegistrationEndTime = evt.RegistrationEndTime,
|
||||||
MatchStartTime = evt.MatchStartTime,
|
MatchStartTime = evt.MatchStartTime,
|
||||||
|
|||||||
@ -257,6 +257,7 @@ public class MyController : IDynamicApiController
|
|||||||
.Where(tm => teamIds.Contains(tm.TeamId) && !tm.DeleteMark)
|
.Where(tm => teamIds.Contains(tm.TeamId) && !tm.DeleteMark)
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
var memberCounts = teamMembers
|
var memberCounts = teamMembers
|
||||||
|
.Where(tm => tm.PersonType == PersonType.Athlete)
|
||||||
.GroupBy(tm => tm.TeamId)
|
.GroupBy(tm => tm.TeamId)
|
||||||
.ToDictionary(g => g.Key, g => g.Count());
|
.ToDictionary(g => g.Key, g => g.Count());
|
||||||
|
|
||||||
@ -337,7 +338,7 @@ public class MyController : IDynamicApiController
|
|||||||
Leader = leader,
|
Leader = leader,
|
||||||
Coach = coach,
|
Coach = coach,
|
||||||
CreatedTime = team.CreatedTime,
|
CreatedTime = team.CreatedTime,
|
||||||
MemberCount = members.Count,
|
MemberCount = members.Count(m => m.PersonType == 1),
|
||||||
Members = members
|
Members = members
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -372,8 +373,24 @@ public class MyController : IDynamicApiController
|
|||||||
.LeftJoin<EventInfo>((c, e) => c.EventId == e.Id)
|
.LeftJoin<EventInfo>((c, e) => c.EventId == e.Id)
|
||||||
.LeftJoin<EventProject>((c, e, ep) => c.ProjectId == ep.Id)
|
.LeftJoin<EventProject>((c, e, ep) => c.ProjectId == ep.Id)
|
||||||
.LeftJoin<ProjectEntity>((c, e, ep, p) => ep.ProjectId == p.Id)
|
.LeftJoin<ProjectEntity>((c, e, ep, p) => ep.ProjectId == p.Id)
|
||||||
.Where((c, e, ep, p) => c.UserId == userId && c.CertificateStatus == 2 && !c.DeleteMark)
|
.Where((c, e, ep, p) => c.UserId == userId && c.CertificateStatus == 2 && !c.DeleteMark);
|
||||||
.Select((c, e, ep, p) => new {
|
|
||||||
|
// 根据类型筛选
|
||||||
|
if (input.Type.HasValue)
|
||||||
|
{
|
||||||
|
if (input.Type == 1)
|
||||||
|
{
|
||||||
|
// 个人证书:没有单位认证ID
|
||||||
|
query = query.Where((c, e, ep, p) => !c.MerchantCertificationId.HasValue);
|
||||||
|
}
|
||||||
|
else if (input.Type == 2)
|
||||||
|
{
|
||||||
|
// 团队证书:有单位认证ID
|
||||||
|
query = query.Where((c, e, ep, p) => c.MerchantCertificationId.HasValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var resultQuery = query.Select((c, e, ep, p) => new {
|
||||||
Id = c.Id,
|
Id = c.Id,
|
||||||
EventName = e.EventName,
|
EventName = e.EventName,
|
||||||
ProjectName = p.Name,
|
ProjectName = p.Name,
|
||||||
@ -384,7 +401,7 @@ public class MyController : IDynamicApiController
|
|||||||
})
|
})
|
||||||
.OrderByDescending(c => c.IssuedTime);
|
.OrderByDescending(c => c.IssuedTime);
|
||||||
|
|
||||||
var pagedResult = await query.ToPagedListAsync(input);
|
var pagedResult = await resultQuery.ToPagedListAsync(input);
|
||||||
|
|
||||||
// 在内存中转换证书名称
|
// 在内存中转换证书名称
|
||||||
var result = new PageResult<MyCertificateDto>
|
var result = new PageResult<MyCertificateDto>
|
||||||
|
|||||||
@ -1791,7 +1791,7 @@
|
|||||||
</member>
|
</member>
|
||||||
<member name="P:YD_Event.Application.Client.Dtos.EventClientQueryInput.Status">
|
<member name="P:YD_Event.Application.Client.Dtos.EventClientQueryInput.Status">
|
||||||
<summary>
|
<summary>
|
||||||
状态筛选:0-全部 1-报名中 2-比赛中 3-已结束
|
状态筛选:0-全部 1-报名中 3-比赛中 4-已结束
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
<member name="P:YD_Event.Application.Client.Dtos.EventClientQueryInput.EventType">
|
<member name="P:YD_Event.Application.Client.Dtos.EventClientQueryInput.EventType">
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user