Team.php 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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\TeamRewards;
  7. use app\common\model\TimedTaskLogModel;
  8. use think\Model;
  9. class Team extends Command
  10. {
  11. protected function configure()
  12. {
  13. $this->setName('Team')->setDescription('Here is the remark ');
  14. }
  15. protected function execute(Input $input, Output $output)
  16. {
  17. /* 永不超时 */
  18. // ini_set('max_execution_time', 0);
  19. // 记录开始运行的时间
  20. $GLOBALS['_beginTime'] = microtime(TRUE);
  21. $output->writeln('定时任务开始执行:' . date('Y-m-d H:i:s', time()));
  22. // $output->writeln("SMH拨币:" . date('Y-m-d H:i:s', time()));
  23. // $begin = microtime(TRUE);
  24. // $log_id = (new \app\common\logic\Team())->AllocateSmh();
  25. // $time_total = round(microtime(true) - $begin, 4);//计算耗时
  26. // //更新发放日志
  27. // if($log_id > 0){
  28. // (new TimedTaskLogModel())
  29. // ->where('id', $log_id)
  30. // ->update([
  31. // 'id' => $log_id,
  32. // 'status' => 1,
  33. // 'end_time' => date('Y-m-d H:i:s'),
  34. // 'elapsed_time' => $time_total
  35. // ]);
  36. // }
  37. // $output->writeln('SMH拨币结束:' . date('Y-m-d H:i:s', time()) . '; 耗时:' . $time_total . '秒');
  38. // $output->writeln("Qubic拨币:" . date('Y-m-d H:i:s', time()));
  39. // $begin = microtime(TRUE);
  40. // $log_id = (new \app\common\logic\Team())->AllocateQubic();
  41. // $time_total = round(microtime(true) - $begin, 4);//计算耗时
  42. // //更新发放日志
  43. // if($log_id > 0){
  44. // (new TimedTaskLogModel())
  45. // ->where('id', $log_id)
  46. // ->update([
  47. // 'id' => $log_id,
  48. // 'status' => 1,
  49. // 'end_time' => date('Y-m-d H:i:s'),
  50. // 'elapsed_time' => $time_total
  51. // ]);
  52. // }
  53. // $output->writeln('Qubic拨币结束:' . date('Y-m-d H:i:s', time()) . '; 耗时:' . $time_total . '秒');
  54. $output->writeln("Aleo拨币:" . date('Y-m-d H:i:s', time()));
  55. $begin = microtime(TRUE);
  56. $log_id = (new \app\common\logic\Team())->AllocateAleo();
  57. $time_total = round(microtime(true) - $begin, 4);//计算耗时
  58. //更新发放日志
  59. if($log_id > 0){
  60. (new TimedTaskLogModel())
  61. ->where('id', $log_id)
  62. ->update([
  63. 'id' => $log_id,
  64. 'status' => 1,
  65. 'end_time' => date('Y-m-d H:i:s'),
  66. 'elapsed_time' => $time_total
  67. ]);
  68. }
  69. $output->writeln('Aleo拨币结束:' . date('Y-m-d H:i:s', time()) . '; 耗时:' . $time_total . '秒');
  70. $time_total = round(microtime(true) - $GLOBALS['_beginTime'], 4);//计算耗时
  71. $output->writeln('定时任务执行结束,总耗时' . date('Y-m-d H:i:s', time()) . '; 耗时:' . $time_total . '秒');
  72. }
  73. }