From 15c1c77110e8d5349aa8869751673f7f08bb4fd9 Mon Sep 17 00:00:00 2001 From: Anyon Date: Fri, 15 May 2020 11:35:10 +0800 Subject: [PATCH] ComposerUpdate --- composer.lock | 8 ++--- vendor/composer/installed.json | 8 ++--- vendor/services.php | 2 +- .../think-library/src/Controller.php | 4 +-- .../zoujingli/think-library/src/Library.php | 34 +++++++++---------- .../zoujingli/think-library/src/Storage.php | 2 +- vendor/zoujingli/think-library/src/common.php | 4 +-- .../think-library/src/extend/DataExtend.php | 2 +- .../think-library/src/extend/ExcelExtend.php | 2 +- .../think-library/src/helper/FormHelper.php | 4 +-- .../think-library/src/helper/PageHelper.php | 8 ++--- .../think-library/src/helper/QueryHelper.php | 12 ++----- .../think-library/src/helper/SaveHelper.php | 4 +-- .../src/helper/ValidateHelper.php | 29 +++++++++++----- .../src/service/MessageService.php | 3 +- .../src/service/SystemService.php | 4 +-- 16 files changed, 63 insertions(+), 67 deletions(-) diff --git a/composer.lock b/composer.lock index 350ff4bed..9e28510e2 100644 --- a/composer.lock +++ b/composer.lock @@ -915,12 +915,12 @@ "source": { "type": "git", "url": "https://github.com/zoujingli/ThinkLibrary.git", - "reference": "38dabf5b9074b0f87de24aab4f4e939a06ef93ac" + "reference": "41cba1a861a1cadebd71dc1b75d247b78e2cdeac" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/38dabf5b9074b0f87de24aab4f4e939a06ef93ac", - "reference": "38dabf5b9074b0f87de24aab4f4e939a06ef93ac", + "url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/41cba1a861a1cadebd71dc1b75d247b78e2cdeac", + "reference": "41cba1a861a1cadebd71dc1b75d247b78e2cdeac", "shasum": "", "mirrors": [ { @@ -964,7 +964,7 @@ ], "description": "ThinkPHP v6.0 Development Library", "homepage": "http://framework.thinkadmin.top", - "time": "2020-05-13T02:56:23+00:00" + "time": "2020-05-15T03:25:42+00:00" }, { "name": "zoujingli/wechat-developer", diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index ecf95f66a..23ba1b2ae 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -941,12 +941,12 @@ "source": { "type": "git", "url": "https://github.com/zoujingli/ThinkLibrary.git", - "reference": "38dabf5b9074b0f87de24aab4f4e939a06ef93ac" + "reference": "41cba1a861a1cadebd71dc1b75d247b78e2cdeac" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/38dabf5b9074b0f87de24aab4f4e939a06ef93ac", - "reference": "38dabf5b9074b0f87de24aab4f4e939a06ef93ac", + "url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/41cba1a861a1cadebd71dc1b75d247b78e2cdeac", + "reference": "41cba1a861a1cadebd71dc1b75d247b78e2cdeac", "shasum": "", "mirrors": [ { @@ -962,7 +962,7 @@ "ext-json": "*", "topthink/framework": "^6.0" }, - "time": "2020-05-13T02:56:23+00:00", + "time": "2020-05-15T03:25:42+00:00", "type": "library", "extra": { "think": { diff --git a/vendor/services.php b/vendor/services.php index c764b4eb1..7b34faffe 100644 --- a/vendor/services.php +++ b/vendor/services.php @@ -1,5 +1,5 @@ 'think\\app\\Service', diff --git a/vendor/zoujingli/think-library/src/Controller.php b/vendor/zoujingli/think-library/src/Controller.php index 518cec510..c6ba60dbe 100644 --- a/vendor/zoujingli/think-library/src/Controller.php +++ b/vendor/zoujingli/think-library/src/Controller.php @@ -81,6 +81,7 @@ abstract class Controller extends \stdClass if (in_array($this->request->action(), get_class_methods(__CLASS__))) { $this->error('Access without permission.'); } + $this->csrf_message = lang('think_library_csrf_error'); $this->initialize(); } @@ -89,9 +90,6 @@ abstract class Controller extends \stdClass */ protected function initialize() { - if (empty($this->csrf_message)) { - $this->csrf_message = lang('think_library_csrf_error'); - } } /** diff --git a/vendor/zoujingli/think-library/src/Library.php b/vendor/zoujingli/think-library/src/Library.php index 473ac085f..03ec12c1a 100644 --- a/vendor/zoujingli/think-library/src/Library.php +++ b/vendor/zoujingli/think-library/src/Library.php @@ -30,7 +30,23 @@ use function Composer\Autoload\includeFile; class Library extends Service { /** - * 注册初始化服务 + * 启动服务 + */ + public function boot() + { + // 动态绑定运行配置 + SystemService::instance()->bindRuntime(); + // 注册系统任务指令 + $this->commands([ + 'think\admin\command\Queue', + 'think\admin\command\Install', + 'think\admin\command\Version', + 'think\admin\command\Database', + ]); + } + + /** + * 初始化服务 */ public function register() { @@ -74,20 +90,4 @@ class Library extends Service $sysRule = "{$this->app->getAppPath()}*/sys.php"; foreach (glob($sysRule) as $file) includeFile($file); } - - /** - * 启动服务 - */ - public function boot() - { - // 动态绑定运行配置 - SystemService::instance()->bindRuntime(); - // 注册系统任务指令 - $this->commands([ - 'think\admin\command\Queue', - 'think\admin\command\Install', - 'think\admin\command\Version', - 'think\admin\command\Database', - ]); - } } \ No newline at end of file diff --git a/vendor/zoujingli/think-library/src/Storage.php b/vendor/zoujingli/think-library/src/Storage.php index 28947ee5c..795914e72 100644 --- a/vendor/zoujingli/think-library/src/Storage.php +++ b/vendor/zoujingli/think-library/src/Storage.php @@ -163,7 +163,7 @@ abstract class Storage { $mimes = self::mimes(); foreach (is_string($exts) ? explode(',', $exts) : $exts as $ext) { - $mime[] = isset($mimes[strtolower($ext)]) ? $mimes[strtolower($ext)] : 'application/octet-stream'; + $mime[] = $mimes[strtolower($ext)] ?? 'application/octet-stream'; } return join(',', array_unique($mime)); } diff --git a/vendor/zoujingli/think-library/src/common.php b/vendor/zoujingli/think-library/src/common.php index 15145e2a1..c19bab6ca 100644 --- a/vendor/zoujingli/think-library/src/common.php +++ b/vendor/zoujingli/think-library/src/common.php @@ -126,7 +126,7 @@ if (!function_exists('systoken')) { function systoken($node = null) { $result = TokenService::instance()->buildFormToken($node); - return isset($result['token']) ? $result['token'] : ''; + return $result['token'] ?? ''; } } if (!function_exists('sysoplog')) { @@ -279,6 +279,6 @@ if (!function_exists('down_file')) { function down_file($source, $force = false, $expire = 0) { $result = Storage::down($source, $force, $expire); - return isset($result['url']) ? $result['url'] : $source; + return $result['url'] ?? $source; } } \ No newline at end of file diff --git a/vendor/zoujingli/think-library/src/extend/DataExtend.php b/vendor/zoujingli/think-library/src/extend/DataExtend.php index 94658f0ef..b1d80c5e1 100644 --- a/vendor/zoujingli/think-library/src/extend/DataExtend.php +++ b/vendor/zoujingli/think-library/src/extend/DataExtend.php @@ -53,7 +53,7 @@ class DataExtend $tree = []; foreach (self::arr2tree($list, $cid, $pid) as $attr) { $attr[$cpath] = "{$ppath}-{$attr[$cid]}"; - $attr['sub'] = isset($attr['sub']) ? $attr['sub'] : []; + $attr['sub'] = $attr['sub'] ?? []; $attr['spt'] = substr_count($ppath, '-'); $attr['spl'] = str_repeat(" ├ ", $attr['spt']); $sub = $attr['sub']; diff --git a/vendor/zoujingli/think-library/src/extend/ExcelExtend.php b/vendor/zoujingli/think-library/src/extend/ExcelExtend.php index 46e235a28..363dcc45a 100644 --- a/vendor/zoujingli/think-library/src/extend/ExcelExtend.php +++ b/vendor/zoujingli/think-library/src/extend/ExcelExtend.php @@ -65,7 +65,7 @@ class ExcelExtend public static function parseKeyDotValue(array $data, $rule) { list($temp, $attr) = [$data, explode('.', trim($rule, '.'))]; - while ($key = array_shift($attr)) $temp = isset($temp[$key]) ? $temp[$key] : $temp; + while ($key = array_shift($attr)) $temp = $temp[$key] ?? $temp; return (is_string($temp) || is_numeric($temp)) ? @iconv('utf-8', 'gbk//TRANSLIT', "{$temp}") : ''; } } \ No newline at end of file diff --git a/vendor/zoujingli/think-library/src/helper/FormHelper.php b/vendor/zoujingli/think-library/src/helper/FormHelper.php index dd26d0dd4..bcd4bae2c 100644 --- a/vendor/zoujingli/think-library/src/helper/FormHelper.php +++ b/vendor/zoujingli/think-library/src/helper/FormHelper.php @@ -71,8 +71,8 @@ class FormHelper extends Helper { $this->query = $this->buildQuery($dbQuery); list($this->template, $this->where, $this->data) = [$template, $where, $data]; - $this->field = empty($field) ? ($this->query->getPk() ? $this->query->getPk() : 'id') : $field;; - $this->value = input($this->field, isset($data[$this->field]) ? $data[$this->field] : null); + $this->field = $field ?: ($this->query->getPk() ?: 'id'); + $this->value = input($this->field, $data[$this->field] ?? null); // GET请求, 获取数据并显示表单页面 if ($this->app->request->isGet()) { if ($this->value !== null) { diff --git a/vendor/zoujingli/think-library/src/helper/PageHelper.php b/vendor/zoujingli/think-library/src/helper/PageHelper.php index 93977ebec..d294f5204 100644 --- a/vendor/zoujingli/think-library/src/helper/PageHelper.php +++ b/vendor/zoujingli/think-library/src/helper/PageHelper.php @@ -70,13 +70,9 @@ class PageHelper extends Helper $this->display = $display; $this->query = $this->buildQuery($dbQuery); // 数据列表排序自动处理 - if ($this->app->request->isPost()) { - $this->sortAction(); - } + if ($this->app->request->isPost()) $this->sortAction(); // 列表设置默认排序处理 - if (!$this->query->getOptions('order')) { - $this->orderAction(); - } + if (!$this->query->getOptions('order')) $this->orderAction(); // 列表分页及结果集处理 if ($this->page) { if ($this->limit > 0) { diff --git a/vendor/zoujingli/think-library/src/helper/QueryHelper.php b/vendor/zoujingli/think-library/src/helper/QueryHelper.php index f5171e8f1..af6d7a5d2 100644 --- a/vendor/zoujingli/think-library/src/helper/QueryHelper.php +++ b/vendor/zoujingli/think-library/src/helper/QueryHelper.php @@ -153,11 +153,7 @@ class QueryHelper extends Helper public function dateBetween($fields, $split = ' - ', $input = 'request', $alias = '#') { return $this->setBetweenWhere($fields, $split, $input, $alias, function ($value, $type) { - if ($type === 'after') { - return "{$value} 23:59:59"; - } else { - return "{$value} 00:00:00"; - } + return $type === 'after' ? "{$value} 23:59:59" : "{$value} 00:00:00"; }); } @@ -172,11 +168,7 @@ class QueryHelper extends Helper public function timeBetween($fields, $split = ' - ', $input = 'request', $alias = '#') { return $this->setBetweenWhere($fields, $split, $input, $alias, function ($value, $type) { - if ($type === 'after') { - return strtotime("{$value} 23:59:59"); - } else { - return strtotime("{$value} 00:00:00"); - } + return $type === 'after' ? strtotime("{$value} 23:59:59") : strtotime("{$value} 00:00:00"); }); } diff --git a/vendor/zoujingli/think-library/src/helper/SaveHelper.php b/vendor/zoujingli/think-library/src/helper/SaveHelper.php index db7219c31..cc5facb19 100644 --- a/vendor/zoujingli/think-library/src/helper/SaveHelper.php +++ b/vendor/zoujingli/think-library/src/helper/SaveHelper.php @@ -62,8 +62,8 @@ class SaveHelper extends Helper { $this->where = $where; $this->query = $this->buildQuery($dbQuery); - $this->data = empty($data) ? $this->app->request->post() : $data; - $this->field = empty($field) ? $this->query->getPk() : $field; + $this->field = $field ?: $this->query->getPk(); + $this->data = $data ?: $this->app->request->post(); $this->value = $this->app->request->post($this->field, null); // 主键限制处理 if (!isset($this->where[$this->field]) && is_string($this->value)) { diff --git a/vendor/zoujingli/think-library/src/helper/ValidateHelper.php b/vendor/zoujingli/think-library/src/helper/ValidateHelper.php index dd35d0743..ad746b5c0 100644 --- a/vendor/zoujingli/think-library/src/helper/ValidateHelper.php +++ b/vendor/zoujingli/think-library/src/helper/ValidateHelper.php @@ -30,32 +30,44 @@ class ValidateHelper extends Helper * @param array $rules 验证规则( 验证信息数组 ) * @param string $type 输入方式 ( post. 或 get. ) * @return array + * name.require => message + * age.max:100 => message + * name.between:1,120 => message + * name.value => value + * name.default => 100 // 获取并设置默认值 */ public function init(array $rules, $type = '') { - list($data, $rule, $info) = [[], [], []]; + list($data, $rule, $info, $alias) = [[], [], [], '']; foreach ($rules as $name => $message) { if (stripos($name, '#') !== false) { list($name, $alias) = explode('#', $name); } if (stripos($name, '.') === false) { if (is_numeric($name)) { - $keys = $message; + $field = $message; if (is_string($message) && stripos($message, '#') !== false) { list($name, $alias) = explode('#', $message); - $keys = empty($alias) ? $name : $alias; + $field = empty($alias) ? $name : $alias; } - $data[$name] = input("{$type}{$keys}"); + $data[$name] = input("{$type}{$field}"); } else { $data[$name] = $message; } } else { list($_rgx) = explode(':', $name); list($_key, $_rule) = explode('.', $name); - $keys = empty($alias) ? $_key : $alias; - $info[$_rgx] = $message; - $data[$_key] = input("{$type}{$keys}"); - $rule[$_key] = empty($rule[$_key]) ? $_rule : "{$rule[$_key]}|{$_rule}"; + if (in_array($_rule, ['value', 'default'])) { + if ($_rule === 'value') { + $data[$_key] = $message; + } elseif ($_rule === 'default') { + $data[$_key] = input($type . ($alias ?: $_key), $message); + } + } else { + $info[$_rgx] = $message; + $data[$_key] = $data[$_key] ?? input($type . ($alias ?: $_key)); + $rule[$_key] = empty($rule[$_key]) ? $_rule : "{$rule[$_key]}|{$_rule}"; + } } } $validate = new Validate(); @@ -65,5 +77,4 @@ class ValidateHelper extends Helper $this->controller->error($validate->getError()); } } - } \ No newline at end of file diff --git a/vendor/zoujingli/think-library/src/service/MessageService.php b/vendor/zoujingli/think-library/src/service/MessageService.php index 8624f851f..01203be77 100644 --- a/vendor/zoujingli/think-library/src/service/MessageService.php +++ b/vendor/zoujingli/think-library/src/service/MessageService.php @@ -265,8 +265,7 @@ class MessageService extends Service { $tkey = date("YmdHis"); $result = HttpExtend::post('http://intl.zthysms.com/intBalance.do', [ - 'username' => $this->globe_username, 'tkey' => $tkey, - 'password' => md5(md5($this->globe_password) . $tkey), + 'username' => $this->globe_username, 'tkey' => $tkey, 'password' => md5(md5($this->globe_password) . $tkey), ]); if (!is_numeric($result) && ($state = intval($result)) && isset($this->globeMessageMap[$state])) { return ['code' => 0, 'num' => 0, 'msg' => $this->globeMessageMap[$state]]; diff --git a/vendor/zoujingli/think-library/src/service/SystemService.php b/vendor/zoujingli/think-library/src/service/SystemService.php index 46ed3d544..f961cd85b 100644 --- a/vendor/zoujingli/think-library/src/service/SystemService.php +++ b/vendor/zoujingli/think-library/src/service/SystemService.php @@ -107,7 +107,7 @@ class SystemService extends Service $map = isset($where[$key]) ? [] : (is_string($value) ? [[$key, 'in', explode(',', $value)]] : [$key => $value]); if (is_array($info = $this->app->db->table($table)->master()->where($where)->where($map)->find()) && !empty($info)) { if ($this->app->db->table($table)->strict(false)->where($where)->where($map)->update($data) !== false) { - return isset($info[$key]) ? $info[$key] : true; + return $info[$key] ?? true; } else { return false; } @@ -275,7 +275,7 @@ class SystemService extends Service if (empty($data['app_map']) || !is_array($data['app_map'])) $data['app_map'] = []; if (empty($data['app_uri']) || !is_array($data['app_uri'])) $data['app_uri'] = []; if (empty($data['app_run']) || !is_string($data['app_run'])) $data['app_run'] = 'developer'; - return is_null($key) ? $data : (isset($data[$key]) ? $data[$key] : null); + return is_null($key) ? $data : ($data[$key] ?? null); } /**