修改GrowthPoint不为int?的类型
This commit is contained in:
@ -44,7 +44,7 @@ namespace QYZH.InteractiveMagazine.Models.Dto.Journal
|
||||
/// <summary>
|
||||
/// 成长值
|
||||
/// </summary>
|
||||
public float GrowthPoint { get; set; }
|
||||
public int GrowthPoint { get; set; }
|
||||
/// <summary>
|
||||
/// 理解力评分
|
||||
/// </summary>
|
||||
|
||||
@ -1,8 +1,5 @@
|
||||
using QYZH.InteractiveMagazine.Models.Enum;
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace QYZH.InteractiveMagazine.Models.Entity
|
||||
{
|
||||
@ -10,14 +7,8 @@ namespace QYZH.InteractiveMagazine.Models.Entity
|
||||
///杂志任务;
|
||||
///</summary>
|
||||
[SugarTable("JournalPageTask")]
|
||||
public partial class JournalPageTask : SqlSugarBaseEntity
|
||||
public class JournalPageTask : SqlSugarBaseEntity
|
||||
{
|
||||
public JournalPageTask()
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Desc:书id
|
||||
/// Default:
|
||||
@ -64,7 +55,7 @@ namespace QYZH.InteractiveMagazine.Models.Entity
|
||||
/// Default:0
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public int? GrowthPoint { get; set; }
|
||||
public int GrowthPoint { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Desc:积分设置
|
||||
|
||||
@ -61,7 +61,7 @@ public class JournalPageTaskService(BaseRepository<Journal> journalRepository, O
|
||||
task.Type = input.Type;
|
||||
task.Task = input.Task;
|
||||
task.Points = input.Points;
|
||||
task.GrowthPoint = (int?)input.GrowthPoint;
|
||||
task.GrowthPoint = input.GrowthPoint;
|
||||
task.Comprehension = input.Comprehension;
|
||||
task.Judgment = input.Judgment;
|
||||
task.Expression = input.Expression;
|
||||
@ -99,7 +99,7 @@ public class JournalPageTaskService(BaseRepository<Journal> journalRepository, O
|
||||
No = task.No,
|
||||
Type = task.Type,
|
||||
Points = task.Points,
|
||||
GrowthPoint = task.GrowthPoint ?? 0,
|
||||
GrowthPoint = task.GrowthPoint,
|
||||
Comprehension = task.Comprehension,
|
||||
Judgment = task.Judgment,
|
||||
Expression = task.Expression,
|
||||
|
||||
@ -191,7 +191,7 @@ public class UserAnswerTaskService(
|
||||
.ToList();
|
||||
|
||||
// 累计成长值(从主任务的 GrowthPoint 累加)
|
||||
var totalGrowthPoints = mainTasks.Sum(t => t.GrowthPoint ?? 0);
|
||||
var totalGrowthPoints = mainTasks.Sum(t => t.GrowthPoint);
|
||||
|
||||
// 累计积分(从已完成任务的 Points 累加,每个 GroupId 只计算一次)
|
||||
var totalPoints = mainTasks.Sum(t => t.Points);
|
||||
@ -435,7 +435,7 @@ public class UserAnswerTaskService(
|
||||
.GroupBy(t => t.GroupId)
|
||||
.Select(g => g.First())
|
||||
.ToList();
|
||||
var totalGrowthPoints = distinctSecondLevelTasks.Sum(t => t.GrowthPoint) ?? 0;
|
||||
var totalGrowthPoints = distinctSecondLevelTasks.Sum(t => t.GrowthPoint);
|
||||
var totalPoints = distinctSecondLevelTasks.Sum(t => t.Points);
|
||||
|
||||
children.Add(new SecondCatalogOutput
|
||||
@ -835,7 +835,7 @@ public class UserAnswerTaskService(
|
||||
{
|
||||
GroupId = groupId,
|
||||
TaskName = mainTask.Task ?? string.Empty,
|
||||
TotalGrowthPoints = mainTask.GrowthPoint ?? 0,
|
||||
TotalGrowthPoints = mainTask.GrowthPoint,
|
||||
TotalPoints = mainTask.Points,
|
||||
AnswerMinutes = groupAnswerMinutes,
|
||||
Status = taskStatus
|
||||
@ -1266,7 +1266,7 @@ public class UserAnswerTaskService(
|
||||
// 重复领取校验
|
||||
var existingRecord = await answerRepository.Context.Queryable<PointsRecord>()
|
||||
.Where(r => r.UserId == userId)
|
||||
.Where(r => r.ChangeType == PointsChangeTypeEnum.TaskReward.ToString() && r.RelatedId == groupId)
|
||||
.Where(r => r.ChangeType == nameof(PointsChangeTypeEnum.TaskReward) && r.RelatedId == groupId)
|
||||
.FirstAsync();
|
||||
|
||||
if (existingRecord != null)
|
||||
@ -1276,7 +1276,7 @@ public class UserAnswerTaskService(
|
||||
|
||||
// 积分、成长值、得分(均取主任务数据)
|
||||
int totalPoints = mainTask.Points;
|
||||
int totalGrowthPoints = mainTask.GrowthPoint ?? 0;
|
||||
int totalGrowthPoints = mainTask.GrowthPoint;
|
||||
float score = mainTaskAnswer.Score;
|
||||
|
||||
if (totalPoints <= 0)
|
||||
@ -1310,8 +1310,11 @@ public class UserAnswerTaskService(
|
||||
{
|
||||
// 4a. 手动更新 Users.Points(积分累加)
|
||||
var newPointsBalance = user.Points + totalPoints;
|
||||
// 4b. 手动更新 Users.GrowthPoints(成长值累加)
|
||||
var newGrowthPointsBalance = user.GrowthPoints + totalGrowthPoints;
|
||||
await answerRepository.Context.Updateable<Users>()
|
||||
.SetColumns(u => u.Points == newPointsBalance)
|
||||
.SetColumns(u => u.GrowthPoints == newGrowthPointsBalance)
|
||||
.SetColumns(u => u.UpdatedAt == DateTime.Now)
|
||||
.Where(u => u.Id == userId)
|
||||
.ExecuteCommandAsync();
|
||||
@ -1324,7 +1327,7 @@ public class UserAnswerTaskService(
|
||||
BalanceAfter = newPointsBalance,
|
||||
ChangeType = PointsChangeTypeEnum.TaskReward.ToString(),
|
||||
RelatedId = groupId,
|
||||
Description = $"完成任务奖励:{mainTask.Task}",
|
||||
Description = $"完成任务奖励,GroupId:{mainTask.GroupId}",
|
||||
Type = PointsFlowTypeEnum.Income,
|
||||
Status = (int)PointsRecordStatusEnum.Success,
|
||||
IsDeleted = false,
|
||||
@ -1518,7 +1521,7 @@ public class UserAnswerTaskService(
|
||||
|
||||
#region 3.6 计算积分、成长值、得分
|
||||
int points = mainTask.Points;
|
||||
int growthPoints = mainTask.GrowthPoint ?? 0;
|
||||
int growthPoints = mainTask.GrowthPoint;
|
||||
float score = mainTaskAnswer.Score;
|
||||
|
||||
if (points <= 0)
|
||||
@ -1603,8 +1606,12 @@ public class UserAnswerTaskService(
|
||||
|
||||
// 4a. 手动更新 Users.Points(积分累加)
|
||||
var newPointsBalance = user.Points + totalPointsAmount;
|
||||
// 4b. 手动更新 Users.GrowthPoints(成长值累加)
|
||||
var newGrowthPointsBalance = user.GrowthPoints + totalGrowthPoints;
|
||||
|
||||
await answerRepository.Context.Updateable<Users>()
|
||||
.SetColumns(u => u.Points == newPointsBalance)
|
||||
.SetColumns(u => u.GrowthPoints == newGrowthPointsBalance)
|
||||
.SetColumns(u => u.UpdatedAt == DateTime.Now)
|
||||
.Where(u => u.Id == userId)
|
||||
.ExecuteCommandAsync();
|
||||
@ -1620,7 +1627,7 @@ public class UserAnswerTaskService(
|
||||
BalanceAfter = newPointsBalance,
|
||||
ChangeType = PointsChangeTypeEnum.TaskReward.ToString(),
|
||||
RelatedId = task.GroupId,
|
||||
Description = $"完成任务奖励:{task.TaskName}",
|
||||
Description = $"完成任务奖励,GroupId:{task.GroupId}",
|
||||
Type = PointsFlowTypeEnum.Income,
|
||||
Status = (int)PointsRecordStatusEnum.Success,
|
||||
IsDeleted = false,
|
||||
|
||||
@ -275,7 +275,7 @@ public class JournalTaskReceiveConsumer(
|
||||
prompt.AppendLine(task.Prompt);
|
||||
prompt.AppendLine();
|
||||
prompt.AppendLine("题目配置:");
|
||||
prompt.AppendLine($"- 成长值上限:{task.GrowthPoint ?? 0}");
|
||||
prompt.AppendLine($"- 成长值上限:{task.GrowthPoint}");
|
||||
prompt.AppendLine($"- 积分上限:{task.Points}");
|
||||
prompt.AppendLine($"- 理解力上限:{task.Comprehension}");
|
||||
prompt.AppendLine($"- 判断力上限:{task.Judgment}");
|
||||
|
||||
Reference in New Issue
Block a user