- 添加OsDevice模型和OsDevicesController - 实现WindowsScannerService用于网络扫描和WMI查询 - 添加AMT设备UUID查询功能(从CIM_ComputerSystemPackage获取PlatformGUID) - 实现PlatformGUID到标准UUID格式的转换(字节序转换) - 修复HardwareInfoRepository保存UUID的问题 - 前端添加OS设备管理页面和UUID获取/刷新按钮 - 添加数据库迁移脚本
104 lines
2.2 KiB
C#
104 lines
2.2 KiB
C#
using System.ComponentModel.DataAnnotations;
|
||
using System.ComponentModel.DataAnnotations.Schema;
|
||
|
||
namespace AmtScanner.Api.Models;
|
||
|
||
/// <summary>
|
||
/// 操作系统设备实体
|
||
/// </summary>
|
||
public class OsDevice
|
||
{
|
||
[Key]
|
||
public long Id { get; set; }
|
||
|
||
/// <summary>
|
||
/// IP 地址
|
||
/// </summary>
|
||
[Required]
|
||
public string IpAddress { get; set; } = string.Empty;
|
||
|
||
/// <summary>
|
||
/// 系统 UUID(SMBIOS UUID,用于与 AMT 绑定)
|
||
/// </summary>
|
||
public string? SystemUuid { get; set; }
|
||
|
||
/// <summary>
|
||
/// 主机名
|
||
/// </summary>
|
||
public string? Hostname { get; set; }
|
||
|
||
/// <summary>
|
||
/// 操作系统类型
|
||
/// </summary>
|
||
public OsType OsType { get; set; } = OsType.Unknown;
|
||
|
||
/// <summary>
|
||
/// 操作系统版本
|
||
/// </summary>
|
||
public string? OsVersion { get; set; }
|
||
|
||
/// <summary>
|
||
/// 操作系统架构
|
||
/// </summary>
|
||
public string? Architecture { get; set; }
|
||
|
||
/// <summary>
|
||
/// 当前登录用户
|
||
/// </summary>
|
||
public string? LoggedInUser { get; set; }
|
||
|
||
/// <summary>
|
||
/// 系统最后启动时间
|
||
/// </summary>
|
||
public DateTime? LastBootTime { get; set; }
|
||
|
||
/// <summary>
|
||
/// MAC 地址
|
||
/// </summary>
|
||
public string? MacAddress { get; set; }
|
||
|
||
/// <summary>
|
||
/// 是否在线
|
||
/// </summary>
|
||
public bool IsOnline { get; set; }
|
||
|
||
/// <summary>
|
||
/// 最后在线时间
|
||
/// </summary>
|
||
public DateTime? LastOnlineAt { get; set; }
|
||
|
||
/// <summary>
|
||
/// 发现时间
|
||
/// </summary>
|
||
public DateTime DiscoveredAt { get; set; } = DateTime.UtcNow;
|
||
|
||
/// <summary>
|
||
/// 最后更新时间
|
||
/// </summary>
|
||
public DateTime LastUpdatedAt { get; set; } = DateTime.UtcNow;
|
||
|
||
/// <summary>
|
||
/// 备注
|
||
/// </summary>
|
||
public string? Description { get; set; }
|
||
|
||
/// <summary>
|
||
/// 关联的 AMT 设备 ID
|
||
/// </summary>
|
||
public long? AmtDeviceId { get; set; }
|
||
|
||
/// <summary>
|
||
/// 关联的 AMT 设备
|
||
/// </summary>
|
||
[ForeignKey(nameof(AmtDeviceId))]
|
||
public AmtDevice? AmtDevice { get; set; }
|
||
}
|
||
|
||
public enum OsType
|
||
{
|
||
Unknown = 0,
|
||
Windows = 1,
|
||
Linux = 2,
|
||
MacOS = 3
|
||
}
|