海南旅游SAAS
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

49 lines
1.2 KiB

4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
  1. <?php
  2. namespace App\Jobs;
  3. use App\Common\OrderStatus;
  4. use App\Common\PayType;
  5. use App\Models\Order;
  6. use App\Service\SmsService;
  7. use App\Traits\SmsTraits;
  8. use Illuminate\Bus\Queueable;
  9. use Illuminate\Contracts\Queue\ShouldBeUnique;
  10. use Illuminate\Contracts\Queue\ShouldQueue;
  11. use Illuminate\Foundation\Bus\Dispatchable;
  12. use Illuminate\Queue\InteractsWithQueue;
  13. use Illuminate\Queue\SerializesModels;
  14. use Illuminate\Support\Facades\Log;
  15. class BalanceDue implements ShouldQueue
  16. {
  17. use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
  18. protected $orderNumber = '';
  19. protected $redis='';
  20. /**
  21. * Create a new job instance.
  22. *
  23. * @return void
  24. */
  25. public function __construct($orderNumber,$delay)
  26. {
  27. $this->orderNumber = $orderNumber;
  28. $this->delay = $delay;
  29. }
  30. /**
  31. * Execute the job.
  32. *
  33. * @return void
  34. */
  35. public function handle()
  36. {
  37. $order = Order::query()->where('order_no',$this->orderNumber)->first();
  38. if(env('SMS_SWITCH' , '') == true && !empty($order->status) && $order->status == OrderStatus::PAY_EARNEST){
  39. $sms = new SmsService();
  40. $type = $order->pay_type == PayType::DEPOSIT_PAY ? '订金' : '定金';
  41. $sms->send('pay',['订单号:'.$this->orderNumber,$type,$order->timeout,$type,'小程序'],[$order->mobile]);
  42. }
  43. }
  44. }