Skip to content

Commit

Permalink
fix(qcloud): cred balance
Browse files Browse the repository at this point in the history
  • Loading branch information
ioito committed Dec 5, 2024
1 parent 92336a2 commit f1ae6b9
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions pkg/multicloud/qcloud/qcloud.go
Original file line number Diff line number Diff line change
Expand Up @@ -987,9 +987,13 @@ func (client *SQcloudClient) GetIStorageById(id string) (cloudprovider.ICloudSto
}

type SAccountBalance struct {
Balance float64
Uin int64
Currency string
Balance float64
Uin int64
Currency string
CashAccountBalance float64
CreditAmount float64
CreditBalance float64
FreezeAmount float64
}

func (client *SQcloudClient) QueryAccountBalance() (*SAccountBalance, error) {
Expand All @@ -1005,7 +1009,11 @@ func (client *SQcloudClient) QueryAccountBalance() (*SAccountBalance, error) {
if err != nil {
return nil, err
}
balance.Balance = balance.Balance / 100.0
amount := balance.Balance / 100.0
if balance.CreditAmount > 0 {
amount = (balance.CashAccountBalance + balance.CreditAmount + balance.Balance - balance.FreezeAmount) / 100.0
}
balance.Balance = amount
if balance.Uin >= 200000000000 {
balance.Currency = "USD"
}
Expand Down

0 comments on commit f1ae6b9

Please sign in to comment.