From c87c47bda5d9674c6ca172cd1ca44b027c203180 Mon Sep 17 00:00:00 2001 From: zpc Date: Tue, 30 Sep 2025 16:16:27 +0800 Subject: [PATCH] 321 --- .../Controllers/SQController.cs | 68 ++++++++++++++++++- 1 file changed, 65 insertions(+), 3 deletions(-) diff --git a/CoreCms.Net.Web.WebApi/Controllers/SQController.cs b/CoreCms.Net.Web.WebApi/Controllers/SQController.cs index a90d0f7..08b0510 100644 --- a/CoreCms.Net.Web.WebApi/Controllers/SQController.cs +++ b/CoreCms.Net.Web.WebApi/Controllers/SQController.cs @@ -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