From cdcfaaecd67aa3ca18864cf813c0d235c833fc2e Mon Sep 17 00:00:00 2001 From: wolter <11@gmail> Date: Mon, 21 Jul 2025 09:51:01 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=94=B6=E9=93=B6=E5=8F=B0=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2=E8=AE=A2=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/http/controllers/front/pay_page.go | 27 ++++++++++++++++++++++++++ app/http/entities/front/pay.go | 5 +++++ app/http/routes/route.go | 2 ++ 3 files changed, 34 insertions(+) diff --git a/app/http/controllers/front/pay_page.go b/app/http/controllers/front/pay_page.go index 3f41211..b61ec89 100644 --- a/app/http/controllers/front/pay_page.go +++ b/app/http/controllers/front/pay_page.go @@ -108,3 +108,30 @@ func GetPayLink(c *gin.Context) { "message": message, }) } + +// 订单查询 +func PayPageCheckOrder(c *gin.Context) { + var ( + code int + orderInfo ordersmodel.Orders + returnUrl string + ) + orderId := strings.TrimSpace(c.Query("no")) + + if orderId == "" || len(orderId) < 18 || len(orderId) > 20 { + controllers.ErrWithCode(c, errorcode.OrdersNotFound) + return + } + + orderInfo, returnUrl, code = thirdpay.PayPageCheckOrder(orderId) + if code == errorcode.OrderPayed { + code = errorcode.Success + } + + rsp := front.PayPageCheckOrderResponse{ + ReturnUrl: returnUrl, + Status: orderInfo.Status, + } + controllers.HandCodeRes(c, rsp, code) + +} diff --git a/app/http/entities/front/pay.go b/app/http/entities/front/pay.go index 46696f9..9431e39 100644 --- a/app/http/entities/front/pay.go +++ b/app/http/entities/front/pay.go @@ -98,3 +98,8 @@ type GetPayLinkRequest struct { OrderId string `json:"no" form:"no"` ClientIp string } + +type PayPageCheckOrderResponse struct { + ReturnUrl string `json:"return_url"` + Status int `json:"status"` +} diff --git a/app/http/routes/route.go b/app/http/routes/route.go index 5f8fe93..2d7b0db 100644 --- a/app/http/routes/route.go +++ b/app/http/routes/route.go @@ -99,6 +99,8 @@ func RegisterRoute(router *gin.Engine) { { // 收银台地址 router.GET(common.PayPageAddress, front.PayPage) + // 订单查询 + router.GET(common.PayPageAddress+"/query", front.PayPageCheckOrder) payPage := router.Group(common.PayPageAddress, middlewares.ValidateRequest()) // 收银台 支付渠道列表