From d68f65c3e2d1a5a036d01de0b58721258abc8d85 Mon Sep 17 00:00:00 2001 From: Hackett Date: Sat, 15 Oct 2016 15:17:31 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E6=88=96=E7=BC=96=E8=BE=91=E5=90=8E=E5=8F=B0=E8=8F=9C=E5=8D=95?= =?UTF-8?q?auth=5Frule=E8=A1=A8=E6=95=B0=E6=8D=AE=E6=9C=AA=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E6=88=96=E6=9B=B4=E6=96=B0=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit thinkPHP的model->count()返回值为string类型,导致if($find_rule_count===0)结果总为false --- application/Admin/Controller/MenuController.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/application/Admin/Controller/MenuController.class.php b/application/Admin/Controller/MenuController.class.php index 8d743e73..ae2c4d8d 100644 --- a/application/Admin/Controller/MenuController.class.php +++ b/application/Admin/Controller/MenuController.class.php @@ -114,7 +114,7 @@ public function add_post() { $menu_name=I("post.name"); $mwhere=array("name"=>$name); - $find_rule_count=$this->auth_rule_model->where($mwhere)->count(); + $find_rule_count=(int)$this->auth_rule_model->where($mwhere)->count(); if($find_rule_count===0){ $this->auth_rule_model->add(array("name"=>$name,"module"=>$app,"type"=>"admin_url","title"=>$menu_name));//type 1-admin rule;2-user rule } @@ -181,7 +181,7 @@ public function edit_post() { $menu_name=I("post.name"); $mwhere=array("name"=>$name); - $find_rule_count=$this->auth_rule_model->where($mwhere)->count(); + $find_rule_count=(int)$this->auth_rule_model->where($mwhere)->count(); if($find_rule_count===0){ $this->auth_rule_model->add(array("name"=>$name,"module"=>$app,"type"=>"admin_url","title"=>$menu_name));//type 1-admin rule;2-user rule }else{ From ac362d56a25aa542b163dd05d96d637657c3197f Mon Sep 17 00:00:00 2001 From: Hackett Date: Sun, 16 Oct 2016 16:27:09 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E5=90=8E=E5=8F=B0=E6=96=B0=E5=8A=A0?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E2=80=9C=E7=94=A8=E6=88=B7=E7=BE=8E=E5=90=8D?= =?UTF-8?q?=E2=80=9D=E4=B8=BA=E7=A9=BA=E5=AD=97=E7=AC=A6=E4=B8=B2=E6=97=B6?= =?UTF-8?q?=E6=96=87=E7=AB=A0=E5=88=97=E8=A1=A8=E2=80=9C=E4=BD=9C=E8=80=85?= =?UTF-8?q?=E2=80=9D=E6=98=BE=E7=A4=BA=E9=94=99=E8=AF=AF=E9=97=AE=E9=A2=98?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- admin/themes/simplebootx/Portal/AdminPost/index.html | 2 +- admin/themes/simplebootx/Portal/AdminPost/recyclebin.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/admin/themes/simplebootx/Portal/AdminPost/index.html b/admin/themes/simplebootx/Portal/AdminPost/index.html index bf7c5e8a..9bfd125c 100644 --- a/admin/themes/simplebootx/Portal/AdminPost/index.html +++ b/admin/themes/simplebootx/Portal/AdminPost/index.html @@ -68,7 +68,7 @@ {$vo.post_title} - {$vo.user_nicename|default=$vo.user_login} + {$vo.user_nicename|default=$vo['user_login']} {$vo.post_hits} diff --git a/admin/themes/simplebootx/Portal/AdminPost/recyclebin.html b/admin/themes/simplebootx/Portal/AdminPost/recyclebin.html index e2df9747..3fc57742 100644 --- a/admin/themes/simplebootx/Portal/AdminPost/recyclebin.html +++ b/admin/themes/simplebootx/Portal/AdminPost/recyclebin.html @@ -47,7 +47,7 @@ {$vo.id} {$vo.post_title} - {$vo.user_nicename|default=$vo.user_login} + {$vo.user_nicename|default=$vo['user_login']} {$vo.post_hits}