package com.usky.system.controller.web;

import com.usky.system.domain.SystemHardwareInfo;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/oshi")
public class SystemInfoController {

    @GetMapping("/list")
    public SystemHardwareInfo getSystemHardwareInfo() {
        SystemHardwareInfo systemHardwareInfo = new SystemHardwareInfo();
        try {
            // 调用 copyTo() 方法填充数据
            systemHardwareInfo.copyTo();
        } catch (Exception e) {
            // 日志记录异常信息
            e.printStackTrace();
            // 可以根据需要返回错误信息或空对象
            return null;
        }
        // 返回填充后的数据
        return systemHardwareInfo;
    }
}