ComposerUpdate

This commit is contained in:
邹景立 2021-03-01 12:05:53 +08:00
parent c6b3b6c224
commit 22214e4ac7
6 changed files with 26 additions and 38 deletions

View File

@ -863,12 +863,12 @@
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/zoujingli/ThinkLibrary.git", "url": "https://github.com/zoujingli/ThinkLibrary.git",
"reference": "90c1f5dccfe047e542d10d80534a4da174433527" "reference": "a273990298618e97fb7a03082f7a032ba0ad548c"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/90c1f5dccfe047e542d10d80534a4da174433527", "url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/a273990298618e97fb7a03082f7a032ba0ad548c",
"reference": "90c1f5dccfe047e542d10d80534a4da174433527", "reference": "a273990298618e97fb7a03082f7a032ba0ad548c",
"shasum": "", "shasum": "",
"mirrors": [ "mirrors": [
{ {
@ -885,7 +885,7 @@
"ext-mbstring": "*", "ext-mbstring": "*",
"topthink/framework": "^6.0" "topthink/framework": "^6.0"
}, },
"time": "2021-02-25T03:15:54+00:00", "time": "2021-03-01T02:53:44+00:00",
"type": "library", "type": "library",
"extra": { "extra": {
"think": { "think": {

2
vendor/services.php vendored
View File

@ -1,5 +1,5 @@
<?php <?php
// This file is automatically generated at:2021-03-01 10:16:28 // This file is automatically generated at:2021-03-01 12:04:40
declare (strict_types = 1); declare (strict_types = 1);
return array ( return array (
0 => 'think\\admin\\Library', 0 => 'think\\admin\\Library',

View File

@ -19,6 +19,7 @@ namespace think\admin\command;
use think\admin\Command; use think\admin\Command;
use think\admin\Exception; use think\admin\Exception;
use think\admin\service\SystemService;
use think\console\Input; use think\console\Input;
use think\console\input\Argument; use think\console\input\Argument;
use think\console\Output; use think\console\Output;
@ -59,7 +60,7 @@ class Database extends Command
protected function _repair(): void protected function _repair(): void
{ {
$this->setQueueProgress("正在获取需要修复的数据表", 0); $this->setQueueProgress("正在获取需要修复的数据表", 0);
[$total, $count] = [count($tables = $this->getTables()), 0]; [$tables, $total, $count] = SystemService::instance()->getTables();
$this->setQueueProgress("总共需要修复 {$total} 张数据表", 0); $this->setQueueProgress("总共需要修复 {$total} 张数据表", 0);
foreach ($tables as $table) { foreach ($tables as $table) {
$this->queue->message($total, ++$count, "正在修复数据表 {$table}"); $this->queue->message($total, ++$count, "正在修复数据表 {$table}");
@ -76,7 +77,7 @@ class Database extends Command
protected function _optimize(): void protected function _optimize(): void
{ {
$this->setQueueProgress("正在获取需要优化的数据表", 0); $this->setQueueProgress("正在获取需要优化的数据表", 0);
[$total, $count] = [count($tables = $this->getTables()), 0]; [$tables, $total, $count] = SystemService::instance()->getTables();
$this->setQueueProgress("总共需要优化 {$total} 张数据表", 0); $this->setQueueProgress("总共需要优化 {$total} 张数据表", 0);
foreach ($tables as $table) { foreach ($tables as $table) {
$this->queue->message($total, ++$count, "正在优化数据表 {$table}"); $this->queue->message($total, ++$count, "正在优化数据表 {$table}");
@ -86,17 +87,4 @@ class Database extends Command
$this->queue->success("已完成对 {$total} 张数据表优化操作"); $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;
}
} }

View File

@ -19,6 +19,7 @@ namespace think\admin\command;
use Exception; use Exception;
use think\admin\Command; use think\admin\Command;
use think\admin\service\SystemService;
use think\console\Input; use think\console\Input;
use think\console\input\Argument; use think\console\input\Argument;
use think\console\Output; use think\console\Output;
@ -52,8 +53,7 @@ class Replace extends Command
$repalce = $input->getArgument('replace'); $repalce = $input->getArgument('replace');
if ($search === '') $this->queue->error('查找替换字符内容不能为空!'); if ($search === '') $this->queue->error('查找替换字符内容不能为空!');
if ($repalce === '') $this->queue->error('目标替换字符内容不能为空!'); if ($repalce === '') $this->queue->error('目标替换字符内容不能为空!');
[$tables, $total, $count] = SystemService::instance()->getTables();
[$total, $count] = [count($tables = $this->getTables()), 0];
foreach ($tables as $table) { foreach ($tables as $table) {
$data = []; $data = [];
$this->queue->message($total, ++$count, sprintf("准备替换数据表 %s", Str::studly($table))); $this->queue->message($total, ++$count, sprintf("准备替换数据表 %s", Str::studly($table)));
@ -74,17 +74,4 @@ class Replace extends Command
} }
$this->queue->success('批量替换成功'); $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;
}
} }

View File

@ -164,6 +164,19 @@ class SystemService extends Service
return $this->save('SystemData', ['name' => $name, 'value' => serialize($value)], 'name'); 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 * @param string $name

View File

@ -75,7 +75,7 @@ class QiniuStorage extends Storage
* @param boolean $safe 安全模式 * @param boolean $safe 安全模式
* @param null|string $attname 下载名称 * @param null|string $attname 下载名称
* @return array * @return array
* @throws \think\Exception * @throws \think\admin\Exception
* @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException * @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException * @throws \think\db\exception\ModelNotFoundException
@ -169,7 +169,7 @@ class QiniuStorage extends Storage
/** /**
* 获取文件上传地址 * 获取文件上传地址
* @return string * @return string
* @throws \think\Exception * @throws \think\admin\Exception
* @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException * @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException * @throws \think\db\exception\ModelNotFoundException
@ -189,7 +189,7 @@ class QiniuStorage extends Storage
case '东南亚': case '东南亚':
return "{$protocol}://up-as0.qiniup.com"; return "{$protocol}://up-as0.qiniup.com";
default: default:
throw new \think\Exception('未配置七牛云空间区域哦'); throw new \think\admin\Exception('未配置七牛云空间区域哦');
} }
} }