12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- <?php
- namespace app\admin\command;
- use think\console\Command;
- use think\console\Input;
- use think\console\Output;
- use think\Exception;
- use think\Loader;
- class Runrecord extends Command
- {
- protected $model = null;
- protected function configure()
- {
- $this
- ->setName('Runrecord')
- ->addArgument('action')
- ->setDescription('命令行执行定时任务')//运行 "php think list" 时的简短描述
- ->setHelp("执行接口 参数为api (api/index/index)");
- }
- protected function execute(Input $input, Output $output)
- {
- $action= $input->getArgument('action');
- switch ($action){
- case "upincome"://更新用户收益
- while (true) {
- $result= action("api/index/upincome");
- $output->writeln('131');
- sleep(600);
- }
- break;
- case "runrecord"://记录广告收益
- while (true) {
- $result= action("api/index/runrecord");
- $output->writeln($result);
- sleep(60);
- }
- break;
- }
- }
- }
|