初次提交

This commit is contained in:
liuzhihang1
2024-06-26 20:45:23 +08:00
parent 4b388a5be1
commit 831ea9889f
57 changed files with 3945 additions and 0 deletions

18
model/config.go Normal file
View File

@@ -0,0 +1,18 @@
package model
type Config struct {
Id int `gorm:"column:id;primary_key"`
Key string `gorm:"column:key"`
Value string `gorm:"column:value"`
}
func (n *Config) TableName() string {
return "config"
}
type SystemConfigurationResp struct {
Key string `json:"key"`
Value any `json:"value"`
Default string `json:"default"`
Describe string `json:"describe"`
}

103
model/es.go Normal file
View File

@@ -0,0 +1,103 @@
package model
type EsResult struct {
Took int `json:"took"`
TimedOut bool `json:"timed_out"`
Shards Shards `json:"_shards"`
Hits Hits `json:"hits"`
}
type Shards struct {
Total int `json:"total"`
Successful int `json:"successful"`
Skipped int `json:"skipped"`
Failed int `json:"failed"`
}
type Total struct {
Value int `json:"value"`
Relation string `json:"relation"`
}
type Source struct {
Log string `json:"log"`
Name string `json:"name"`
Time int64 `json:"time"`
Using string `json:"using"`
}
type HitsItem struct {
Index string `json:"_index"`
ID string `json:"_id"`
Score interface{} `json:"_score"`
Source Source `json:"_source"`
Sort []int64 `json:"sort"`
}
type Hits struct {
Total Total `json:"total"`
MaxScore interface{} `json:"max_score"`
Hits []HitsItem `json:"hits"`
}
type GetLogReq struct {
Match struct {
Log string `json:"log"`
Name string `json:"name"`
Using string `json:"using"`
} `json:"match"`
TimeRange struct {
StartTime int64 `json:"startTime"`
EndTime int64 `json:"endTime"`
} `json:"time"`
Page struct {
From int `json:"from"`
Size int `json:"size"`
} `json:"page"`
Sort string `json:"sort"`
}
type EsResp struct {
Took int `json:"took"`
TimedOut bool `json:"timed_out"`
Shards struct {
Total int `json:"total"`
Successful int `json:"successful"`
Skipped int `json:"skipped"`
Failed int `json:"failed"`
} `json:"_shards"`
Hits struct {
Total struct {
Value int `json:"value"`
Relation string `json:"relation"`
} `json:"total"`
MaxScore int `json:"max_score"`
Hits []struct {
Index string `json:"_index"`
ID string `json:"_id"`
Score int `json:"_score"`
Source struct {
Log string `json:"log"`
Name string `json:"name"`
Time int64 `json:"time"`
Using string `json:"using"`
} `json:"_source"`
} `json:"hits"`
} `json:"hits"`
}
type LogResp struct {
Total int `json:"total"`
Data []Eslog `json:"data"`
}
type Eslog struct {
Log string `json:"log"`
Time int64 `json:"time"`
Name string `json:"name"`
Using string `json:"using"`
Id string `json:"id"`
}
type QueryBody struct {
Query struct {
Bool struct {
Must []any `json:"must"`
} `json:"bool"`
} `json:"query"`
}

6
model/file.go Normal file
View File

@@ -0,0 +1,6 @@
package model
type FileStruct struct {
Name string `json:"name"`
IsDir bool `json:"isDir"`
}

8
model/message.go Normal file
View File

@@ -0,0 +1,8 @@
package model
type WsMessage struct {
MessageType string `json:"messageType"`
Content string `json:"content"`
}

26
model/permission.go Normal file
View File

@@ -0,0 +1,26 @@
package model
type Permission struct {
Id int64 `gorm:"column:id;NOT NULL" json:"id"`
Account string `gorm:"column:account;NOT NULL" json:"account"`
Pid int32 `gorm:"column:pid;NOT NULL" json:"pid"`
Owned bool `gorm:"column:owned;NOT NULL" json:"owned"`
Start bool `gorm:"column:start;NOT NULL" json:"start"`
Stop bool `gorm:"column:stop;NOT NULL" json:"stop"`
Terminal bool `gorm:"column:terminal;NOT NULL" json:"terminal"`
}
func (*Permission) TableName() string {
return "permission"
}
type PermissionPo struct {
Id int64 `gorm:"column:id" json:"id"`
Account string `gorm:"column:account" json:"account"`
Name string `gorm:"column:name" json:"name"`
Pid int32 `gorm:"column:pid" json:"pid"`
Owned bool `gorm:"column:owned" json:"owned"`
Start bool `gorm:"column:start" json:"start"`
Stop bool `gorm:"column:stop" json:"stop"`
Terminal bool `gorm:"column:terminal" json:"terminal"`
}

22
model/proc.go Normal file
View File

@@ -0,0 +1,22 @@
package model
type ProcessInfo struct {
Name string `json:"name"`
Uuid int `json:"uuid"`
StartTime string `json:"startTime"`
User string `json:"user"`
Usage Usage `json:"usage"`
State State `json:"state"`
TermType string `json:"termType"`
}
type Usage struct {
Cpu []float64 `json:"cpu"`
Mem []float64 `json:"mem"`
Time []string `json:"time"`
}
type State struct {
State uint8 `json:"state"`
Info string `json:"info"`
}

16
model/process.go Normal file
View File

@@ -0,0 +1,16 @@
package model
type Process struct {
Uuid int `gorm:"primaryKey;autoIncrement;column:uuid" json:"uuid"`
Name string `gorm:"column:name" json:"name"`
Cmd string `gorm:"column:args" json:"cmd"`
Cwd string `gorm:"column:cwd" json:"cwd"`
AutoRestart bool `gorm:"column:auto_restart" json:"autoRestart"`
Push bool `gorm:"column:push" json:"push"`
LogReport bool `gorm:"column:log_report" json:"logReport"`
TermType string `gorm:"column:term_type" json:"termType"`
}
func (*Process) TableName() string {
return "process"
}

14
model/push_msg.go Normal file
View File

@@ -0,0 +1,14 @@
package model
type Push struct {
Id int64 `gorm:"column:id;NOT NULL" json:"id"`
Method string `gorm:"column:method;NOT NULL" json:"method"`
Url string `gorm:"column:url;NOT NULL" json:"url"`
Body string `gorm:"column:body;NOT NULL" json:"body"`
Remark string `gorm:"column:remark;NOT NULL" json:"remark"`
Enable bool `gorm:"column:enable;NOT NULL" json:"enable"`
}
func (*Push) TableName() string {
return "push"
}

15
model/user.go Normal file
View File

@@ -0,0 +1,15 @@
package model
import "time"
type User struct {
Account string `json:"account" gorm:"primaryKey;column:account" `
Password string `json:"password" gorm:"column:password" `
Role int `json:"role" gorm:"column:role" `
CreateTime time.Time `json:"createTime" gorm:"column:create_time" `
Remark string `json:"remark" gorm:"column:remark" `
}
func (*User) TableName() string {
return "users"
}