优化仪表盘等

This commit is contained in:
hero920103 committed 2025-11-13 11:28:00 +08:00
1 parent db16ee70de
commit 117e2b3440
18 files changed
+863 -442

No files matched your search

+44
View File
@@ -304,3 +304,47 @@ func (c *TaskController) DeleteTask() {
}
c.ServeJSON()
}
// 仪表盘获取待办任务
// GetTodoTasks 获取待办任务列表
// @router /api/oa/tasks/todo [get]
func (c *TaskController) GetTodoTasks() {
// 优先取查询参数,其次取中间件写入的上下文
tenantId, _ := c.GetInt("tenantId", 0)
if tenantId == 0 {
if v := c.Ctx.Input.GetData("tenantId"); v != nil {
if tid, ok := v.(int); ok {
tenantId = tid
}
}
}
id, _ := c.GetInt("id", 0)
if id == 0 {
if v := c.Ctx.Input.GetData("id"); v != nil {
if uid, ok := v.(int); ok {
id = uid
}
}
}
limit, _ := c.GetInt("limit", 10)
tasks, err := services.GetTodoTasks(tenantId, id, limit)
if err != nil {
c.Data["json"] = map[string]interface{}{
"code": 1,
"message": "获取待办任务失败: " + err.Error(),
"data": nil,
}
c.ServeJSON()
return
}
c.Data["json"] = map[string]interface{}{
"code": 0,
"message": "获取成功",
"data": tasks,
}
c.ServeJSON()
}