🎨新增客户端离线通知选项配置以及监听任务
All checks were successful
continuous-integration/drone/tag Build is passing

This commit is contained in:
coward
2024-06-13 14:34:03 +08:00
parent 67f394f136
commit 6f249d20b0
18 changed files with 155 additions and 132 deletions

View File

@@ -38,7 +38,7 @@ func (r clientRepo) List(p param.ClientList) (data []vo.Client, total int64, err
Scopes(utils.Page(p.Current, p.Size)).
Joins("LEFT JOIN t_user as tu ON twc.user_id = tu.id").
Select("twc.id", "twc.created_at", "twc.updated_at", "twc.name", "twc.email", "twc.subnet_range", "twc.ip_allocation as ip_allocation_str", "twc.allowed_ips as allowed_ips_str",
"twc.extra_allowed_ips as extra_allowed_ips_str", "twc.endpoint", "twc.use_server_dns", "twc.enable_after_creation", "twc.enabled", "twc.keys as keys_str", "tu.name as create_user")
"twc.extra_allowed_ips as extra_allowed_ips_str", "twc.endpoint", "twc.use_server_dns", "twc.enable_after_creation", "twc.enabled", "twc.keys as keys_str", "tu.name as create_user", "twc.offline_monitoring")
if p.Name != "" {
sel.Where("twc.name LIKE ?", "%"+p.Name+"%")
@@ -104,6 +104,7 @@ func (r clientRepo) Save(p param.SaveClient, adminId string) (client *entity.Cli
EnableAfterCreation: p.EnabledAfterCreation,
UserId: adminId,
Enabled: p.Enabled,
OfflineMonitoring: p.OfflineMonitoring,
}
// id不为空更新信息
@@ -113,7 +114,7 @@ func (r clientRepo) Save(p param.SaveClient, adminId string) (client *entity.Cli
if err = r.Model(&entity.Client{}).
Where("id = ?", p.Id).Select("name", "email", "subnet_range", "ip_allocation",
"allowed_ips", "extra_allowed_ips", "endpoint", "use_server_dns", "enable_after_creation",
"user_id", "enabled").
"user_id", "enabled", "offline_monitoring").
Updates(ent).Error; err != nil {
return
}
@@ -186,6 +187,7 @@ func (r clientRepo) Save(p param.SaveClient, adminId string) (client *entity.Cli
Keys: string(keysStr),
UserId: adminId,
Enabled: p.Enabled,
OfflineMonitoring: p.OfflineMonitoring,
}
err = r.Model(&entity.Client{}).Create(ent).Error