Runrecord.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. namespace app\admin\command;
  3. use think\console\Command;
  4. use think\console\Input;
  5. use think\console\Output;
  6. use think\Exception;
  7. use think\Loader;
  8. class Runrecord extends Command
  9. {
  10. protected $model = null;
  11. protected function configure()
  12. {
  13. $this
  14. ->setName('Runrecord')
  15. ->addArgument('action')
  16. ->setDescription('命令行执行定时任务')//运行 "php think list" 时的简短描述
  17. ->setHelp("执行接口 参数为api (api/index/index)");
  18. }
  19. protected function execute(Input $input, Output $output)
  20. {
  21. $action= $input->getArgument('action');
  22. switch ($action){
  23. case "upincome"://更新用户收益
  24. $result= action("api/index/upincome");
  25. $output->writeln($result);
  26. break;
  27. case "runrecord"://记录广告收益
  28. $result= action("api/index/runrecord");
  29. $output->writeln($result);
  30. break;
  31. case "oldrecord":
  32. $result= action("api/index/oldrecord");
  33. $output->writeln($result);
  34. }
  35. }
  36. }