feat: 合并Gin_Vue

This commit is contained in:
TsMask committed 2023-10-16 17:10:38 +08:00
1 parent 5289818fd4
commit 40a32cb67f
203 files changed
+19719 -178

No files matched your search

+52
View File
@@ -0,0 +1,52 @@
package foo
import (
"time"
"ems.agt/src/framework/cron"
"ems.agt/src/framework/logger"
)
var NewProcessor = &FooProcessor{
progress: 0,
count: 0,
}
// foo 队列任务处理
type FooProcessor struct {
// 任务进度
progress int
// 执行次数
count int
}
func (s *FooProcessor) Execute(data any) any {
logger.Infof("执行 %d 次,上次进度: %d ", s.count, s.progress)
s.count++
options := data.(cron.JobData)
sysJob := options.SysJob
logger.Infof("重复 %v 任务ID %s", options.Repeat, sysJob.JobID)
// 实现任务处理逻辑
i := 0
s.progress = i
for i < 20 {
// 获取任务进度
progress := s.progress
logger.Infof("jonId: %s => 任务进度:%d", sysJob.JobID, progress)
// 延迟响应
time.Sleep(time.Second * 2)
i++
// 改变任务进度
s.progress = i
}
// 返回结果,用于记录执行结果
return map[string]any{
"repeat": options.Repeat,
"jobName": sysJob.JobName,
"invokeTarget": sysJob.InvokeTarget,
"targetParams": sysJob.TargetParams,
}
}