feat: fix the bug for size compute.

This commit is contained in:
lishuang
2023-08-06 22:46:25 +08:00
parent 44b811507d
commit f1d31d1c10
2 changed files with 8 additions and 1 deletions
+5
View File
@@ -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 + "%"}}
+3 -1
View File
@@ -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
}
}