composer update
This commit is contained in:
parent
e2ada87dbf
commit
b7ec3b9482
|
@ -73,13 +73,23 @@ function app_path(string $path = ''): string
|
||||||
/**
|
/**
|
||||||
* Public path
|
* Public path
|
||||||
* @param string $path
|
* @param string $path
|
||||||
|
* @param string|null $plugin
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function public_path(string $path = ''): string
|
function public_path(string $path = '', string $plugin = null): string
|
||||||
{
|
{
|
||||||
static $publicPath = '';
|
static $publicPaths = [];
|
||||||
if (!$publicPath) {
|
$plugin = $plugin ?? '';
|
||||||
$publicPath = \config('app.public_path') ?: run_path('public');
|
if (isset($publicPaths[$plugin])) {
|
||||||
|
$publicPath = $publicPaths[$plugin];
|
||||||
|
} else {
|
||||||
|
$prefix = $plugin ? "plugin.$plugin." : '';
|
||||||
|
$pathPrefix = $plugin ? 'plugin' . DIRECTORY_SEPARATOR . $plugin . DIRECTORY_SEPARATOR : '';
|
||||||
|
$publicPath = \config("{$prefix}app.public_path", run_path("{$pathPrefix}public"));
|
||||||
|
if (count($publicPaths) > 32) {
|
||||||
|
$publicPaths = [];
|
||||||
|
}
|
||||||
|
$publicPaths[$plugin] = $publicPath;
|
||||||
}
|
}
|
||||||
return path_combine($publicPath, $path);
|
return path_combine($publicPath, $path);
|
||||||
}
|
}
|
||||||
|
@ -244,9 +254,6 @@ function think_view(string $template, array $vars = [], string $app = null): Res
|
||||||
* @param array $vars
|
* @param array $vars
|
||||||
* @param string|null $app
|
* @param string|null $app
|
||||||
* @return Response
|
* @return Response
|
||||||
* @throws LoaderError
|
|
||||||
* @throws RuntimeError
|
|
||||||
* @throws SyntaxError
|
|
||||||
*/
|
*/
|
||||||
function twig_view(string $template, array $vars = [], string $app = null): Response
|
function twig_view(string $template, array $vars = [], string $app = null): Response
|
||||||
{
|
{
|
||||||
|
@ -510,7 +517,11 @@ function cpu_count(): int
|
||||||
if (strtolower(PHP_OS) === 'darwin') {
|
if (strtolower(PHP_OS) === 'darwin') {
|
||||||
$count = (int)shell_exec('sysctl -n machdep.cpu.core_count');
|
$count = (int)shell_exec('sysctl -n machdep.cpu.core_count');
|
||||||
} else {
|
} else {
|
||||||
$count = (int)shell_exec('nproc');
|
try {
|
||||||
|
$count = (int)shell_exec('nproc');
|
||||||
|
} catch (\Throwable $ex) {
|
||||||
|
// Do nothing
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $count > 0 ? $count : 4;
|
return $count > 0 ? $count : 4;
|
||||||
|
@ -526,35 +537,3 @@ function input(string $param = null, $default = null)
|
||||||
{
|
{
|
||||||
return is_null($param) ? request()->all() : request()->input($param, $default);
|
return is_null($param) ? request()->all() : request()->input($param, $default);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取一周的日期
|
|
||||||
* @return array
|
|
||||||
*/
|
|
||||||
function get_week_days() {
|
|
||||||
// 获取当前日期
|
|
||||||
$today = new DateTime();
|
|
||||||
|
|
||||||
// 获取当前周的周一
|
|
||||||
$monday = clone $today;
|
|
||||||
$monday->modify('monday this week');
|
|
||||||
|
|
||||||
// 获取当前周的周日
|
|
||||||
$sunday = clone $today;
|
|
||||||
$sunday->modify('sunday this week');
|
|
||||||
|
|
||||||
// 初始化日期数组
|
|
||||||
$dates = [];
|
|
||||||
$dayNmae = ['星期一', '星期二', '星期三', '星期四', '星期五', '星期六', '星期天'];
|
|
||||||
// 从周一到周日循环
|
|
||||||
for ($i = 0; $i < 7; $i++) {
|
|
||||||
$date = clone $monday;
|
|
||||||
$date->modify("+$i days");
|
|
||||||
$dates[] = [
|
|
||||||
'date_name' => $dayNmae[$i],
|
|
||||||
'date' => $date->format('Y-m-d')
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
return $dates;
|
|
||||||
}
|
|
||||||
|
|
|
@ -27,9 +27,11 @@ if (is_dir($command_path = Util::guessPath(app_path(), '/command', true))) {
|
||||||
|
|
||||||
foreach (config('plugin', []) as $firm => $projects) {
|
foreach (config('plugin', []) as $firm => $projects) {
|
||||||
if (isset($projects['app'])) {
|
if (isset($projects['app'])) {
|
||||||
if ($command_str = Util::guessPath(base_path() . "/plugin/$firm", 'command')) {
|
foreach (['', '/app'] as $app) {
|
||||||
$command_path = base_path() . "/plugin/$firm/$command_str";
|
if ($command_str = Util::guessPath(base_path() . "/plugin/$firm{$app}", 'command')) {
|
||||||
$cli->installCommands($command_path, "plugin\\$firm\\$command_str");
|
$command_path = base_path() . "/plugin/$firm{$app}/$command_str";
|
||||||
|
$cli->installCommands($command_path, "plugin\\$firm" . str_replace('/', '\\', $app) . "\\$command_str");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
foreach ($projects as $name => $project) {
|
foreach ($projects as $name => $project) {
|
||||||
|
|
Loading…
Reference in New Issue