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
38 lines
821 B
<?php
|
|
|
|
namespace App\Providers;
|
|
|
|
use App\Models\Demand;
|
|
use App\Models\DemandProduct;
|
|
use App\Service\SmsService;
|
|
use Illuminate\Support\ServiceProvider;
|
|
|
|
class DemandBiddingServiceProvider extends ServiceProvider
|
|
{
|
|
/**
|
|
* Register services.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function register()
|
|
{
|
|
//
|
|
}
|
|
|
|
/**
|
|
* Bootstrap services.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function boot()
|
|
{
|
|
DemandProduct::created(function ($order) {
|
|
$demand = Demand::query()->with('publisher')->where('id',$order->demand_id)->first();
|
|
if(!empty($demand->publisher->contact_phone)) {
|
|
$smsConfig = config('sms.tencent');
|
|
$sms = new SmsService();
|
|
$sms->send($smsConfig['templates']['bidding'],['','$demand->id'],$demand->publisher->contact_phone);
|
|
}
|
|
});
|
|
}
|
|
}
|