|
|
@@ -57,6 +57,9 @@ public class SystemController {
|
|
|
public String getSystemConfig() {
|
|
|
ResponseResult<SystemBean> responseResult = new ResponseResult<SystemBean>();
|
|
|
SystemBean systemBean = systemRepository.findSystemBean();
|
|
|
+ if (systemBean == null) {
|
|
|
+ systemBean = new SystemBean();
|
|
|
+ }
|
|
|
responseResult.setContent(systemBean);
|
|
|
responseResult.setCode(ResultCode.SUCCESS);
|
|
|
responseResult.setMessage("获取成功");
|
|
|
@@ -83,7 +86,40 @@ public class SystemController {
|
|
|
|
|
|
switch (configType) {
|
|
|
case CONFIG_TYPE_REST:
|
|
|
+ // 休息模式,禁止访问
|
|
|
systemBean.isRestMode = booleanValue;
|
|
|
+ // 控制图片nginx路径:/www/server/panel/vhost/nginx/home.com.config
|
|
|
+ // 注意坑:renameTo不能重命名为不同后缀的文件
|
|
|
+ File normalFile = new File("/file/eden/");
|
|
|
+ File limitFile = new File("/file/ydy");
|
|
|
+ if (booleanValue) {
|
|
|
+ // 限制
|
|
|
+ if (normalFile.exists()) {
|
|
|
+ try {
|
|
|
+ normalFile.renameTo(limitFile);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (limitFile.exists()) {
|
|
|
+ try {
|
|
|
+ limitFile.renameTo(normalFile);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /*String limitCmd = "mv /file/eden /file/ydy";
|
|
|
+ String normalCmd = "mv /file/ydy /file/eden";
|
|
|
+ if (booleanValue) {
|
|
|
+ exeCmd(limitCmd);
|
|
|
+ } else {
|
|
|
+ exeCmd(normalCmd);
|
|
|
+ }*/
|
|
|
+ //String reloadNginx = "nginx -s reload";
|
|
|
+ //exeCmd(reloadNginx);
|
|
|
break;
|
|
|
case CONFIG_TYPE_WALK:
|
|
|
systemBean.isWalking = booleanValue;
|