From bcf64c0c54902255c1af46643f600e9cc54567a0 Mon Sep 17 00:00:00 2001 From: wangyuting2 <851424971@qq.com> Date: Tue, 10 May 2022 16:41:36 +0800 Subject: [PATCH] * Optimize code. --- framework/model.class.php | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/framework/model.class.php b/framework/model.class.php index 7f58ebbde1..be9480d01f 100644 --- a/framework/model.class.php +++ b/framework/model.class.php @@ -83,12 +83,15 @@ class model extends baseModel if(isset($this->config->bizVersion)) { static $actions; - if(empty($actions)) $actions = $this->dao->select('*')->from(TABLE_WORKFLOWACTION) - ->where('module')->eq($moduleName) - ->andWhere('buildin')->eq('1') - ->andWhere('status')->eq('enable') - ->beginIF(!empty($this->config->vision))->andWhere('vision')->eq($this->config->vision)->fi() - ->fetchAll('action'); + if(empty($actions)) + { + $actions = $this->dao->select('*')->from(TABLE_WORKFLOWACTION) + ->where('module')->eq($moduleName) + ->andWhere('buildin')->eq('1') + ->andWhere('status')->eq('enable') + ->beginIF(!empty($this->config->vision))->andWhere('vision')->eq($this->config->vision)->fi() + ->fetchAll('action'); + } } $enabled = true; @@ -138,13 +141,16 @@ class model extends baseModel if(strpos($module, '.') !== false) list($appName, $moduleName) = explode('.', $module); static $actions; - if(empty($actions)) $actions = $this->dao->select('*')->from(TABLE_WORKFLOWACTION) - ->where('module')->eq($moduleName) - ->andWhere('buildin')->eq('0') - ->andWhere('status')->eq('enable') - ->beginIF(!empty($this->config->vision))->andWhere('vision')->eq($this->config->vision)->fi() - ->orderBy('order_asc') - ->fetchAll(); + if(empty($actions)) + { + $actions = $this->dao->select('*')->from(TABLE_WORKFLOWACTION) + ->where('module')->eq($moduleName) + ->andWhere('buildin')->eq('0') + ->andWhere('status')->eq('enable') + ->beginIF(!empty($this->config->vision))->andWhere('vision')->eq($this->config->vision)->fi() + ->orderBy('order_asc') + ->fetchAll(); + } $menu = ''; if($show)