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"
|
"github.com/shirou/gopsutil/mem"
|
||||||
"go-admin/pkg/app"
|
"go-admin/pkg/app"
|
||||||
"runtime"
|
"runtime"
|
||||||
"time"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -28,15 +27,11 @@ func ServerInfo(c *gin.Context) {
|
|||||||
osDic["numGoroutine"] = runtime.NumGoroutine()
|
osDic["numGoroutine"] = runtime.NumGoroutine()
|
||||||
|
|
||||||
dis, _ := disk.Usage("/")
|
dis, _ := disk.Usage("/")
|
||||||
diskUsedGB := int(dis.Used) / GB
|
|
||||||
diskTotalGB := int(dis.Total) / GB
|
diskTotalGB := int(dis.Total) / GB
|
||||||
diskFreeGB := int(dis.Free) / GB
|
diskFreeGB := int(dis.Free) / GB
|
||||||
diskUsedPercent := int(dis.UsedPercent)
|
|
||||||
diskDic := make(map[string]interface{}, 0)
|
diskDic := make(map[string]interface{}, 0)
|
||||||
diskDic["total"] = diskTotalGB
|
diskDic["total"] = diskTotalGB
|
||||||
diskDic["used"] = diskUsedGB
|
|
||||||
diskDic["free"] = diskFreeGB
|
diskDic["free"] = diskFreeGB
|
||||||
diskDic["usage"] = diskUsedPercent
|
|
||||||
|
|
||||||
mem, _ := mem.VirtualMemory()
|
mem, _ := mem.VirtualMemory()
|
||||||
memUsedMB := int(mem.Used) / GB
|
memUsedMB := int(mem.Used) / GB
|
||||||
@@ -49,12 +44,9 @@ func ServerInfo(c *gin.Context) {
|
|||||||
memDic["free"] = memFreeMB
|
memDic["free"] = memFreeMB
|
||||||
memDic["usage"] = memUsedPercent
|
memDic["usage"] = memUsedPercent
|
||||||
|
|
||||||
cpuPercent, _ := cpu.Percent(time.Duration(200)*time.Millisecond, true)
|
|
||||||
cpuDic := make(map[string]interface{}, 0)
|
cpuDic := make(map[string]interface{}, 0)
|
||||||
cpuDic["cpuNum"], _ = cpu.Counts(false)
|
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{
|
app.Custum(c, gin.H{
|
||||||
"code": 200,
|
"code": 200,
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type SysColumns struct {
|
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"`
|
TableId int `gorm:"type:int(11);" json:"tableId"`
|
||||||
ColumnName string `gorm:"type:varchar(128);" json:"columnName"`
|
ColumnName string `gorm:"type:varchar(128);" json:"columnName"`
|
||||||
ColumnComment string `gorm:"column:column_comment;type:varchar(128);" json:"columnComment"`
|
ColumnComment string `gorm:"column:column_comment;type:varchar(128);" json:"columnComment"`
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type SysTables struct {
|
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"` //表名称
|
TableName string `gorm:"type:varchar(255);" json:"tableName"` //表名称
|
||||||
TableComment string `gorm:"type:varchar(255);" json:"tableComment"` //表备注
|
TableComment string `gorm:"type:varchar(255);" json:"tableComment"` //表备注
|
||||||
ClassName string `gorm:"type:varchar(255);" json:"className"` //类名
|
ClassName string `gorm:"type:varchar(255);" json:"className"` //类名
|
||||||
|
|||||||
Reference in new issue
Block a user