🐛 delete timed task

pull/548/head
微凉 2021-11-06 17:25:07 +08:00
parent ac8476702c
commit d4523d52ee
1 changed files with 6 additions and 2 deletions

View File

@ -1,7 +1,9 @@
package model
import (
"fmt"
"github.com/Xhofe/alist/conf"
"github.com/robfig/cron/v3"
"time"
)
@ -44,9 +46,11 @@ func SaveAccount(account Account) error {
}
func DeleteAccount(name string) error {
account := Account{
Name: name,
account, ok := GetAccount(name)
if !ok {
return fmt.Errorf("no [%s] account", name)
}
conf.Cron.Remove(cron.EntryID(account.CronId))
if err := conf.DB.Delete(&account).Error; err != nil {
return err
}