package v1 import ( "apsClient/model/request" _ "apsClient/model/response" "apsClient/pkg/contextx" "apsClient/pkg/ecode" "apsClient/service" "encoding/json" "github.com/gin-gonic/gin" ) type TaskApi struct{} // TaskList // @Tags Base // @Summary 任务开启通知 // @Produce application/json // @Param object query request.TaskList true "查询参数" // @Success 200 {object} contextx.Response{data=[]model.ScheduleTask} "成功" // @Router /v1/task/list [get] func (slf *TaskApi) TaskList(c *gin.Context) { var params request.TaskList ctx, ok := contextx.NewContext(c, ¶ms) if !ok { return } taskList, total, code := service.NewTaskService().GetTaskList(params.Page, params.PageSize) if code != ecode.OK { ctx.Fail(code) return } for _, task := range taskList { if task.Data != "" { err := json.Unmarshal([]byte(task.Data), &task.TaskInfo) if err != nil { ctx.Fail(ecode.UnknownErr) return } } } ctx.ResultList(taskList, total) }