This commit is contained in:
link 2022-12-07 10:57:27 +08:00 committed by GitHub
parent be9a010d17
commit 6bda9406fb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -337,17 +337,12 @@ func GetSystemProxy(c *gin.Context) {
func PutSystemState(c *gin.Context) { func PutSystemState(c *gin.Context) {
state := c.Param("state") state := c.Param("state")
if state == "off" { if state == "off" {
go func() { service.MyService.System().SystemShutdown()
time.Sleep(30 * time.Second)
service.MyService.System().SystemShutdown()
}()
} else if state == "restart" { } else if state == "restart" {
go func() { service.MyService.System().SystemReboot()
time.Sleep(30 * time.Second)
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 获取一个可用端口 // @Summary 获取一个可用端口