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

70 lines
1.2 KiB

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