feat: 更新预算服务和控制器,优化统计信息获取逻辑,增强参数验证
All checks were successful
Docker Build & Deploy / Build Docker Image (push) Successful in 25s
Docker Build & Deploy / Deploy to Production (push) Successful in 7s
Docker Build & Deploy / Cleanup Dangling Images (push) Successful in 2s
Docker Build & Deploy / WeChat Notification (push) Successful in 2s

This commit is contained in:
孙诚
2026-01-09 16:59:08 +08:00
parent b5d0524868
commit 76fd0d23dc
3 changed files with 97 additions and 20 deletions

View File

@@ -35,10 +35,16 @@ public class BudgetController(
/// 获取单个预算统计信息
/// </summary>
[HttpGet]
public async Task<BaseResponse<BudgetResult>> GetStatisticsAsync([FromQuery] long id, [FromQuery] DateTime? referenceDate = null)
public async Task<BaseResponse<BudgetResult>> GetStatisticsAsync([FromQuery] long id, [FromQuery] DateTime referenceDate)
{
try
{
// 参数验证
if (id == 0)
{
return "预算 Id 无效".Fail<BudgetResult>();
}
var result = await budgetService.GetStatisticsAsync(id, referenceDate);
if (result == null)
@@ -204,11 +210,11 @@ public class BudgetController(
{
var msg = await budgetService.ArchiveBudgetsAsync(year, month);
if(!string.IsNullOrEmpty(msg))
if (!string.IsNullOrEmpty(msg))
{
return msg.Fail();
}
return BaseResponse.Done();
}
catch (Exception ex)