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

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