76 lines
2.1 KiB
Go
76 lines
2.1 KiB
Go
package outgiving
|
|
|
|
import (
|
|
"git.inspur.com/sbg-jszt/cfn/cfn-schedule/internal/controller"
|
|
"git.inspur.com/sbg-jszt/cfn/cfn-schedule/internal/controller/v1/app_manage"
|
|
"git.inspur.com/sbg-jszt/cfn/cfn-schedule/internal/model"
|
|
"git.inspur.com/sbg-jszt/cfn/cfn-schedule/internal/model/app_manage/out_giving"
|
|
"git.inspur.com/sbg-jszt/cfn/cfn-schedule/internal/pkg/errors"
|
|
"git.inspur.com/sbg-jszt/cfn/cfn-schedule/internal/pkg/request"
|
|
"github.com/gin-gonic/gin"
|
|
)
|
|
|
|
type OutGivingLogPageBody struct {
|
|
PageInfo *request.PageInfo `json:"pageInfo" binding:"required"`
|
|
NodeId string `json:"nodeId"`
|
|
OutGivingId string `json:"outGivingId"`
|
|
Status string `json:"status"`
|
|
CreateTimeMillis string `json:"createTimeMillis"`
|
|
}
|
|
|
|
// {
|
|
// "page": "1",
|
|
// "limit": "10",
|
|
// "total": "0",
|
|
// "nodeId": "56e192c8e76742fa85c72342212ef466",
|
|
// "outGivingId": "8KY1Y1",
|
|
// "status": "0",
|
|
// }
|
|
func ListData(c *gin.Context) {
|
|
var pageBody OutGivingLogPageBody
|
|
err := c.ShouldBindJSON(&pageBody)
|
|
if err != nil {
|
|
controller.FailCode(c, errors.InvalidParameter, err, "请检查参数!")
|
|
return
|
|
}
|
|
|
|
fields := map[string]interface{}{}
|
|
if pageBody.NodeId != "" {
|
|
fields["node_id"] = pageBody.NodeId
|
|
}
|
|
if pageBody.OutGivingId != "" {
|
|
fields["out_giving_id"] = pageBody.OutGivingId
|
|
}
|
|
if pageBody.Status != "" {
|
|
fields["status"] = pageBody.Status
|
|
}
|
|
|
|
workspaceId := app_manage.GetWorkspaceId(c)
|
|
fields["workspace_id"] = workspaceId
|
|
|
|
page := &model.Page[out_giving.OutGivingLog]{
|
|
CurrentPage: pageBody.PageInfo.CurrentPage,
|
|
PageSize: pageBody.PageInfo.PageSize,
|
|
Order: pageBody.PageInfo.Order,
|
|
}
|
|
|
|
log := out_giving.NewOutGivingLog()
|
|
err = log.Page(page, fields)
|
|
if err != nil {
|
|
controller.FailCode(c, errors.ServerError, err, "查询分发日志失败!")
|
|
return
|
|
}
|
|
|
|
controller.Success(c, page)
|
|
}
|
|
|
|
func GetLogsIdByExecId(c *gin.Context) {
|
|
value := c.Query("execId")
|
|
id, err := out_giving.GetOutGivingExecLogById(value)
|
|
if err != nil {
|
|
controller.FailCode(c, errors.ServerError, err, "查询分发日志失败!")
|
|
return
|
|
}
|
|
controller.Success(c, id)
|
|
}
|