diff --git a/api/handler/payment_handler.go b/api/handler/payment_handler.go index c3f5cd61..9c186517 100644 --- a/api/handler/payment_handler.go +++ b/api/handler/payment_handler.go @@ -83,7 +83,7 @@ func (h *PaymentHandler) DoPay(c *gin.Context) { } // 检查二维码是否过期 - if time.Now().Unix()-int64(t) > 30 { + if time.Now().Unix()-int64(t) > int64(h.App.SysConfig.OrderPayTimeout) { resp.ERROR(c, "支付二维码已过期,请重新生成!") return } @@ -342,6 +342,8 @@ func (h *PaymentHandler) Mobile(c *gin.Context) { payWay = PayWayXunHu notifyURL = h.App.Config.HuPiPayConfig.NotifyURL returnURL = h.App.Config.HuPiPayConfig.ReturnURL + parse, _ := url.Parse(h.App.Config.HuPiPayConfig.ReturnURL) + baseURL := fmt.Sprintf("%s://%s", parse.Scheme, parse.Host) params := payment.HuPiPayReq{ Version: "1.1", TradeOrderId: orderNo, @@ -351,6 +353,7 @@ func (h *PaymentHandler) Mobile(c *gin.Context) { ReturnURL: returnURL, CallbackURL: returnURL, WapName: "极客学长", + WapUrl: baseURL, Type: "WAP", } r, err := h.huPiPayService.Pay(params) diff --git a/api/test/test.go b/api/test/test.go index 46b90764..0a48ec97 100644 --- a/api/test/test.go +++ b/api/test/test.go @@ -1,12 +1,12 @@ package main import ( - "geekai/utils" "fmt" + "net/url" ) func main() { - text := "https://nk.img.r9it.com/chatgpt-plus/1712709360012445.png 请简单描述一下这幅图上的内容 " - imgURL := utils.ExtractImgURL(text) - fmt.Println(imgURL) + text := "https://nk.img.r9it.com/chatgpt-plus/1712709360012445.png" + parse, _ := url.Parse(text) + fmt.Println(fmt.Sprintf("%s://%s", parse.Scheme, parse.Host)) }