getWxOauth($userid, 'wxOfficialAccount')) { if ($event == "storgeErr") { // 积分记录 $path = "pages/warehouse/item/?orderid=".$param['id']; } $msg = $param['data']; // 获取 h5 域名 $url = $this->getH5DomainUrl($path); $msg['touser'] = $oauth->openid; $msg['url'] = $url; } return $this->send($msg, $type,$param['code']); } protected function getH5DomainUrl($path) { return Config::get('site.domain').$path; } /** * 获取微信授权 oauth */ protected function getWxOauth($userid, $platform) { $oauth = UserOauth::where('user_id', $userid) ->where('provider', 'Wechat') ->where('platform', $platform)->find(); if ($oauth && $oauth->openid) { return $oauth; } return null; } protected function send($notifiable,$notification,$code) { $result = (new \addons\shopro\library\Wechat('wxOfficialAccount',$code))->getApp()->template_message->send($notifiable); return true; } }