From eb560031598aec8aeeb3c9ac82879351887a9615 Mon Sep 17 00:00:00 2001 From: liugang Date: Fri, 8 Aug 2025 11:38:52 +0800 Subject: [PATCH] * [perf] Replace the magic constants __CLASS__ and __FUNCTION__ with the magic constant __METHOD__ to simplify the code. --- framework/model.class.php | 9 +++++---- module/execution/model.php | 2 +- module/my/model.php | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/framework/model.class.php b/framework/model.class.php index ca902f2ac8..0ed7134191 100644 --- a/framework/model.class.php +++ b/framework/model.class.php @@ -287,14 +287,15 @@ class model extends baseModel * Cache basic search params. * * @param string $module - * @param string $className 构造搜索参数的类名。The class name which builds the search params. - * @param string $methodName 构造搜索参数的方法名。The method name which builds the search params. - * @param array $methodArgs 调用构造搜索参数的方法时传入的参数列表(实参)。 The arguments passed to the method which builds the search params (actual parameters). + * @param string $classMethod 构造搜索参数的类名和方法名,以::分隔。The class name and method name which builds the search params, separated by ::. + * @param array $methodArgs 调用构造搜索参数的方法时传入的参数列表(实参)。 The arguments passed to the method which builds the search params (actual parameters). * @access public * @return void */ - public function cacheSearchParams(string $module, string $className, string $methodName, array $methodArgs) + public function cacheSearchParams(string $module, string $classMethod, array $methodArgs) { + list($className, $methodName) = explode('::', $classMethod); + $funcModel = str_replace(['ext', 'Model'], '', $className); $key = 0; diff --git a/module/execution/model.php b/module/execution/model.php index cbd2d61e8a..45c87f8d47 100755 --- a/module/execution/model.php +++ b/module/execution/model.php @@ -4179,7 +4179,7 @@ class executionModel extends model public function buildTaskSearchForm(int $executionID, array $executions, int $queryID, string $actionURL, bool $processParams = false) { $module = $this->config->execution->search['module']; - if(!$processParams) return $this->cacheSearchParams($module, __CLASS__, __FUNCTION__, func_get_args()); + if(!$processParams) return $this->cacheSearchParams($module, __METHOD__, func_get_args()); $showAll = empty($executionID) && empty($executions) ? true : false; if($showAll) diff --git a/module/my/model.php b/module/my/model.php index 36bb9f9102..cf713548ec 100644 --- a/module/my/model.php +++ b/module/my/model.php @@ -456,7 +456,7 @@ class myModel extends model public function buildTaskSearchForm(int $queryID, string $actionURL, string $rawMethod, bool $processParams = false) { $module = $rawMethod . 'Task'; - if(!$processParams) return $this->cacheSearchParams($module, __CLASS__, __FUNCTION__, func_get_args()); + if(!$processParams) return $this->cacheSearchParams($module, __METHOD__, func_get_args()); $this->loadModel('execution');