public function __construct() { //解决flash上传的cookie问题 if (isset($_POST['PHPSESSIONID'])) { $session_id = Crypt::decrypt(trim($_POST['PHPSESSIONID'])); if (!empty($session_id)) { session_id($session_id); Session::setId($session_id); } } parent::__construct(); $this->model = new Attachment(); }
public function callAction($method, $parameters) { if (!empty($this->wechat_oauth2_account)) { $account = WechatAccount::findOrFail($this->wechat_oauth2_account); $oauth2 = new OAuth2($account->toArray(), $account->getKey()); $this->wechatUser = $oauth2->getUser(); if (empty($this->wechatUser)) { //ajax 请求则报错 if (app('request')->ajax()) { return $this->failure('wechat::wechat.failure_ajax_oauth2'); } $this->wechatUser = $oauth2->authenticate(NULL, $this->wechat_oauth2_type, $this->wechat_oauth2_bindUserRole); } $userModel = config('auth.model'); $this->wechat_oauth2_bindUserRole && ($this->user = (new $userModel())->find($this->wechatUser->uid)); $this->user = (new $userModel())->find(15); } return parent::callAction($method, $parameters); }