update
This commit is contained in:
1 parent
45fc174cc2
commit
52a77636fb
3 files changed
+3
-11
No files matched your search
@@ -7,7 +7,6 @@ import (
|
||||
"github.com/shirou/gopsutil/mem"
|
||||
"go-admin/pkg/app"
|
||||
"runtime"
|
||||
"time"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -28,15 +27,11 @@ func ServerInfo(c *gin.Context) {
|
||||
osDic["numGoroutine"] = runtime.NumGoroutine()
|
||||
|
||||
dis, _ := disk.Usage("/")
|
||||
diskUsedGB := int(dis.Used) / GB
|
||||
diskTotalGB := int(dis.Total) / GB
|
||||
diskFreeGB := int(dis.Free) / GB
|
||||
diskUsedPercent := int(dis.UsedPercent)
|
||||
diskDic := make(map[string]interface{}, 0)
|
||||
diskDic["total"] = diskTotalGB
|
||||
diskDic["used"] = diskUsedGB
|
||||
diskDic["free"] = diskFreeGB
|
||||
diskDic["usage"] = diskUsedPercent
|
||||
|
||||
mem, _ := mem.VirtualMemory()
|
||||
memUsedMB := int(mem.Used) / GB
|
||||
@@ -49,12 +44,9 @@ func ServerInfo(c *gin.Context) {
|
||||
memDic["free"] = memFreeMB
|
||||
memDic["usage"] = memUsedPercent
|
||||
|
||||
cpuPercent, _ := cpu.Percent(time.Duration(200)*time.Millisecond, true)
|
||||
cpuDic := make(map[string]interface{}, 0)
|
||||
cpuDic["cpuNum"], _ = cpu.Counts(false)
|
||||
cpuDic["user"] = cpuPercent[cpu.CPUser]
|
||||
cpuDic["nice"] = cpuPercent[cpu.CPNice]
|
||||
cpuDic["sys"] = cpuPercent[cpu.CPSys]
|
||||
|
||||
|
||||
app.Custum(c, gin.H{
|
||||
"code": 200,
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
)
|
||||
|
||||
type SysColumns struct {
|
||||
ColumnId int `gorm:"primary_key;AUTO_INCREMENT" json:"columnId"`
|
||||
ColumnId int `gorm:"primary_key;auto_increment" json:"columnId"`
|
||||
TableId int `gorm:"type:int(11);" json:"tableId"`
|
||||
ColumnName string `gorm:"type:varchar(128);" json:"columnName"`
|
||||
ColumnComment string `gorm:"column:column_comment;type:varchar(128);" json:"columnComment"`
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
)
|
||||
|
||||
type SysTables struct {
|
||||
TableId int `gorm:"primary_key;AUTO_INCREMENT" json:"tableId"` //表编码
|
||||
TableId int `gorm:"primary_key;auto_increment" json:"tableId"` //表编码
|
||||
TableName string `gorm:"type:varchar(255);" json:"tableName"` //表名称
|
||||
TableComment string `gorm:"type:varchar(255);" json:"tableComment"` //表备注
|
||||
ClassName string `gorm:"type:varchar(255);" json:"className"` //类名
|
||||
|
||||
Reference in new issue
Block a user