assign('member', $this->member() ?? []); } /** * assign 代理,返回 $this 便于链式 */ protected function assign($name, $value = null) { $this->view->assign($name, $value); return $this; } /** * 获取当前登录会员(未登录返回 null) * @return \ywxapp\model\Member|null */ protected function member() { if ($this->auth && $this->auth->isLogin) { return $this->auth->info; } return null; } /** * 是否已登录 */ protected function requireLogin(): bool { return $this->auth && $this->auth->isLogin; } }