From a1ef2d42d320f075c75e8cef52a879114441c103 Mon Sep 17 00:00:00 2001 From: sunty <1172534965@qq.com> Date: 星期三, 30 十月 2019 15:54:07 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- controllers/syssetcont.go | 32 +++++++++++++++++++++++++++----- 1 files changed, 27 insertions(+), 5 deletions(-) diff --git a/controllers/syssetcont.go b/controllers/syssetcont.go index 3be8a7a..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, "鏃跺尯鍙傛暟閿欒") @@ -356,3 +351,30 @@ info := sys.GetSysInfo() util.ResponseFormat(c, code.UpdateSuccess, info) } + +// @Summary 鏌ヨ绯荤粺鐘舵�侀槇鍊艰缃� +// @Description 鑾峰彇褰撳墠绯荤粺鐨勮繍琛岀姸鎬侊紝CPU, GPU, 鍐呭瓨鐨勯槇鍊奸厤缃� +// @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/sysThresholds [GET] +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