Commit 0c0d6b4b by CalciumIon

feat: 优化充值订单号

parent fda2fd2e
...@@ -101,8 +101,8 @@ func RequestEpay(c *gin.Context) { ...@@ -101,8 +101,8 @@ func RequestEpay(c *gin.Context) {
} }
uri, params, err := client.Purchase(&epay.PurchaseArgs{ uri, params, err := client.Purchase(&epay.PurchaseArgs{
Type: payType, Type: payType,
ServiceTradeNo: "A" + tradeNo, ServiceTradeNo: fmt.Sprintf("USR%d-%s", id, tradeNo),
Name: "B" + tradeNo, Name: fmt.Sprintf("TUC%d", req.Amount),
Money: strconv.FormatFloat(payMoney, 'f', 2, 64), Money: strconv.FormatFloat(payMoney, 'f', 2, 64),
Device: epay.PC, Device: epay.PC,
NotifyUrl: notifyUrl, NotifyUrl: notifyUrl,
......
...@@ -791,11 +791,11 @@ type topUpRequest struct { ...@@ -791,11 +791,11 @@ type topUpRequest struct {
Key string `json:"key"` Key string `json:"key"`
} }
var lock = sync.Mutex{} var topUpLock = sync.Mutex{}
func TopUp(c *gin.Context) { func TopUp(c *gin.Context) {
lock.Lock() topUpLock.Lock()
defer lock.Unlock() defer topUpLock.Unlock()
req := topUpRequest{} req := topUpRequest{}
err := c.ShouldBindJSON(&req) err := c.ShouldBindJSON(&req)
if err != nil { if err != nil {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment