From 88ba8a840ee8d806294b2f20e61a1ed7a514361a Mon Sep 17 00:00:00 2001 From: CalciumIon <1808837298@qq.com> Date: Sat, 3 Aug 2024 01:28:18 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96=E5=85=85=E5=80=BC?= =?UTF-8?q?=E8=AE=A2=E5=8D=95=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- controller/topup.go | 4 ++-- controller/user.go | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/controller/topup.go b/controller/topup.go index 87c68c3..dc1e265 100644 --- a/controller/topup.go +++ b/controller/topup.go @@ -101,8 +101,8 @@ func RequestEpay(c *gin.Context) { } uri, params, err := client.Purchase(&epay.PurchaseArgs{ Type: payType, - ServiceTradeNo: "A" + tradeNo, - Name: "B" + tradeNo, + ServiceTradeNo: fmt.Sprintf("USR%d-%s", id, tradeNo), + Name: fmt.Sprintf("TUC%d", req.Amount), Money: strconv.FormatFloat(payMoney, 'f', 2, 64), Device: epay.PC, NotifyUrl: notifyUrl, diff --git a/controller/user.go b/controller/user.go index a6798eb..6faec2b 100644 --- a/controller/user.go +++ b/controller/user.go @@ -791,11 +791,11 @@ type topUpRequest struct { Key string `json:"key"` } -var lock = sync.Mutex{} +var topUpLock = sync.Mutex{} func TopUp(c *gin.Context) { - lock.Lock() - defer lock.Unlock() + topUpLock.Lock() + defer topUpLock.Unlock() req := topUpRequest{} err := c.ShouldBindJSON(&req) if err != nil {