From 0f56fe15256b0a4458d5f2cee77c0bf40369ee09 Mon Sep 17 00:00:00 2001 From: MaysWind Date: Sat, 5 Dec 2020 16:44:02 +0800 Subject: [PATCH] modify method and variable name --- pkg/api/accounts.go | 4 ++-- pkg/services/accounts.go | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pkg/api/accounts.go b/pkg/api/accounts.go index 0b071dd1..23e33a56 100644 --- a/pkg/api/accounts.go +++ b/pkg/api/accounts.go @@ -78,7 +78,7 @@ func (a *AccountsApi) AccountGetHandler(c *core.Context) (interface{}, *errs.Err } uid := c.GetCurrentUid() - accountAndSubAccounts, err := a.accounts.GetAccountByAccountId(uid, accountGetReq.Id) + accountAndSubAccounts, err := a.accounts.GetAccountAndSubAccountsByAccountId(uid, accountGetReq.Id) if err != nil { log.ErrorfWithRequestId(c, "[accounts.AccountGetHandler] failed to get account \"id:%d\" for user \"uid:%d\", because %s", accountGetReq.Id, uid, err.Error()) @@ -196,7 +196,7 @@ func (a *AccountsApi) AccountModifyHandler(c *core.Context) (interface{}, *errs. } uid := c.GetCurrentUid() - accountAndSubAccounts, err := a.accounts.GetAccountByAccountId(uid, accountModifyReq.Id) + accountAndSubAccounts, err := a.accounts.GetAccountAndSubAccountsByAccountId(uid, accountModifyReq.Id) if err != nil { log.ErrorfWithRequestId(c, "[accounts.AccountModifyHandler] failed to get account \"id:%d\" for user \"uid:%d\", because %s", accountModifyReq.Id, uid, err.Error()) diff --git a/pkg/services/accounts.go b/pkg/services/accounts.go index f997e38f..30c1e034 100644 --- a/pkg/services/accounts.go +++ b/pkg/services/accounts.go @@ -38,7 +38,7 @@ func (s *AccountService) GetAllAccountsByUid(uid int64) ([]*models.Account, erro return accounts, err } -func (s *AccountService) GetAccountByAccountId(uid int64, accountId int64) ([]*models.Account, error) { +func (s *AccountService) GetAccountAndSubAccountsByAccountId(uid int64, accountId int64) ([]*models.Account, error) { if uid <= 0 { return nil, errs.ErrUserIdInvalid } @@ -175,9 +175,9 @@ func (s *AccountService) HideAccount(uid int64, ids []int64, hidden bool) error } return s.UserDataDB(uid).DoTransaction(func(sess *xorm.Session) error { - deletedRows, err := sess.Cols("hidden", "updated_unix_time").In("account_id", ids).Where("uid=? AND deleted=?", uid, false).Update(updateModel) + updateRows, err := sess.Cols("hidden", "updated_unix_time").In("account_id", ids).Where("uid=? AND deleted=?", uid, false).Update(updateModel) - if deletedRows < 1 { + if updateRows < 1 { return errs.ErrAccountNotFound }