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

38 lines
821 B

5 years ago
  1. <?php
  2. namespace App\Providers;
  3. use App\Models\Demand;
  4. use App\Models\DemandProduct;
  5. use App\Service\SmsService;
  6. use Illuminate\Support\ServiceProvider;
  7. class DemandBiddingServiceProvider extends ServiceProvider
  8. {
  9. /**
  10. * Register services.
  11. *
  12. * @return void
  13. */
  14. public function register()
  15. {
  16. //
  17. }
  18. /**
  19. * Bootstrap services.
  20. *
  21. * @return void
  22. */
  23. public function boot()
  24. {
  25. DemandProduct::created(function ($order) {
  26. $demand = Demand::query()->with('publisher')->where('id',$order->demand_id)->first();
  27. if(!empty($demand->publisher->contact_phone)) {
  28. $smsConfig = config('sms.tencent');
  29. $sms = new SmsService();
  30. $sms->send($smsConfig['templates']['bidding'],['','$demand->id'],$demand->publisher->contact_phone);
  31. }
  32. });
  33. }
  34. }