mirror of
https://github.com/eyebluecn/tank.git
synced 2024-04-21 12:32:16 +00:00
feat: fix the bug for size compute.
This commit is contained in:
@@ -648,6 +648,11 @@ func (this *MatterDao) SumSizeByUserUuidAndPath(userUuid string, path string) in
|
||||
|
||||
}
|
||||
|
||||
func (this *MatterDao) UpdateSize(matterUuid string, size int64) {
|
||||
db := core.CONTEXT.GetDB().Model(&Matter{}).Where("uuid = ?", matterUuid).Update("size", size)
|
||||
this.PanicError(db.Error)
|
||||
}
|
||||
|
||||
func (this *MatterDao) CountByUserUuidAndPath(userUuid string, path string) int64 {
|
||||
|
||||
var wp = &builder.WherePair{Query: "user_uuid = ? AND path like ?", Args: []interface{}{userUuid, path + "%"}}
|
||||
|
||||
@@ -583,7 +583,9 @@ func (this *MatterService) ComputeRouteSize(matterUuid string, user *User, space
|
||||
|
||||
//when changed, we update
|
||||
if matter.Size != size {
|
||||
this.spaceDao.UpdateTotalSize(space.Uuid, size)
|
||||
this.matterDao.UpdateSize(matterUuid, size)
|
||||
|
||||
matter.Size = size
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user