12345678910111213141516171819202122232425262728293031323334353637 |
- <?php
- namespace App\Listeners;
- use App\Events\CancelOrderEvent;
- use Illuminate\Queue\Listener;
- use Illuminate\Support\Facades\Log;
- class CancelOrderListener {
- protected $template_id;
- protected $url;
- //支付
- public function __construct()
- {
- $this->template_id='Q3c9olbC-A9Un_uzNwwTrf1tY9YUD7B-mCndlB_td1c';
- // $this->url='http://weidian.jiuweiyun.cn/web/user';
- $this->url='https://weidian.cliu.cc/web/user';
- }
- public function handle(CancelOrderEvent $event)
- {
- try{
- $data=$event->data;
- $openid=$data['openid'];
- $app=app('wechat.official_account.daweiboshi');
- $app->template_message->send([
- 'touser' => $openid,
- 'template_id' => $this->template_id,
- 'url' => $this->url,
- 'data' => $data['data']
- ]);
- }catch (\Exception $exception){
- Log::error('发送模板消息出错,出错内容为'.$exception);
- }
- }
- }
|