修复一个导致边缘节点信息更新不完全的问题
This commit is contained in:
@@ -1,7 +1,11 @@
|
||||
## TODO
|
||||
|
||||
### 长期
|
||||
|
||||
模型字段修改,特定枚举字段使用自定义类型代替通用 int32
|
||||
|
||||
更新接口可以传输更结构化的数据,直接区分不同类型以加快更新速度
|
||||
|
||||
## 业务逻辑
|
||||
|
||||
### 代理服务与节点的增量更新
|
||||
@@ -19,7 +23,7 @@
|
||||
| 0 | 保留位,预留扩展 |
|
||||
| 1 | 空,固定为 0 |
|
||||
| 2 | 空,固定为 0 |
|
||||
| 3 | 端口 |
|
||||
| 3 | 端口 |
|
||||
| 4 | 省份 |
|
||||
| 5 | 城市 |
|
||||
| 6 | 运营商 |
|
||||
|
||||
@@ -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))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user