CheckOrder.php 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <?php
  2. namespace App\Console\Commands;
  3. use App\Jobs\OrderHandleJob;
  4. use App\Services\OrderService;
  5. use Illuminate\Console\Command;
  6. use App\Models\Order;
  7. use App\Models\User;
  8. use App\Models\Plan;
  9. use Illuminate\Support\Facades\DB;
  10. class CheckOrder extends Command
  11. {
  12. /**
  13. * The name and signature of the console command.
  14. *
  15. * @var string
  16. */
  17. protected $signature = 'check:order';
  18. /**
  19. * The console command description.
  20. *
  21. * @var string
  22. */
  23. protected $description = '订单检查任务';
  24. /**
  25. * Create a new command instance.
  26. *
  27. * @return void
  28. */
  29. public function __construct()
  30. {
  31. parent::__construct();
  32. }
  33. /**
  34. * Execute the console command.
  35. *
  36. * @return mixed
  37. */
  38. public function handle()
  39. {
  40. ini_set('memory_limit', -1);
  41. $orders = Order::whereIn('status', [0, 1])
  42. ->get();
  43. foreach ($orders as $order) {
  44. OrderHandleJob::dispatch($order->trade_no);
  45. }
  46. }
  47. }