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.
This commit is contained in:
19
backend/app/http/tenant/dto/me_balance.go
Normal file
19
backend/app/http/tenant/dto/me_balance.go
Normal file
@@ -0,0 +1,19 @@
|
||||
package dto
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"quyun/v2/pkg/consts"
|
||||
)
|
||||
|
||||
// MeBalanceResponse 返回当前用户在当前租户下的余额信息(租户内隔离)。
|
||||
type MeBalanceResponse struct {
|
||||
// Currency 币种:当前固定 CNY(金额单位为分)。
|
||||
Currency consts.Currency `json:"currency"`
|
||||
// Balance 可用余额:可用于购买/消费。
|
||||
Balance int64 `json:"balance"`
|
||||
// BalanceFrozen 冻结余额:用于下单冻结/争议期等。
|
||||
BalanceFrozen int64 `json:"balance_frozen"`
|
||||
// UpdatedAt 更新时间:余额变更时更新。
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
}
|
||||
Reference in New Issue
Block a user