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:
2025-12-18 16:24:37 +08:00
parent 435e541dbe
commit 3249e405ac
13 changed files with 990 additions and 33 deletions

View File

@@ -224,14 +224,14 @@ func (s *ContentTestSuite) Test_HasAccess() {
Convey("权益 active 应返回 true", func() {
access := &models.ContentAccess{
TenantID: tenantID,
UserID: userID,
ContentID: content.ID,
OrderID: 0,
Status: consts.ContentAccessStatusActive,
RevokedAt: time.Time{},
CreatedAt: now,
UpdatedAt: now,
TenantID: tenantID,
UserID: userID,
ContentID: content.ID,
OrderID: 0,
Status: consts.ContentAccessStatusActive,
RevokedAt: time.Time{},
CreatedAt: now,
UpdatedAt: now,
}
So(access.Create(ctx), ShouldBeNil)
@@ -241,4 +241,3 @@ func (s *ContentTestSuite) Test_HasAccess() {
})
})
}