This commit is contained in:
2026-06-29 17:16:40 +08:00
37 changed files with 698 additions and 371 deletions

View File

@ -1,6 +1,7 @@
using Microsoft.Extensions.Logging;
using QYZH.InteractiveMagazine.IService;
using QYZH.InteractiveMagazine.Models.Common;
using QYZH.InteractiveMagazine.Models.Dto;
using QYZH.InteractiveMagazine.Models.Dto.Points;
using QYZH.InteractiveMagazine.Models.Dto.UserAnswerTaskService;
using QYZH.InteractiveMagazine.Models.Entity;
@ -1111,7 +1112,7 @@ public class UserAnswerTaskService(
if (relatedTasks == null || relatedTasks.Count == 0)
{
throw new BusinessException("任务不存在", 404);
throw new BusinessException("任务不存在", ResultCode.NOT_FOUND);
}
#endregion
@ -1148,7 +1149,7 @@ public class UserAnswerTaskService(
if (userAnswers == null || userAnswers.Count == 0)
{
throw new BusinessException("请先完成答题再领取积分", 400);
throw new BusinessException("请先完成答题再领取积分", ResultCode.BAD_REQUEST);
}
#endregion
@ -1166,7 +1167,7 @@ public class UserAnswerTaskService(
var completedAnswer = userAnswers.FirstOrDefault(a => a.JournalPageTaskId == task.Id && a.Status == (int)UserAnswerStatusEnum.Complete);
if (completedAnswer == null)
{
throw new BusinessException("跨页题目需要完成所有任务才能领取积分", 400);
throw new BusinessException("跨页题目需要完成所有任务才能领取积分", ResultCode.BAD_REQUEST);
}
}
}
@ -1175,7 +1176,7 @@ public class UserAnswerTaskService(
// 普通题目:只需要 Status=1 即可
if (userAnswers.FirstOrDefault()?.Status != (int)UserAnswerStatusEnum.Complete)
{
throw new BusinessException("请先完成答题再领取积分", 400);
throw new BusinessException("请先完成答题再领取积分", ResultCode.BAD_REQUEST);
}
}
#endregion
@ -1201,7 +1202,7 @@ public class UserAnswerTaskService(
if (totalPoints <= 0)
{
throw new BusinessException("该任务无积分可领取", 400);
throw new BusinessException("该任务无积分可领取", ResultCode.BAD_REQUEST);
}
#endregion
@ -1239,7 +1240,7 @@ public class UserAnswerTaskService(
if (existingRecord != null)
{
throw new BusinessException("积分已领取,请勿重复领取", 400);
throw new BusinessException("积分已领取,请勿重复领取", ResultCode.BAD_REQUEST);
}
#endregion
@ -1316,7 +1317,7 @@ public class UserAnswerTaskService(
if (input == null || input.GroupIds == null || input.GroupIds.Count == 0)
{
throw new BusinessException("任务分组Id列表不能为空", 400);
throw new BusinessException("任务分组Id列表不能为空", ResultCode.BAD_REQUEST);
}
var groupIds = input.GroupIds.Distinct().ToList();