AutoSettleJob.php 943 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. namespace App\Jobs;
  3. use App\DataApiNew\Models\OrderSettRecord;
  4. use App\DataApiNew\Helper\OrdersHelper;
  5. use Illuminate\Bus\Queueable;
  6. use Illuminate\Queue\SerializesModels;
  7. use Illuminate\Queue\InteractsWithQueue;
  8. use Illuminate\Contracts\Queue\ShouldQueue;
  9. use Illuminate\Foundation\Bus\Dispatchable;
  10. use Illuminate\Support\Facades\Log;
  11. class AutoSettleJob implements ShouldQueue
  12. {
  13. use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
  14. public $recordId;
  15. public $type;
  16. public function __construct($recordId, $type)
  17. {
  18. $this->recordId = $recordId;
  19. $this->type = $type;
  20. }
  21. public function handle()
  22. {
  23. try {
  24. if ($this->type == 1) {
  25. // 号卡
  26. (new OrdersHelper())->batchOrderSettle($this->recordId);
  27. }
  28. } catch (\Exception $e) {
  29. Log::error('自动批量结算异常:' . $e);
  30. }
  31. }
  32. }