|
|
|
@ -28,23 +28,23 @@ class DemandBiddingServiceProvider extends ServiceProvider |
|
|
|
*/ |
|
|
|
public function boot() |
|
|
|
{ |
|
|
|
DemandBidding::created(function ($order) { |
|
|
|
$demand = Demand::query()->with(['publisher'])->where('id',$order->demand_id)->first(); |
|
|
|
if(!empty($demand->publisher->contact_phone)) { |
|
|
|
$sms = new SmsService(); |
|
|
|
$sms->send('bidding',[$order->biddingUser->name,$demand->id,DemandTraits::$polymorphic[$demand->publisher_type]],[$demand->publisher->contact_phone]); |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
Demand::updated(function ($demand) { |
|
|
|
//如果状态改变了
|
|
|
|
if($demand->isDirty('bidding_id')) { |
|
|
|
if(!empty($demand->publisher->contact_phone)) { |
|
|
|
$sms = new SmsService(); |
|
|
|
$sms->send('bidding',[$demand->publisher->name,$demand->id,DemandTraits::$polymorphic[$demand->bidding_user_type]],[$demand->biddingUser->contact_phone]); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
//DemandBidding::created(function ($order) {
|
|
|
|
// $demand = Demand::query()->with(['publisher'])->where('id',$order->demand_id)->first();
|
|
|
|
// if(!empty($demand->publisher->contact_phone)) {
|
|
|
|
// $sms = new SmsService();
|
|
|
|
// $sms->send('bidding',[$order->biddingUser->name,$demand->id,DemandTraits::$polymorphic[$demand->publisher_type]],[$demand->publisher->contact_phone]);
|
|
|
|
// }
|
|
|
|
//});
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//Demand::updated(function ($demand) {
|
|
|
|
// //如果状态改变了
|
|
|
|
// if($demand->isDirty('bidding_id')) {
|
|
|
|
// if(!empty($demand->publisher->contact_phone)) {
|
|
|
|
// $sms = new SmsService();
|
|
|
|
// $sms->send('bidding',[$demand->publisher->name,$demand->id,DemandTraits::$polymorphic[$demand->bidding_user_type]],[$demand->biddingUser->contact_phone]);
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
//});
|
|
|
|
} |
|
|
|
} |