引包目录名调整
This commit is contained in:
30
digital-human/controller/async_task_controller.go
Normal file
30
digital-human/controller/async_task_controller.go
Normal file
@@ -0,0 +1,30 @@
|
||||
package controller
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"ai-agent/digital-human/model/dto"
|
||||
"ai-agent/digital-human/service"
|
||||
|
||||
"github.com/gogf/gf/v2/util/gconv"
|
||||
)
|
||||
|
||||
type asyncTask struct{}
|
||||
|
||||
// AsyncTask 异步任务同步控制器(供定时任务服务调用)
|
||||
var AsyncTask = new(asyncTask)
|
||||
|
||||
// SyncAsyncTasks 扫描待处理任务并同步状态/转移结果
|
||||
func (c *asyncTask) SyncAsyncTasks(ctx context.Context, req *dto.SyncAsyncTasksReq) (res *dto.SyncAsyncTasksRes, err error) {
|
||||
// 从上下文获取用户信息(gfdb Hook 会自动填充)
|
||||
if ctx.Value("userId") == nil {
|
||||
ctx = context.WithValue(ctx, "userId", gconv.String(1))
|
||||
}
|
||||
if ctx.Value("userName") == nil {
|
||||
ctx = context.WithValue(ctx, "userName", "admin")
|
||||
}
|
||||
if ctx.Value("tenantId") == nil {
|
||||
ctx = context.WithValue(ctx, "tenantId", uint64(1))
|
||||
}
|
||||
return service.AsyncTask.Sync(ctx, req)
|
||||
}
|
||||
Reference in New Issue
Block a user