修复一个导致边缘节点信息更新不完全的问题

This commit is contained in:
2025-05-28 16:03:19 +08:00
parent 933c947b3e
commit 41dcc14f5f
2 changed files with 17 additions and 10 deletions

View File

@@ -217,12 +217,6 @@ func ProxyReportUpdate(c *fiber.Ctx) (err error) {
var otherEdges = make([]*ProxyEdge, 0, len(req.Edges))
for _, edge := range req.Edges {
// 跳过不方便批量操作的边缘节点
if edge.Port != nil || edge.Prov != nil || edge.City != nil {
otherEdges = append(otherEdges, edge)
continue
}
// 检查更新ISP
if edge.Isp != nil {
switch edge2.ISPFromStr(*edge.Isp) {
@@ -245,15 +239,21 @@ func ProxyReportUpdate(c *fiber.Ctx) (err error) {
idsInactive = append(idsInactive, edge.Id)
}
}
// 无法分类更新
if edge.Host != nil || edge.Port != nil || edge.Prov != nil || edge.City != nil {
otherEdges = append(otherEdges, edge)
continue
}
}
slog.Debug("更新边缘节点信息",
"active", len(idsActive),
"inactive", len(idsInactive),
"isp_unknown", len(idsIspUnknown),
"isp_china_telecom", len(idsIspTelecom),
"isp_china_unicom", len(idsIspUnicom),
"isp_china_mobile", len(idsIspMobile),
"isp_telecom", len(idsIspTelecom),
"isp_unicom", len(idsIspUnicom),
"isp_mobile", len(idsIspMobile),
"other_edges", len(otherEdges),
)
@@ -319,6 +319,9 @@ func ProxyReportUpdate(c *fiber.Ctx) (err error) {
do := q.Edge.Debug().Where(q.Edge.ID.Eq(edge.Id))
var assigns = make([]field.AssignExpr, 0, 5)
if edge.Host != nil {
assigns = append(assigns, q.Edge.Host.Value(*edge.Host))
}
if edge.Port != nil {
assigns = append(assigns, q.Edge.ProxyPort.Value(*edge.Port))
}