From 389c9ba723a5354242bc337de60aa1b6ad68e8ad Mon Sep 17 00:00:00 2001 From: Anyon Date: Mon, 24 Aug 2020 13:48:49 +0800 Subject: [PATCH] =?UTF-8?q?ComposerUpdate=20=E4=BF=AE=E5=A4=8D=E5=8D=87?= =?UTF-8?q?=E7=BA=A7=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- composer.lock | 8 +-- vendor/composer/installed.json | 8 +-- vendor/services.php | 2 +- .../src/service/ModuleService.php | 50 +++++++++++-------- .../think-library/src/service/NodeService.php | 2 +- 5 files changed, 39 insertions(+), 31 deletions(-) diff --git a/composer.lock b/composer.lock index 72a5ec31d..fc32830dd 100644 --- a/composer.lock +++ b/composer.lock @@ -937,12 +937,12 @@ "source": { "type": "git", "url": "https://github.com/zoujingli/ThinkLibrary.git", - "reference": "5caa2ceb15d1a311ee1cfc7cc7a4ec12a7ee540c" + "reference": "656726c8c8e1175ec8d0f284e9fd00eb40d77d7f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/5caa2ceb15d1a311ee1cfc7cc7a4ec12a7ee540c", - "reference": "5caa2ceb15d1a311ee1cfc7cc7a4ec12a7ee540c", + "url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/656726c8c8e1175ec8d0f284e9fd00eb40d77d7f", + "reference": "656726c8c8e1175ec8d0f284e9fd00eb40d77d7f", "shasum": "", "mirrors": [ { @@ -987,7 +987,7 @@ ], "description": "ThinkPHP v6.0 Development Library", "homepage": "http://thinkadmin.top", - "time": "2020-08-24T05:23:03+00:00" + "time": "2020-08-24T05:44:28+00:00" }, { "name": "zoujingli/wechat-developer", diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index 1eb277564..6670a639f 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -963,12 +963,12 @@ "source": { "type": "git", "url": "https://github.com/zoujingli/ThinkLibrary.git", - "reference": "5caa2ceb15d1a311ee1cfc7cc7a4ec12a7ee540c" + "reference": "656726c8c8e1175ec8d0f284e9fd00eb40d77d7f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/5caa2ceb15d1a311ee1cfc7cc7a4ec12a7ee540c", - "reference": "5caa2ceb15d1a311ee1cfc7cc7a4ec12a7ee540c", + "url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/656726c8c8e1175ec8d0f284e9fd00eb40d77d7f", + "reference": "656726c8c8e1175ec8d0f284e9fd00eb40d77d7f", "shasum": "", "mirrors": [ { @@ -985,7 +985,7 @@ "ext-mbstring": "*", "topthink/framework": "^6.0" }, - "time": "2020-08-24T05:23:03+00:00", + "time": "2020-08-24T05:44:28+00:00", "type": "library", "extra": { "think": { diff --git a/vendor/services.php b/vendor/services.php index be0132c03..a4b1a067b 100644 --- a/vendor/services.php +++ b/vendor/services.php @@ -1,5 +1,5 @@ 'think\\admin\\Library', diff --git a/vendor/zoujingli/think-library/src/service/ModuleService.php b/vendor/zoujingli/think-library/src/service/ModuleService.php index f5c80d031..20218f123 100644 --- a/vendor/zoujingli/think-library/src/service/ModuleService.php +++ b/vendor/zoujingli/think-library/src/service/ModuleService.php @@ -99,7 +99,7 @@ class ModuleService extends Service { $data = $this->app->cache->get('moduleOnlineData', []); if (!empty($data)) return $data; - $result = json_decode(HttpExtend::get("{$this->server}/admin/api.update/version"), true); + $result = json_decode(HttpExtend::get($this->server . '/admin/api.update/version'), true); if (isset($result['code']) && $result['code'] > 0 && isset($result['data']) && is_array($result['data'])) { $this->app->cache->set('moduleOnlineData', $result['data'], 30); return $result['data']; @@ -115,26 +115,24 @@ class ModuleService extends Service */ public function install($name): array { + $install = InstallService::instance(); $this->app->cache->set('moduleOnlineData', []); - $data = InstallService::instance()->grenerateDifference(['app' . '/' . $name]); - if (empty($data)) { - return [0, '没有需要安装的文件', []]; - } else { - $lines = []; - foreach ($data as $file) { - [$state, $mode, $name] = InstallService::instance()->updateFileByDownload($file); - if ($state) { - if ($mode === 'add') $lines[] = "add {$name} successed"; - if ($mode === 'mod') $lines[] = "modify {$name} successed"; - if ($mode === 'del') $lines[] = "deleted {$name} successed"; - } else { - if ($mode === 'add') $lines[] = "add {$name} failed"; - if ($mode === 'mod') $lines[] = "modify {$name} failed"; - if ($mode === 'del') $lines[] = "deleted {$name} failed"; - } + $data = $install->grenerateDifference(['app' . '/' . $name]); + if (empty($data)) return [0, '没有需要安装的文件', []]; + $lines = []; + foreach ($data as $file) { + [$state, $mode, $name] = $install->updateFileByDownload($file); + if ($state) { + if ($mode === 'add') $lines[] = "add {$name} successed"; + if ($mode === 'mod') $lines[] = "modify {$name} successed"; + if ($mode === 'del') $lines[] = "deleted {$name} successed"; + } else { + if ($mode === 'add') $lines[] = "add {$name} failed"; + if ($mode === 'mod') $lines[] = "modify {$name} failed"; + if ($mode === 'del') $lines[] = "deleted {$name} failed"; } - return [1, '模块安装成功', $lines]; } + return [1, '模块安装成功', $lines]; } /** @@ -149,7 +147,7 @@ class ModuleService extends Service $vars = $this->_getModuleVersion($name); if (is_array($vars) && isset($vars['version']) && preg_match('|^\d{4}\.\d{2}\.\d{2}\.\d{2}$|', $vars['version'])) { $data[$name] = array_merge($vars, ['change' => []]); - foreach ($service->scanDirectory($this->app->getBasePath() . $name . '/module/change/', [], 'md') as $file) { + foreach ($service->scanDirectory($this->_getModulePath($name) . '/module/change/', [], 'md') as $file) { $data[$name]['change'][pathinfo($file, PATHINFO_FILENAME)] = Parsedown::instance()->parse(file_get_contents($file)); } } @@ -197,8 +195,7 @@ class ModuleService extends Service */ private function _getModuleVersion($name) { - $appdir = $this->app->getBasePath() . $name; - $filename = $appdir . DIRECTORY_SEPARATOR . 'module' . DIRECTORY_SEPARATOR . 'module.json'; + $filename = $this->_getModulePath($name) . 'module.json'; if (file_exists($filename) && is_file($filename) && is_readable($filename)) { $vars = json_decode(file_get_contents($filename), true); return isset($vars['name']) && isset($vars['version']) ? $vars : null; @@ -206,4 +203,15 @@ class ModuleService extends Service return false; } } + + /** + * 获取模块信息路径 + * @param string $name + * @return string + */ + private function _getModulePath($name) + { + $appdir = $this->app->getBasePath() . $name; + return $appdir . DIRECTORY_SEPARATOR . 'module' . DIRECTORY_SEPARATOR; + } } \ No newline at end of file diff --git a/vendor/zoujingli/think-library/src/service/NodeService.php b/vendor/zoujingli/think-library/src/service/NodeService.php index 4dc973227..d9269c397 100644 --- a/vendor/zoujingli/think-library/src/service/NodeService.php +++ b/vendor/zoujingli/think-library/src/service/NodeService.php @@ -148,7 +148,7 @@ class NodeService extends Service if (is_readable($realpath)) if (is_dir($realpath)) { $data = $this->scanDirectory($realpath, $data, $ext); } elseif (is_file($realpath) && (is_null($ext) || pathinfo($realpath, 4) === $ext)) { - $data[] = $realpath; + $data[] = strtr($realpath, '\\', '/'); } } return $data;