From 6a98708e8589488a099db387e5b76ab826174093 Mon Sep 17 00:00:00 2001 From: molong Date: Thu, 1 Jun 2017 10:07:21 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=B8=80=E5=A4=84sql?= =?UTF-8?q?=E6=B3=A8=E5=85=A5=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/common/model/SeoRule.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/application/common/model/SeoRule.php b/application/common/model/SeoRule.php index f2a92471..23c566a2 100644 --- a/application/common/model/SeoRule.php +++ b/application/common/model/SeoRule.php @@ -113,9 +113,12 @@ class SeoRule extends Base{ private function getRelatedRules($module, $controller, $action){ //查询与当前页面相关的SEO规则 - $map = "(app='*' or app='$module') and (controller='*' or controller='$controller') and (action='*' or action='$action') and status=1"; - - $rules = $this->where($map)->order('sort asc')->select(); + $rules = $this->where('app',['=','*'],['=',$module],'or') + ->where('controller',['=','*'],['=',$controller],'or') + ->where('action',['=','*'],['=',$action],'or') + ->where('status', 1) + ->order('sort asc') + ->select(); //返回规则列表 return $rules;