Files
quyun-v2/backend/app/http/tenant/dto/ledger_me.go
Rogee 3249e405ac feat: add balance and ledger endpoints for tenant
- Implemented MyBalance and MyLedgerPage methods in the ledger service to retrieve current user balance and transaction history for a specified tenant.
- Added corresponding test cases for MyBalance and MyLedgerPage methods in the ledger test suite.
- Created DTOs for balance response and ledger items to structure the response data.
- Updated Swagger documentation to include new endpoints for retrieving tenant balance and ledgers.
- Added HTTP tests for the new endpoints to ensure proper functionality.
2025-12-18 16:24:37 +08:00

32 lines
1.1 KiB
Go
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package dto
import (
"time"
"quyun/v2/app/requests"
"quyun/v2/database/models"
"quyun/v2/pkg/consts"
)
// MyLedgerListFilter 定义“我的余额流水”查询条件。
type MyLedgerListFilter struct {
// Pagination 分页参数page/limit
requests.Pagination `json:",inline" query:",inline"`
// Type 按流水类型过滤(可选)。
Type *consts.TenantLedgerType `json:"type,omitempty" query:"type"`
// OrderID 按关联订单过滤(可选)。
OrderID *int64 `json:"order_id,omitempty" query:"order_id"`
// CreatedAtFrom 创建时间起(可选)。
CreatedAtFrom *time.Time `json:"created_at_from,omitempty" query:"created_at_from"`
// CreatedAtTo 创建时间止(可选)。
CreatedAtTo *time.Time `json:"created_at_to,omitempty" query:"created_at_to"`
}
// MyLedgerItem 返回一条余额流水,并补充展示字段。
type MyLedgerItem struct {
// Ledger 流水记录(租户内隔离)。
Ledger *models.TenantLedger `json:"ledger"`
// TypeDescription 流水类型中文说明(用于前端展示)。
TypeDescription string `json:"type_description"`
}