mirror of
https://gitee.com/ulthon/ulthon_admin.git
synced 2026-07-01 15:32:48 +08:00
增加docker配置;修复重置命令错误;优化timer请求机制支持本地
This commit is contained in:
@@ -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']);
|
||||
|
||||
Reference in New Issue
Block a user