From d1327a26f4355f745f803ee146aa352ac09a707f Mon Sep 17 00:00:00 2001 From: molong Date: Thu, 1 Mar 2018 11:06:03 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/common/controller/Api.php | 2 +- application/common/model/Menu.php | 36 +++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 application/common/model/Menu.php diff --git a/application/common/controller/Api.php b/application/common/controller/Api.php index b4c81ea0..70a9a9a5 100644 --- a/application/common/controller/Api.php +++ b/application/common/controller/Api.php @@ -41,7 +41,7 @@ class Api { } } - protected function checkAuthor($header){ + protected function checkAuthor($header){return true; if (isset($header['authorization']) && $header['authorization']) { list($appid, $sign) = explode('{|}', $header['authorization']); $this->client = db('Client')->where('appid', $appid)->find(); diff --git a/application/common/model/Menu.php b/application/common/model/Menu.php new file mode 100644 index 00000000..4a515e07 --- /dev/null +++ b/application/common/model/Menu.php @@ -0,0 +1,36 @@ + +// +---------------------------------------------------------------------- + +namespace app\common\model; + +/** + * 菜单模型类 + * @author molong + */ +class Menu extends \app\common\model\Base { + + protected $type = array( + 'id' => 'integer', + ); + + public function getAuthNodes($type = 'admin'){ + $map['type'] = $type; + $rows = $this->db()->field('id,pid,group,title,url')->where($map)->order('id asc')->select(); + foreach ($rows as $key => $value) { + $data[$value['id']] = $value; + } + foreach ($data as $key => $value) { + if ($value['pid'] > 0) { + $value['group'] = $data[$value['pid']]['title'] . '管理'; + $list[] = $value; + } + } + return $list; + } +} \ No newline at end of file