From bcef4a9cee3a1533ee1bc3275d12d8c0d77e0458 Mon Sep 17 00:00:00 2001 From: Anyon Date: Tue, 31 Dec 2019 11:12:18 +0800 Subject: [PATCH] ComposerUpdate --- composer.lock | 8 +++--- vendor/composer/installed.json | 8 +++--- vendor/services.php | 2 +- vendor/zoujingli/think-library/src/common.php | 13 ++++++++++ .../think-library/src/lang/en-us.php | 2 +- .../src/service/CaptchaService.php | 12 ++++++--- .../src/service/JsonRpcClientService.php | 12 ++++----- .../think-library/src/service/NodeService.php | 26 +++++++++++-------- .../src/service/TokenService.php | 2 +- 9 files changed, 53 insertions(+), 32 deletions(-) diff --git a/composer.lock b/composer.lock index 874005828..24d285899 100644 --- a/composer.lock +++ b/composer.lock @@ -909,12 +909,12 @@ "source": { "type": "git", "url": "https://github.com/zoujingli/ThinkLibrary.git", - "reference": "fa56d64793a05550c1ae45ea5420f0b2bd93fc94" + "reference": "4834f87b32ed0fadf14864068614e9d2b20c9507" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/fa56d64793a05550c1ae45ea5420f0b2bd93fc94", - "reference": "fa56d64793a05550c1ae45ea5420f0b2bd93fc94", + "url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/4834f87b32ed0fadf14864068614e9d2b20c9507", + "reference": "4834f87b32ed0fadf14864068614e9d2b20c9507", "shasum": "", "mirrors": [ { @@ -958,7 +958,7 @@ ], "description": "ThinkPHP v6.0 Development Library", "homepage": "http://framework.thinkadmin.top", - "time": "2019-12-30T10:26:31+00:00" + "time": "2019-12-31T02:35:41+00:00" }, { "name": "zoujingli/wechat-developer", diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index 9f61cc52e..b334a09db 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -935,12 +935,12 @@ "source": { "type": "git", "url": "https://github.com/zoujingli/ThinkLibrary.git", - "reference": "fa56d64793a05550c1ae45ea5420f0b2bd93fc94" + "reference": "4834f87b32ed0fadf14864068614e9d2b20c9507" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/fa56d64793a05550c1ae45ea5420f0b2bd93fc94", - "reference": "fa56d64793a05550c1ae45ea5420f0b2bd93fc94", + "url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/4834f87b32ed0fadf14864068614e9d2b20c9507", + "reference": "4834f87b32ed0fadf14864068614e9d2b20c9507", "shasum": "", "mirrors": [ { @@ -956,7 +956,7 @@ "ext-json": "*", "topthink/framework": "^6.0" }, - "time": "2019-12-30T10:26:31+00:00", + "time": "2019-12-31T02:35:41+00:00", "type": "library", "extra": { "think": { diff --git a/vendor/services.php b/vendor/services.php index f630f3c14..b91db2ed9 100644 --- a/vendor/services.php +++ b/vendor/services.php @@ -1,5 +1,5 @@ 'think\\app\\Service', diff --git a/vendor/zoujingli/think-library/src/common.php b/vendor/zoujingli/think-library/src/common.php index f2d99dede..c8e039e1b 100644 --- a/vendor/zoujingli/think-library/src/common.php +++ b/vendor/zoujingli/think-library/src/common.php @@ -249,4 +249,17 @@ if (!function_exists('down_file')) { $result = Storage::down($source, $force, $expire); return isset($result['url']) ? $result['url'] : $source; } +} +if (!function_exists('format_bytes')) { + /** + * 文件字节单位转换 + * @param integer $size + * @return string + */ + function format_bytes($size) + { + $units = [' B', ' KB', ' MB', ' GB', ' TB']; + for ($i = 0; $size >= 1024 && $i < 4; $i++) $size /= 1024; + return round($size, 2) . $units[$i]; + } } \ No newline at end of file diff --git a/vendor/zoujingli/think-library/src/lang/en-us.php b/vendor/zoujingli/think-library/src/lang/en-us.php index c22fdefd8..bd6ea321e 100644 --- a/vendor/zoujingli/think-library/src/lang/en-us.php +++ b/vendor/zoujingli/think-library/src/lang/en-us.php @@ -21,7 +21,7 @@ return [ 'think_library_form_success' => 'Data saving completed.', 'think_library_form_error' => 'Sorry, data saving failed, please try again later.', 'think_library_save_success' => 'Data update completed.', - 'think_library_save_error' => 'Sorry, Data update failed, please try again later.', + 'think_library_save_error' => 'Sorry, data update failed, please try again later.', 'think_library_sort_success' => 'Modification of list sort completed.', 'think_library_sort_error' => 'Sorry, modification of list sort failed, please try again later.', 'think_library_page_html' => 'Total %s records, display %s per page, total %s page current display %s page.', diff --git a/vendor/zoujingli/think-library/src/service/CaptchaService.php b/vendor/zoujingli/think-library/src/service/CaptchaService.php index d2e82ebff..b6795fd2c 100644 --- a/vendor/zoujingli/think-library/src/service/CaptchaService.php +++ b/vendor/zoujingli/think-library/src/service/CaptchaService.php @@ -62,7 +62,7 @@ class CaptchaService extends Service /** * 动态切换配置 * @param array $config - * @return $this|Service + * @return $this */ public function config($config = []) { @@ -118,9 +118,13 @@ class CaptchaService extends Service public function check($code, $uniqid = null) { $_uni = is_string($uniqid) ? $uniqid : input('uniqid', '-'); - $_val = $this->app->cache->get($_uni); - $this->app->cache->delete($_uni); - return is_string($_val) && strtolower($_val) === strtolower($code); + $_val = $this->app->cache->get($_uni, ''); + if (is_string($_val) && strtolower($_val) === strtolower($code)) { + $this->app->cache->delete($_uni); + return true; + } else { + return false; + } } /** diff --git a/vendor/zoujingli/think-library/src/service/JsonRpcClientService.php b/vendor/zoujingli/think-library/src/service/JsonRpcClientService.php index bd9c3679b..0fe60cea7 100644 --- a/vendor/zoujingli/think-library/src/service/JsonRpcClientService.php +++ b/vendor/zoujingli/think-library/src/service/JsonRpcClientService.php @@ -25,18 +25,18 @@ use think\admin\Service; */ class JsonRpcClientService extends Service { - /** - * 服务端地址 - * @var string - */ - private $proxy; - /** * 请求ID * @var integer */ private $id; + /** + * 服务端地址 + * @var string + */ + private $proxy; + /** * 创建连接对象 * @param string $proxy diff --git a/vendor/zoujingli/think-library/src/service/NodeService.php b/vendor/zoujingli/think-library/src/service/NodeService.php index ad97631b9..c2d34e0a3 100644 --- a/vendor/zoujingli/think-library/src/service/NodeService.php +++ b/vendor/zoujingli/think-library/src/service/NodeService.php @@ -83,19 +83,20 @@ class NodeService extends Service } else { $data = []; } - $ignore = get_class_methods('\think\admin\Controller'); - foreach ($this->scanDirectory(dirname($this->app->getAppPath())) as $file) { + $ignores = get_class_methods('\think\admin\Controller'); + foreach ($this->_scanDirectory(dirname($this->app->getAppPath())) as $file) { if (preg_match("|/(\w+)/(\w+)/controller/(.+)\.php$|i", $file, $matches)) { - list(, $namespace, $application, $baseclass) = $matches; - $class = new \ReflectionClass(strtr("{$namespace}/{$application}/controller/{$baseclass}", '/', '\\')); - $prefix = strtr("{$application}/" . $this->nameTolower($baseclass), '\\', '/'); - $data[$prefix] = $this->parseComment($class->getDocComment(), $baseclass); + list(, $namespace, $appname, $classname) = $matches; + $class = new \ReflectionClass(strtr("{$namespace}/{$appname}/controller/{$classname}", '/', '\\')); + $prefix = strtr("{$appname}/{$this->nameTolower($classname)}", '\\', '/'); + $data[$prefix] = $this->_parseComment($class->getDocComment(), $classname); foreach ($class->getMethods(\ReflectionMethod::IS_PUBLIC) as $method) { - if (in_array($method->getName(), $ignore)) continue; - $data["{$prefix}/{$method->getName()}"] = $this->parseComment($method->getDocComment(), $method->getName()); + if (in_array($metname = $method->getName(), $ignores)) continue; + $data["{$prefix}/{$metname}"] = $this->_parseComment($method->getDocComment(), $metname); } } } + $data = array_change_key_case($data, CASE_LOWER); $this->app->cache->set('system_auth_node', $data); return $data; } @@ -106,10 +107,13 @@ class NodeService extends Service * @param string $default * @return array */ - private function parseComment($comment, $default = '') + private function _parseComment($comment, $default = '') { $text = strtr($comment, "\n", ' '); $title = preg_replace('/^\/\*\s*\*\s*\*\s*(.*?)\s*\*.*?$/', '$1', $text); + foreach (['@auth', '@menu', '@login'] as $find) if (stripos($title, $find) === 0) { + $title = $default; + } return [ 'title' => $title ? $title : $default, 'isauth' => intval(preg_match('/@auth\s*true/i', $text)), @@ -125,11 +129,11 @@ class NodeService extends Service * @param string $ext 有文件后缀 * @return array */ - private function scanDirectory($path, $data = [], $ext = 'php') + private function _scanDirectory($path, $data = [], $ext = 'php') { foreach (glob("{$path}*") as $item) { if (is_dir($item)) { - $data = array_merge($data, $this->scanDirectory("{$item}/")); + $data = array_merge($data, $this->_scanDirectory("{$item}/")); } elseif (is_file($item) && pathinfo($item, PATHINFO_EXTENSION) === $ext) { $data[] = strtr($item, '\\', '/'); } diff --git a/vendor/zoujingli/think-library/src/service/TokenService.php b/vendor/zoujingli/think-library/src/service/TokenService.php index f079a2c70..476ecf504 100644 --- a/vendor/zoujingli/think-library/src/service/TokenService.php +++ b/vendor/zoujingli/think-library/src/service/TokenService.php @@ -69,7 +69,7 @@ class TokenService extends Service */ public function buildFormToken($node = null) { - list($token, $time) = [uniqid('csrf'), time()]; + list($token, $time) = [uniqid('csrf') . rand(1000, 9999), time()]; foreach ($this->app->session->all() as $key => $item) { if (stripos($key, 'csrf') === 0 && isset($item['time'])) { if ($item['time'] + 600 < $time) $this->clearFormToken($key);