chore: 并入 iotlcm-admin-svr 历史到 admin-svr/(原提交 49818c6)

This commit is contained in:
MiFaZhan
2026-11-02 13:27:59 +08:00
1250 changed files with 154111 additions and 0 deletions
@@ -0,0 +1,32 @@
package tasks
import (
"context"
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service"
"time"
"github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/util/gconv"
)
func init() {
RegisterInnerTask("clear_operation_log_by_days", "ClearOperationLogByDays")
RegisterInnerTask("test", "Test")
}
func (t Task) ClearOperationLogByDays(days string) {
ctx := context.Background()
g.Log().Debugf(ctx, "执行任务:清理超过%v天的操作日志", days)
err := service.SysOperLog().ClearOperationLogByDays(ctx, gconv.Int(days))
if err != nil {
g.Log().Error(ctx, "TaskJob.ClearOperationLogByDays", err)
}
time.Sleep(time.Second * 30)
g.Log().Debugf(ctx, "执行任务:完成")
}
func (t Task) Test() {
ctx := context.Background()
// 测试代码
g.Log().Debugf(ctx, "执行任务:测试")
}