Feat: copy files and folders

This commit is contained in:
HFO4
2019-12-03 16:32:23 +08:00
parent 85bbb3d122
commit c15b8a047d
5 changed files with 162 additions and 38 deletions

View File

@@ -85,6 +85,16 @@ func (user *User) IncreaseStorage(size uint64) bool {
return false
}
// IncreaseStorageWithoutCheck 忽略可用容量,增加用户已用容量
func (user *User) IncreaseStorageWithoutCheck(size uint64) {
if size == 0 {
return
}
user.Storage += size
DB.Model(user).UpdateColumn("storage", gorm.Expr("storage + ?", size))
}
// GetRemainingCapacity 获取剩余配额
func (user *User) GetRemainingCapacity() uint64 {
if user.Group.MaxStorage <= user.Storage {