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

71 lines
1.3 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. Log::info(now());
  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. $sms->send(
  49. 'pay',
  50. [
  51. $order->order_no,
  52. '定金/订金',
  53. $order->timeout,
  54. '定金/订金',
  55. '小程序'
  56. ],
  57. [
  58. $order->mobile
  59. ],
  60. );
  61. }
  62. }
  63. }
  64. }
  65. }