You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
535 B
23 lines
535 B
package initialize
|
|
|
|
import (
|
|
"fmt"
|
|
"gin-vue-admin/config"
|
|
"gin-vue-admin/global"
|
|
"gin-vue-admin/utils"
|
|
)
|
|
|
|
func Timer() {
|
|
if global.GVA_CONFIG.Timer.Start {
|
|
for _, detail := range global.GVA_CONFIG.Timer.Detail {
|
|
go func(detail config.Detail) {
|
|
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)
|
|
}
|
|
})
|
|
}(detail)
|
|
}
|
|
}
|
|
}
|