From 16aabbc4905a901a81783ce5c5cbce9900056961 Mon Sep 17 00:00:00 2001 From: CaIon <1808837298@qq.com> Date: Sat, 9 Sep 2023 05:05:46 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=85=85=E5=80=BCbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- controller/topup.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/controller/topup.go b/controller/topup.go index 4a7a62e7..6fd0a223 100644 --- a/controller/topup.go +++ b/controller/topup.go @@ -51,6 +51,11 @@ func RequestEpay(c *gin.Context) { c.JSON(200, gin.H{"message": err.Error(), "data": 10}) return } + if req.Amount < 1 { + c.JSON(200, gin.H{"message": "充值金额不能小于1", "data": 10}) + return + } + id := c.GetInt("id") amount := GetAmount(float64(req.Amount)) @@ -157,6 +162,10 @@ func RequestAmount(c *gin.Context) { c.JSON(200, gin.H{"message": "error", "data": "参数错误"}) return } + if req.Amount < 1 { + c.JSON(200, gin.H{"message": "error", "data": "充值金额不能小于1"}) + return + } c.JSON(200, gin.H{"message": "success", "data": GetAmount(float64(req.Amount))}) }