1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- <?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"://更新用户收益
- $result= action("api/index/upincome");
- $output->writeln($result);
- break;
- case "runrecord"://记录广告收益
- $result= action("api/index/runrecord");
- $output->writeln($result);
- break;
- case "oldrecord":
- $result= action("api/index/oldrecord");
- $output->writeln($result);
- }
- }
- }
|