@@ -46,7 +46,7 @@ func (c *SystemController) GetOne() {
4646 c .ServeJSON ()
4747}
4848
49- // GetOne ...
49+ // PutOne 更新初始化数据 ...
5050// @Title Get One
5151// @Description get Alarm by id
5252// @Param X-Token header string true "x-token in header"
@@ -58,18 +58,19 @@ func (c *SystemController) GetOne() {
5858func (c * SystemController ) PutOne () {
5959 idStr := c .Ctx .Input .Param (":id" )
6060 id , _ := strconv .Atoi (idStr )
61- cpu_core := gjson .Get (string (c .Ctx .Input .RequestBody ), "cpu_core" ).String ()
62- uptime_id := gjson .Get (string (c .Ctx .Input .RequestBody ), "uptime_id" ).String ()
63- cpu_utilization_id := gjson .Get (string (c .Ctx .Input .RequestBody ), "cpu_utilization_id" ).String ()
64- group_id := gjson .Get (string (c .Ctx .Input .RequestBody ), "group_id" ).String ()
65- memory_total_id := gjson .Get (string (c .Ctx .Input .RequestBody ), "memory_total_id" ).String ()
66- memory_used_id := gjson .Get (string (c .Ctx .Input .RequestBody ), "memory_used_id" ).String ()
67- memory_utilization_id := gjson .Get (string (c .Ctx .Input .RequestBody ), "memory_utilization_id" ).String ()
61+ cpuCore := gjson .Get (string (c .Ctx .Input .RequestBody ), "cpu_core" ).String ()
62+ uptimeId := gjson .Get (string (c .Ctx .Input .RequestBody ), "uptime_id" ).String ()
63+ cpuUtilizationId := gjson .Get (string (c .Ctx .Input .RequestBody ), "cpu_utilization_id" ).String ()
64+ groupId := gjson .Get (string (c .Ctx .Input .RequestBody ), "group_id" ).String ()
65+ memoryTotalId := gjson .Get (string (c .Ctx .Input .RequestBody ), "memory_total_id" ).String ()
66+ memoryUsedId := gjson .Get (string (c .Ctx .Input .RequestBody ), "memory_used_id" ).String ()
67+ memoryUtilizationId := gjson .Get (string (c .Ctx .Input .RequestBody ), "memory_utilization_id" ).String ()
6868 model := gjson .Get (string (c .Ctx .Input .RequestBody ), "model" ).String ()
69- v := models.System {ID : int64 (id ), CPUCore : cpu_core , CPUUtilizationID : cpu_utilization_id ,
70- GroupID : group_id , MemoryTotalID : memory_total_id , UptimeID : uptime_id , Model : model ,
71- MemoryUsedID : memory_used_id , MemoryUtilizationID : memory_utilization_id ,
72- }
69+ pingTemplateId := gjson .Get (string (c .Ctx .Input .RequestBody ), "ping_template_id" ).String ()
70+ v := models.System {ID : int64 (id ), CPUCore : cpuCore , CPUUtilizationID : cpuUtilizationId ,
71+ GroupID : groupId , MemoryTotalID : memoryTotalId , UptimeID : uptimeId , Model : model ,
72+ MemoryUsedID : memoryUsedId , MemoryUtilizationID : memoryUtilizationId ,
73+ PingTemplateID : pingTemplateId }
7374 err := models .UpdateSystem (& v )
7475 if err != nil {
7576 SystemRes .Code = 500
0 commit comments