<?php
namespace app\admin\command;
use think\console\Command;
use think\console\Input;
use think\console\Output;
class Risk extends Command
{
protected function configure()
{
$this->setName('Risk')->setDescription('get Risk');
}
protected function execute(Input $input, Output $output)
{
action('admin/Timing/get_risk_data');//执行控制器的方法,不能通过session判断
}
}
配置application/command.php
<?php
return [
'app\admin\command\Risk',
];
执行命令
php think Risk