From 3e8f613475be394dbba00c5305e098263af450c8 Mon Sep 17 00:00:00 2001 From: huang Date: Tue, 17 Mar 2026 09:45:51 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=20OpenAPI=20=E6=96=87?= =?UTF-8?q?=E6=A1=A3=E7=94=9F=E6=88=90=E5=99=A8=E5=90=AF=E5=8A=A8=20panic?= =?UTF-8?q?=EF=BC=8C=E8=B7=AF=E7=94=B1=E7=BC=BA=E5=B0=91=20path=20paramete?= =?UTF-8?q?r=20=E5=AE=9A=E4=B9=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 新增 UpdateWechatConfigParams/AgentOfflinePayParams 聚合结构体,嵌入 IDReq 提供 path:id 标签 - 修复 PUT /:id 和 POST /:id/offline-pay 路由的 Input 引用 - 修复 Makefile 构建路径从单文件改为包路径,解决多文件编译问题 - 标记 tasks.md 中 1.2.4 迁移任务为已完成 --- Makefile | 4 ++-- internal/model/dto/agent_recharge_dto.go | 6 ++++++ internal/model/dto/wechat_config_dto.go | 6 ++++++ internal/routes/agent_recharge.go | 2 +- internal/routes/wechat_config.go | 2 +- openspec/changes/add-payment-config-management/tasks.md | 2 +- 6 files changed, 17 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 9eb0a46..a4d618f 100644 --- a/Makefile +++ b/Makefile @@ -7,8 +7,8 @@ GOCLEAN=$(GOCMD) clean GOTEST=$(GOCMD) test GOGET=$(GOCMD) get BINARY_NAME=bin/junhong-cmp -MAIN_PATH=cmd/api/main.go -WORKER_PATH=cmd/worker/main.go +MAIN_PATH=./cmd/api +WORKER_PATH=./cmd/worker WORKER_BINARY=bin/junhong-worker # Database migration parameters diff --git a/internal/model/dto/agent_recharge_dto.go b/internal/model/dto/agent_recharge_dto.go index 4dc542a..55b5cd6 100644 --- a/internal/model/dto/agent_recharge_dto.go +++ b/internal/model/dto/agent_recharge_dto.go @@ -12,6 +12,12 @@ type AgentOfflinePayRequest struct { OperationPassword string `json:"operation_password" validate:"required" required:"true" description:"操作密码"` } +// AgentOfflinePayParams 确认线下充值聚合参数 (用于文档生成) +type AgentOfflinePayParams struct { + IDReq + AgentOfflinePayRequest +} + // AgentRechargeResponse 代理充值记录响应 type AgentRechargeResponse struct { ID uint `json:"id" description:"充值记录ID"` diff --git a/internal/model/dto/wechat_config_dto.go b/internal/model/dto/wechat_config_dto.go index fe708d2..00abebc 100644 --- a/internal/model/dto/wechat_config_dto.go +++ b/internal/model/dto/wechat_config_dto.go @@ -70,6 +70,12 @@ type UpdateWechatConfigRequest struct { FyNotifyURL *string `json:"fy_notify_url" validate:"omitempty,max=500" maxLength:"500" description:"富友支付回调地址"` } +// UpdateWechatConfigParams 更新微信参数配置聚合参数 (用于文档生成) +type UpdateWechatConfigParams struct { + IDReq + UpdateWechatConfigRequest +} + // WechatConfigListRequest 微信参数配置列表查询请求 type WechatConfigListRequest struct { Page int `json:"page" query:"page" validate:"omitempty,min=1" minimum:"1" description:"页码"` diff --git a/internal/routes/agent_recharge.go b/internal/routes/agent_recharge.go index 2241405..deabbf4 100644 --- a/internal/routes/agent_recharge.go +++ b/internal/routes/agent_recharge.go @@ -48,7 +48,7 @@ func registerAgentRechargeRoutes(router fiber.Router, handler *admin.AgentRechar Register(group, doc, groupPath, "POST", "/:id/offline-pay", handler.OfflinePay, RouteSpec{ Summary: "确认线下充值", Tags: []string{"代理预充值"}, - Input: new(dto.AgentOfflinePayRequest), + Input: new(dto.AgentOfflinePayParams), Output: new(dto.AgentRechargeResponse), Auth: true, }) diff --git a/internal/routes/wechat_config.go b/internal/routes/wechat_config.go index 3d81a04..5c8ef9e 100644 --- a/internal/routes/wechat_config.go +++ b/internal/routes/wechat_config.go @@ -58,7 +58,7 @@ func registerWechatConfigRoutes(router fiber.Router, handler *admin.WechatConfig Register(group, doc, groupPath, "PUT", "/:id", handler.Update, RouteSpec{ Summary: "更新支付配置", Tags: []string{"微信支付配置管理"}, - Input: new(dto.UpdateWechatConfigRequest), + Input: new(dto.UpdateWechatConfigParams), Output: new(dto.WechatConfigResponse), Auth: true, }) diff --git a/openspec/changes/add-payment-config-management/tasks.md b/openspec/changes/add-payment-config-management/tasks.md index 9a76fbd..3fea067 100644 --- a/openspec/changes/add-payment-config-management/tasks.md +++ b/openspec/changes/add-payment-config-management/tasks.md @@ -21,7 +21,7 @@ - [x] 1.2.1 创建数据库迁移文件:新建 `tb_wechat_config` 表(基础字段、OAuth 公众号字段、OAuth 小程序字段、微信直连支付字段、富友支付字段),`is_active` 默认 `false` - [x] 1.2.2 创建数据库迁移文件:`tb_order` 新增 `payment_config_id` 列(bigint, nullable, 带索引) - [x] 1.2.3 创建数据库迁移文件:`tb_asset_recharge_record` 新增 `payment_config_id` 列(bigint, nullable, 带索引) -- [ ] 1.2.4 执行迁移,确认表结构正确 +- [x] 1.2.4 执行迁移,确认表结构正确 - [x] 1.2.5 创建 `internal/model/wechat_config.go`:WechatConfig 模型(GORM 标签、TableName、渠道类型常量 `ProviderTypeWechat` / `ProviderTypeFuiou`) - [x] 1.2.6 修改 `internal/model/order.go`:Order 模型新增 `PaymentConfigID *uint` 字段 - [x] 1.2.7 修改 `internal/model/asset_wallet.go`:AssetRechargeRecord 模型新增 `PaymentConfigID *uint` 字段