This commit is contained in:
MaysWind
2024-11-15 00:40:14 +08:00
parent 835b3b7b8b
commit 89bd055f02
+4 -4
View File
@@ -194,22 +194,22 @@ func (a *AccountsApi) AccountCreateHandler(c *core.WebContext) (any, *errs.Error
subAccount := accountCreateReq.SubAccounts[i] subAccount := accountCreateReq.SubAccounts[i]
if subAccount.Category != accountCreateReq.Category { if subAccount.Category != accountCreateReq.Category {
log.Warnf(c, "[accounts.AccountCreateHandler] category of sub-account not equals to parent") log.Warnf(c, "[accounts.AccountCreateHandler] category of sub-account#%d not equals to parent", i)
return nil, errs.ErrSubAccountCategoryNotEqualsToParent return nil, errs.ErrSubAccountCategoryNotEqualsToParent
} }
if subAccount.Type != models.ACCOUNT_TYPE_SINGLE_ACCOUNT { if subAccount.Type != models.ACCOUNT_TYPE_SINGLE_ACCOUNT {
log.Warnf(c, "[accounts.AccountCreateHandler] sub-account type invalid") log.Warnf(c, "[accounts.AccountCreateHandler] sub-account#%d type invalid", i)
return nil, errs.ErrSubAccountTypeInvalid return nil, errs.ErrSubAccountTypeInvalid
} }
if subAccount.Currency == validators.ParentAccountCurrencyPlaceholder { if subAccount.Currency == validators.ParentAccountCurrencyPlaceholder {
log.Warnf(c, "[accounts.AccountCreateHandler] sub-account cannot set currency placeholder") log.Warnf(c, "[accounts.AccountCreateHandler] sub-account#%d cannot set currency placeholder", i)
return nil, errs.ErrAccountCurrencyInvalid return nil, errs.ErrAccountCurrencyInvalid
} }
if subAccount.Balance != 0 && subAccount.BalanceTime <= 0 { if subAccount.Balance != 0 && subAccount.BalanceTime <= 0 {
log.Warnf(c, "[accounts.AccountCreateHandler] sub-account balance time is not set") log.Warnf(c, "[accounts.AccountCreateHandler] sub-account#%d balance time is not set", i)
return nil, errs.ErrAccountBalanceTimeNotSet return nil, errs.ErrAccountBalanceTimeNotSet
} }
} }