refactor: 全框架 JSON 操作迁移到 simapi_serialization

- 依赖:新增 simapi_serialization path 依赖(保留 soulsoft_serialization 供 soulsoft web 栈传递使用)
- SimApiJson.json / SimApiUtil.json → JsonSerializer.Serialize
- SimApiUtil.fromJson / base64DecodeTo → JsonSerializer.Deserialize(去 ISerialization 约束)
- SimApiHttpClient signQuery/aesQuery/aesSignQuery/query → 去约束,反序列化换新库
- SimApiBaseResponse/SimApiDataResponse/SimApiLoginItem/AesBodyRequest/AuthSDK DTO → 去 @Serialization 宏/去 soulsoft 接口,改纯 POCO(simapi_serialization 反射)
- SimApiBaseResponse 标 @SerializerParent:子类响应序列化包含 _code/_message
- SimApiResultWriter / SimApiExceptionMiddleware → 响应输出走 simapi_serialization(统一 _code/_message 格式)
- SimApiRequestLogMiddleware 截断 → Deserialize<HashMap<String,Any>> + 重序列化
- SimApiAuthDto JsonValue 字段 → HashMap<String,Any>;SimApiCache.get<T> 去约束
- webdemo:AuthController readFromJson 换 Deserialize;cjpm.toml 补依赖
- 验证:webdemo 启动正常,GET/POST 接口响应格式统一,S3 存储全链路 OK
This commit is contained in:
2026-08-18 00:07:00 +08:00
parent 8b0a8f783c
commit 73f60f6f15
17 changed files with 108 additions and 380 deletions
+5 -13
View File
@@ -6,19 +6,17 @@
* 说明:C# 中这些 DTO 是 SimApiAuthCenterDto / SimApiAuthIamDto 的嵌套类;
* 仓颉不支持在类体内声明嵌套类(unexpected class declaration in class body),
* 故拍平为顶层类,语义与字段保持一致。
*
* 序列化/反序列化由 simapi_serialization 反射处理(免标注、免约束)。
*/
package simapi.authsdk
import std.collection.*
import stdx.encoding.json.*
import soulsoft_serialization.*
import soulsoft_serialization.macros.*
/**
* 应用/Profile 通用项(对齐 C# AppAndProfileItem)。
*/
@Serialization
public class AppAndProfileItem {
public var _id: String = ""
public var _name: String = ""
@@ -30,14 +28,13 @@ public class AppAndProfileItem {
/**
* 安全确认响应(对齐 C# ConfirmResponse)。
* _data 用 ?JsonValue 对齐 C# Dictionary<string,object>?(任意 JSON 对象)。
* _data 用 ?HashMap<String, Any> 对齐 C# Dictionary<string,object>?(任意 JSON 对象)。
*/
@Serialization
public class ConfirmResponse {
public var _applicationId: String = ""
public var _profileId: String = ""
public var _scene: ?String = None
public var _data: ?JsonValue = None
public var _data: ?HashMap<String, Any> = None
public init() {}
}
@@ -45,10 +42,9 @@ public class ConfirmResponse {
/**
* 登录信息响应(对齐 C# LoginInfoResponse)。
*/
@Serialization
public class LoginInfoResponse {
public var _scene: ?String = None
public var _data: ?JsonValue = None
public var _data: ?HashMap<String, Any> = None
public var _profileId: String = ""
public var _name: String = ""
public var _image: ?String = None
@@ -60,7 +56,6 @@ public class LoginInfoResponse {
/**
* 获取授权码响应(对齐 C# GetCodeResponse)。
*/
@Serialization
public class GetCodeResponse {
public var _code: String = ""
public var _server: String = ""
@@ -78,7 +73,6 @@ public class GetCodeResponse {
/**
* 群组关联项(对齐 C# GroupRelatedItem)。
*/
@Serialization
public class GroupRelatedItem {
public var _id: String = ""
public var _name: String = ""
@@ -94,7 +88,6 @@ public class GroupRelatedItem {
/**
* 群组详情树节点(对齐 C# GroupDetailTreeNodechildren 递归)。
*/
@Serialization
public class GroupDetailTreeNode {
public var _id: String = ""
public var _name: String = ""
@@ -109,7 +102,6 @@ public class GroupDetailTreeNode {
/**
* 权限项(对齐 C# PermissionItem)。
*/
@Serialization
public class PermissionItem {
public var _identifier: String = ""
public var _name: String = ""