This commit is contained in:
Liang Ding 2022-07-02 22:46:28 +08:00
parent 177b42c1ef
commit e4b712547f
No known key found for this signature in database
GPG key ID: 136F30F901A2231D
9 changed files with 22 additions and 14 deletions

View file

@ -59,9 +59,7 @@ func RemoveCloudBackup() (err error) {
}
func getCloudAvailableBackupSize() (size int64, err error) {
var sync map[string]interface{}
var assetSize int64
sync, _, assetSize, err = getCloudSpaceOSS()
sync, _, assetSize, repoSize, err := getCloudSpaceOSS()
if nil != err {
return
}
@ -70,16 +68,15 @@ func getCloudAvailableBackupSize() (size int64, err error) {
if nil != sync {
syncSize = int64(sync["size"].(float64))
}
size = int64(Conf.User.UserSiYuanRepoSize) - syncSize - assetSize
size = int64(Conf.User.UserSiYuanRepoSize) - syncSize - assetSize - repoSize
return
}
func GetCloudSpace() (s *Sync, b *Backup, hSize, hAssetSize, hTotalSize string, err error) {
var sync, backup map[string]interface{}
var assetSize int64
sync, backup, assetSize, err = getCloudSpaceOSS()
func GetCloudSpace() (s *Sync, b *Backup, hSize, hAssetSize, hRepoSize, hTotalSize string, err error) {
sync, backup, assetSize, repoSize, err := getCloudSpaceOSS()
if nil != err {
return nil, nil, "", "", "", errors.New(Conf.Language(30) + " " + err.Error())
err = errors.New(Conf.Language(30) + " " + err.Error())
return
}
var totalSize, syncSize, backupSize int64
@ -103,8 +100,9 @@ func GetCloudSpace() (s *Sync, b *Backup, hSize, hAssetSize, hTotalSize string,
HSize: humanize.Bytes(uint64(backupSize)),
Updated: backupUpdated,
}
totalSize = syncSize + backupSize + assetSize
totalSize = syncSize + backupSize + assetSize + repoSize
hAssetSize = humanize.Bytes(uint64(assetSize))
hRepoSize = humanize.Bytes(uint64(repoSize))
hSize = humanize.Bytes(uint64(totalSize))
hTotalSize = byteCountSI(int64(Conf.User.UserSiYuanRepoSize))
return