审核打分修复
This commit is contained in:
父節點
b9d2bde1a5
當前提交
2462bd3a9d
@ -33,7 +33,7 @@ func (c CheckinService) SetStatus(aw *app.Wrapper) app.Result {
|
|||||||
type SetStatusReq struct {
|
type SetStatusReq struct {
|
||||||
ID int `form:"id" binding:"required"`
|
ID int `form:"id" binding:"required"`
|
||||||
Status int `form:"status" binding:"required"`
|
Status int `form:"status" binding:"required"`
|
||||||
Credit int `form:"credit" binding:"required,gte=1"`
|
Credit int `form:"credit"`
|
||||||
}
|
}
|
||||||
var req SetStatusReq
|
var req SetStatusReq
|
||||||
if err := aw.Ctx.ShouldBind(&req); err != nil {
|
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拒绝")
|
return aw.Error("只能是 2通过,3拒绝")
|
||||||
}
|
}
|
||||||
if req.Status == 2 { // pass
|
if req.Status == 2 { // pass
|
||||||
|
if req.Credit < 1 {
|
||||||
|
return aw.Error("打分无效")
|
||||||
|
}
|
||||||
user := userDAO.FindUserByID(userActivity.UserID)
|
user := userDAO.FindUserByID(userActivity.UserID)
|
||||||
user.Credit += req.Credit
|
user.Credit += req.Credit
|
||||||
userDAO.SaveUser(user)
|
userDAO.SaveUser(user)
|
||||||
|
載入中…
x
新增問題並參考
Block a user