# cash_transaction — 现金流水账本(分) > 模型 `app/models/wallet.py` | 关联接口 [wallet-cash-transactions](../api/wallet-cash-transactions.md) | [← 表索引](./README.md) 现金每次变动一笔流水(单位:分)。金币兑现金、提现、提现退款都记这里。 ## 字段 | 列 | 类型 | 约束 / 默认 | 说明 | |---|---|---|---| | `id` | Integer | PK, autoincrement | | | `user_id` | Integer | FK→user.id, index, NOT NULL | 归属用户 | | `amount_cents` | Integer | NOT NULL | 正=入账(兑入),负=出账(提现) | | `balance_after_cents` | Integer | NOT NULL | 本笔变动后现金余额(分) | | `biz_type` | String(32) | NOT NULL | `exchange_in`(兑入)/ `withdraw`(提现出账)/ `withdraw_refund`(提现退回) | | `ref_id` | String(64) | nullable | 关联业务 id(如提现 `out_bill_no`) | | `remark` | String(128) | nullable | 用户可见备注(如"提现未成功,金额已退回") | | `created_at` | DateTime(tz) | server_default now(), index | 时间 | ## 索引与约束 - PK: `id`;index: `user_id`、`created_at` ## 关系 - `user_id` → `user.id`(多对一) ## 说明 - 提现失败/取消退款写 `withdraw_refund`(+X);退款流水 `remark` 是用户可见文案,技术原因记在 `withdraw_order.fail_reason`。