chore: 并入 iotlcm-app 历史到 app/(原提交 f40bda9)

This commit is contained in:
MiFaZhan
2026-11-02 13:28:00 +08:00
1107 changed files with 147143 additions and 0 deletions
+32
View File
@@ -0,0 +1,32 @@
package tasks
import (
"context"
"time"
"git.5iot.com/iotlcm-public/iotlcm-app/internal/service"
"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, "执行任务:测试")
}