diff --git a/internal/routes/admin.go b/internal/routes/admin.go index 56204b7..2e88aa0 100644 --- a/internal/routes/admin.go +++ b/internal/routes/admin.go @@ -108,6 +108,6 @@ func RegisterAdminRoutes(router fiber.Router, handlers *bootstrap.Handlers, midd registerPollingManualTriggerRoutes(authGroup, handlers.PollingManualTrigger, doc, basePath) } if handlers.Asset != nil { - registerAssetRoutes(authGroup, handlers.Asset, doc, basePath) + registerAssetRoutes(authGroup, handlers.Asset, handlers.AssetWallet, doc, basePath) } } diff --git a/internal/routes/asset.go b/internal/routes/asset.go index 38f1cb5..e30979c 100644 --- a/internal/routes/asset.go +++ b/internal/routes/asset.go @@ -8,7 +8,7 @@ import ( "github.com/break/junhong_cmp_fiber/pkg/openapi" ) -func registerAssetRoutes(router fiber.Router, handler *admin.AssetHandler, doc *openapi.Generator, basePath string) { +func registerAssetRoutes(router fiber.Router, handler *admin.AssetHandler, walletHandler *admin.AssetWalletHandler, doc *openapi.Generator, basePath string) { assets := router.Group("/assets") groupPath := basePath + "/assets" @@ -91,4 +91,22 @@ func registerAssetRoutes(router fiber.Router, handler *admin.AssetHandler, doc * Output: nil, Auth: true, }) + + Register(assets, doc, groupPath, "GET", "/:asset_type/:id/wallet", walletHandler.GetWallet, RouteSpec{ + Summary: "资产钱包概况", + Description: "查询指定卡或设备的钱包余额概况。企业账号禁止调用。", + Tags: []string{"资产管理"}, + Input: new(dto.AssetTypeIDRequest), + Output: new(dto.AssetWalletResponse), + Auth: true, + }) + + Register(assets, doc, groupPath, "GET", "/:asset_type/:id/wallet/transactions", walletHandler.ListTransactions, RouteSpec{ + Summary: "资产钱包流水列表", + Description: "分页查询指定资产的钱包收支流水,含充值/扣款来源编号。企业账号禁止调用。", + Tags: []string{"资产管理"}, + Input: new(dto.AssetWalletTransactionListRequest), + Output: new(dto.AssetWalletTransactionListResponse), + Auth: true, + }) } diff --git a/pkg/openapi/handlers.go b/pkg/openapi/handlers.go index 78909c7..a141916 100644 --- a/pkg/openapi/handlers.go +++ b/pkg/openapi/handlers.go @@ -53,5 +53,6 @@ func BuildDocHandlers() *bootstrap.Handlers { PollingCleanup: admin.NewPollingCleanupHandler(nil), PollingManualTrigger: admin.NewPollingManualTriggerHandler(nil), Asset: admin.NewAssetHandler(nil, nil, nil), + AssetWallet: admin.NewAssetWalletHandler(nil), } }