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

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