feat: 添加核心财务模型、账户存储库和存钱罐服务
This commit is contained in:
@@ -286,11 +286,16 @@ func (Account) TableName() string {
|
||||
return "accounts"
|
||||
}
|
||||
|
||||
// TotalBalance calculates the total balance including sub-accounts
|
||||
// Feature: financial-core-upgrade
|
||||
// Validates: Requirements 1.3
|
||||
// TotalBalance calculates the total balance including sub-accounts
|
||||
// Feature: financial-core-upgrade
|
||||
// Validates: Requirements 1.3
|
||||
func (a *Account) TotalBalance() float64 {
|
||||
total := a.AvailableBalance + a.FrozenBalance
|
||||
// Balance is treated as Available Balance (liquid funds)
|
||||
// FrozenBalance represents funds locked in savings pots/piggy banks
|
||||
total := a.Balance + a.FrozenBalance
|
||||
for _, sub := range a.SubAccounts {
|
||||
if sub.SubAccountType != nil && *sub.SubAccountType != SubAccountTypeSavingsPot {
|
||||
total += sub.Balance
|
||||
|
||||
Reference in New Issue
Block a user