mirror of
https://github.com/flipped-aurora/gin-vue-admin.git
synced 2026-09-21 12:32:25 +00:00
自动插件模式鉴定调整 (#1161)
* fix: #1160 * 自动插件模式鉴定调整 Co-authored-by: songzhibin97 <718428482@qq.com>
This commit is contained in:
committed by
GitHub
co-authored by
songzhibin97
parent
d6c6f39387
commit
d52d909171
@@ -3,6 +3,8 @@ package initialize
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/robfig/cron/v3"
|
||||
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/config"
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/global"
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/utils"
|
||||
@@ -12,12 +14,16 @@ func Timer() {
|
||||
if global.GVA_CONFIG.Timer.Start {
|
||||
for i := range global.GVA_CONFIG.Timer.Detail {
|
||||
go func(detail config.Detail) {
|
||||
var option []cron.Option
|
||||
if global.GVA_CONFIG.Timer.WithSeconds {
|
||||
option = append(option, cron.WithSeconds())
|
||||
}
|
||||
_, err := global.GVA_Timer.AddTaskByFunc("ClearDB", global.GVA_CONFIG.Timer.Spec, func() {
|
||||
err := utils.ClearTable(global.GVA_DB, detail.TableName, detail.CompareField, detail.Interval)
|
||||
if err != nil {
|
||||
fmt.Println("timer error:", err)
|
||||
}
|
||||
})
|
||||
}, option...)
|
||||
if err != nil {
|
||||
fmt.Println("add timer error:", err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user