Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
LinkLeong authored Dec 7, 2022
1 parent be9a010 commit 6bda940
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions route/v1/system.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 获取一个可用端口
Expand Down

0 comments on commit 6bda940

Please sign in to comment.