From 22214e4ac74bffa866f9ecbd1ebd04de22d4a8a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E6=99=AF=E7=AB=8B?= Date: Mon, 1 Mar 2021 12:05:53 +0800 Subject: [PATCH] ComposerUpdate --- vendor/composer/installed.json | 8 ++++---- vendor/services.php | 2 +- .../think-library/src/command/Database.php | 18 +++--------------- .../think-library/src/command/Replace.php | 17 ++--------------- .../src/service/SystemService.php | 13 +++++++++++++ .../think-library/src/storage/QiniuStorage.php | 6 +++--- 6 files changed, 26 insertions(+), 38 deletions(-) diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index 3706cab42..30a8ebd47 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -863,12 +863,12 @@ "source": { "type": "git", "url": "https://github.com/zoujingli/ThinkLibrary.git", - "reference": "90c1f5dccfe047e542d10d80534a4da174433527" + "reference": "a273990298618e97fb7a03082f7a032ba0ad548c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/90c1f5dccfe047e542d10d80534a4da174433527", - "reference": "90c1f5dccfe047e542d10d80534a4da174433527", + "url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/a273990298618e97fb7a03082f7a032ba0ad548c", + "reference": "a273990298618e97fb7a03082f7a032ba0ad548c", "shasum": "", "mirrors": [ { @@ -885,7 +885,7 @@ "ext-mbstring": "*", "topthink/framework": "^6.0" }, - "time": "2021-02-25T03:15:54+00:00", + "time": "2021-03-01T02:53:44+00:00", "type": "library", "extra": { "think": { diff --git a/vendor/services.php b/vendor/services.php index 5eeb01c85..fb090c1e9 100644 --- a/vendor/services.php +++ b/vendor/services.php @@ -1,5 +1,5 @@ 'think\\admin\\Library', diff --git a/vendor/zoujingli/think-library/src/command/Database.php b/vendor/zoujingli/think-library/src/command/Database.php index b315f01a4..ac6b39921 100644 --- a/vendor/zoujingli/think-library/src/command/Database.php +++ b/vendor/zoujingli/think-library/src/command/Database.php @@ -19,6 +19,7 @@ namespace think\admin\command; use think\admin\Command; use think\admin\Exception; +use think\admin\service\SystemService; use think\console\Input; use think\console\input\Argument; use think\console\Output; @@ -59,7 +60,7 @@ class Database extends Command protected function _repair(): void { $this->setQueueProgress("正在获取需要修复的数据表", 0); - [$total, $count] = [count($tables = $this->getTables()), 0]; + [$tables, $total, $count] = SystemService::instance()->getTables(); $this->setQueueProgress("总共需要修复 {$total} 张数据表", 0); foreach ($tables as $table) { $this->queue->message($total, ++$count, "正在修复数据表 {$table}"); @@ -76,7 +77,7 @@ class Database extends Command protected function _optimize(): void { $this->setQueueProgress("正在获取需要优化的数据表", 0); - [$total, $count] = [count($tables = $this->getTables()), 0]; + [$tables, $total, $count] = SystemService::instance()->getTables(); $this->setQueueProgress("总共需要优化 {$total} 张数据表", 0); foreach ($tables as $table) { $this->queue->message($total, ++$count, "正在优化数据表 {$table}"); @@ -86,17 +87,4 @@ class Database extends Command $this->queue->success("已完成对 {$total} 张数据表优化操作"); } - /** - * 获取数据库的数据表 - * @return array - */ - protected function getTables(): array - { - $tables = []; - foreach ($this->app->db->query("show tables") as $item) { - $tables = array_merge($tables, array_values($item)); - } - return $tables; - } - } \ No newline at end of file diff --git a/vendor/zoujingli/think-library/src/command/Replace.php b/vendor/zoujingli/think-library/src/command/Replace.php index 2fd30d635..4dec32d9c 100644 --- a/vendor/zoujingli/think-library/src/command/Replace.php +++ b/vendor/zoujingli/think-library/src/command/Replace.php @@ -19,6 +19,7 @@ namespace think\admin\command; use Exception; use think\admin\Command; +use think\admin\service\SystemService; use think\console\Input; use think\console\input\Argument; use think\console\Output; @@ -52,8 +53,7 @@ class Replace extends Command $repalce = $input->getArgument('replace'); if ($search === '') $this->queue->error('查找替换字符内容不能为空!'); if ($repalce === '') $this->queue->error('目标替换字符内容不能为空!'); - - [$total, $count] = [count($tables = $this->getTables()), 0]; + [$tables, $total, $count] = SystemService::instance()->getTables(); foreach ($tables as $table) { $data = []; $this->queue->message($total, ++$count, sprintf("准备替换数据表 %s", Str::studly($table))); @@ -74,17 +74,4 @@ class Replace extends Command } $this->queue->success('批量替换成功'); } - - /** - * 获取数据库的数据表 - * @return array - */ - protected function getTables(): array - { - $tables = []; - foreach ($this->app->db->query("show tables") as $item) { - $tables = array_merge($tables, array_values($item)); - } - return $tables; - } } \ No newline at end of file diff --git a/vendor/zoujingli/think-library/src/service/SystemService.php b/vendor/zoujingli/think-library/src/service/SystemService.php index d9a091aa9..92377023e 100644 --- a/vendor/zoujingli/think-library/src/service/SystemService.php +++ b/vendor/zoujingli/think-library/src/service/SystemService.php @@ -164,6 +164,19 @@ class SystemService extends Service return $this->save('SystemData', ['name' => $name, 'value' => serialize($value)], 'name'); } + /** + * 获取数据库所有数据表 + * @return array [table, total, count] + */ + public function getTables(): array + { + $tables = []; + foreach ($this->app->db->query("show tables") as $item) { + $tables = array_merge($tables, array_values($item)); + } + return [$tables, count($tables), 0]; + } + /** * 读取数据内容 * @param string $name diff --git a/vendor/zoujingli/think-library/src/storage/QiniuStorage.php b/vendor/zoujingli/think-library/src/storage/QiniuStorage.php index 7c7b068a8..bc1f40f77 100644 --- a/vendor/zoujingli/think-library/src/storage/QiniuStorage.php +++ b/vendor/zoujingli/think-library/src/storage/QiniuStorage.php @@ -75,7 +75,7 @@ class QiniuStorage extends Storage * @param boolean $safe 安全模式 * @param null|string $attname 下载名称 * @return array - * @throws \think\Exception + * @throws \think\admin\Exception * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException @@ -169,7 +169,7 @@ class QiniuStorage extends Storage /** * 获取文件上传地址 * @return string - * @throws \think\Exception + * @throws \think\admin\Exception * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException @@ -189,7 +189,7 @@ class QiniuStorage extends Storage case '东南亚': return "{$protocol}://up-as0.qiniup.com"; default: - throw new \think\Exception('未配置七牛云空间区域哦'); + throw new \think\admin\Exception('未配置七牛云空间区域哦'); } }