dnsmgr/app/command/Opiptask.php
coolxitech 638ab7cf3f refactor(command): 重构命令行任务处理逻辑
- 使用模型替换 Db::name() 方法,提高代码可读性和可维护性
- 优化 Dmtask 和 Opiptask 命令的执行逻辑
- 更新异常捕获方式,使用更具体的异常类
- 调整命名空间和引入的类,以适应新的代码结构
2024-11-09 20:23:57 +08:00

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();
}
}