cache

This commit is contained in:
微凉
2021-10-27 18:59:03 +08:00
parent fb7e67724d
commit 9644cc98c3
13 changed files with 743 additions and 29 deletions

View File

@ -6,15 +6,18 @@ import (
)
type Account struct {
Name string `json:"name" gorm:"primaryKey" validate:"required"`
Type string `json:"type"`
Username string `json:"username"`
Password string `json:"password"`
RefreshToken string `json:"refresh_token"`
AccessToken string `json:"access_token"`
RootFolder string `json:"root_folder"`
Status int `json:"status"`
CronId int `json:"cron_id"`
Name string `json:"name" gorm:"primaryKey" validate:"required"`
Type string `json:"type"`
Username string `json:"username"`
Password string `json:"password"`
RefreshToken string `json:"refresh_token"`
AccessToken string `json:"access_token"`
RootFolder string `json:"root_folder"`
Status string
CronId int
DriveId string
OrderBy string `json:"order_by"`
OrderDirection string `json:"order_direction"`
}
var accountsMap = map[string]Account{}
@ -78,6 +81,7 @@ func GetAccounts() []*Account {
}
func initAccounts() {
log.Infof("init accounts...")
var accounts []Account
if err := conf.DB.Find(&accounts).Error; err != nil {
log.Fatalf("failed sync init accounts")