go-common/app/admin/main/laser/http/task_log.go
2019-04-22 18:49:16 +08:00

40 lines
909 B
Go

package http
import (
"go-common/app/admin/main/laser/model"
"go-common/library/ecode"
"go-common/library/log"
"go-common/library/net/http/blademaster"
)
func queryTaskLog(c *blademaster.Context) {
v := new(struct {
MID int64 `form:"mid"`
TaskID int64 `form:"task_id"`
Platform int `form:"platform"`
TaskState int `form:"task_state"`
Sortby string `form:"sort"`
PageNo int `form:"page_no"`
PageSize int `form:"page_size"`
})
err := c.Bind(v)
if err != nil {
c.JSON(nil, ecode.RequestErr)
return
}
logs, count, err := svc.QueryTaskLog(c, v.MID, v.TaskID, v.Platform, v.TaskState, v.Sortby, v.PageNo, v.PageSize)
if err != nil {
log.Error("svc.QueryTaskLog() error(%v)", err)
c.JSON(nil, err)
return
}
pager := &model.TaskLogPager{
PageNo: v.PageNo,
PageSize: v.PageSize,
Items: logs,
Total: count,
}
c.JSON(pager, nil)
}