浏览代码

feat: 钱包兼容非货币形式显示额度

CaIon 1 年之前
父节点
当前提交
3db64afc7f
共有 1 个文件被更改,包括 5 次插入1 次删除
  1. 5 1
      controller/topup.go

+ 5 - 1
controller/topup.go

@@ -111,9 +111,13 @@ func RequestEpay(c *gin.Context) {
 		c.JSON(200, gin.H{"message": "error", "data": "拉起支付失败"})
 		return
 	}
+	amount := req.Amount
+	if !common.DisplayInCurrencyEnabled {
+		amount = amount / int(common.QuotaPerUnit)
+	}
 	topUp := &model.TopUp{
 		UserId:     id,
-		Amount:     req.Amount,
+		Amount:     amount,
 		Money:      payMoney,
 		TradeNo:    "A" + tradeNo,
 		CreateTime: time.Now().Unix(),