海南旅游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.

46 lines
1.1 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 Illuminate\Bus\Queueable;
  8. use Illuminate\Contracts\Queue\ShouldQueue;
  9. use Illuminate\Foundation\Bus\Dispatchable;
  10. use Illuminate\Queue\InteractsWithQueue;
  11. use Illuminate\Queue\SerializesModels;
  12. class BalanceDue implements ShouldQueue
  13. {
  14. use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
  15. protected $orderNumber = '';
  16. protected $redis='';
  17. /**
  18. * Create a new job instance.
  19. *
  20. * @return void
  21. */
  22. public function __construct($orderNumber,$delay)
  23. {
  24. $this->orderNumber = $orderNumber;
  25. $this->delay = $delay;
  26. }
  27. /**
  28. * Execute the job.
  29. *
  30. * @return void
  31. */
  32. public function handle()
  33. {
  34. $order = Order::query()->where('order_no',$this->orderNumber)->first();
  35. if(env('SMS_SWITCH' , '') == true && !empty($order->status) && $order->status == OrderStatus::PAY_EARNEST){
  36. $sms = new SmsService();
  37. $type = $order->pay_type == PayType::DEPOSIT_PAY ? '订金' : '定金';
  38. $sms->send('pay',['订单号:'.$this->orderNumber,$type,$order->timeout,$type,'小程序'],[$order->mobile]);
  39. }
  40. }
  41. }