Skip to content

Ledger API ​

由 scripts/generate-api-docs.ts 自动生成 —— 请勿手改 共 5 个端点

GET /ledger/{accountType}/{accountId} ​

读余额(O(1))

请求参数 ​

参数名位置类型必填说明
accountTypepathstring✅
accountIdpathstring✅

响应 ​

状态码说明
200

POST /ledger/{accountType}/{accountId}/credit ​

入账

请求参数 ​

参数名位置类型必填说明
accountTypepathstring✅
accountIdpathstring✅

请求体 ​

json
{
  "$ref": "#/components/schemas/LedgerMoveDto"
}

响应 ​

状态码说明
201

POST /ledger/{accountType}/{accountId}/debit ​

出账(原子扣减;余额不足 409)

请求参数 ​

参数名位置类型必填说明
accountTypepathstring✅
accountIdpathstring✅

请求体 ​

json
{
  "$ref": "#/components/schemas/LedgerMoveDto"
}

响应 ​

状态码说明
201

GET /ledger/{accountType}/{accountId}/history ​

变动流水(只追加)

请求参数 ​

参数名位置类型必填说明
accountTypepathstring✅
accountIdpathstring✅

响应 ​

状态码说明
200

POST /ledger/{accountType}/{accountId}/open ​

开户(幂等;余额从 0 开始)

请求参数 ​

参数名位置类型必填说明
accountTypepathstring✅
accountIdpathstring✅

响应 ​

状态码说明
201

Released under the MIT License.