|
@@ -520,22 +520,22 @@ public abstract class SnapshotApplicationBase
|
|
dto.ValidateObject();
|
|
dto.ValidateObject();
|
|
if (int.TryParse(dto.InvitationCode, out var invitationCode) == false)
|
|
if (int.TryParse(dto.InvitationCode, out var invitationCode) == false)
|
|
{
|
|
{
|
|
- throw UserFriendlyException.SameMessage("邀请码格式错误");
|
|
|
|
|
|
+ throw new UserFriendlyException(200, "邀请码格式错误");
|
|
}
|
|
}
|
|
var third = await _thirdAccountRepository.GetByOpenIdAsync(_sessionContext.OpenId)
|
|
var third = await _thirdAccountRepository.GetByOpenIdAsync(_sessionContext.OpenId)
|
|
?? throw UserFriendlyException.SameMessage("用户不存在");
|
|
?? throw UserFriendlyException.SameMessage("用户不存在");
|
|
if (third.InvitationCode.NotNullOrEmpty())
|
|
if (third.InvitationCode.NotNullOrEmpty())
|
|
{
|
|
{
|
|
- throw UserFriendlyException.SameMessage("邀请码已存在");
|
|
|
|
|
|
+ throw new UserFriendlyException(200, "邀请码已存在");
|
|
}
|
|
}
|
|
if (_inviteCodeRecordRepository.Queryable().Where(m => m.InviteCode == dto.InvitationCode).Any())
|
|
if (_inviteCodeRecordRepository.Queryable().Where(m => m.InviteCode == dto.InvitationCode).Any())
|
|
{
|
|
{
|
|
- throw UserFriendlyException.SameMessage("邀请码已经被使用");
|
|
|
|
|
|
+ throw new UserFriendlyException(200, "邀请码已经被使用");
|
|
}
|
|
}
|
|
third.InvitationCode = dto.InvitationCode;
|
|
third.InvitationCode = dto.InvitationCode;
|
|
var invite = await _inviteCodeRepository.Queryable()
|
|
var invite = await _inviteCodeRepository.Queryable()
|
|
.Where(m => invitationCode >= m.BeginCode && invitationCode <= m.EndCode)
|
|
.Where(m => invitationCode >= m.BeginCode && invitationCode <= m.EndCode)
|
|
- .FirstAsync() ?? throw UserFriendlyException.SameMessage("邀请码无效");
|
|
|
|
|
|
+ .FirstAsync() ?? throw new UserFriendlyException(200, "邀请码无效");
|
|
var entity = new InviteCodeRecord
|
|
var entity = new InviteCodeRecord
|
|
{
|
|
{
|
|
OrgId = invite.Id,
|
|
OrgId = invite.Id,
|