templateId = $templateId; $this->noticeData = $noticeData; $this->openId = $openId; $this->url = $url; $this->uniacid = \YunShop::app()->uniacid; } /** * Execute the job. * * @return bool */ public function handle() { try { \YunShop::app()->uniacid = \Setting::$uniqueAccountId = $this->uniacid; if ($this->attempts() > 1) { \Log::info('消息通知测试,执行大于两次终止'); return true; } $app = EasyWeChat::officialAccount(); $res = $app->template_message->send([ 'touser' => $this->openId, 'template_id' => $this->templateId, 'url' => $this->url, 'data' => $this->noticeData, ]); if ($res['errcode']) { \Log::debug('-------消息发送失败-----',[$res,$this->noticeData]); } return true; } catch (\Exception $e) { \Log::debug('消息发送失败',$e->getMessage()); } } }