feat: 收银台查询订单
This commit is contained in:
parent
f5b70d1ce9
commit
cdcfaaecd6
|
@ -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)
|
||||
|
||||
}
|
||||
|
|
|
@ -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"`
|
||||
}
|
||||
|
|
|
@ -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())
|
||||
// 收银台 支付渠道列表
|
||||
|
|
Loading…
Reference in New Issue