fix api ui, add versions

This commit is contained in:
2025-11-01 15:40:55 +08:00
parent af6bc86a0c
commit c73aa1d2a8
12 changed files with 411 additions and 71 deletions
+18 -3
View File
@@ -1,9 +1,11 @@
using Microsoft.AspNetCore.Mvc;
using System.Collections.Generic;
using Microsoft.AspNetCore.Mvc;
using SimApi.Attributes;
using SimApi.Communications;
using SimApi.Helpers;
namespace SimApi.Controllers;
public class SimApiCommonController(SimApiAuth auth) : SimApiBaseController
{
/// <summary>
@@ -25,7 +27,7 @@ public class SimApiCommonController(SimApiAuth auth) : SimApiBaseController
[HttpPost, SimApiDoc("认证", "检测登陆")]
public SimApiBaseResponse<string> CheckLogin()
{
ErrorWhenNull(LoginInfo, 401,"未登录");
ErrorWhenNull(LoginInfo, 401, "未登录");
return new SimApiBaseResponse<string>
{
Data = LoginInfo.Id
@@ -50,7 +52,20 @@ public class SimApiCommonController(SimApiAuth auth) : SimApiBaseController
return new SimApiBaseResponse();
}
[HttpPost,SimApiAuth]
[HttpPost, HttpGet]
public SimApiBaseResponse<Dictionary<string, string>> Versions()
{
return new SimApiBaseResponse<Dictionary<string, string>>()
{
Data = new Dictionary<string, string>
{
{ "SimApi", SimApiUtil.SimApiVersion },
{ "App", SimApiUtil.AppVersion }
}
};
}
[HttpPost, SimApiAuth]
public SimApiBaseResponse<SimApiLoginItem> UserInfo()
{
return new SimApiBaseResponse<SimApiLoginItem>(LoginInfo);