feat: 实现客户端实例上报功能

- 新增 ClientInstance 模型,记录客户端 IP 与配置项的关联
- 配置拉取接口(fetchAll/fetchChanged)自动记录客户端信息
- 配置列表页面展示每个配置的在线客户端数量
- 点击可查看具体 IP 地址、拉取方式、最后拉取时间
- 超过 5 分钟未拉取的记录自动清理
- 注释掉 /api/ping 接口
This commit is contained in:
2026-04-27 21:07:37 +08:00
parent b4b38fa0c7
commit ed94f53306
9 changed files with 167 additions and 5 deletions
+5 -1
View File
@@ -42,6 +42,7 @@ func main() {
userHandler := handler.NewUserHandler(permService)
groupHandler := handler.NewGroupHandler()
profileHandler := handler.NewProfileHandler()
clientHandler := handler.NewClientHandler()
// init gin
r := gin.Default()
@@ -101,6 +102,9 @@ func main() {
admin.POST("/profile/delete/:id", profileHandler.Delete)
admin.POST("/profile/switch/:id", profileHandler.Switch)
admin.GET("/profile/options", profileHandler.Options)
// client instance management
admin.GET("/client/listByConfig", clientHandler.ListByConfigId)
}
// user info routes (JWT auth required)
@@ -116,7 +120,7 @@ func main() {
{
api.POST("/fetchAllConfigs", configApiHandler.FetchAllConfigs)
api.POST("/fetchChangedConfigs", configApiHandler.FetchChangedConfigs)
api.GET("/ping", configApiHandler.Ping)
// api.GET("/ping", configApiHandler.Ping)
}
// start server