hpds_jkw_web/internal/proto/response.go

171 lines
5.6 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package proto
import "hpds-iot-web/model"
// BaseResponse 基础返回结构
type BaseResponse struct {
Code int `json:"code"`
Message string `json:"message"`
Data interface{} `json:"result,omitempty"`
Status string `json:"type,omitempty"`
Err error `json:"error,omitempty"` // 错误堆栈
//Page int64 `json:"page,omitempty"` //当前页码
//PageSize int64 `json:"pageSize,omitempty"` // 单页显示记录数--前端参数2
//PageCount int64 `json:"totalPage,omitempty"` // 总页数
//TotalSize int64 `json:"total,omitempty"` // 总记录数
}
type UserLoginResponse struct {
UserId int64 `json:"userId"`
Token string `json:"token"`
RealName string `json:"realName"`
UserName string `json:"userName"`
Roles []RoleItem `json:"roles"`
Avatar string `json:"avatar"`
Desc string `json:"desc"`
HomePath string `json:"homePath"`
}
type RoleItem struct {
RoleId int64 `json:"roleId"`
RoleName string `json:"roleName"`
Value string `json:"value"`
}
type OwnerItem struct {
OwnerId int `json:"ownerId"`
OwnerName string `json:"ownerName"`
ChargeUser string `json:"chargeUser"`
Phone string `json:"phone"`
}
type UploadResponse struct {
Url string `json:"url"`
}
type OwnerProjectItem struct {
OwnerId int `json:"key"`
OwnerName string `json:"title"`
ProjectList []ProjectItem `json:"children"`
}
type ProjectItem struct {
ProjectId string `json:"key"`
ProjectName string `json:"title"`
}
type DatasetItem struct {
DatasetId int64 `json:"datasetId"`
DatasetName string `json:"datasetName"`
DatasetDesc string `json:"datasetDesc"`
StoreName string `json:"storeName"`
CategoryId int `json:"categoryId"`
ProjectId int64 `json:"projectId"`
OwnerId int64 `json:"ownerId"`
Creator int64 `json:"creator"`
CreateAt int64 `json:"createAt"`
DatasetCount int64 `json:"datasetCount"`
DatasetSize int64 `json:"datasetSize"`
}
type NodeState struct {
List []model.NodeState `json:"list"`
}
type NodeLastState struct {
List []NodeLastStateItem `json:"list"`
}
type NodeLastStateItem struct {
NodeId int64 `json:"nodeId"`
NodeGuid string `json:"nodeGuid"`
NodeName string `json:"nodeName"`
NodeType int `json:"nodeType"`
NodeStatus int `json:"nodeStatus"`
Platform string `json:"platform"`
PlatformVersion string `json:"platformVersion"`
CPU string `json:"CPU"`
MemTotal uint64 `json:"memTotal"`
DiskTotal uint64 `json:"diskTotal"`
SwapTotal uint64 `json:"swapTotal"`
CpuUsed float64 `json:"cpuUsed"`
MemUsed uint64 `json:"memUsed"`
SwapUsed uint64 `json:"swapUsed"`
DiskUsed uint64 `json:"diskUsed"`
NetInTransfer uint64 `json:"netInTransfer"`
NetOutTransfer uint64 `json:"netOutTransfer"`
NetInSpeed uint64 `json:"netInSpeed"`
NetOutSpeed uint64 `json:"netOutSpeed"`
Load1 float64 `json:"load1"`
Load5 float64 `json:"load5"`
Load15 float64 `json:"load15"`
TcpConnCount uint64 `json:"tcpConnCount"`
UdpConnCount uint64 `json:"udpConnCount"`
ProcessCount uint64 `json:"processCount"`
ExecTask string `json:"execTask"`
}
type TaskDetail struct {
TaskId int64 `json:"taskId"`
ModelId int64 `json:"modelId"`
ModelName string `json:"modelName"`
NodeId int64 `json:"nodeId"`
NodeName string `json:"nodeName"`
TaskName string `json:"taskName"`
TaskDesc string `json:"taskDesc"`
DatasetArr string `json:"datasetArr"`
ResultStorage string `json:"resultStorage"`
AppointmentTime string `json:"appointmentTime"`
StartTime int64 `json:"startTime"`
FinishTime int64 `json:"finishTime"`
Status int `json:"status"`
CreateAt int64 `xorm:"created" json:"createAt"`
UpdateAt int64 `xorm:"updated" json:"updateAt"`
}
type TaskResultItem struct {
FileId int64 `json:"fileId"`
FileName string `json:"fileName"`
SrcFile string `json:"srcFile"`
DistFile string `json:"distFile"`
DiseaseType int `json:"diseaseType"`
DiseaseTypeName string `json:"diseaseTypeName"`
DiseaseLevel int `json:"diseaseLevel"`
DiseaseLevelName string `json:"diseaseLevelName"`
KPile string `json:"KPile"`
UpDown int `json:"upDown"`
LineNum int `json:"lineNum"`
Length float64 `json:"length"`
Width float64 `json:"width"`
Area float64 `json:"area"`
HorizontalPositions float64 `json:"horizontalPositions"`
Memo string `json:"memo"`
Stat bool `json:"stat"`
}
// MessageEvent 定义SSE事件
type MessageEvent struct {
TaskId int64
EventId int64
Data interface{}
}
type TaskLogProgress struct {
PayloadType int `json:"payloadType"`
TaskId int64 `json:"taskId"`
TotalCount int64 `json:"totalCount"`
CompletedCount int64 `json:"completedCount"`
FailingCount int64 `json:"failingCount"`
UnfinishedCount int64 `json:"unfinishedCount"`
}
type TaskLogPayload struct {
PayloadType int `json:"payloadType"`
TaskId int64 `json:"taskId"`
TaskCode string `json:"taskCode"`
NodeId int64 `json:"nodeId"`
NodeGuid string `json:"nodeGuid"`
TaskContent string `json:"taskContent"`
Status int `json:"status"` //1执行成功;2:执行失败
EventTime int64 `json:"eventTime"`
}