This commit is contained in:
zpc 2025-09-30 16:16:27 +08:00
parent 57e74be261
commit c87c47bda5

View File

@ -1233,7 +1233,11 @@ public class SQController : ControllerBase
.Select(a => a.user_id)
.Distinct()
.ToList();
var qiandaoUserIds = dto.attendeds
.Where(a => a != null && a.isAttended)
.Select(a => a.user_id)
.Distinct()
.ToList();
try
{
_dbBase.Ado.BeginTran();
@ -1265,27 +1269,85 @@ public class SQController : ControllerBase
},
it => it.reservation_id == dto.reservation_id && it.status == 0);
// 3) 对于传入的未出席名单,标记为未赴约(2)
// 3) 对于传入的未出席名单,标记为未赴约(2),同时将其踢出
if (falseUserIds.Count > 0)
{
await _SQReservationParticipantsServices.UpdateAsync(
it => new SQReservationParticipants
{
is_arrive = 2
is_arrive = 2,
status = 1
},
it => it.reservation_id == dto.reservation_id && it.status == 0 && falseUserIds.Contains(it.user_id));
//_sQReservationReputationServices.
//AddReputationAsync(falseUserIds, -5, $"未按时赴约扣除5点信誉分预约ID:{dto.reservation_id}");
//添加鸽子次数
foreach (var user_id in falseUserIds)
{
var user = await _userServices.QueryByIdAsync(user_id);
if (user != null)
{
//扣除信誉分
await _sQReservationReputationServices.InsertAsync(new SQReservationReputation()
{
created_at = DateTime.Now,
remark = $"{reservation.title}对局未签到",
reputation_value = (decimal)-0.5,
reservation_id = dto.reservation_id,
updated_at = DateTime.Now,
user_id = user_id
});
user.dove_count++;
if (user.credit_score > 0)
{
user.credit_score = (user.credit_score - (decimal)0.5);
}
if (user.credit_score <= 0)
{
user.credit_score = 0;
}
}
await _userServices.UpdateAsync(user);
}
}
//确保发起者始终为已赴约(1)
if (!qiandaoUserIds.Contains(userId))
{
qiandaoUserIds.Add(userId);
}
if (qiandaoUserIds.Count > 0)
{
foreach (var user_id in qiandaoUserIds)
{
var user = await _userServices.QueryByIdAsync(user_id);
if (user != null)
{
user.dove_count++;
if (user.credit_score < 5)
{
user.credit_score = (user.credit_score + (decimal)0.2);
if (user.credit_score > 5)
{
user.credit_score = 5;
}
//增加信记录
await _sQReservationReputationServices.InsertAsync(new SQReservationReputation()
{
created_at = DateTime.Now,
remark = $"{reservation.title} 完成组局",
reputation_value = (decimal)0.2,
reservation_id = dto.reservation_id,
updated_at = DateTime.Now,
user_id = user_id
});
await _userServices.UpdateAsync(user);
}
}
}
}
// 4) 确保发起者始终为已赴约(1)
await _SQReservationParticipantsServices.UpdateAsync(
it => new SQReservationParticipants