39 lines
914 B
PHP
39 lines
914 B
PHP
<?php
|
|
|
|
namespace App\Listeners;
|
|
|
|
use App\Events\SendSmsEvent;
|
|
use App\Models\SmsLog;
|
|
use Illuminate\Queue\InteractsWithQueue;
|
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
|
use Illuminate\Support\Facades\Log;
|
|
|
|
class SendSmsEventListener
|
|
{
|
|
/**
|
|
* Create the event listener.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function __construct()
|
|
{
|
|
//
|
|
}
|
|
|
|
/**
|
|
* Handle the event.
|
|
*
|
|
* @param SendSmsEvent $event
|
|
* @return void
|
|
*/
|
|
public function handle(SendSmsEvent $event)
|
|
{
|
|
|
|
//发送短信
|
|
$result=send_sms($event->config['mobiles'],$event->config['tpl_id'],$event->config['params']);
|
|
//发送短信日志试试
|
|
SmsLog::add($event->config['mobiles'],$event->config['tpl_id'],$event->config['screen'],$event->config['user_type'],$event->config['user_id']);
|
|
Log::channel('smslog')->info($result, $event->config);
|
|
}
|
|
}
|