SenAirdrop.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. namespace app\api\command;
  3. use think\console\Command;
  4. use think\console\Input;
  5. use think\console\Output;
  6. use app\common\logic\AirdropLogic;
  7. use app\common\model\UserAirdrop;
  8. use think\Model;
  9. //空投,发放
  10. class SenAirdrop extends Command
  11. {
  12. protected function configure()
  13. {
  14. $this->setName('SenAirdrop')->setDescription('Here is the remark ');
  15. }
  16. protected function execute(Input $input, Output $output)
  17. {
  18. // 记录开始运行的时间
  19. $GLOBALS['_beginTime'] = microtime(TRUE);
  20. $output->writeln('定时任务开始执行:' . date('Y-m-d H:i:s', time()));
  21. $teamRewards = new AirdropLogic();
  22. $output->writeln('向指定用户空投:' . date('Y-m-d H:i:s', time()));
  23. $teamRewards->setAirdropRewards();
  24. $output->writeln('向指定用户空投结束:' . date('Y-m-d H:i:s', time()));
  25. $output->writeln('层级奖励空投:' . date('Y-m-d H:i:s', time()));
  26. $teamRewards->setParentRewards();
  27. $output->writeln('层级奖励空投结束:' . date('Y-m-d H:i:s', time()));
  28. $time_total = round(microtime(true) - $GLOBALS['_beginTime'], 4);//计算耗时
  29. $output->writeln('定时任务执行结束,总耗时' . date('Y-m-d H:i:s', time()) . '; 耗时:' . $time_total . '秒');
  30. }
  31. }