feat: 收银台查询订单

This commit is contained in:
wolter 2025-07-21 09:51:01 +08:00
parent f5b70d1ce9
commit cdcfaaecd6
3 changed files with 34 additions and 0 deletions

View File

@ -108,3 +108,30 @@ func GetPayLink(c *gin.Context) {
"message": message, "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)
}

View File

@ -98,3 +98,8 @@ type GetPayLinkRequest struct {
OrderId string `json:"no" form:"no"` OrderId string `json:"no" form:"no"`
ClientIp string ClientIp string
} }
type PayPageCheckOrderResponse struct {
ReturnUrl string `json:"return_url"`
Status int `json:"status"`
}

View File

@ -99,6 +99,8 @@ func RegisterRoute(router *gin.Engine) {
{ {
// 收银台地址 // 收银台地址
router.GET(common.PayPageAddress, front.PayPage) router.GET(common.PayPageAddress, front.PayPage)
// 订单查询
router.GET(common.PayPageAddress+"/query", front.PayPageCheckOrder)
payPage := router.Group(common.PayPageAddress, middlewares.ValidateRequest()) payPage := router.Group(common.PayPageAddress, middlewares.ValidateRequest())
// 收银台 支付渠道列表 // 收银台 支付渠道列表