mirror of
https://gitee.com/ulthon/ulthon_admin.git
synced 2026-07-07 10:32:48 +08:00
增加docker配置;修复重置命令错误;优化timer请求机制支持本地
This commit is contained in:
@@ -348,6 +348,7 @@ class AdminUpdateServiceBase
|
||||
'app',
|
||||
'config',
|
||||
'route',
|
||||
'docker'
|
||||
];
|
||||
|
||||
foreach ($optional_files_prefix as $prefix) {
|
||||
@@ -356,7 +357,7 @@ class AdminUpdateServiceBase
|
||||
}
|
||||
}
|
||||
|
||||
// 如果file_path不存在目录分隔符,则是可选更新的文件
|
||||
// 如果file_path不存在目录分隔符,则是可选更新的文件(根目录下的文件)
|
||||
if (strpos($file_path, '/') === false) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -21,6 +21,9 @@ class TimerBase extends Command
|
||||
$this->setName('timer')
|
||||
->addOption('temp', null, Option::VALUE_NONE)
|
||||
->addOption('quit', null, Option::VALUE_NONE)
|
||||
->addOption('local', null, Option::VALUE_NONE)
|
||||
->addOption('local-host', null, Option::VALUE_OPTIONAL, '本地域名','http://localhost')
|
||||
->addOption('local-port', null, Option::VALUE_OPTIONAL, '本地端口', '80')
|
||||
->setDescription('内置秒级定时器');
|
||||
}
|
||||
|
||||
@@ -30,16 +33,23 @@ class TimerBase extends Command
|
||||
$output->writeln('start timer');
|
||||
|
||||
$site_domain = sysconfig('site', 'site_domain');
|
||||
|
||||
if (empty($site_domain)) {
|
||||
$output->writeln('请前往后台设置站点域名(site_domain)配置项');
|
||||
|
||||
return;
|
||||
}
|
||||
$output->writeln('站点域名:' . $site_domain);
|
||||
$host = $site_domain;
|
||||
|
||||
if ($input->hasOption('local')) {
|
||||
$host = $input->getOption('local-host') . ':' . $input->getOption('local-port');
|
||||
}
|
||||
|
||||
$client = new Client([
|
||||
'base_uri' => $site_domain,
|
||||
'base_uri' => $host,
|
||||
'headers' => [
|
||||
'Host' => $site_domain,
|
||||
],
|
||||
'verify' => false,
|
||||
]);
|
||||
|
||||
@@ -52,14 +62,12 @@ class TimerBase extends Command
|
||||
$config_item = static::initConfigItem($config_item);
|
||||
|
||||
$name = $config_item['name'];
|
||||
|
||||
if ($name == 'http_demo' && !env('adminsystem.is_demo', false)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$cache_key = 'timer_' . $name;
|
||||
$cache_tag = 'system_timer';
|
||||
|
||||
$last_exec_time = Cache::get($cache_key, 0);
|
||||
|
||||
if ($last_exec_time >= time() - $config_item['frequency']) {
|
||||
@@ -67,9 +75,7 @@ class TimerBase extends Command
|
||||
}
|
||||
|
||||
Cache::tag($cache_tag)->set($cache_key, time());
|
||||
|
||||
$type = $config_item['type'];
|
||||
|
||||
switch ($type) {
|
||||
case 'site':
|
||||
$output->writeln(date('Y-m-d H:i:s') . ': build site request async:' . $config_item['target']);
|
||||
|
||||
@@ -17,7 +17,7 @@ class ResetPasswordBase extends TimerController
|
||||
return $this->error('本功能只有在演示环境下在能使用', '', '/');
|
||||
}
|
||||
|
||||
$output = Console::call('admin:resetPassword', [
|
||||
$output = Console::call('admin:reset:password', [
|
||||
'--password=123456',
|
||||
]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user