新增配置项

This commit is contained in:
Bob.Song
2026-02-08 17:09:34 +08:00
parent 9dd1e6c278
commit 3b0ca1158a
5 changed files with 61 additions and 7 deletions

View File

@@ -10,7 +10,7 @@ namespace ACBuildService.Controllers;
[SignValidation]
public class ApiController : NBControllerBase
{
#region
#region
[HttpPost("list")]
public async Task<IActionResult> List([FromForm] PageFormArgs data)
@@ -104,6 +104,10 @@ public class ApiController : NBControllerBase
return Success();
}
#endregion
#region
[HttpPost("info")]
public async Task<IActionResult> Info()
{
@@ -113,11 +117,6 @@ public class ApiController : NBControllerBase
return Success(list);
}
#endregion
#region
[HttpPost("device")]
public async Task<IActionResult> Device([FromForm] DeviceFormArgs data)
{
@@ -158,4 +157,37 @@ public class ApiController : NBControllerBase
}
#endregion
#region
[HttpPost("cfg/list")]
public async Task<IActionResult> CfgList([FromForm] PageFormArgs data)
{
await Task.CompletedTask;
var list = DB.Main.Queryable<ConfigTable>().ToList();
return Success(list);
}
[HttpPost("cfg/add")]
public async Task<IActionResult> CfgAdd([FromForm] ConfigTable data)
{
await DB.Main.Insertable(data).ExecuteCommandAsync();
return Success();
}
[HttpPost("cfg/edit")]
public async Task<IActionResult> CfgEdit([FromForm] ConfigTable data)
{
await DB.Main.Updateable(data).ExecuteCommandAsync();
return Success();
}
[HttpPost("cfg/remove")]
public async Task<IActionResult> CfgRemove([FromForm] KeyFormArgs data)
{
await DB.Main.Deleteable<ConfigTable>().Where(it => it.Key == data.Key).ExecuteCommandAsync();
return Success();
}
#endregion
}

View File

@@ -5,6 +5,11 @@ public class BaseFormArgs
public string Sign { get; set; } = string.Empty;
}
public class KeyFormArgs : BaseFormArgs
{
public string Key { get; set; }
}
public class PageFormArgs : BaseFormArgs
{
public int Page { get; set; }