feat: 添加节点自动更新功能,支持手动触发更新

This commit is contained in:
ryan
2026-03-10 20:32:27 +08:00
parent 83a11ead2b
commit e72d658e2f
18 changed files with 227 additions and 90 deletions
+26 -1
View File
@@ -3,9 +3,10 @@ package controller
import (
"atsflare/service"
"encoding/json"
"github.com/gin-gonic/gin"
"net/http"
"strconv"
"github.com/gin-gonic/gin"
)
func CreateNode(c *gin.Context) {
@@ -117,3 +118,27 @@ func DeleteNode(c *gin.Context) {
"message": "",
})
}
func RequestNodeAgentUpdate(c *gin.Context) {
id, err := strconv.ParseUint(c.Param("id"), 10, 64)
if err != nil || id == 0 {
c.JSON(http.StatusBadRequest, gin.H{
"success": false,
"message": "无效的参数",
})
return
}
node, err := service.RequestNodeAgentUpdate(uint(id))
if err != nil {
c.JSON(http.StatusOK, gin.H{
"success": false,
"message": err.Error(),
})
return
}
c.JSON(http.StatusOK, gin.H{
"success": true,
"message": "",
"data": node,
})
}