fix: 去除开站引导系统重置判断
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
package controller
|
package controller
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"runtime"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"be.ems/src/framework/constants"
|
"be.ems/src/framework/constants"
|
||||||
@@ -8,6 +9,7 @@ import (
|
|||||||
"be.ems/src/framework/reqctx"
|
"be.ems/src/framework/reqctx"
|
||||||
"be.ems/src/framework/resp"
|
"be.ems/src/framework/resp"
|
||||||
"be.ems/src/framework/token"
|
"be.ems/src/framework/token"
|
||||||
|
"be.ems/src/framework/utils/cmd"
|
||||||
"be.ems/src/framework/utils/machine"
|
"be.ems/src/framework/utils/machine"
|
||||||
"be.ems/src/framework/utils/regular"
|
"be.ems/src/framework/utils/regular"
|
||||||
"be.ems/src/modules/common/service"
|
"be.ems/src/modules/common/service"
|
||||||
@@ -122,9 +124,25 @@ func (s *BootloaderController) Reset(c *gin.Context) {
|
|||||||
// return
|
// return
|
||||||
// }
|
// }
|
||||||
|
|
||||||
if err := machine.Reset(); err != nil {
|
// if err := machine.Reset(); err != nil {
|
||||||
c.JSON(200, resp.ErrMsg(err.Error()))
|
// c.JSON(200, resp.ErrMsg(err.Error()))
|
||||||
return
|
// return
|
||||||
|
// }
|
||||||
|
|
||||||
|
// 重置数据库
|
||||||
|
if runtime.GOOS == "windows" {
|
||||||
|
// return fmt.Errorf("not support window")
|
||||||
|
} else {
|
||||||
|
// 重置数据库
|
||||||
|
if _, err := cmd.Execf("sudo cp -rf /usr/local/omc/etc/db/omc_db.sqlite /usr/local/omc/database/omc_db.sqlite"); err != nil {
|
||||||
|
c.JSON(200, resp.ErrMsg(err.Error()))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
// 重启服务
|
||||||
|
if _, err := cmd.Execf("nohup sh -c \"sleep 1s && %s\" > /dev/null 2>&1 &", "sudo systemctl restart restagent"); err != nil {
|
||||||
|
c.JSON(200, resp.ErrMsg(err.Error()))
|
||||||
|
return
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 清除授权信息
|
// 清除授权信息
|
||||||
|
|||||||
Reference in New Issue
Block a user