From 80a043837ec4b08b1008b87496c4f9d2bbf6315e Mon Sep 17 00:00:00 2001 From: xiaochanghai Date: Wed, 11 Jun 2025 17:30:47 +0800 Subject: [PATCH] =?UTF-8?q?=E8=87=AA=E5=8A=A8=E5=8F=91=E6=94=BE=E7=A7=AF?= =?UTF-8?q?=E5=88=86=EF=BC=8C=E6=96=B0=E5=A2=9E=E5=9B=9E=E5=86=99=E8=87=B3?= =?UTF-8?q?=E5=AD=A6=E4=B9=A0=E8=AE=B0=E5=BD=95=E4=B8=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Ghre/Ghre_StudyRecordServices.cs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Tiobon.Core.Services/Ghre/Ghre_StudyRecordServices.cs b/Tiobon.Core.Services/Ghre/Ghre_StudyRecordServices.cs index 2dcae4c9..6fd83cff 100644 --- a/Tiobon.Core.Services/Ghre/Ghre_StudyRecordServices.cs +++ b/Tiobon.Core.Services/Ghre/Ghre_StudyRecordServices.cs @@ -2255,6 +2255,7 @@ ORDER BY {filter.orderBy}"; { var now = DateTime.Now; //抓取当天提交考试的数据 + var records = await Db.Queryable() .Where(x => x.StudyProgress == 100 && (x.IsIssueCredit == null || x.IsIssueCredit == false)) .Take(100) @@ -2285,9 +2286,9 @@ ORDER BY {filter.orderBy}"; if (courseCreditPoints <= 0) continue; - record.CreditPoints = 0; if (creditRuleId != null) { + record.CreditPoints = 0; var creditRule = await Db.Queryable().Where(x => x.Id == creditRuleId).Select(x => new { x.RuleType, @@ -2314,8 +2315,9 @@ ORDER BY {filter.orderBy}"; { if (record.ExamId != null) { - if (await Db.Queryable().Where(x => x.StudyRecordId == record.Id && x.IsPass == true && x.Status == "ExamEnd").AnyAsync()) - creditPoint.CreditPoints = ((courseCreditPoints * creditRule.ExamPassPercent) / 100).ObjToInt(); + if (await Db.Queryable().Where(x => x.StudyRecordId == record.Id && x.IsPass == true && x.Status == "ExamEnd").AnyAsync()) { } + creditPoint.CreditPoints = ((courseCreditPoints * creditRule.ExamPassPercent) / 100).ObjToInt(); + record.IsIssueCredit = true; } } else if (creditRule.RuleType == "ScoreRanges")//分数段 @@ -2324,6 +2326,7 @@ ORDER BY {filter.orderBy}"; if (record.ExamId != null) { + record.IsIssueCredit = true; var examRecord = await Db.Queryable().Where(x => x.StudyRecordId == record.Id && x.ScoreStatus == "HasScore" && x.IsPass == true && x.Status == "ExamEnd").FirstAsync(); if (examRecord != null && examRecord.Score > 0) { @@ -2355,12 +2358,13 @@ ORDER BY {filter.orderBy}"; } } } - record.IsIssueCredit = true; } await Db.Insertable(creditPoints).ExecuteReturnSnowflakeIdListAsync(); + records = records.Where(x => x.IsIssueCredit == true).ToList(); await Db.Updateable(records) .UpdateColumns(it => new { it.IsIssueCredit, it.CreditPoints }, true) + .ExecuteCommandAsync(); return ServiceResult.OprateSuccess("发放成功!"); }