Fix: uint may overflow / Test: get user storage

This commit is contained in:
HFO4
2019-12-07 15:05:48 +08:00
parent 9386371097
commit f4c414c0f6
11 changed files with 126 additions and 61 deletions

View File

@@ -65,7 +65,7 @@ func (user *User) DeductionStorage(size uint64) bool {
DB.Model(user).UpdateColumn("storage", gorm.Expr("storage - ?", size))
return true
}
// 如果要减少的容量超出用容量,则设为零
// 如果要减少的容量超出用容量,则设为零
user.Storage = 0
DB.Model(user).UpdateColumn("storage", 0)