model = new Site(); } /** * 获取授权当前的站点信息 */ public function getSiteInfo(){ //通过用户id获取 return (new SiteService())->getSiteCache($this->site_id); } /** * 通过站点id获取菜单列表 * @param int $is_tree * @param int|string $status * @return mixed */ public function getMenuList(int $is_tree, int|string $status, $addon = 'all', int $is_button = 1){ return (new SiteService())->getMenuList($this->site_id, $is_tree, $status, $addon, $is_button); } /** * 通过站点id获取菜单列表 * @param int|string $status * @return mixed */ public function getApiList(int|string $status){ return (new SiteService())->getApiList($this->site_id, $status); } /** * 查询当前站点可以单独显示的菜单(仅支持站点端调用) * @return array|SysMenu[] * @throws DataNotFoundException * @throws DbException * @throws ModelNotFoundException */ public function getShowMenuList(){ $menu_keys = (new SiteService())->getMenuIdsBySiteId($this->site_id, 1); return (new SysMenu())->where([['menu_key', 'in', $menu_keys], ['menu_type', '=', MenuTypeDict::MENU], ['app_type', '=', AppTypeDict::SITE],['is_show', '=', 1]])->select()->toArray(); } /** * 获取站点支持 * @return array|mixed|string|null * @throws DataNotFoundException * @throws DbException * @throws ModelNotFoundException */ public function getAuthAddonList(){ return (new AddonService())->getAddonListBySiteId($this->site_id); } }