🐛 fix change name error

This commit is contained in:
微凉
2021-11-15 14:54:22 +08:00
parent aeb72320ca
commit 27e61c9eb8
4 changed files with 26 additions and 6 deletions

View File

@ -68,6 +68,10 @@ func DeleteAccount(id uint) error {
return nil
}
func DeleteAccountFromMap(name string) {
delete(accountsMap, name)
}
func AccountsCount() int {
return len(accountsMap)
}
@ -86,6 +90,15 @@ func GetAccount(name string) (Account, bool) {
return account, ok
}
func GetAccountById(id uint) (*Account, error) {
var account Account
account.ID = id
if err := conf.DB.First(&account).Error; err != nil {
return nil, err
}
return &account, nil
}
func GetAccountFiles() ([]*File, error) {
files := make([]*File, 0)
var accounts []Account