mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-19 01:04:25 +08:00
support scheduled transaction (#2)
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
package cron
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/mayswind/ezbookkeeping/pkg/core"
|
||||
"github.com/mayswind/ezbookkeeping/pkg/services"
|
||||
)
|
||||
@@ -16,3 +18,15 @@ var RemoveExpiredTokensJob = &CronJob{
|
||||
return services.Tokens.DeleteAllExpiredTokens(c)
|
||||
},
|
||||
}
|
||||
|
||||
// CreateScheduledTransactionJob represents the cron job which periodically create transaction by scheduled transaction template
|
||||
var CreateScheduledTransactionJob = &CronJob{
|
||||
Name: "CreateScheduledTransaction",
|
||||
Description: "Periodically create transaction by scheduled transaction template.",
|
||||
Period: CronJobEvery15MinutesPeriod{
|
||||
Second: 0,
|
||||
},
|
||||
Run: func(c *core.CronContext) error {
|
||||
return services.Transactions.CreateScheduledTransactions(c, time.Now().Unix(), c.GetInterval())
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user