fix
This commit is contained in:
18
pkg/proto/apicode.go
Normal file
18
pkg/proto/apicode.go
Normal file
@@ -0,0 +1,18 @@
|
||||
package proto
|
||||
|
||||
const (
|
||||
Code_Success = 0
|
||||
Code_FailedAuth = 5001
|
||||
Code_Error = 5002
|
||||
Code_NotFound = 5004
|
||||
Code_NotAllowed = 5005
|
||||
Code_JWTError = 5006
|
||||
Code_RPCError = 5007
|
||||
Code_ParamsError = 5008
|
||||
Code_DBError = 5009
|
||||
)
|
||||
|
||||
const (
|
||||
Msg_NotAllowed = "permission not allowed"
|
||||
Msg_JWTError = "parse jwt token failed"
|
||||
)
|
||||
66
pkg/proto/args.go
Normal file
66
pkg/proto/args.go
Normal file
@@ -0,0 +1,66 @@
|
||||
package proto
|
||||
|
||||
import (
|
||||
"jiacrontab/models"
|
||||
)
|
||||
|
||||
type SearchLog struct {
|
||||
JobID uint
|
||||
GroupID uint
|
||||
UserID uint
|
||||
Root bool
|
||||
IsTail bool
|
||||
Offset int64
|
||||
Pagesize int
|
||||
Date string
|
||||
Pattern string
|
||||
}
|
||||
|
||||
type CleanNodeLog struct {
|
||||
Unit string
|
||||
Offset int
|
||||
}
|
||||
|
||||
type CleanNodeLogRet struct {
|
||||
Total int64 `json:"total"`
|
||||
Size string `json:"size"`
|
||||
}
|
||||
|
||||
type SearchLogResult struct {
|
||||
Content []byte
|
||||
Offset int64
|
||||
FileSize int64
|
||||
}
|
||||
|
||||
type SendMail struct {
|
||||
MailTo []string
|
||||
Subject string
|
||||
Content string
|
||||
}
|
||||
|
||||
type ApiPost struct {
|
||||
Urls []string
|
||||
Data string
|
||||
}
|
||||
|
||||
type ExecCrontabJobReply struct {
|
||||
Job models.CrontabJob
|
||||
Content []byte
|
||||
}
|
||||
|
||||
type ActionJobsArgs struct {
|
||||
UserID uint
|
||||
Root bool
|
||||
GroupID uint
|
||||
JobIDs []uint
|
||||
}
|
||||
|
||||
type GetJobArgs struct {
|
||||
UserID uint
|
||||
GroupID uint
|
||||
Root bool
|
||||
JobID uint
|
||||
}
|
||||
type EmptyArgs struct{}
|
||||
|
||||
type EmptyReply struct{}
|
||||
10
pkg/proto/const.go
Normal file
10
pkg/proto/const.go
Normal file
@@ -0,0 +1,10 @@
|
||||
package proto
|
||||
|
||||
const (
|
||||
DefaultTimeLayout = "2006-01-02 15:04:05"
|
||||
|
||||
TimeoutTrigger_CallApi = "CallApi"
|
||||
TimeoutTrigger_SendEmail = "SendEmail"
|
||||
TimeoutTrigger_Kill = "Kill"
|
||||
TimeoutTrigger_DingdingWebhook = "DingdingWebhook"
|
||||
)
|
||||
70
pkg/proto/crontab.go
Normal file
70
pkg/proto/crontab.go
Normal file
@@ -0,0 +1,70 @@
|
||||
package proto
|
||||
|
||||
import (
|
||||
"jiacrontab/models"
|
||||
"time"
|
||||
)
|
||||
|
||||
type DepJobs []DepJob
|
||||
type DepJob struct {
|
||||
Name string
|
||||
Dest string
|
||||
From string
|
||||
ProcessID int // 当前主任务进程id
|
||||
ID string // 依赖任务id
|
||||
JobID uint // 主任务id
|
||||
JobUniqueID string // 主任务唯一标志
|
||||
Commands []string
|
||||
Timeout int64
|
||||
Err error
|
||||
LogContent []byte
|
||||
}
|
||||
|
||||
type QueryJobArgs struct {
|
||||
SearchTxt string
|
||||
Root bool
|
||||
GroupID uint
|
||||
UserID uint
|
||||
Page, Pagesize int
|
||||
}
|
||||
|
||||
type QueryCrontabJobRet struct {
|
||||
Total int64
|
||||
Page int
|
||||
GroupID uint
|
||||
Pagesize int
|
||||
List []models.CrontabJob
|
||||
}
|
||||
|
||||
type QueryDaemonJobRet struct {
|
||||
Total int64
|
||||
GroupID int
|
||||
Page int
|
||||
Pagesize int
|
||||
List []models.DaemonJob
|
||||
}
|
||||
|
||||
type AuditJobArgs struct {
|
||||
GroupID uint
|
||||
Root bool
|
||||
UserID uint
|
||||
JobIDs []uint
|
||||
}
|
||||
|
||||
type CrontabApiNotifyBody struct {
|
||||
NodeAddr string
|
||||
JobName string
|
||||
JobID int
|
||||
CreateUsername string
|
||||
CreatedAt time.Time
|
||||
Timeout int64
|
||||
Type string
|
||||
RetryNum int
|
||||
}
|
||||
|
||||
type EditCrontabJobArgs struct {
|
||||
Job models.CrontabJob
|
||||
UserID uint
|
||||
GroupID uint
|
||||
Root bool
|
||||
}
|
||||
12
pkg/proto/daemon.go
Normal file
12
pkg/proto/daemon.go
Normal file
@@ -0,0 +1,12 @@
|
||||
package proto
|
||||
|
||||
import (
|
||||
"jiacrontab/models"
|
||||
)
|
||||
|
||||
type EditDaemonJobArgs struct {
|
||||
Job models.DaemonJob
|
||||
GroupID uint
|
||||
UserID uint
|
||||
Root bool
|
||||
}
|
||||
14
pkg/proto/resp.go
Normal file
14
pkg/proto/resp.go
Normal file
@@ -0,0 +1,14 @@
|
||||
package proto
|
||||
|
||||
const (
|
||||
SuccessRespCode = 0
|
||||
ErrorRespCode = -1
|
||||
)
|
||||
|
||||
type Resp struct {
|
||||
Code int `json:"code"`
|
||||
Msg string `json:"msg"`
|
||||
Data interface{} `json:"data,omitempty"`
|
||||
Sign string `json:"sign"`
|
||||
Version string `json:"version"`
|
||||
}
|
||||
Reference in New Issue
Block a user