update
This commit is contained in:
1 parent
0690285147
commit
5618cd2738
154 files changed
+5021
-3161
No files matched your search
@@ -94,8 +94,8 @@ func (h *ServerHandler) ListServers(c *gin.Context) {
|
||||
|
||||
// 关键词搜索
|
||||
if query.Keyword != "" {
|
||||
db = db.Where("hostname LIKE ? OR ip LIKE ? OR public_ip LIKE ?",
|
||||
"%"+query.Keyword+"%", "%"+query.Keyword+"%", "%"+query.Keyword+"%")
|
||||
db = db.Where("alias LIKE ? OR cloud_instance_name LIKE ? OR hostname LIKE ? OR ip LIKE ? OR public_ip LIKE ? OR cloud_instance_id LIKE ?",
|
||||
"%"+query.Keyword+"%", "%"+query.Keyword+"%", "%"+query.Keyword+"%", "%"+query.Keyword+"%", "%"+query.Keyword+"%", "%"+query.Keyword+"%")
|
||||
}
|
||||
|
||||
// 状态过滤
|
||||
@@ -194,23 +194,26 @@ func (h *ServerHandler) CreateServer(c *gin.Context) {
|
||||
}
|
||||
|
||||
server := model.Server{
|
||||
Hostname: req.Hostname,
|
||||
IP: req.IP,
|
||||
PublicIP: req.PublicIP,
|
||||
Port: req.Port,
|
||||
Username: req.Username,
|
||||
Password: req.Password,
|
||||
SSHKey: req.SSHKey,
|
||||
AuthType: req.AuthType,
|
||||
OS: req.OS,
|
||||
CPU: req.CPU,
|
||||
Memory: req.Memory,
|
||||
Disk: req.Disk,
|
||||
RegionID: req.RegionID,
|
||||
CloudID: req.CloudID,
|
||||
Tags: req.Tags,
|
||||
Description: req.Description,
|
||||
Status: "stopped",
|
||||
Hostname: req.Hostname,
|
||||
Alias: req.Alias,
|
||||
CloudInstanceName: req.CloudInstanceName,
|
||||
CloudInstanceID: req.CloudInstanceID,
|
||||
IP: req.IP,
|
||||
PublicIP: req.PublicIP,
|
||||
Port: req.Port,
|
||||
Username: req.Username,
|
||||
Password: req.Password,
|
||||
SSHKey: req.SSHKey,
|
||||
AuthType: req.AuthType,
|
||||
OS: req.OS,
|
||||
CPU: req.CPU,
|
||||
Memory: req.Memory,
|
||||
Disk: req.Disk,
|
||||
RegionID: req.RegionID,
|
||||
CloudID: req.CloudID,
|
||||
Tags: req.Tags,
|
||||
Description: req.Description,
|
||||
Status: "stopped",
|
||||
}
|
||||
|
||||
if req.Status != "" {
|
||||
@@ -295,6 +298,15 @@ func (h *ServerHandler) UpdateServer(c *gin.Context) {
|
||||
if req.Hostname != "" {
|
||||
updates["hostname"] = req.Hostname
|
||||
}
|
||||
if req.Alias != nil {
|
||||
updates["alias"] = *req.Alias
|
||||
}
|
||||
if req.CloudInstanceName != "" {
|
||||
updates["cloud_instance_name"] = req.CloudInstanceName
|
||||
}
|
||||
if req.CloudInstanceID != "" {
|
||||
updates["cloud_instance_id"] = req.CloudInstanceID
|
||||
}
|
||||
if req.IP != "" {
|
||||
updates["ip"] = req.IP
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user