mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-18 16:54:25 +08:00
code refactor
This commit is contained in:
@@ -278,13 +278,17 @@ func (s *AccountService) DeleteAccount(uid int64, accountId int64) error {
|
||||
|
||||
exists, err := sess.Cols("uid", "deleted", "source_account_id").Where("uid=? AND deleted=?", uid, false).In("source_account_id", accountAndSubAccountIds).Limit(1).Exist(&models.Transaction{})
|
||||
|
||||
if exists {
|
||||
if err != nil {
|
||||
return err
|
||||
} else if exists {
|
||||
return errs.ErrAccountInUseCannotBeDeleted
|
||||
}
|
||||
|
||||
exists, err = sess.Cols("uid", "deleted", "destination_account_id").Where("uid=? AND deleted=?", uid, false).In("destination_account_id", accountAndSubAccountIds).Limit(1).Exist(&models.Transaction{})
|
||||
|
||||
if exists {
|
||||
if err != nil {
|
||||
return err
|
||||
} else if exists {
|
||||
return errs.ErrAccountInUseCannotBeDeleted
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user