You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
57 lines
1.3 KiB
57 lines
1.3 KiB
package handler
|
|
|
|
import (
|
|
"github.com/gin-gonic/gin"
|
|
|
|
"laic-backend/common"
|
|
"laic-backend/service"
|
|
"laic-backend/vo"
|
|
)
|
|
|
|
// GetExecutionPage 执行记录分页列表
|
|
func GetExecutionPage(c *gin.Context) {
|
|
var req vo.ExecutionPageReq
|
|
_ = c.ShouldBindQuery(&req)
|
|
if req.PageNum <= 0 {
|
|
req.PageNum = 1
|
|
}
|
|
if req.PageSize <= 0 {
|
|
req.PageSize = 10
|
|
}
|
|
page, busiErr := service.DefaultExecutionService.GetPage(common.GetUserId(c), common.IsAdmin(c), &req)
|
|
if busiErr != nil {
|
|
common.FailWithBusiError(c, busiErr)
|
|
return
|
|
}
|
|
common.OKWithData(c, page)
|
|
}
|
|
|
|
// GetExecution 执行记录详情
|
|
func GetExecution(c *gin.Context) {
|
|
id, busiErr := parseID(c)
|
|
if busiErr != nil {
|
|
common.FailWithBusiError(c, busiErr)
|
|
return
|
|
}
|
|
exec, busiErr := service.DefaultExecutionService.GetDetail(common.GetUserId(c), common.IsAdmin(c), id)
|
|
if busiErr != nil {
|
|
common.FailWithBusiError(c, busiErr)
|
|
return
|
|
}
|
|
common.OKWithData(c, exec)
|
|
}
|
|
|
|
// GetTrajectory 执行轨迹
|
|
func GetTrajectory(c *gin.Context) {
|
|
id, busiErr := parseID(c)
|
|
if busiErr != nil {
|
|
common.FailWithBusiError(c, busiErr)
|
|
return
|
|
}
|
|
traj, busiErr := service.DefaultExecutionService.GetTrajectory(common.GetUserId(c), common.IsAdmin(c), id)
|
|
if busiErr != nil {
|
|
common.FailWithBusiError(c, busiErr)
|
|
return
|
|
}
|
|
common.OKWithData(c, traj)
|
|
}
|
|
|