From 863c880b169a788fe74b27187baa2e3f60b72ed2 Mon Sep 17 00:00:00 2001 From: zhangzengfei <zhangzengfei@iotlink.com> Date: 星期三, 30 十月 2019 15:19:23 +0800 Subject: [PATCH] feat: add reboot --- controllers/syssetcont.go | 21 ++++++++++++++++----- 1 files changed, 16 insertions(+), 5 deletions(-) diff --git a/controllers/syssetcont.go b/controllers/syssetcont.go index 1ba05ba..8034844 100644 --- a/controllers/syssetcont.go +++ b/controllers/syssetcont.go @@ -318,11 +318,6 @@ return } - if root := sys.CheckRootPermissions(); !root { - util.ResponseFormat(c, code.ServiceInsideError, "鏈嶅姟鍣ㄦ病鏈変慨鏀规椂闂寸殑鏉冮檺") - return - } - if args.TimeZone != "CST" && args.TimeZone != "UTC" { if r := sys.SetTimeZone(args.TimeZone); !r { util.ResponseFormat(c, code.RequestParamError, "鏃跺尯鍙傛暟閿欒") @@ -367,3 +362,19 @@ func (sset SysSetController) GetSysThresholds(c *gin.Context) { util.ResponseFormat(c, code.UpdateSuccess, config.Server.SysThresholds) } + +// @Summary 閲嶅惎绯荤粺 +// @Description 閲嶅惎鎿嶄綔绯荤粺 +// @Produce json +// @Tags sysset +// @Success 200 {string} json "{"code":200, msg:"鐩綍缁撴瀯鏁版嵁", success:true}" +// @Failure 500 {string} json "{"code":500, msg:"杩斿洖閿欒淇℃伅", success:false}" +// @Router /data/api-v/sysset/reboot [GET] +func (sset SysSetController) RebootOS(c *gin.Context) { + if isOk, msg := sys.Reboot(); !isOk { + util.ResponseFormat(c, code.UpdateFail, msg) + return + } + + util.ResponseFormat(c, code.Success, "姝e湪閲嶅惎") +} -- Gitblit v1.8.0