This commit is contained in:
王炜翔 2024-10-05 11:14:58 +08:00
parent 023c24ecd5
commit d5dd4d455e

View File

@ -10,18 +10,18 @@ namespace asg_form.Controllers.Budget
{
public class BgDB
{
public long id { get; set; }
public int id { get; set; }
public string budget_year { get; set; }
public long budget_money { get; set; }
public int budget_money { get; set; }
public string budget_type { get; set; }
public string budget_name { get; set; }
public string budget_used { get; set; }
public string source_event_name { get; set; }
public long source_event_id { get; set; }
public int source_event_id { get; set; }
public string used_event_name { get; set; }
public long used_event_id { get; set; }
public int used_event_id { get; set; }
public string? use_person { get; set; }
public long? use_person_id { get; set; }
public int? use_person_id { get; set; }
public string change_time { get; set; }
public string use_status { get; set; }
public string? update_person { get; set; }//设置默认
@ -46,10 +46,10 @@ namespace asg_form.Controllers.Budget
public string budgetType { get; set; }
public string budgetName { get; set; }
public string sourceEventName { get; set; }
public long sourceEventId { get; set; }
public int sourceEventId { get; set; }
public string budgetUsed { get; set; }
public string usedEventName { get; set; }
public long usedEventId { get; set; }
public int usedEventId { get; set; }
public string updatePerson { get; set; }
public string updateTime { get; set; }//自动生成时间
@ -95,7 +95,7 @@ namespace asg_form.Controllers.Budget
[Route("api/v1/admin/updateBg")]
[HttpPost]
[Authorize]
public async Task<ActionResult<object>> UpdBg(long id, [FromBody] bgMsg msg)
public async Task<ActionResult<object>> UpdBg(int id, [FromBody] bgMsg msg)
{
if (!this.User.FindAll(ClaimTypes.Role).Any(a => a.Value == "admin"))
{
@ -153,7 +153,7 @@ namespace asg_form.Controllers.Budget
}
catch (Exception ex)
{
return StatusCode(500, new { code = 500, message = "服务器错误", details = ex.Message });
return Ok(new { code = 500, message = "服务器错误", details = ex.Message });
}
}
@ -199,7 +199,7 @@ namespace asg_form.Controllers.Budget
[Route("api/v1/admin/countBudgetTotal")]
[HttpGet]
[Authorize]
public async Task<ActionResult<object>> cntBg(int sourceEventId)
public async Task<ActionResult<object>> cntBg()
{
if (!this.User.FindAll(ClaimTypes.Role).Any(a => a.Value == "admin"))
{
@ -211,7 +211,6 @@ namespace asg_form.Controllers.Budget
using (var db = new TestDbContext())
{
var budgetTotals = await db.budgetDetails
.Where(b => b.source_event_id == sourceEventId)
.GroupBy(b => new
{
b.source_event_id,