优化仪表盘等
This commit is contained in:
@@ -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()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user