mid = input('mid', ''); $this->token = input('token', ''); if (empty($this->mid)) $this->error('请求会员MID无效!'); if (empty($this->token)) $this->error('接口授权TOKEN无效!'); $this->member = $this->getMember(); return $this; } /** * 获取会员数据 * @return array */ protected function getMember() { try { $this->member = MemberService::instance()->get($this->mid); if ($this->member['token'] !== $this->token) { $this->error('无效的授权,请重新登录授权!'); } return $this->member; } catch (HttpResponseException $exception) { throw $exception; } catch (\Exception $exception) { $this->error($exception->getMessage()); } } }