LingxinMeng 1 ano atrás
pai
commit
41f4134b30
2 arquivos alterados com 7 adições e 7 exclusões
  1. 4 4
      amd64/web-server/handler/h_monitor.go
  2. 3 3
      amd64/web-server/main.go

+ 4 - 4
amd64/web-server/handler/h_monitor.go

@@ -10,10 +10,10 @@ import (
 )
 
 type DeviceMonitor struct {
-	Id               int    `db:"id"`                 // 自增id
-	TotalCpuUsage    string `db:"total_cpu_usage"`    // cpu总占用
-	TotalMemoryUsage string `db:"total_memory_usage"` // 内存总占用
-	Top10Process     string `db:"top10_process"`      // cpu占用前十的进程信息
+	Id               int    `db:"id" json:"id"`                               // 自增id
+	TotalCpuUsage    string `db:"total_cpu_usage" json:"totalCpuUsage"`       // cpu总占用
+	TotalMemoryUsage string `db:"total_memory_usage" json:"totalMemoryUsage"` // 内存总占用
+	Top10Process     string `db:"top10_process" json:"top10Process"`          // cpu占用前十的进程信息
 }
 
 // SaveDeviceMonitor 保存实车上传的监控信息

+ 3 - 3
amd64/web-server/main.go

@@ -48,10 +48,10 @@ func init() {
 		ApplicationYaml.Log.Prefix,
 	)
 	c_db.InitSqlxMysql(
-		ApplicationYaml.Mysql.Ip,
-		ApplicationYaml.Mysql.Port,
 		ApplicationYaml.Mysql.Username,
 		ApplicationYaml.Mysql.Password,
+		ApplicationYaml.Mysql.Ip,
+		ApplicationYaml.Mysql.Port,
 		ApplicationYaml.Mysql.Dbname,
 		ApplicationYaml.Mysql.Charset,
 	)
@@ -73,7 +73,7 @@ func main() {
 	reportPrefix.POST("/page", handler.Page) // 分页查询
 	//reportPrefix.POST("/pdf", handler.Hello)  // pdf下载
 	monitorPrefix := projectPrefix.Group("/monitor")
-	monitorPrefix.POST("/save", handler.SaveDeviceMonitor)
+	monitorPrefix.POST("/insert", handler.SaveDeviceMonitor)
 	// 端口
 	err := router.Run(":" + ApplicationYaml.Web.Port)
 	if err != nil {