From 2462bd3a9df97e5a7c2a66bd287f4823c7c32e55 Mon Sep 17 00:00:00 2001 From: juzeon <812312770@qq.com> Date: Fri, 25 Nov 2022 22:13:10 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=A1=E6=A0=B8=E6=89=93=E5=88=86=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- service/checkin.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/service/checkin.go b/service/checkin.go index 14f686c..832fbb1 100644 --- a/service/checkin.go +++ b/service/checkin.go @@ -33,7 +33,7 @@ func (c CheckinService) SetStatus(aw *app.Wrapper) app.Result { type SetStatusReq struct { ID int `form:"id" binding:"required"` Status int `form:"status" binding:"required"` - Credit int `form:"credit" binding:"required,gte=1"` + Credit int `form:"credit"` } var req SetStatusReq if err := aw.Ctx.ShouldBind(&req); err != nil { @@ -50,6 +50,9 @@ func (c CheckinService) SetStatus(aw *app.Wrapper) app.Result { return aw.Error("只能是 2通过,3拒绝") } if req.Status == 2 { // pass + if req.Credit < 1 { + return aw.Error("打分无效") + } user := userDAO.FindUserByID(userActivity.UserID) user.Credit += req.Credit userDAO.SaveUser(user)