From 0caf81660cfdd3ddf27586955f805667a4a4e96b Mon Sep 17 00:00:00 2001 From: PandaGoAdmin <18610165312@163.com> Date: Sun, 19 Dec 2021 22:52:54 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9C=8D=E5=8A=A1=E7=9B=91=E6=8E=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- system/api/system.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/system/api/system.go b/system/api/system.go index a088b21..ce3cfcf 100644 --- a/system/api/system.go +++ b/system/api/system.go @@ -34,18 +34,21 @@ func (s *System) ServerInfo(g *gin.Context) { diskDic["total"] = total / GB diskDic["free"] = free / GB diskDic["used"] = used / GB + diskDic["progress"] = int64((float64(used) / float64(total)) * 100) used2, free2, total2 := kgo.KOS.MemoryUsage(true) memDic := make(map[string]interface{}, 0) memDic["total"] = total2 / GB memDic["used"] = used2 / GB memDic["free"] = free2 / GB + memDic["progress"] = int64((float64(used2) / float64(total2)) * 100) cpuDic := make(map[string]interface{}, 0) used3, idle, total3 := kgo.KOS.CpuUsage() cpuDic["total"] = total3 / GB cpuDic["used"] = used3 / GB cpuDic["free"] = idle / GB + cpuDic["progress"] = int64((float64(used3) / float64(total3)) * 100) g.JSON(http.StatusOK, gin.H{ "code": 200,