feat: 新增预警定时扫描器,移除附件归档字段并为角色表补充更新时间
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
package handler
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"os"
|
||||
"runtime"
|
||||
"time"
|
||||
|
||||
"bj_power_wms/internal/svc"
|
||||
)
|
||||
|
||||
// processStartTime 进程启动时刻(包加载即服务启动,用于计算运行时长)。
|
||||
var processStartTime = time.Now()
|
||||
|
||||
// SystemInfoHandler GET /api/system/info 只读本机信息面板数据。
|
||||
// 含 OS / 主机名 / Go 版本 / 监听端口 / 启动时间 / MES 地址(MES 地址只读,修改需改配置文件并重启)。
|
||||
func SystemInfoHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
host, _ := os.Hostname()
|
||||
c := svcCtx.Config
|
||||
ok(w, map[string]any{
|
||||
"os": runtime.GOOS,
|
||||
"hostname": host,
|
||||
"goVersion": runtime.Version(),
|
||||
"port": c.Port,
|
||||
"startTime": processStartTime.Unix(),
|
||||
"uptimeSeconds": int64(time.Since(processStartTime).Seconds()),
|
||||
"mesAddress": c.Mes.BaseURL,
|
||||
})
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user