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

58 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
4 years ago
4 years ago
4 years ago
  1. <?php
  2. namespace App\Console\Commands;
  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\Console\Command;
  9. class BalanceDue extends Command
  10. {
  11. /**
  12. * The name and signature of the console command.
  13. *
  14. * @var string
  15. */
  16. protected $signature = 'balance:due';
  17. /**
  18. * The console command description.
  19. *
  20. * @var string
  21. */
  22. protected $description = '尾款支付通知';
  23. /**
  24. * Create a new command instance.
  25. *
  26. * @return void
  27. */
  28. public function __construct()
  29. {
  30. parent::__construct();
  31. }
  32. /**
  33. * Execute the console command.
  34. *
  35. * @return int
  36. */
  37. public function handle()
  38. {
  39. if (env('SMS_SWITCH' , '') == true) {
  40. $orders = Order::query()
  41. ->where('status', OrderStatus::PAY_EARNEST)
  42. ->get();
  43. $sms = new SmsService();
  44. foreach ($orders as $order) {
  45. if (!empty($order->mobile)) {
  46. $type = $order->pay_type == PayType::DEPOSIT_PAY ? '订金' : '定金';
  47. $sms->send('pay',['订单号:'.$order->orderNumber,$type,$order->timeout,$type,SmsTraits::$systeaNameText['user']],[$order->mobile]);
  48. }
  49. }
  50. }
  51. }
  52. }