From d85d7bffd69487f58538e37d9ba50cbf10b598b0 Mon Sep 17 00:00:00 2001 From: huang Date: Mon, 16 Mar 2026 15:43:55 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E6=9B=B4=E6=96=B0=E8=B7=AF?= =?UTF-8?q?=E7=94=B1=E5=92=8C=20OpenAPI=20=E6=B3=A8=E5=86=8C=E4=BB=A5?= =?UTF-8?q?=E6=8E=A5=E5=85=A5=20AssetWallet?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus --- internal/routes/admin.go | 2 +- internal/routes/asset.go | 20 +++++++++++++++++++- pkg/openapi/handlers.go | 1 + 3 files changed, 21 insertions(+), 2 deletions(-) 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), } }