更新代码
This commit is contained in:
parent
2afb129b7b
commit
2e30caf389
@ -10,7 +10,7 @@ class IndexController extends BaseLikeAdminController
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
return json(['msg' => 'hello']);
|
||||
return json(['msg' =>create_password(123456, '11d3')]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
2498
composer.lock
generated
2498
composer.lock
generated
File diff suppressed because it is too large
Load Diff
@ -11,12 +11,13 @@
|
||||
* @link http://www.workerman.net/
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
||||
*/
|
||||
use function DI\env;
|
||||
|
||||
return [
|
||||
'default' => [
|
||||
'host' => '127.0.0.1',
|
||||
'password' => null,
|
||||
'password' => 'jhkdjhkjdhsIUTYURTU_xM6ine',
|
||||
'port' => 6379,
|
||||
'database' => 0,
|
||||
'database' => 1,
|
||||
],
|
||||
];
|
||||
|
@ -27,6 +27,7 @@ use Twig\Error\SyntaxError;
|
||||
use Webman\App;
|
||||
use Webman\Config;
|
||||
use Webman\Route;
|
||||
use Workerman\Protocols\Http\Session;
|
||||
use Workerman\Worker;
|
||||
|
||||
// Project base path
|
||||
@ -300,7 +301,7 @@ function route(string $name, ...$parameters): string
|
||||
* Session
|
||||
* @param mixed $key
|
||||
* @param mixed $default
|
||||
* @return mixed
|
||||
* @return mixed|bool|Session
|
||||
*/
|
||||
function session($key = null, $default = null)
|
||||
{
|
||||
@ -379,7 +380,7 @@ function copy_dir(string $source, string $dest, bool $overwrite = false)
|
||||
$files = scandir($source);
|
||||
foreach ($files as $file) {
|
||||
if ($file !== "." && $file !== "..") {
|
||||
copy_dir("$source/$file", "$dest/$file");
|
||||
copy_dir("$source/$file", "$dest/$file", $overwrite);
|
||||
}
|
||||
}
|
||||
} else if (file_exists($source) && ($overwrite || !file_exists($dest))) {
|
||||
@ -514,3 +515,14 @@ function cpu_count(): int
|
||||
}
|
||||
return $count > 0 ? $count : 4;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get request parameters, if no parameter name is passed, an array of all values is returned, default values is supported
|
||||
* @param string|null $param param's name
|
||||
* @param mixed|null $default default value
|
||||
* @return mixed|null
|
||||
*/
|
||||
function input(string $param = null, $default = null)
|
||||
{
|
||||
return is_null($param) ? request()->all() : request()->input($param, $default);
|
||||
}
|
||||
|
16
webman
16
webman
@ -36,8 +36,20 @@ foreach (config('plugin', []) as $firm => $projects) {
|
||||
if (!is_array($project)) {
|
||||
continue;
|
||||
}
|
||||
foreach ($project['command'] ?? [] as $command) {
|
||||
$cli->add(Container::get($command));
|
||||
foreach ($project['command'] ?? [] as $class_name) {
|
||||
$reflection = new \ReflectionClass($class_name);
|
||||
if ($reflection->isAbstract()) {
|
||||
continue;
|
||||
}
|
||||
$properties = $reflection->getStaticProperties();
|
||||
$name = $properties['defaultName'];
|
||||
if (!$name) {
|
||||
throw new RuntimeException("Command {$class_name} has no defaultName");
|
||||
}
|
||||
$description = $properties['defaultDescription'] ?? '';
|
||||
$command = Container::get($class_name);
|
||||
$command->setName($name)->setDescription($description);
|
||||
$cli->add($command);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -61,6 +61,7 @@ function write_process_file($runtimeProcessPath, $processName, $firm): string
|
||||
require_once __DIR__ . '/../../vendor/autoload.php';
|
||||
|
||||
use Workerman\Worker;
|
||||
use Workerman\Connection\TcpConnection;
|
||||
use Webman\Config;
|
||||
use support\App;
|
||||
|
||||
@ -77,6 +78,7 @@ worker_start('$processParam', $configParam);
|
||||
|
||||
if (DIRECTORY_SEPARATOR != "/") {
|
||||
Worker::\$logFile = config('server')['log_file'] ?? Worker::\$logFile;
|
||||
TcpConnection::\$defaultMaxPackageSize = config('server')['max_package_size'] ?? 10*1024*1024;
|
||||
}
|
||||
|
||||
Worker::runAll();
|
||||
|
Loading…
x
Reference in New Issue
Block a user