From 6bda9406fb0401b37504a1e8ea891c3aa72811df Mon Sep 17 00:00:00 2001 From: link Date: Wed, 7 Dec 2022 10:57:27 +0800 Subject: [PATCH] fixed (#741) --- route/v1/system.go | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/route/v1/system.go b/route/v1/system.go index 5c04e1034..e8bfd68a2 100644 --- a/route/v1/system.go +++ b/route/v1/system.go @@ -337,17 +337,12 @@ func GetSystemProxy(c *gin.Context) { func PutSystemState(c *gin.Context) { state := c.Param("state") if state == "off" { - go func() { - time.Sleep(30 * time.Second) - service.MyService.System().SystemShutdown() - }() + service.MyService.System().SystemShutdown() } else if state == "restart" { - go func() { - time.Sleep(30 * time.Second) - service.MyService.System().SystemReboot() - }() + service.MyService.System().SystemReboot() + } - c.JSON(http.StatusOK, model.Result{Success: common_err.SUCCESS, Message: common_err.GetMsg(common_err.SUCCESS), Data: "The operation will be executed after 30 seconds"}) + c.JSON(http.StatusOK, model.Result{Success: common_err.SUCCESS, Message: common_err.GetMsg(common_err.SUCCESS), Data: "The operation will be completed shortly."}) } // @Summary 获取一个可用端口