feat: 更新多个模块以支持新的数据结构和日志格式
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
package service
|
||||
|
||||
import (
|
||||
"be.ems/src/framework/vo"
|
||||
packetTask "be.ems/src/modules/trace/packet_task"
|
||||
)
|
||||
|
||||
@@ -12,8 +11,8 @@ var NewPacket = &Packet{}
|
||||
type Packet struct{}
|
||||
|
||||
// NetworkDevices 获取网卡设备信息
|
||||
func (s *Packet) NetworkDevices() []vo.TreeSelect {
|
||||
arr := make([]vo.TreeSelect, 0)
|
||||
func (s *Packet) NetworkDevices() []map[string]any {
|
||||
arr := make([]map[string]any, 0)
|
||||
devices, err := packetTask.NetworkDevices()
|
||||
if err != nil {
|
||||
return arr
|
||||
@@ -28,16 +27,16 @@ func (s *Packet) NetworkDevices() []vo.TreeSelect {
|
||||
if lable == "" {
|
||||
lable = device.Name
|
||||
}
|
||||
item := vo.TreeSelect{
|
||||
ID: device.Name,
|
||||
Label: lable,
|
||||
Children: []vo.TreeSelect{},
|
||||
item := map[string]any{
|
||||
"id": device.Name,
|
||||
"label": lable,
|
||||
"children": []map[string]any{},
|
||||
}
|
||||
|
||||
for _, address := range device.Addresses {
|
||||
if address.IP != nil {
|
||||
ip := address.IP.String()
|
||||
item.Children = append(item.Children, vo.TreeSelect{ID: ip, Label: ip})
|
||||
item["children"] = append(item["children"].([]map[string]any), map[string]any{"id": ip, "label": ip})
|
||||
}
|
||||
}
|
||||
arr = append(arr, item)
|
||||
|
||||
Reference in New Issue
Block a user