From 381c314d61a4c161abb882b6bf8ed17365734e88 Mon Sep 17 00:00:00 2001 From: witersen <1801168257@qq.com> Date: Mon, 9 May 2022 22:35:35 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=AE=88=E6=8A=A4=E8=BF=9B?= =?UTF-8?q?=E7=A8=8Bbind=E5=A4=B1=E8=B4=A5=EF=BC=8C=E5=8D=B3=E8=A7=A3?= =?UTF-8?q?=E5=86=B3=E7=AB=AF=E5=8F=A3=E9=87=8D=E7=94=A8=E9=97=AE=E9=A2=98?= =?UTF-8?q?=EF=BC=881=E5=B9=B4=E7=9A=84bug=E8=A7=A3=E5=86=B3=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 01.web/src/views/advance/index.vue | 17 ++++++----------- 02.php/api.php | 4 ++-- 02.php/app/service/Svn.php | 8 ++++---- 02.php/app/service/base/Base.php | 10 +++++----- 02.php/server/svnadmind.php | 21 +++++++++++++++------ 5 files changed, 32 insertions(+), 28 deletions(-) diff --git a/01.web/src/views/advance/index.vue b/01.web/src/views/advance/index.vue index 41f0c7d..fd5502b 100644 --- a/01.web/src/views/advance/index.vue +++ b/01.web/src/views/advance/index.vue @@ -12,18 +12,13 @@ - - + + diff --git a/02.php/api.php b/02.php/api.php index 33c9bc6..e0374c0 100644 --- a/02.php/api.php +++ b/02.php/api.php @@ -3,7 +3,7 @@ * @Author: witersen * @Date: 2022-04-24 23:37:06 * @LastEditors: witersen - * @LastEditTime: 2022-05-09 17:35:57 + * @LastEditTime: 2022-05-09 21:11:05 * @Description: QQ:1801168257 */ @@ -99,7 +99,7 @@ $state = FunDetectState(); if ($state == 0) { json1(401, 0, '守护进程响应超时'); } else if ($state == 2) { - json1(401, 0, '守护进程未启动'); + json1(401, 0, '后台程序未启动'); } /** diff --git a/02.php/app/service/Svn.php b/02.php/app/service/Svn.php index a7b509b..bee890a 100644 --- a/02.php/app/service/Svn.php +++ b/02.php/app/service/Svn.php @@ -3,7 +3,7 @@ * @Author: witersen * @Date: 2022-04-24 23:37:05 * @LastEditors: witersen - * @LastEditTime: 2022-05-09 17:04:19 + * @LastEditTime: 2022-05-09 20:52:21 * @Description: QQ:1801168257 */ @@ -25,7 +25,7 @@ class Svn extends Base $result = $result['result']; if ($result == '') { - return message(200, 0, 'svnserve服务未在运行,SVN用户将无法使用仓库浏览功能'); + return message(200, 0, 'svnserve服务未在运行,SVN用户将无法使用系统的仓库在线内容浏览功能'); } else { return message(); } @@ -75,7 +75,7 @@ class Svn extends Base //运行中+已加入环境变量 if ($isRun && $isInstall) { - return 1; + return 2; } //未运行+未加入环境变量 @@ -85,7 +85,7 @@ class Svn extends Base //未运行+已加入环境变量 if (!$isRun && $isInstall) { - return 2; + return 1; } } diff --git a/02.php/app/service/base/Base.php b/02.php/app/service/base/Base.php index 65f3654..b8ab04e 100644 --- a/02.php/app/service/base/Base.php +++ b/02.php/app/service/base/Base.php @@ -3,7 +3,7 @@ * @Author: witersen * @Date: 2022-05-06 18:42:00 * @LastEditors: witersen - * @LastEditTime: 2022-05-09 16:38:22 + * @LastEditTime: 2022-05-09 21:10:15 * @Description: QQ:1801168257 */ @@ -203,7 +203,7 @@ class Base return [ 'code' => 401, 'status' => 0, - 'message' => '非法请求', + 'message' => 'token为空', 'data' => [] ]; } @@ -213,7 +213,7 @@ class Base return [ 'code' => 401, 'status' => 0, - 'message' => '非法请求', + 'message' => 'token格式错误', 'data' => [] ]; } @@ -226,7 +226,7 @@ class Base return [ 'code' => 401, 'status' => 0, - 'message' => '非法请求', + 'message' => 'token格式错误', 'data' => [] ]; } @@ -239,7 +239,7 @@ class Base return [ 'code' => 401, 'status' => 0, - 'message' => '非法请求', + 'message' => 'token校验失败', 'data' => [] ]; } diff --git a/02.php/server/svnadmind.php b/02.php/server/svnadmind.php index 4c1bd9a..b5a47e9 100644 --- a/02.php/server/svnadmind.php +++ b/02.php/server/svnadmind.php @@ -3,7 +3,7 @@ * @Author: witersen * @Date: 2022-04-24 23:37:06 * @LastEditors: witersen - * @LastEditTime: 2022-05-09 00:00:19 + * @LastEditTime: 2022-05-09 22:30:20 * @Description: QQ:1801168257 */ @@ -85,13 +85,21 @@ class Daemon private function InitSocket() { //创建套接字 - $socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP) or exit('启动失败:socket_create 错误' . PHP_EOL); + $socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP) or exit('启动失败:socket_create 错误:' . socket_strerror(socket_last_error()) . PHP_EOL); + + //设置可重复使用端口号 + if (!socket_set_option($socket, SOL_SOCKET, SO_REUSEADDR, 1)) { + exit('启动失败:设置套接字选项错误:' . socket_strerror(socket_last_error()) . PHP_EOL); + } //绑定地址和端口 socket_bind($socket, $this->config_daemon['IPC_ADDRESS'], $this->config_daemon['IPC_PORT']) or exit('启动失败:socket_bind 错误,可能是由于频繁启动,端口未释放,请稍后重试或检查端口冲突' . PHP_EOL); - //设置可重复使用端口号 - socket_set_option($socket, SOL_SOCKET, SO_REUSEADDR, 1); + $rval = socket_get_option($socket, SOL_SOCKET, SO_REUSEADDR); + + if ($rval === false) { + exit('启动失败:无法获取套接字选项:' . socket_strerror(socket_last_error()) . PHP_EOL); + } //监听 设置并发队列的最大长度 socket_listen($socket, $this->config_daemon['SOCKET_LISTEN_BACKLOG']); @@ -241,6 +249,8 @@ class Daemon exit('程序正在运行中' . PHP_EOL); } } + $this->UpdateSign(); + echo '已在启动时自动更改系统的加密密钥,正在登录的用户会退出登录' . PHP_EOL; $this->InitDeamon(); } @@ -265,7 +275,7 @@ class Daemon $pid = file_get_contents($this->pidFile); $result = trim(shell_exec("ps -ax | awk '{ print $1 }' | grep -e \"^$pid$\"")); if (strstr($result, $pid)) { - exit('程序正在运行中,请先停止' . PHP_EOL); + exit('无法进入调试模式,请先停止后台程序' . PHP_EOL); } } $this->InitSocket(); @@ -286,7 +296,6 @@ class Daemon $this->CheckPhpVersion(); $this->CheckDisabledFun(); if ($this->workMode == 'start') { - $this->UpdateSign(); $this->StartDaemon(); } else if ($this->workMode == 'console') { $this->StartConsole();