feat: 移除预算相关的停止状态属性和相关功能,简化预算管理逻辑
All checks were successful
Docker Build & Deploy / Build Docker Image (push) Successful in 24s
Docker Build & Deploy / Deploy to Production (push) Successful in 11s
Docker Build & Deploy / Cleanup Dangling Images (push) Successful in 1s
Docker Build & Deploy / WeChat Notification (push) Successful in 1s

This commit is contained in:
2026-01-10 17:38:22 +08:00
parent 037bad2d9b
commit b757f18765
8 changed files with 5 additions and 78 deletions

View File

@@ -16,7 +16,6 @@ public class BudgetController(
try
{
return (await budgetService.GetListAsync(referenceDate))
.OrderBy(b => b.IsStopped)
.OrderBy(b => b.Category)
.ThenBy(b => b.Type)
.ThenByDescending(b => b.Limit > 0 ? b.Current / b.Limit : 0)
@@ -151,7 +150,6 @@ public class BudgetController(
budget.Limit = dto.Limit;
budget.Category = dto.Category;
budget.SelectedCategories = dto.SelectedCategories != null ? string.Join(",", dto.SelectedCategories) : string.Empty;
budget.IsStopped = dto.IsStopped;
if (dto.StartDate.HasValue)
{
budget.StartDate = dto.StartDate.Value;
@@ -173,33 +171,6 @@ public class BudgetController(
}
}
/// <summary>
/// 切换预算暂停状态
/// </summary>
[HttpPost]
public async Task<BaseResponse> ToggleStopAsync([FromQuery] long id)
{
try
{
var budget = await budgetRepository.GetByIdAsync(id);
if (budget == null)
{
return "预算不存在".Fail();
}
budget.IsStopped = !budget.IsStopped;
var success = await budgetRepository.UpdateAsync(budget);
return success ? BaseResponse.Done() : "操作失败".Fail();
}
catch (Exception ex)
{
logger.LogError(ex, "切换预算状态失败, Id: {Id}", id);
return $"操作失败: {ex.Message}".Fail();
}
}
/// <summary>
/// 归档预算
/// </summary>

View File

@@ -13,6 +13,5 @@ public class CreateBudgetDto
public class UpdateBudgetDto : CreateBudgetDto
{
public long Id { get; set; }
public bool IsStopped { get; set; }
}