修改GrowthPoint不为int?的类型
This commit is contained in:
@ -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,
|
||||
|
||||
Reference in New Issue
Block a user