- 纯 POCO DTO 字段去下划线:AuthDto(id/name/applicationId/profileId/scene 等)、 SimApiLoginItem(id/types/meta/extra)、AesBodyRequest(data)、 SimApiBaseResponse 系列(code/message/data/list/page/count/total) - SimApiBaseResponse 去 open(不再允许继承)+ 删 @SerializerParent(无子类继承) - SimApiResponse<T> / SimApiDataResponse 改为组合(自带 code/message/data) - 删除 toJsonString(无使用点,统一走 simapi_serialization) - 删除 SimApiJson.cj:json() → SimApiUtil.json() 直接序列化; escapeJson() 迁入 SimApiUtil - 同步更新所有字段引用(AuthCenter/AuthIam/HttpClient/ExceptionMiddleware 等) - 保留 sqlsharp 实体 User/Bot 的 _ 前缀(soulsoft 宏依赖)
40 lines
1.1 KiB
Plaintext
40 lines
1.1 KiB
Plaintext
/*
|
||
* Copyright (c) 2025 SimcuTeam. All rights reserved.
|
||
* 移植自 C# 项目 SimApi(E:\simcu\simapi-net),遵循 MIT 许可证。
|
||
*/
|
||
|
||
package simapi.communications
|
||
|
||
/**
|
||
* 带任意对象数据的响应(非泛型版,供响应自动封装使用)。
|
||
*
|
||
* 与 SimApiResponse<T> 的区别:data 为 Any(运行时类型不定),用于
|
||
* SimApiRequestDelegateFactory 派发结果时统一包装 DTO/数组/动态结构。
|
||
*
|
||
* 序列化/反序列化由 simapi_serialization 反射处理:
|
||
* - code/message/data 为普通字段,反射递归
|
||
* - data 为动态结构(HashMap<String, Any>)同样反射支持
|
||
*/
|
||
public class SimApiDataResponse {
|
||
public var code: Int64 = 200
|
||
public var message: String = "成功"
|
||
public var data: ?Any = None
|
||
|
||
public init() {}
|
||
|
||
public init(data: Any) {
|
||
this.data = Some(data)
|
||
}
|
||
|
||
public init(code: Int64, message: String) {
|
||
this.code = code
|
||
this.message = message
|
||
}
|
||
|
||
public init(code: Int64, message: String, data: Any) {
|
||
this.code = code
|
||
this.message = message
|
||
this.data = Some(data)
|
||
}
|
||
}
|