RechargeTxHashVerify.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. namespace app\api\command;
  3. use app\common\logic\ScanLogic;
  4. use app\common\model\OfflineRechargeVerifyModel;
  5. use think\console\Command;
  6. use think\console\Input;
  7. use think\console\Output;
  8. use think\Model;
  9. /**
  10. * 充值订单的Hash校验类
  11. */
  12. class RechargeTxHashVerify extends Command
  13. {
  14. protected function configure()
  15. {
  16. $this->setName('RechargeTxHashVerify')->setDescription("充值订单的Hash校验");
  17. }
  18. protected function execute(Input $input, Output $output)
  19. {
  20. /* 永不超时 */
  21. // ini_set('max_execution_time', 0);
  22. // 记录开始运行的时间
  23. $GLOBALS['_beginTime'] = microtime(TRUE);
  24. $output->writeln('定时任务开始执行:' . date('Y-m-d H:i:s', time()));
  25. $rs = (new ScanLogic())->scanCollectionAddress();
  26. if(!empty($rs)){
  27. // 记录执行记录
  28. (new OfflineRechargeVerifyModel())->insert([
  29. 'order_id' => 0,
  30. 'user_id' => 0,
  31. 'result' => $rs == '',
  32. 'fail_reason' => $rs,
  33. 'create_time' => time(),
  34. ]);
  35. }
  36. /*** 这里写计划任务列表集 END ***/
  37. $time_total = round(microtime(true) - $GLOBALS['_beginTime'], 4);//计算耗时
  38. $output->writeln('定时任务执行结束:' . date('Y-m-d H:i:s', time()) . '; 耗时:' . $time_total . '秒');
  39. }
  40. }