简化了内置控制器返回写法

This commit is contained in:
2026-04-26 12:27:56 +08:00
parent b7775cbe6c
commit b6dbcd6cee
4 changed files with 16 additions and 43 deletions
+6 -10
View File
@@ -1,6 +1,5 @@
using System.Collections.Generic;
using Microsoft.AspNetCore.Mvc;
using SimApi.Communications;
using SimApi.Helpers;
namespace SimApi.Controllers;
@@ -14,22 +13,19 @@ public class SimApiCommonController : SimApiBaseController
/// <returns></returns>
[HttpGet("exception/{code:int}")]
[ApiExplorerSettings(IgnoreApi = true)]
public SimApiBaseResponse ExceptionHandler(int code)
public void ExceptionHandler(int code)
{
return new SimApiBaseResponse(code);
SimApiError.Error(code);
}
[HttpPost, HttpGet]
public SimApiBaseResponse<Dictionary<string, string>> Versions()
public Dictionary<string, string> Versions()
{
return new SimApiBaseResponse<Dictionary<string, string>>()
return new Dictionary<string, string>
{
Data = new Dictionary<string, string>
{
{ "SimApi", SimApiUtil.SimApiVersion },
{ "App", SimApiUtil.AppVersion }
}
{ "SimApi", SimApiUtil.SimApiVersion },
{ "App", SimApiUtil.AppVersion }
};
}
}