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": {
"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",

View File

@ -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": {

2
vendor/services.php vendored
View File

@ -1,5 +1,5 @@
<?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);
return array (
0 => 'think\\app\\Service',

View File

@ -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];
}
}

View File

@ -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.',

View File

@ -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;
}
}
/**

View File

@ -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

View File

@ -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, '\\', '/');
}

View File

@ -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);