From 2d199cdf1e7e88b93b158d37658bec8f71e58787 Mon Sep 17 00:00:00 2001 From: Tinywan <756684177@qq.com> Date: Wed, 7 Sep 2016 21:41:37 +0800 Subject: [PATCH] =?UTF-8?q?API=20=E4=B8=87=E8=83=BD=E7=AD=BE=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Home/Controller/BaseController.class.php | 14 ++++++------ .../Controller/ProductController.class.php | 6 +++++ Backend/Home/Model/ProductViewModel.php | 22 +++++++++++++++++++ 3 files changed, 35 insertions(+), 7 deletions(-) create mode 100644 Backend/Home/Model/ProductViewModel.php diff --git a/Backend/Home/Controller/BaseController.class.php b/Backend/Home/Controller/BaseController.class.php index 5c7525d..a5dbb6f 100644 --- a/Backend/Home/Controller/BaseController.class.php +++ b/Backend/Home/Controller/BaseController.class.php @@ -32,13 +32,13 @@ public function _initialize(){ /***************************************权限认证****************************************************/ $Public = in_array(MODULE_NAME,explode(',',C('NOT_AUTH_MODULE'))) || in_array(ACTION_NAME,explode(',',C('NOT_AUTH_ACTION'))); // 如果不在公共模块之中,同时开启权限验证的话,则开始认证过程 - if(C('USER_AUTH_ON') && !$Public) - { - if(!Rbac::AccessDecision()) //通过accessDecision获取权限信息 - { - return $this->error("您没有操作权限"); //没有获取到权限信息时需要执行的代码 - } - } +// if(C('USER_AUTH_ON') && !$Public) +// { +// if(!Rbac::AccessDecision()) //通过accessDecision获取权限信息 +// { +// return $this->error("您没有操作权限"); //没有获取到权限信息时需要执行的代码 +// } +// } /***************************************导航栏菜单显示****************************************************/ /* * 思路: diff --git a/Backend/Home/Controller/ProductController.class.php b/Backend/Home/Controller/ProductController.class.php index ebb6969..1f2c75f 100644 --- a/Backend/Home/Controller/ProductController.class.php +++ b/Backend/Home/Controller/ProductController.class.php @@ -9,6 +9,7 @@ namespace Home\Controller; use Home\Controller\BaseController; +use Home\Model\ProductViewModel; class ProductController extends BaseController { @@ -204,4 +205,9 @@ public function test() p(word_time(time())); } + public function viewFind(){ + $Model = D('Product'); + p($Model->select()); + } + } \ No newline at end of file diff --git a/Backend/Home/Model/ProductViewModel.php b/Backend/Home/Model/ProductViewModel.php new file mode 100644 index 0000000..b053e49 --- /dev/null +++ b/Backend/Home/Model/ProductViewModel.php @@ -0,0 +1,22 @@ +array('id','name','title'), + 'Category'=>array('title'=>'category_name', '_on'=>'Blog.category_id=Category.id'), + 'User'=>array('name'=>'username', '_on'=>'Blog.user_id=User.id'), + ); +} \ No newline at end of file