SenAirdrop.php 977 B

1234567891011121314151617181920212223242526272829303132333435
  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. // 发放团队奖励
  22. $teamRewards = new AirdropLogic();
  23. $teamRewards->setAirdropRewards();
  24. $time_total = round(microtime(true) - $GLOBALS['_beginTime'], 4);//计算耗时
  25. $output->writeln('定时任务执行结束,总耗时' . date('Y-m-d H:i:s', time()) . '; 耗时:' . $time_total . '秒');
  26. }
  27. }