From 33ad8c544e6a04bb8edf3aa6db7bc3a848dc613d Mon Sep 17 00:00:00 2001 From: Rogee Date: Wed, 4 Feb 2026 14:58:01 +0800 Subject: [PATCH] fix: regenerate api routes and swagger documentation Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus --- backend/app/http/v1/routes.gen.go | 22 ++++ backend/docs/docs.go | 204 ++++++++++++++++++++++++++++++ backend/docs/swagger.json | 204 ++++++++++++++++++++++++++++++ backend/docs/swagger.yaml | 136 ++++++++++++++++++++ 4 files changed, 566 insertions(+) diff --git a/backend/app/http/v1/routes.gen.go b/backend/app/http/v1/routes.gen.go index d3ce598..26eaabd 100644 --- a/backend/app/http/v1/routes.gen.go +++ b/backend/app/http/v1/routes.gen.go @@ -163,6 +163,28 @@ func (r *Routes) Register(router fiber.Router) { QueryParam[string]("expires"), QueryParam[string]("sign"), )) + // Register routes for controller: Transaction + r.log.Debugf("Registering route: Get /v1/t/:tenantCode/orders/:id/status -> transaction.Status") + router.Get("/v1/t/:tenantCode/orders/:id/status"[len(r.Path()):], DataFunc1( + r.transaction.Status, + PathParam[int64]("id"), + )) + r.log.Debugf("Registering route: Post /v1/t/:tenantCode/orders -> transaction.Create") + router.Post("/v1/t/:tenantCode/orders"[len(r.Path()):], DataFunc1( + r.transaction.Create, + Body[dto.OrderCreateForm]("form"), + )) + r.log.Debugf("Registering route: Post /v1/t/:tenantCode/orders/:id/pay -> transaction.Pay") + router.Post("/v1/t/:tenantCode/orders/:id/pay"[len(r.Path()):], DataFunc2( + r.transaction.Pay, + PathParam[int64]("id"), + Body[dto.OrderPayForm]("form"), + )) + r.log.Debugf("Registering route: Post /v1/t/:tenantCode/webhook/payment/notify -> transaction.Webhook") + router.Post("/v1/t/:tenantCode/webhook/payment/notify"[len(r.Path()):], DataFunc1( + r.transaction.Webhook, + Body[dto.PaymentWebhookForm]("form"), + )) // Register routes for controller: User r.log.Debugf("Registering route: Delete /v1/t/:tenantCode/me/favorites/:contentId -> user.RemoveFavorite") router.Delete("/v1/t/:tenantCode/me/favorites/:contentId"[len(r.Path()):], Func2( diff --git a/backend/docs/docs.go b/backend/docs/docs.go index b8c003f..4d3e437 100644 --- a/backend/docs/docs.go +++ b/backend/docs/docs.go @@ -4871,6 +4871,115 @@ const docTemplate = `{ } } }, + "/v1/t/{tenantCode}/orders": { + "post": { + "description": "创建订单", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Transaction" + ], + "summary": "Create Order", + "parameters": [ + { + "description": "订单创建参数", + "name": "form", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/dto.OrderCreateForm" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/dto.OrderCreateResponse" + } + } + } + } + }, + "/v1/t/{tenantCode}/orders/{id}/pay": { + "post": { + "description": "支付订单", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Transaction" + ], + "summary": "Pay Order", + "parameters": [ + { + "type": "integer", + "format": "int64", + "description": "订单ID", + "name": "id", + "in": "path", + "required": true + }, + { + "description": "支付参数", + "name": "form", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/dto.OrderPayForm" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/dto.OrderPayResponse" + } + } + } + } + }, + "/v1/t/{tenantCode}/orders/{id}/status": { + "get": { + "description": "查询订单状态", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Transaction" + ], + "summary": "Order Status", + "parameters": [ + { + "type": "integer", + "format": "int64", + "description": "订单ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/dto.OrderStatusResponse" + } + } + } + } + }, "/v1/t/{tenantCode}/storage/{any}": { "get": { "consumes": [ @@ -5196,6 +5305,40 @@ const docTemplate = `{ } } } + }, + "/v1/t/{tenantCode}/webhook/payment/notify": { + "post": { + "description": "Payment Webhook", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Transaction" + ], + "summary": "Payment Webhook", + "parameters": [ + { + "description": "Webhook Data", + "name": "form", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/dto.PaymentWebhookForm" + } + } + ], + "responses": { + "200": { + "description": "success", + "schema": { + "type": "string" + } + } + } + } } }, "definitions": { @@ -6140,6 +6283,58 @@ const docTemplate = `{ } } }, + "dto.OrderCreateForm": { + "type": "object", + "properties": { + "content_id": { + "description": "ContentID 内容ID。", + "type": "integer" + }, + "idempotency_key": { + "description": "IdempotencyKey 幂等键(同一业务请求需保持一致)。", + "type": "string" + }, + "quantity": { + "description": "Quantity 购买数量(默认 1)。", + "type": "integer" + }, + "sku": { + "description": "Sku 规格标识(可选)。", + "type": "string" + }, + "user_coupon_id": { + "description": "UserCouponID 用户券ID(可选)。", + "type": "integer" + } + } + }, + "dto.OrderCreateResponse": { + "type": "object", + "properties": { + "order_id": { + "description": "OrderID 创建成功的订单ID。", + "type": "integer" + } + } + }, + "dto.OrderPayForm": { + "type": "object", + "properties": { + "method": { + "description": "Method 支付方式(alipay/balance)。", + "type": "string" + } + } + }, + "dto.OrderPayResponse": { + "type": "object", + "properties": { + "pay_params": { + "description": "PayParams 支付参数(透传给前端)。", + "type": "string" + } + } + }, "dto.OrderStatisticsResponse": { "type": "object", "properties": { @@ -6185,6 +6380,15 @@ const docTemplate = `{ } } }, + "dto.OrderStatusResponse": { + "type": "object", + "properties": { + "status": { + "description": "Status 订单状态(unpaid/paid/completed 等)。", + "type": "string" + } + } + }, "dto.OrderTenantLite": { "type": "object", "properties": { diff --git a/backend/docs/swagger.json b/backend/docs/swagger.json index 30a64d5..64a5d7f 100644 --- a/backend/docs/swagger.json +++ b/backend/docs/swagger.json @@ -4865,6 +4865,115 @@ } } }, + "/v1/t/{tenantCode}/orders": { + "post": { + "description": "创建订单", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Transaction" + ], + "summary": "Create Order", + "parameters": [ + { + "description": "订单创建参数", + "name": "form", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/dto.OrderCreateForm" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/dto.OrderCreateResponse" + } + } + } + } + }, + "/v1/t/{tenantCode}/orders/{id}/pay": { + "post": { + "description": "支付订单", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Transaction" + ], + "summary": "Pay Order", + "parameters": [ + { + "type": "integer", + "format": "int64", + "description": "订单ID", + "name": "id", + "in": "path", + "required": true + }, + { + "description": "支付参数", + "name": "form", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/dto.OrderPayForm" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/dto.OrderPayResponse" + } + } + } + } + }, + "/v1/t/{tenantCode}/orders/{id}/status": { + "get": { + "description": "查询订单状态", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Transaction" + ], + "summary": "Order Status", + "parameters": [ + { + "type": "integer", + "format": "int64", + "description": "订单ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/dto.OrderStatusResponse" + } + } + } + } + }, "/v1/t/{tenantCode}/storage/{any}": { "get": { "consumes": [ @@ -5190,6 +5299,40 @@ } } } + }, + "/v1/t/{tenantCode}/webhook/payment/notify": { + "post": { + "description": "Payment Webhook", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Transaction" + ], + "summary": "Payment Webhook", + "parameters": [ + { + "description": "Webhook Data", + "name": "form", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/dto.PaymentWebhookForm" + } + } + ], + "responses": { + "200": { + "description": "success", + "schema": { + "type": "string" + } + } + } + } } }, "definitions": { @@ -6134,6 +6277,58 @@ } } }, + "dto.OrderCreateForm": { + "type": "object", + "properties": { + "content_id": { + "description": "ContentID 内容ID。", + "type": "integer" + }, + "idempotency_key": { + "description": "IdempotencyKey 幂等键(同一业务请求需保持一致)。", + "type": "string" + }, + "quantity": { + "description": "Quantity 购买数量(默认 1)。", + "type": "integer" + }, + "sku": { + "description": "Sku 规格标识(可选)。", + "type": "string" + }, + "user_coupon_id": { + "description": "UserCouponID 用户券ID(可选)。", + "type": "integer" + } + } + }, + "dto.OrderCreateResponse": { + "type": "object", + "properties": { + "order_id": { + "description": "OrderID 创建成功的订单ID。", + "type": "integer" + } + } + }, + "dto.OrderPayForm": { + "type": "object", + "properties": { + "method": { + "description": "Method 支付方式(alipay/balance)。", + "type": "string" + } + } + }, + "dto.OrderPayResponse": { + "type": "object", + "properties": { + "pay_params": { + "description": "PayParams 支付参数(透传给前端)。", + "type": "string" + } + } + }, "dto.OrderStatisticsResponse": { "type": "object", "properties": { @@ -6179,6 +6374,15 @@ } } }, + "dto.OrderStatusResponse": { + "type": "object", + "properties": { + "status": { + "description": "Status 订单状态(unpaid/paid/completed 等)。", + "type": "string" + } + } + }, "dto.OrderTenantLite": { "type": "object", "properties": { diff --git a/backend/docs/swagger.yaml b/backend/docs/swagger.yaml index e529688..ff52889 100644 --- a/backend/docs/swagger.yaml +++ b/backend/docs/swagger.yaml @@ -687,6 +687,42 @@ definitions: description: Username 买家用户名。 type: string type: object + dto.OrderCreateForm: + properties: + content_id: + description: ContentID 内容ID。 + type: integer + idempotency_key: + description: IdempotencyKey 幂等键(同一业务请求需保持一致)。 + type: string + quantity: + description: Quantity 购买数量(默认 1)。 + type: integer + sku: + description: Sku 规格标识(可选)。 + type: string + user_coupon_id: + description: UserCouponID 用户券ID(可选)。 + type: integer + type: object + dto.OrderCreateResponse: + properties: + order_id: + description: OrderID 创建成功的订单ID。 + type: integer + type: object + dto.OrderPayForm: + properties: + method: + description: Method 支付方式(alipay/balance)。 + type: string + type: object + dto.OrderPayResponse: + properties: + pay_params: + description: PayParams 支付参数(透传给前端)。 + type: string + type: object dto.OrderStatisticsResponse: properties: by_status: @@ -717,6 +753,12 @@ definitions: description: StatusDescription 状态描述(用于展示)。 type: string type: object + dto.OrderStatusResponse: + properties: + status: + description: Status 订单状态(unpaid/paid/completed 等)。 + type: string + type: object dto.OrderTenantLite: properties: code: @@ -6387,6 +6429,78 @@ paths: summary: Delete media asset tags: - Common + /v1/t/{tenantCode}/orders: + post: + consumes: + - application/json + description: 创建订单 + parameters: + - description: 订单创建参数 + in: body + name: form + required: true + schema: + $ref: '#/definitions/dto.OrderCreateForm' + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/dto.OrderCreateResponse' + summary: Create Order + tags: + - Transaction + /v1/t/{tenantCode}/orders/{id}/pay: + post: + consumes: + - application/json + description: 支付订单 + parameters: + - description: 订单ID + format: int64 + in: path + name: id + required: true + type: integer + - description: 支付参数 + in: body + name: form + required: true + schema: + $ref: '#/definitions/dto.OrderPayForm' + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/dto.OrderPayResponse' + summary: Pay Order + tags: + - Transaction + /v1/t/{tenantCode}/orders/{id}/status: + get: + consumes: + - application/json + description: 查询订单状态 + parameters: + - description: 订单ID + format: int64 + in: path + name: id + required: true + type: integer + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/dto.OrderStatusResponse' + summary: Order Status + tags: + - Transaction /v1/t/{tenantCode}/storage/{any}: get: consumes: @@ -6601,6 +6715,28 @@ paths: summary: Upload part tags: - Common + /v1/t/{tenantCode}/webhook/payment/notify: + post: + consumes: + - application/json + description: Payment Webhook + parameters: + - description: Webhook Data + in: body + name: form + required: true + schema: + $ref: '#/definitions/dto.PaymentWebhookForm' + produces: + - application/json + responses: + "200": + description: success + schema: + type: string + summary: Payment Webhook + tags: + - Transaction securityDefinitions: BasicAuth: type: basic