From e9170d2a1bed2005ab6c85a1c3f2675ffef9565a Mon Sep 17 00:00:00 2001 From: veking <594661320@qq.com> Date: Mon, 15 Jan 2018 16:46:39 +0800 Subject: [PATCH 1/3] =?UTF-8?q?fixed:=20wxapp=E5=8A=A0=E8=BD=BDinc?= =?UTF-8?q?=E7=9B=AE=E5=BD=95=E6=96=87=E4=BB=B6=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- framework/class/account.class.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/framework/class/account.class.php b/framework/class/account.class.php index 7a0e2df9d..d8b6beedf 100644 --- a/framework/class/account.class.php +++ b/framework/class/account.class.php @@ -1767,14 +1767,16 @@ abstract class WeModuleWxapp extends WeBase { //版本号不存在相应的目录则直接使用最新版 $file = "$dir/{$this->version}/{$function_name}.inc.php"; if (!file_exists($file)) { + $file = ''; //reset $version_path_tree = glob("$dir/*"); usort($version_path_tree, function($version1, $version2) { return -version_compare($version1, $version2); }); if (!empty($version_path_tree)) { - foreach ($version_path_tree as $path) { - $file = "$path/{$function_name}.inc.php"; - if (file_exists($file)) { + foreach ($version_path_tree as $item) { + if (strpos($item, "{$function_name}.inc.php") !== false + && file_exists($file)) { + $file = $item; break; } } -- Gitee From a30c2a32b80966d83189a090bad5c61f9d3360df Mon Sep 17 00:00:00 2001 From: veking <594661320@qq.com> Date: Mon, 15 Jan 2018 17:08:08 +0800 Subject: [PATCH 2/3] =?UTF-8?q?fixed:=20wxapp=E5=8A=A0=E8=BD=BDinc?= =?UTF-8?q?=E7=9B=AE=E5=BD=95=E6=96=87=E4=BB=B6=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- framework/class/account.class.php | 57 ++++++++++++++++--------------- 1 file changed, 30 insertions(+), 27 deletions(-) diff --git a/framework/class/account.class.php b/framework/class/account.class.php index d8b6beedf..9e0c30de9 100644 --- a/framework/class/account.class.php +++ b/framework/class/account.class.php @@ -1761,33 +1761,36 @@ abstract class WeModuleWxapp extends WeBase { public $appid; public $version; - public function __call($name, $arguments) { - $dir = IA_ROOT . '/addons/' . $this->modulename . '/inc/wxapp'; - $function_name = strtolower(substr($name, 6)); - //版本号不存在相应的目录则直接使用最新版 - $file = "$dir/{$this->version}/{$function_name}.inc.php"; - if (!file_exists($file)) { - $file = ''; //reset - $version_path_tree = glob("$dir/*"); - usort($version_path_tree, function($version1, $version2) { - return -version_compare($version1, $version2); - }); - if (!empty($version_path_tree)) { - foreach ($version_path_tree as $item) { - if (strpos($item, "{$function_name}.inc.php") !== false - && file_exists($file)) { - $file = $item; - break; - } - } - } - } - if(file_exists($file)) { - require $file; - exit; - } - return null; - } + public function __call($name, $arguments) { + $dir = IA_ROOT . '/addons/' . $this->modulename . '/inc/wxapp'; + $function_name = strtolower(substr($name, 6)); + //版本号不存在相应的目录则直接使用最新版 + $file = "$dir/{$this->version}/{$function_name}.inc.php"; + if (!file_exists($file)) { + $curDir = getcwd(); + chdir($dir); + $version_path_tree = glob("*"); + usort($version_path_tree, function($version1, $version2) { + return -version_compare($version1, $version2); + }); + if (!empty($version_path_tree)) { + foreach ($version_path_tree as $path) { + $file = "$path/{$function_name}.inc.php"; + if (file_exists($file)) { + break; + } + } + } + } + if(file_exists($file)) { + require $file; + if ($curDir) { + chdir($curDir); + } + exit; + } + return null; + } public function result($errno, $message, $data = '') { exit(json_encode(array( -- Gitee From 769f97fde148178d82c9f5cce687708032925666 Mon Sep 17 00:00:00 2001 From: veking <594661320@qq.com> Date: Tue, 16 Jan 2018 08:57:07 +0800 Subject: [PATCH 3/3] =?UTF-8?q?fixed:=20WeModuleWxapp=E5=8A=A0=E8=BD=BDinc?= =?UTF-8?q?=E7=9B=AE=E5=BD=95=E6=96=87=E4=BB=B6=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- framework/class/account.class.php | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/framework/class/account.class.php b/framework/class/account.class.php index 9e0c30de9..905ec8197 100644 --- a/framework/class/account.class.php +++ b/framework/class/account.class.php @@ -1767,16 +1767,20 @@ abstract class WeModuleWxapp extends WeBase { //版本号不存在相应的目录则直接使用最新版 $file = "$dir/{$this->version}/{$function_name}.inc.php"; if (!file_exists($file)) { - $curDir = getcwd(); - chdir($dir); - $version_path_tree = glob("*"); + $version_path_tree = glob("{$dir}/*"); usort($version_path_tree, function($version1, $version2) { return -version_compare($version1, $version2); }); if (!empty($version_path_tree)) { foreach ($version_path_tree as $path) { - $file = "$path/{$function_name}.inc.php"; - if (file_exists($file)) { + if (is_dir($path)) { + $tmp_file = "$path/{$function_name}.inc.php"; + } else { + $tmp_file = $path; + } + if (strpos($tmp_file, "/{$function_name}.inc.php") !== false + && file_exists($tmp_file)) { + $file = $tmp_file; break; } } @@ -1784,9 +1788,6 @@ abstract class WeModuleWxapp extends WeBase { } if(file_exists($file)) { require $file; - if ($curDir) { - chdir($curDir); - } exit; } return null; -- Gitee