CheckOrder.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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. ->orderBy('created_at', 'ASC')
  43. ->get();
  44. foreach ($orders as $order) {
  45. OrderHandleJob::dispatch($order->trade_no);
  46. }
  47. }
  48. }