mirror of
https://github.com/netcccyun/dnsmgr.git
synced 2026-02-21 15:31:12 +08:00
- 使用模型替换 Db::name() 方法,提高代码可读性和可维护性 - 优化 Dmtask 和 Opiptask 命令的执行逻辑 - 更新异常捕获方式,使用更具体的异常类 - 调整命名空间和引入的类,以适应新的代码结构
32 lines
660 B
PHP
32 lines
660 B
PHP
<?php
|
|
|
|
declare (strict_types=1);
|
|
|
|
namespace app\command;
|
|
|
|
use Exception;
|
|
use think\console\Command;
|
|
use think\console\Input;
|
|
use think\console\Output;
|
|
use think\facade\Config;
|
|
use app\lib\OptimizeService;
|
|
use app\model\Config as ConfigModel;
|
|
|
|
class Opiptask extends Command
|
|
{
|
|
protected function configure()
|
|
{
|
|
// 指令配置
|
|
$this->setName('opiptask')
|
|
->setDescription('CF优选IP任务');
|
|
}
|
|
|
|
protected function execute(Input $input, Output $output)
|
|
{
|
|
$res = ConfigModel::cache('configs', 0)->column('value', 'key');
|
|
Config::set($res, 'sys');
|
|
|
|
(new OptimizeService())->execute();
|
|
}
|
|
}
|