diff --git a/docker_mixed/Dockerfile b/docker_mixed/Dockerfile new file mode 100644 index 00000000..c45de9d7 --- /dev/null +++ b/docker_mixed/Dockerfile @@ -0,0 +1,17 @@ +FROM richardchien/cqhttp:latest +RUN apt-get update && apt-get install -y software-properties-common && \ + add-apt-repository ppa:ondrej/php && \ + apt-get update && \ + apt-get install php7.3 php7.3-dev php7.3-mbstring gcc make openssl \ + php7.3-mbstring php7.3-json php7.3-ctype php7.3-curl -y && \ + apt-get install wget composer -y && \ + wget https://github.com/swoole/swoole-src/archive/v4.5.0.tar.gz && \ + tar -zxvf v4.5.0.tar.gz && \ + cd swoole-src-4.5.0/ && \ + phpize7.3 && ./configure --enable-openssl && make -j2 && make install && \ + (echo "extension=swoole.so" >> $(php -i | grep "Loaded Configuration File" | awk '{print $5}')) +ADD start.sh /home/user/start.sh +RUN chown user:user /home/user/start.sh && chmod +x /home/user/start.sh +ADD https://github.com/zhamao-robot/zhamao-framework/archive/master.zip /home/user/master.zip +RUN chown user:user /home/user/master.zip && chmod 777 /home/user/master.zip +VOLUME ["/home/user/coolq","/home/user/zhamao-framework"] diff --git a/docker_mixed/start.sh b/docker_mixed/start.sh new file mode 100644 index 00000000..adf73f0f --- /dev/null +++ b/docker_mixed/start.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +unzip master.zip +mv zhamao-framework-master/* zhamao-framework/ +cd zhamao-framework +php bin/start diff --git a/src/Framework/Console.php b/src/Framework/Console.php index e7a8e0fb..e38bd0d9 100755 --- a/src/Framework/Console.php +++ b/src/Framework/Console.php @@ -61,14 +61,14 @@ class Console $trace = debug_backtrace()[1] ?? ['file' => '', 'function' => '']; $trace = "[" . basename($trace["file"], ".php") . ":" . $trace["function"] . "] "; } - if(ZMBuf::$atomics["info_level"]->get() >= 1) { + if (ZMBuf::$atomics["info_level"]->get() >= 1) { if (!is_string($obj)) { if (isset($trace)) { var_dump($obj); return; } else $obj = "{Object}"; } - echo(self::setColor($head . ($trace ?? "") . $obj, "yellow") . "\n"); + echo(self::setColor($head . ($trace ?? "") . $obj, in_array("--white-term", FrameworkLoader::$argv) ? "blue" : "yellow") . "\n"); } } @@ -78,14 +78,14 @@ class Console $trace = debug_backtrace()[1] ?? ['file' => '', 'function' => '']; $trace = "[" . basename($trace["file"], ".php") . ":" . $trace["function"] . "] "; } - if(ZMBuf::$atomics["info_level"]->get() >= 2) { + if (ZMBuf::$atomics["info_level"]->get() >= 2) { if (!is_string($obj)) { if (isset($trace)) { var_dump($obj); return; } else $obj = "{Object}"; } - echo(self::setColor($head . ($trace ?? "") . $obj, "lightblue") . "\n"); + echo(self::setColor($head . ($trace ?? "") . $obj, in_array("--white-term", FrameworkLoader::$argv) ? "black" : "lightblue") . "\n"); } } @@ -95,7 +95,7 @@ class Console $trace = debug_backtrace()[1] ?? ['file' => '', 'function' => '']; $trace = "[" . basename($trace["file"], ".php") . ":" . $trace["function"] . "] "; } - if(ZMBuf::$atomics["info_level"]->get() >= 2) { + if (ZMBuf::$atomics["info_level"]->get() >= 2) { if (!is_string($obj)) { if (isset($trace)) { var_dump($obj); @@ -107,8 +107,8 @@ class Console } static function verbose($obj, $head = null) { - if($head === null) $head = date("[H:i:s] ") . "[V] "; - if(ZMBuf::$atomics["info_level"]->get() >= 3) { + if ($head === null) $head = date("[H:i:s] ") . "[V] "; + if (ZMBuf::$atomics["info_level"]->get() >= 3) { if (!is_string($obj)) { if (isset($trace)) { var_dump($obj); @@ -173,7 +173,7 @@ class Console $it = explodeMsg($cmd); switch ($it[0] ?? '') { case 'logtest': - Console::log(date("[H:i:s]"). " [L] This is normal msg. (0)"); + Console::log(date("[H:i:s]") . " [L] This is normal msg. (0)"); Console::error("This is error msg. (0)"); Console::warning("This is warning msg. (1)"); Console::info("This is info msg. (2)");