feat: add TenantLedger model and query generation

- Introduced TenantLedger model with fields for managing tenant transactions, including ID, TenantID, UserID, OrderID, transaction Type, Amount, and balance details.
- Implemented CRUD operations for TenantLedger with methods for Create, Update, Delete, and Reload.
- Generated query methods for TenantLedger to facilitate database interactions, including filtering, pagination, and aggregation functions.
- Established relationships with Order model for foreign key references.
This commit is contained in:
2025-12-18 13:12:26 +08:00
parent f93caefcb2
commit 1da84f2af3
42 changed files with 6468 additions and 265 deletions

View File

@@ -33,6 +33,25 @@ GET {{ host }}/t/{{ tenantCode }}/v1/contents/{{ contentID }}/assets
Content-Type: application/json
Authorization: Bearer {{ token }}
### Tenant - Purchase content (tenant balance)
POST {{ host }}/t/{{ tenantCode }}/v1/contents/{{ contentID }}/purchase
Content-Type: application/json
Authorization: Bearer {{ token }}
{
"idempotency_key": "purchase-{{ contentID }}-001"
}
### Tenant - My orders list
GET {{ host }}/t/{{ tenantCode }}/v1/orders?page=1&limit=10
Content-Type: application/json
Authorization: Bearer {{ token }}
### Tenant - My order detail
GET {{ host }}/t/{{ tenantCode }}/v1/orders/{{ orderID }}
Content-Type: application/json
Authorization: Bearer {{ token }}
### Tenant Admin - Create content draft
POST {{ host }}/t/{{ tenantCode }}/v1/admin/contents
Content-Type: application/json
@@ -79,3 +98,24 @@ Authorization: Bearer {{ token }}
"sort": 0
}
### Tenant Admin - Orders list
GET {{ host }}/t/{{ tenantCode }}/v1/admin/orders?page=1&limit=10
Content-Type: application/json
Authorization: Bearer {{ token }}
### Tenant Admin - Order detail
@orderID = 1
GET {{ host }}/t/{{ tenantCode }}/v1/admin/orders/{{ orderID }}
Content-Type: application/json
Authorization: Bearer {{ token }}
### Tenant Admin - Refund order (default window paid_at + 24h)
POST {{ host }}/t/{{ tenantCode }}/v1/admin/orders/{{ orderID }}/refund
Content-Type: application/json
Authorization: Bearer {{ token }}
{
"force": false,
"reason": "联调退款",
"idempotency_key": "refund-{{ orderID }}-001"
}