后台登录入口
-
login
+
Login
diff --git a/composer.lock b/composer.lock
index 53458c97f..fd5b25018 100644
--- a/composer.lock
+++ b/composer.lock
@@ -879,12 +879,12 @@
"source": {
"type": "git",
"url": "https://github.com/zoujingli/ThinkLibrary.git",
- "reference": "54dfd26bd7de6bb86d233f4bb03b80d3b475ce7f"
+ "reference": "0a8548f0b1814130840210695a9febc3766d0803"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/54dfd26bd7de6bb86d233f4bb03b80d3b475ce7f",
- "reference": "54dfd26bd7de6bb86d233f4bb03b80d3b475ce7f",
+ "url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/0a8548f0b1814130840210695a9febc3766d0803",
+ "reference": "0a8548f0b1814130840210695a9febc3766d0803",
"shasum": "",
"mirrors": [
{
@@ -927,8 +927,8 @@
}
],
"description": "ThinkPHP v6.0 Development Library",
- "homepage": "http://framework.thinkadmin.top",
- "time": "2020-07-30T10:54:48+00:00"
+ "homepage": "http://thinkadmin.top",
+ "time": "2020-07-31T08:20:24+00:00"
},
{
"name": "zoujingli/wechat-developer",
diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json
index acf083ffe..90704d776 100644
--- a/vendor/composer/installed.json
+++ b/vendor/composer/installed.json
@@ -903,12 +903,12 @@
"source": {
"type": "git",
"url": "https://github.com/zoujingli/ThinkLibrary.git",
- "reference": "54dfd26bd7de6bb86d233f4bb03b80d3b475ce7f"
+ "reference": "0a8548f0b1814130840210695a9febc3766d0803"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/54dfd26bd7de6bb86d233f4bb03b80d3b475ce7f",
- "reference": "54dfd26bd7de6bb86d233f4bb03b80d3b475ce7f",
+ "url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/0a8548f0b1814130840210695a9febc3766d0803",
+ "reference": "0a8548f0b1814130840210695a9febc3766d0803",
"shasum": "",
"mirrors": [
{
@@ -924,7 +924,7 @@
"ext-json": "*",
"topthink/framework": "^6.0"
},
- "time": "2020-07-30T10:54:48+00:00",
+ "time": "2020-07-31T08:20:24+00:00",
"type": "library",
"extra": {
"think": {
@@ -953,7 +953,7 @@
}
],
"description": "ThinkPHP v6.0 Development Library",
- "homepage": "http://framework.thinkadmin.top"
+ "homepage": "http://thinkadmin.top"
},
{
"name": "zoujingli/wechat-developer",
diff --git a/vendor/services.php b/vendor/services.php
index c91bcd537..b22d6c600 100644
--- a/vendor/services.php
+++ b/vendor/services.php
@@ -1,5 +1,5 @@
'think\\admin\\Library',
diff --git a/vendor/zoujingli/think-library/composer.json b/vendor/zoujingli/think-library/composer.json
index 42e7f2ddc..a01e4cf91 100644
--- a/vendor/zoujingli/think-library/composer.json
+++ b/vendor/zoujingli/think-library/composer.json
@@ -2,7 +2,7 @@
"type": "library",
"name": "zoujingli/think-library",
"license": "MIT",
- "homepage": "http://framework.thinkadmin.top",
+ "homepage": "http://thinkadmin.top",
"description": "ThinkPHP v6.0 Development Library",
"authors": [
{
diff --git a/vendor/zoujingli/think-library/src/Library.php b/vendor/zoujingli/think-library/src/Library.php
index fd8a929cb..e16df2464 100644
--- a/vendor/zoujingli/think-library/src/Library.php
+++ b/vendor/zoujingli/think-library/src/Library.php
@@ -53,7 +53,7 @@ class Library extends Service
$this->commands(['build' => Build::class, 'clear' => Clear::class]);
// 注册 ThinkAdmin 指令
$this->commands([Queue::class, Install::class, Version::class, Database::class]);
- // 动态应用配置参数
+ // 动态应用运行参数
SystemService::instance()->bindRuntime();
}
diff --git a/vendor/zoujingli/think-library/src/Storage.php b/vendor/zoujingli/think-library/src/Storage.php
index ab577b130..0049c1186 100644
--- a/vendor/zoujingli/think-library/src/Storage.php
+++ b/vendor/zoujingli/think-library/src/Storage.php
@@ -15,9 +15,7 @@
namespace think\admin;
-use think\admin\storage\AliossStorage;
use think\admin\storage\LocalStorage;
-use think\admin\storage\QiniuStorage;
use think\App;
use think\Container;
@@ -57,25 +55,22 @@ abstract class Storage
/**
* Storage constructor.
* @param App $app
- */
- public function __construct(App $app)
- {
- $this->app = $app;
- }
-
- /**
- * 存储初始化
- * @return static
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
- protected function initialize()
+ public function __construct(App $app)
{
+ $this->app = $app;
$this->linkType = sysconf('storage.link_type');
- return $this;
+ $this->initialize();
}
+ /**
+ * 存储驱动初始化
+ */
+ abstract protected function initialize();
+
/**
* 静态访问启用
* @param string $method 方法名称
@@ -106,9 +101,9 @@ abstract class Storage
*/
public static function instance($name = null)
{
- $class = ucfirst(strtolower(is_null($name) ? sysconf('storage.type') : $name));
+ $class = ucfirst(strtolower($name ?: sysconf('storage.type')));
if (class_exists($object = "think\\admin\\storage\\{$class}Storage")) {
- return Container::getInstance()->make($object)->initialize();
+ return Container::getInstance()->make($object);
} else {
throw new Exception("File driver [{$class}] does not exist.");
}
diff --git a/vendor/zoujingli/think-library/src/service/SystemService.php b/vendor/zoujingli/think-library/src/service/SystemService.php
index c602a29f7..d3855476a 100644
--- a/vendor/zoujingli/think-library/src/service/SystemService.php
+++ b/vendor/zoujingli/think-library/src/service/SystemService.php
@@ -213,7 +213,7 @@ class SystemService extends Service
* @param string $type 运行模式(dev|demo|local)
* @return boolean
*/
- public function checkRunMode($type = 'dev')
+ public function checkRunMode($type = 'dev'): bool
{
$domain = $this->app->request->host(true);
$isDemo = is_numeric(stripos($domain, 'thinkadmin.top'));
@@ -228,7 +228,7 @@ class SystemService extends Service
* 判断实时运行模式
* @return boolean
*/
- public function isDebug()
+ public function isDebug(): bool
{
return $this->getRuntime('run') !== 'product';
}
@@ -238,7 +238,7 @@ class SystemService extends Service
* @param null|boolean $state
* @return boolean
*/
- public function productMode($state = null)
+ public function productMode($state = null): bool
{
if (is_null($state)) {
return $this->bindRuntime();
@@ -254,37 +254,35 @@ class SystemService extends Service
* @param array|null $uri 域名映射
* @return boolean 是否调试模式
*/
- public function setRuntime($map = [], $run = null, $uri = [])
+ public function setRuntime(array $map = [], $run = null, array $uri = []): bool
{
$data = $this->getRuntime();
- if (is_array($map) && count($map) > 0 && count($data['map']) > 0) {
- foreach ($data['map'] as $kk => $vv) if (in_array($vv, $map)) unset($data['map'][$kk]);
- }
- if (is_array($uri) && count($uri) > 0 && count($data['uri']) > 0) {
- foreach ($data['uri'] as $kk => $vv) if (in_array($vv, $uri)) unset($data['uri'][$kk]);
- }
- $file = "{$this->app->getRootPath()}runtime/config.json";
- $data['run'] = is_null($run) ? $data['run'] : $run;
- $data['map'] = is_null($map) ? [] : array_merge($data['map'], $map);
- $data['uri'] = is_null($uri) ? [] : array_merge($data['uri'], $uri);
- file_put_contents($file, json_encode($data, JSON_UNESCAPED_UNICODE));
+ $data['run'] = is_string($run) ? $run : $data['run'];
+ $data['map'] = array_unique(array_reverse(array_merge($data['map'], $map)));
+ $data['uri'] = array_unique(array_reverse(array_merge($data['uri'], $uri)));
+ foreach ($data['map'] as $kk => $vv) if ($kk === $vv) unset($data['map'][$kk]);
+ foreach ($data['uri'] as $kk => $vv) if ($kk === $vv) unset($data['uri'][$kk]);
+ file_put_contents("{$this->app->getRootPath()}runtime/config.json", json_encode($data, JSON_UNESCAPED_UNICODE));
return $this->bindRuntime($data);
}
/**
* 获取实时运行配置
- * @param null|string $key
+ * @param string $key
+ * @param array $default
* @return array
*/
- public function getRuntime($key = null)
+ public function getRuntime($key = null, $default = [])
{
- $file = "{$this->app->getRootPath()}runtime/config.json";
- $data = file_exists($file) ? json_decode(file_get_contents($file), true) : [];
+ $jsonfile = "{$this->app->getRootPath()}runtime/config.json";
+ if (file_exists($jsonfile) && is_file($jsonfile)) {
+ $data = json_decode(file_get_contents($jsonfile), true);
+ }
if (empty($data) || !is_array($data)) $data = [];
if (empty($data['map']) || !is_array($data['map'])) $data['map'] = [];
if (empty($data['uri']) || !is_array($data['uri'])) $data['uri'] = [];
if (empty($data['run']) || !is_string($data['run'])) $data['run'] = 'developer';
- return is_null($key) ? $data : ($data[$key] ?? null);
+ return is_null($key) ? $data : ($data[$key] ?? $default);
}
/**
@@ -292,33 +290,27 @@ class SystemService extends Service
* @param array $data 配置数据
* @return boolean 是否调试模式
*/
- public function bindRuntime($data = [])
+ public function bindRuntime($data = []): bool
{
+ // 获取运行配置
if (empty($data)) $data = $this->getRuntime();
// 动态设置应用绑定
- if (!empty($data['map'])) {
- $maps = $this->app->config->get('app.app_map', []);
- if (is_array($maps) && count($maps) > 0 && count($data['map']) > 0) {
- foreach ($maps as $kk => $vv) if (in_array($vv, $data['map'])) unset($maps[$kk]);
- }
- $this->app->config->set(['app_map' => array_merge($maps, $data['map'])], 'app');
+ $config = ['app_map' => [], 'domain_bind' => []];
+ if (isset($data['map']) && is_array($data['map']) && count($data['map']) > 0) {
+ $config['app_map'] = array_unique(array_reverse(array_merge($this->app->config->get('app.app_map', []), $data['map'])));
}
- // 动态设置域名绑定
- if (!empty($data['uri'])) {
- $uris = $this->app->config->get('app.domain_bind', []);
- if (is_array($uris) && count($uris) > 0 && count($data['uri']) > 0) {
- foreach ($uris as $kk => $vv) if (in_array($vv, $data['uri'])) unset($uris[$kk]);
- }
- $this->app->config->set(['domain_bind' => array_merge($uris, $data['uri'])], 'app');
+ if (isset($data['uri']) && is_array($data['uri']) && count($data['uri']) > 0) {
+ $config['domain_bind'] = array_unique(array_reverse(array_merge($this->app->config->get('app.domain_bind', []), $data['uri'])));
}
// 动态设置运行模式
+ $this->app->config->set($config, 'app');
return $this->app->debug($data['run'] !== 'product')->isDebug();
}
/**
* 压缩发布项目
*/
- public function pushRuntime()
+ public function pushRuntime(): void
{
$type = $this->app->db->getConfig('default');
$this->app->console->call("optimize:schema", ["--connection={$type}"]);
@@ -332,7 +324,7 @@ class SystemService extends Service
/**
* 清理运行缓存
*/
- public function clearRuntime()
+ public function clearRuntime(): void
{
$data = $this->getRuntime();
$this->app->console->call('clear');
@@ -343,7 +335,7 @@ class SystemService extends Service
* 初始化并运行应用
* @param \think\App $app
*/
- public function doInit(\think\App $app)
+ public function doInit(\think\App $app): void
{
$app->debug($this->isDebug());
$response = $app->http->run();
diff --git a/vendor/zoujingli/think-library/src/storage/AliossStorage.php b/vendor/zoujingli/think-library/src/storage/AliossStorage.php
index 9f5b6ab88..6a8030cd5 100644
--- a/vendor/zoujingli/think-library/src/storage/AliossStorage.php
+++ b/vendor/zoujingli/think-library/src/storage/AliossStorage.php
@@ -38,20 +38,19 @@ class AliossStorage extends Storage
private $bucket;
/**
- * AccessKeyId
+ * AccessId
* @var string
*/
private $accessKey;
/**
- * AccessKeySecret
+ * AccessSecret
* @var string
*/
private $secretKey;
/**
* 初始化入口
- * @return static
* @throws \think\admin\Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
@@ -71,8 +70,6 @@ class AliossStorage extends Storage
elseif ($type === 'http') $this->prefix = "http://{$domain}";
elseif ($type === 'https') $this->prefix = "https://{$domain}";
else throw new \think\admin\Exception('未配置阿里云URL域名哦');
- // 初始化配置并返回当前实例
- return parent::initialize();
}
/**
diff --git a/vendor/zoujingli/think-library/src/storage/LocalStorage.php b/vendor/zoujingli/think-library/src/storage/LocalStorage.php
index 0a436bfea..6305290d7 100644
--- a/vendor/zoujingli/think-library/src/storage/LocalStorage.php
+++ b/vendor/zoujingli/think-library/src/storage/LocalStorage.php
@@ -27,7 +27,6 @@ class LocalStorage extends Storage
/**
* 初始化入口
- * @return static
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
@@ -43,7 +42,6 @@ class LocalStorage extends Storage
elseif ($type === 'http') $this->prefix = "http://{$domain}";
elseif ($type === 'https') $this->prefix = "https://{$domain}";
}
- return parent::initialize();
}
/**
diff --git a/vendor/zoujingli/think-library/src/storage/QiniuStorage.php b/vendor/zoujingli/think-library/src/storage/QiniuStorage.php
index 956f2d688..cb1af8b1f 100644
--- a/vendor/zoujingli/think-library/src/storage/QiniuStorage.php
+++ b/vendor/zoujingli/think-library/src/storage/QiniuStorage.php
@@ -31,7 +31,6 @@ class QiniuStorage extends Storage
/**
* 初始化入口
- * @return static
* @throws \think\admin\Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
@@ -50,8 +49,6 @@ class QiniuStorage extends Storage
elseif ($type === 'http') $this->prefix = "http://{$domain}";
elseif ($type === 'https') $this->prefix = "https://{$domain}";
else throw new \think\admin\Exception('未配置七牛云URL域名哦');
- // 初始化配置并返回当前实例
- return parent::initialize();
}
/**