重构: 源码文件蛇形命名, 接口去I头(BindRequestContext/SimApiAuthChecker), 清理C#相关说明, serialization依赖路径改 serialization-cj

This commit is contained in:
2026-08-25 13:43:26 +08:00
parent 829f009229
commit 30e5f165f2
56 changed files with 319 additions and 332 deletions
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2025 SimcuTeam. All rights reserved.
* 移植自 C# 项目 SimApiE:\simcu\simapi-net),遵循 MIT 许可证。
* 遵循 MIT 许可证。
* Controllers/SimApiAuthController:认证相关内置路由。
*/
@@ -12,7 +12,6 @@ import simcu::simapi.helpers.*
/**
* 认证控制器:退出登录。
* 对齐 C# 的 SimApiAuthController。
*/
public class SimApiAuthController <: SimApiBaseController {
private let _auth: SimApiAuth
@@ -23,8 +22,8 @@ public class SimApiAuthController <: SimApiBaseController {
/**
* POST /auth/logout:退出登录(void 自动封装为 SimApiBaseResponse())。
* 对齐 C# LogoutRoute 默认值 /auth/logoutSimApiAuthController.Logout[HttpPost]
* 由 MapControllerRoute(pattern=LogoutRoute) 注册
* 对应路由 [HttpPost]
* 由 MapControllerRoute(pattern=LogoutRoute) 注册。
*/
@HttpPost["/auth/logout"]
public func logout(): Unit {
@@ -1,8 +1,8 @@
/*
* Copyright (c) 2025 SimcuTeam. All rights reserved.
* 移植自 C# 项目 SimApiE:\simcu\simapi-net),遵循 MIT 许可证。
* 遵循 MIT 许可证。
* Controllers/SimApiBaseController:基础控制器,所有控制器继承。
* 提供当前登录信息访问(对齐 C# 的 LoginInfo / LoginToken
* 提供当前登录信息访问。
*/
package simcu::simapi.controllers
@@ -15,9 +15,8 @@ import simcu::simapi.interfaces.*
/**
* 基础控制器:所有控制器均继承本控制器。
* 对齐 C# 的 SimApiBaseController[Consumes]/[Produces] JSON + 登录信息)。
*/
public open class SimApiBaseController <: Controller & IBindRequestContext {
public open class SimApiBaseController <: Controller & BindRequestContext {
/**
* 当前登录信息(需 EnableSimApiAuth;未登录抛 401)。
*/
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2025 SimcuTeam. All rights reserved.
* 移植自 C# 项目 SimApiE:\simcu\simapi-net),遵循 MIT 许可证。
* 遵循 MIT 许可证。
* Controllers/SimApiCommonController:通用内置路由。
*/
@@ -14,8 +14,7 @@ import simcu::simapi.helpers.*
/**
* 通用控制器:错误反馈、WebConfig、用户信息。
* 对齐 C# 的 SimApiCommonController
* 控制器直接返回 SimApiBaseResponse / SimApiResponse<T>(对齐 C# SimApiBaseResponse<T>)。
* 控制器直接返回 SimApiBaseResponse / SimApiResponse<T>
*/
public class SimApiCommonController <: SimApiBaseController {
private let _options: SimApiOptions
@@ -26,7 +25,7 @@ public class SimApiCommonController <: SimApiBaseController {
/**
* GET /exception/{code}:错误反馈页面(始终注册)。
* 对齐 C# ExceptionHandler抛 SimApiException,由异常中间件统一输出。
* 抛 SimApiException,由异常中间件统一输出。
*/
@HttpGet["exception/{code}"]
public func exceptionHandler(@FromRoute code: Int64): Unit {
@@ -35,8 +34,8 @@ public class SimApiCommonController <: SimApiBaseController {
/**
* POST/GET /config:给前端的自定义信息(含版本)。
* 对齐 C# WebConfigRoute 默认值 /configSimApiCommonController.WebConfig[HttpPost, HttpGet] 无路径,
* 由 MapControllerRoute(pattern=WebConfigRoute) 注册;soulsoft 约定路由不支持 defaults,故用特性路由直接对齐路径
* 对应路由 [HttpPost, HttpGet] 无路径,
* 由 MapControllerRoute(pattern=WebConfigRoute) 注册;soulsoft 约定路由不支持 defaults,故用特性路由直接对齐路径。
*/
@HttpGet["/config"]
public func webConfig(): HashMap<String, Any> {