ComposerUpdate

This commit is contained in:
Anyon 2019-12-31 11:12:18 +08:00
parent 1d8367885a
commit bcef4a9cee
9 changed files with 53 additions and 32 deletions

8
composer.lock generated
View File

@ -909,12 +909,12 @@
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/zoujingli/ThinkLibrary.git", "url": "https://github.com/zoujingli/ThinkLibrary.git",
"reference": "fa56d64793a05550c1ae45ea5420f0b2bd93fc94" "reference": "4834f87b32ed0fadf14864068614e9d2b20c9507"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/fa56d64793a05550c1ae45ea5420f0b2bd93fc94", "url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/4834f87b32ed0fadf14864068614e9d2b20c9507",
"reference": "fa56d64793a05550c1ae45ea5420f0b2bd93fc94", "reference": "4834f87b32ed0fadf14864068614e9d2b20c9507",
"shasum": "", "shasum": "",
"mirrors": [ "mirrors": [
{ {
@ -958,7 +958,7 @@
], ],
"description": "ThinkPHP v6.0 Development Library", "description": "ThinkPHP v6.0 Development Library",
"homepage": "http://framework.thinkadmin.top", "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", "name": "zoujingli/wechat-developer",

View File

@ -935,12 +935,12 @@
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/zoujingli/ThinkLibrary.git", "url": "https://github.com/zoujingli/ThinkLibrary.git",
"reference": "fa56d64793a05550c1ae45ea5420f0b2bd93fc94" "reference": "4834f87b32ed0fadf14864068614e9d2b20c9507"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/fa56d64793a05550c1ae45ea5420f0b2bd93fc94", "url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/4834f87b32ed0fadf14864068614e9d2b20c9507",
"reference": "fa56d64793a05550c1ae45ea5420f0b2bd93fc94", "reference": "4834f87b32ed0fadf14864068614e9d2b20c9507",
"shasum": "", "shasum": "",
"mirrors": [ "mirrors": [
{ {
@ -956,7 +956,7 @@
"ext-json": "*", "ext-json": "*",
"topthink/framework": "^6.0" "topthink/framework": "^6.0"
}, },
"time": "2019-12-30T10:26:31+00:00", "time": "2019-12-31T02:35:41+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:2019-12-30 18:59:17 // This file is automatically generated at:2019-12-31 11:11:55
declare (strict_types = 1); declare (strict_types = 1);
return array ( return array (
0 => 'think\\app\\Service', 0 => 'think\\app\\Service',

View File

@ -250,3 +250,16 @@ if (!function_exists('down_file')) {
return isset($result['url']) ? $result['url'] : $source; 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];
}
}

View File

@ -21,7 +21,7 @@ return [
'think_library_form_success' => 'Data saving completed.', 'think_library_form_success' => 'Data saving completed.',
'think_library_form_error' => 'Sorry, data saving failed, please try again later.', 'think_library_form_error' => 'Sorry, data saving failed, please try again later.',
'think_library_save_success' => 'Data update completed.', '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_success' => 'Modification of list sort completed.',
'think_library_sort_error' => 'Sorry, modification of list sort failed, please try again later.', '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.', 'think_library_page_html' => 'Total %s records, display %s per page, total %s page current display %s page.',

View File

@ -62,7 +62,7 @@ class CaptchaService extends Service
/** /**
* 动态切换配置 * 动态切换配置
* @param array $config * @param array $config
* @return $this|Service * @return $this
*/ */
public function config($config = []) public function config($config = [])
{ {
@ -118,9 +118,13 @@ class CaptchaService extends Service
public function check($code, $uniqid = null) public function check($code, $uniqid = null)
{ {
$_uni = is_string($uniqid) ? $uniqid : input('uniqid', '-'); $_uni = is_string($uniqid) ? $uniqid : input('uniqid', '-');
$_val = $this->app->cache->get($_uni); $_val = $this->app->cache->get($_uni, '');
if (is_string($_val) && strtolower($_val) === strtolower($code)) {
$this->app->cache->delete($_uni); $this->app->cache->delete($_uni);
return is_string($_val) && strtolower($_val) === strtolower($code); return true;
} else {
return false;
}
} }
/** /**

View File

@ -25,18 +25,18 @@ use think\admin\Service;
*/ */
class JsonRpcClientService extends Service class JsonRpcClientService extends Service
{ {
/**
* 服务端地址
* @var string
*/
private $proxy;
/** /**
* 请求ID * 请求ID
* @var integer * @var integer
*/ */
private $id; private $id;
/**
* 服务端地址
* @var string
*/
private $proxy;
/** /**
* 创建连接对象 * 创建连接对象
* @param string $proxy * @param string $proxy

View File

@ -83,19 +83,20 @@ class NodeService extends Service
} else { } else {
$data = []; $data = [];
} }
$ignore = get_class_methods('\think\admin\Controller'); $ignores = get_class_methods('\think\admin\Controller');
foreach ($this->scanDirectory(dirname($this->app->getAppPath())) as $file) { foreach ($this->_scanDirectory(dirname($this->app->getAppPath())) as $file) {
if (preg_match("|/(\w+)/(\w+)/controller/(.+)\.php$|i", $file, $matches)) { if (preg_match("|/(\w+)/(\w+)/controller/(.+)\.php$|i", $file, $matches)) {
list(, $namespace, $application, $baseclass) = $matches; list(, $namespace, $appname, $classname) = $matches;
$class = new \ReflectionClass(strtr("{$namespace}/{$application}/controller/{$baseclass}", '/', '\\')); $class = new \ReflectionClass(strtr("{$namespace}/{$appname}/controller/{$classname}", '/', '\\'));
$prefix = strtr("{$application}/" . $this->nameTolower($baseclass), '\\', '/'); $prefix = strtr("{$appname}/{$this->nameTolower($classname)}", '\\', '/');
$data[$prefix] = $this->parseComment($class->getDocComment(), $baseclass); $data[$prefix] = $this->_parseComment($class->getDocComment(), $classname);
foreach ($class->getMethods(\ReflectionMethod::IS_PUBLIC) as $method) { foreach ($class->getMethods(\ReflectionMethod::IS_PUBLIC) as $method) {
if (in_array($method->getName(), $ignore)) continue; if (in_array($metname = $method->getName(), $ignores)) continue;
$data["{$prefix}/{$method->getName()}"] = $this->parseComment($method->getDocComment(), $method->getName()); $data["{$prefix}/{$metname}"] = $this->_parseComment($method->getDocComment(), $metname);
} }
} }
} }
$data = array_change_key_case($data, CASE_LOWER);
$this->app->cache->set('system_auth_node', $data); $this->app->cache->set('system_auth_node', $data);
return $data; return $data;
} }
@ -106,10 +107,13 @@ class NodeService extends Service
* @param string $default * @param string $default
* @return array * @return array
*/ */
private function parseComment($comment, $default = '') private function _parseComment($comment, $default = '')
{ {
$text = strtr($comment, "\n", ' '); $text = strtr($comment, "\n", ' ');
$title = preg_replace('/^\/\*\s*\*\s*\*\s*(.*?)\s*\*.*?$/', '$1', $text); $title = preg_replace('/^\/\*\s*\*\s*\*\s*(.*?)\s*\*.*?$/', '$1', $text);
foreach (['@auth', '@menu', '@login'] as $find) if (stripos($title, $find) === 0) {
$title = $default;
}
return [ return [
'title' => $title ? $title : $default, 'title' => $title ? $title : $default,
'isauth' => intval(preg_match('/@auth\s*true/i', $text)), 'isauth' => intval(preg_match('/@auth\s*true/i', $text)),
@ -125,11 +129,11 @@ class NodeService extends Service
* @param string $ext 有文件后缀 * @param string $ext 有文件后缀
* @return array * @return array
*/ */
private function scanDirectory($path, $data = [], $ext = 'php') private function _scanDirectory($path, $data = [], $ext = 'php')
{ {
foreach (glob("{$path}*") as $item) { foreach (glob("{$path}*") as $item) {
if (is_dir($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) { } elseif (is_file($item) && pathinfo($item, PATHINFO_EXTENSION) === $ext) {
$data[] = strtr($item, '\\', '/'); $data[] = strtr($item, '\\', '/');
} }

View File

@ -69,7 +69,7 @@ class TokenService extends Service
*/ */
public function buildFormToken($node = null) 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) { foreach ($this->app->session->all() as $key => $item) {
if (stripos($key, 'csrf') === 0 && isset($item['time'])) { if (stripos($key, 'csrf') === 0 && isset($item['time'])) {
if ($item['time'] + 600 < $time) $this->clearFormToken($key); if ($item['time'] + 600 < $time) $this->clearFormToken($key);