fix: 修复代理充值 Handler 缺少参数验证导致 check constraint 违反的问题
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 7m18s

payment_method 字段传入中文值「线下转账」时,因 AgentRechargeHandler
未注入 validator 而跳过 oneof 验证,直接写入 DB 触发
chk_agent_recharge_method 约束报错。

- AgentRechargeHandler 注入 validator,Create 方法补加 Struct 验证
- bootstrap/handlers.go 传入 validate 实例
- openapi/handlers.go 补 nil 占位保持编译通过
This commit is contained in:
2026-04-03 09:17:15 +08:00
parent a8a91fe04e
commit c0c32c62f4
3 changed files with 10 additions and 5 deletions

View File

@@ -95,7 +95,7 @@ func initHandlers(svc *services, deps *Dependencies) *Handlers {
AssetLifecycle: admin.NewAssetLifecycleHandler(svc.AssetLifecycle),
AssetWallet: admin.NewAssetWalletHandler(svc.AssetWallet),
WechatConfig: admin.NewWechatConfigHandler(svc.WechatConfig),
AgentRecharge: admin.NewAgentRechargeHandler(svc.AgentRecharge),
AgentRecharge: admin.NewAgentRechargeHandler(svc.AgentRecharge, validate),
Refund: admin.NewRefundHandler(svc.Refund),
}
}