refactor(h5): 对齐后端 Result 契约 (ResultEnum SUCCESS=0/ERROR=1, Result.data)

- ResultEnum.SUCCESS 200→0、ERROR 300→1, 与后端 CommonCode 一致

- Result 接口字段 result→data, 与后端 Result 结构及现有 axios 解构对齐
This commit is contained in:
bootx
2026-06-29 09:08:00 +08:00
parent fa33a1280e
commit 53e4b8d497
2 changed files with 5 additions and 3 deletions

View File

@@ -2,8 +2,9 @@
* @description: 请求结果集
*/
export enum ResultEnum {
SUCCESS = 200,
ERROR = 300,
// 与后端 CommonCode 对齐:成功 0、失败 1
SUCCESS = 0,
ERROR = 1,
TIMEOUT = 10042,
TYPE = 'success',
}

View File

@@ -57,9 +57,10 @@ export interface RequestOptions {
withToken?: boolean
}
// 与后端 cn.daxpay.open.platform.core.rest.result.Result 对齐
export interface Result<T = any> {
code: number
type?: 'success' | 'error' | 'warning'
message: string
result?: T
data?: T
}