From 340a0b144cae585bf2eec9f56043bc9d9b9f05bd Mon Sep 17 00:00:00 2001 From: Anyon Date: Fri, 10 Aug 2018 14:33:02 +0800 Subject: [PATCH] =?UTF-8?q?[=E6=9B=B4=E6=96=B0]ComposerUpdate?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- extend/service/ToolsService.php | 4 +- thinkphp/README.md | 5 +- thinkphp/base.php | 22 -- thinkphp/library/think/App.php | 11 +- thinkphp/library/think/Collection.php | 62 ++++++ thinkphp/library/think/Config.php | 108 +++++++--- thinkphp/library/think/Container.php | 1 + thinkphp/library/think/Facade.php | 2 +- thinkphp/library/think/Model.php | 5 + .../library/think/cache/driver/Memcache.php | 2 +- thinkphp/library/think/db/Connection.php | 39 +--- thinkphp/library/think/db/Query.php | 192 ++++++++++++++---- thinkphp/library/think/facade/App.php | 9 + thinkphp/library/think/facade/Build.php | 9 + thinkphp/library/think/facade/Cache.php | 9 + thinkphp/library/think/facade/Config.php | 11 +- thinkphp/library/think/facade/Cookie.php | 9 + thinkphp/library/think/facade/Debug.php | 9 + thinkphp/library/think/facade/Env.php | 9 + thinkphp/library/think/facade/Hook.php | 9 + thinkphp/library/think/facade/Lang.php | 9 + thinkphp/library/think/facade/Log.php | 9 + thinkphp/library/think/facade/Middleware.php | 9 + thinkphp/library/think/facade/Request.php | 9 + thinkphp/library/think/facade/Response.php | 9 + thinkphp/library/think/facade/Route.php | 9 + thinkphp/library/think/facade/Session.php | 9 + thinkphp/library/think/facade/Template.php | 36 ++++ thinkphp/library/think/facade/Url.php | 9 + thinkphp/library/think/facade/Validate.php | 10 + thinkphp/library/think/facade/View.php | 9 + thinkphp/library/think/model/Collection.php | 16 ++ .../library/think/model/concern/Attribute.php | 21 +- .../think/model/concern/RelationShip.php | 16 +- .../library/think/model/concern/TimeStamp.php | 4 + .../think/model/relation/BelongsToMany.php | 3 +- .../library/think/model/relation/OneToOne.php | 62 +++--- thinkphp/library/think/route/Dispatch.php | 2 +- vendor/autoload.php | 2 +- vendor/composer/autoload_real.php | 14 +- vendor/composer/autoload_static.php | 8 +- vendor/composer/installed.json | 12 +- 42 files changed, 628 insertions(+), 186 deletions(-) create mode 100644 thinkphp/library/think/facade/Template.php diff --git a/extend/service/ToolsService.php b/extend/service/ToolsService.php index 84fbe3d51..714db9a43 100644 --- a/extend/service/ToolsService.php +++ b/extend/service/ToolsService.php @@ -37,8 +37,8 @@ class ToolsService Session::init(config('session.')); } $token = request()->header('token', ''); - empty($token) && $token = request()->post('token', ''); empty($token) && $token = request()->get('token', ''); + empty($token) && $token = request()->post('token', ''); list($name, $value) = explode('=', decode($token) . '='); if (!empty($value) && session_name() === $name) { session_id($value); @@ -48,7 +48,7 @@ class ToolsService header('Access-Control-Allow-Credentials:true'); header('Access-Control-Allow-Methods:GET,POST,OPTIONS'); header("Access-Control-Allow-Headers:Accept,Referer,Host,Keep-Alive,User-Agent,X-Requested-With,Cache-Control,Cookie,token"); - header('Content-Type:text/plain charset=UTF-8'); + header('Content-Type:text/plain charset=utf-8'); header('Access-Control-Max-Age:1728000'); header('HTTP/1.0 204 No Content'); header('Content-Length:0'); diff --git a/thinkphp/README.md b/thinkphp/README.md index 09b8b2ca7..92731cb23 100644 --- a/thinkphp/README.md +++ b/thinkphp/README.md @@ -3,9 +3,11 @@ ThinkPHP 5.1 —— 12载初心,你值得信赖的PHP框架 =============== +[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/top-think/framework/badges/quality-score.png?b=5.1)](https://scrutinizer-ci.com/g/top-think/framework/?branch=5.1) [![Build Status](https://travis-ci.org/top-think/framework.svg?branch=master)](https://travis-ci.org/top-think/framework) [![Total Downloads](https://poser.pugx.org/topthink/framework/downloads)](https://packagist.org/packages/topthink/framework) [![Latest Stable Version](https://poser.pugx.org/topthink/framework/v/stable)](https://packagist.org/packages/topthink/framework) +[![PHP Version](https://img.shields.io/badge/php-%3E%3D5.6-8892BF.svg)](http://www.php.net/) [![License](https://poser.pugx.org/topthink/framework/license)](https://packagist.org/packages/topthink/framework) ThinkPHP5.1对底层架构做了进一步的改进,减少依赖,其主要特性包括: @@ -25,6 +27,7 @@ ThinkPHP5.1对底层架构做了进一步的改进,减少依赖,其主要特 + 中间件支持(`V5.1.6+`) + 支持`Swoole`/`Workerman`运行(`V5.1.18+`) + ### 废除的功能: + 聚合模型 @@ -67,7 +70,7 @@ composer update topthink/framework ## 命名规范 -`ThinkPHP5`遵循PSR-2命名规范和PSR-4自动加载规范。 +`ThinkPHP5.1`遵循PSR-2命名规范和PSR-4自动加载规范。 ## 参与开发 diff --git a/thinkphp/base.php b/thinkphp/base.php index 084dd74db..d7238cc6a 100644 --- a/thinkphp/base.php +++ b/thinkphp/base.php @@ -28,28 +28,6 @@ if (interface_exists('Psr\Log\LoggerInterface')) { {} } -// 注册核心类的静态代理 -Facade::bind([ - facade\App::class => App::class, - facade\Build::class => Build::class, - facade\Cache::class => Cache::class, - facade\Config::class => Config::class, - facade\Cookie::class => Cookie::class, - facade\Debug::class => Debug::class, - facade\Env::class => Env::class, - facade\Hook::class => Hook::class, - facade\Lang::class => Lang::class, - facade\Log::class => Log::class, - facade\Middleware::class => Middleware::class, - facade\Request::class => Request::class, - facade\Response::class => Response::class, - facade\Route::class => Route::class, - facade\Session::class => Session::class, - facade\Url::class => Url::class, - facade\Validate::class => Validate::class, - facade\View::class => View::class, -]); - // 注册类库别名 Loader::addClassAlias([ 'App' => facade\App::class, diff --git a/thinkphp/library/think/App.php b/thinkphp/library/think/App.php index 8d4313e19..c27fb87e0 100644 --- a/thinkphp/library/think/App.php +++ b/thinkphp/library/think/App.php @@ -20,7 +20,7 @@ use think\route\Dispatch; */ class App extends Container { - const VERSION = '5.1.21'; + const VERSION = '5.1.22'; /** * 当前模块路径 @@ -178,6 +178,8 @@ class App extends Container $this->instance('app', $this); + $this->configExt = $this->env->get('config_ext', '.php'); + // 加载惯例配置文件 $this->config->set(include $this->thinkPath . 'convention.php'); @@ -204,8 +206,6 @@ class App extends Container // 注册应用命名空间 Loader::addNamespace($this->namespace, $this->appPath); - $this->configExt = $this->env->get('config_ext', '.php'); - // 初始化应用 $this->init(); @@ -312,7 +312,7 @@ class App extends Container // 自动读取配置文件 if (is_dir($path . 'config')) { - $dir = $path . 'config'; + $dir = $path . 'config'.DIRECTORY_SEPARATOR; } elseif (is_dir($this->configPath . $module)) { $dir = $this->configPath . $module; } @@ -321,8 +321,7 @@ class App extends Container foreach ($files as $file) { if ('.' . pathinfo($file, PATHINFO_EXTENSION) === $this->configExt) { - $filename = $dir . DIRECTORY_SEPARATOR . $file; - $this->config->load($filename, pathinfo($file, PATHINFO_FILENAME)); + $this->config->load($dir . $file, pathinfo($file, PATHINFO_FILENAME)); } } } diff --git a/thinkphp/library/think/Collection.php b/thinkphp/library/think/Collection.php index 929b51939..28558953e 100644 --- a/thinkphp/library/think/Collection.php +++ b/thinkphp/library/think/Collection.php @@ -249,6 +249,68 @@ class Collection implements ArrayAccess, Countable, IteratorAggregate, JsonSeria return new static(array_filter($this->items)); } + /** + * 根据字段条件过滤数组中的元素 + * @access public + * @param string $field 字段名 + * @param mixed $operator 操作符 + * @param mixed $value 数据 + * @return static + */ + public function where($field, $operator, $value = null) + { + if (is_null($value)) { + $value = $operator; + $operator = '='; + } + + return $this->filter(function ($data) use ($field, $operator, $value) { + if (strpos($field, '.')) { + list($field, $relation) = explode('.', $field); + + $result = isset($data[$field][$relation]) ? $data[$field][$relation] : null; + } else { + $result = isset($data[$field]) ? $data[$field] : null; + } + + switch ($operator) { + case '===': + return $result === $value; + case '!==': + return $result !== $value; + case '!=': + case '<>': + return $result != $value; + case '>': + return $result > $value; + case '>=': + return $result >= $value; + case '<': + return $result < $value; + case '<=': + return $result <= $value; + case 'like': + return is_string($result) && false !== strpos($result, $value); + case 'not like': + return is_string($result) && false === strpos($result, $value); + case 'in': + return is_scalar($result) && in_array($result, $value, true); + case 'not in': + return is_scalar($result) && !in_array($result, $value, true); + case 'between': + list($min, $max) = is_string($value) ? explode(',', $value) : $value; + return is_scalar($result) && $result >= $min && $result <= $max; + case 'not between': + list($min, $max) = is_string($value) ? explode(',', $value) : $value; + return is_scalar($result) && $result > $max || $result < $min; + case '==': + case '=': + default: + return $result == $value; + } + }); + } + /** * 返回数据中指定的一列 * @access public diff --git a/thinkphp/library/think/Config.php b/thinkphp/library/think/Config.php index 52ca8f0e9..c3f04a2f7 100644 --- a/thinkphp/library/think/Config.php +++ b/thinkphp/library/think/Config.php @@ -11,19 +11,68 @@ namespace think; +use Yaconf; + class Config implements \ArrayAccess { /** * 配置参数 * @var array */ - private $config = []; + protected $config = []; /** * 配置前缀 * @var string */ - private $prefix = 'app'; + protected $prefix = 'app'; + + /** + * 配置文件目录 + * @var string + */ + protected $path; + + /** + * 配置文件后缀 + * @var string + */ + protected $ext; + + /** + * 是否支持Yaconf + * @var bool + */ + protected $yaconf; + + /** + * 构造方法 + * @access public + */ + public function __construct($path = '', $ext = '.php') + { + $this->path = $path; + $this->ext = $ext; + $this->yaconf = class_exists('Yaconf'); + } + + public static function __make(App $app) + { + $path = $app->getConfigPath(); + $ext = $app->getConfigExt(); + return new static($path, $ext); + } + + /** + * 设置开启Yaconf + * @access public + * @param bool $yaconf 是否使用Yaconf + * @return void + */ + public function useYaconf($yaconf) + { + $this->yaconf = $yaconf; + } /** * 设置配置参数默认前缀 @@ -65,20 +114,34 @@ class Config implements \ArrayAccess public function load($file, $name = '') { if (is_file($file)) { - $name = strtolower($name); - $type = pathinfo($file, PATHINFO_EXTENSION); + $filename = $file; + } elseif (is_file($this->path . $file . $this->ext)) { + $filename = $this->path . $file . $this->ext; + } - if ('php' == $type) { - return $this->set(include $file, $name); - } elseif ('yaml' == $type && function_exists('yaml_parse_file')) { - return $this->set(yaml_parse_file($file), $name); - } - return $this->parse($file, $type, $name); + if (isset($filename)) { + return $this->loadFile($filename, $name); + } elseif ($this->yaconf && Yaconf::has($file)) { + return $this->set(Yaconf::get($file), $name); } return $this->config; } + protected function loadFile($file, $name) + { + $name = strtolower($name); + $type = pathinfo($file, PATHINFO_EXTENSION); + + if ('php' == $type) { + return $this->set(include $file, $name); + } elseif ('yaml' == $type && function_exists('yaml_parse_file')) { + return $this->set(yaml_parse_file($file), $name); + } + + return $this->parse($file, $type, $name); + } + /** * 检测配置是否存在 * @access public @@ -91,10 +154,6 @@ class Config implements \ArrayAccess $name = $this->prefix . '.' . $name; } - if (class_exists('Yaconf')) { - return Yaconf::has($name); - } - return !is_null($this->get($name)); } @@ -108,6 +167,11 @@ class Config implements \ArrayAccess { $name = strtolower($name); + if ($this->yaconf && Yaconf::has($name)) { + $config = Yaconf::get($name); + return isset($this->config[$name]) ? array_merge($this->config[$name], $config) : $config; + } + return isset($this->config[$name]) ? $this->config[$name] : []; } @@ -120,12 +184,8 @@ class Config implements \ArrayAccess */ public function get($name = null, $default = null) { - if (class_exists('Yaconf')) { - if ($name && !strpos($name, '.')) { - $name = $this->prefix . '.' . $name; - } - - return Yaconf::get($name, $default); + if ($name && !strpos($name, '.')) { + $name = $this->prefix . '.' . $name; } // 无参数时获取所有 @@ -133,12 +193,14 @@ class Config implements \ArrayAccess return $this->config; } - if (!strpos($name, '.')) { - $name = $this->prefix . '.' . $name; - } elseif ('.' == substr($name, -1)) { + if ('.' == substr($name, -1)) { return $this->pull(substr($name, 0, -1)); } + if ($this->yaconf && Yaconf::has($name)) { + return Yaconf::get($name); + } + $name = explode('.', $name); $name[0] = strtolower($name[0]); $config = $this->config; diff --git a/thinkphp/library/think/Container.php b/thinkphp/library/think/Container.php index 95d2b98a5..5c19b748a 100644 --- a/thinkphp/library/think/Container.php +++ b/thinkphp/library/think/Container.php @@ -57,6 +57,7 @@ class Container implements ArrayAccess, IteratorAggregate, Countable 'response' => Response::class, 'route' => Route::class, 'session' => Session::class, + 'template' => Template::class, 'url' => Url::class, 'validate' => Validate::class, 'view' => View::class, diff --git a/thinkphp/library/think/Facade.php b/thinkphp/library/think/Facade.php index f467e0f81..ac5ae28bc 100644 --- a/thinkphp/library/think/Facade.php +++ b/thinkphp/library/think/Facade.php @@ -75,7 +75,7 @@ class Facade } /** - * 获取当前Facade对应类名 + * 获取当前Facade对应类名(或者已经绑定的容器对象标识) * @access protected * @return string */ diff --git a/thinkphp/library/think/Model.php b/thinkphp/library/think/Model.php index 7c3edbcbc..d47ce3e30 100644 --- a/thinkphp/library/think/Model.php +++ b/thinkphp/library/think/Model.php @@ -18,6 +18,7 @@ use think\db\Query; * Class Model * @package think * @mixin Query + * @method \think\Model withAttr(array $name,\Closure $closure) 动态定义获取器 */ abstract class Model implements \JsonSerializable, \ArrayAccess { @@ -1041,6 +1042,10 @@ abstract class Model implements \JsonSerializable, \ArrayAccess public function __call($method, $args) { + if ('withattr' == strtolower($method)) { + return call_user_func_array([$this, 'withAttribute'], $args); + } + return call_user_func_array([$this->db(), $method], $args); } diff --git a/thinkphp/library/think/cache/driver/Memcache.php b/thinkphp/library/think/cache/driver/Memcache.php index ea2c0e234..162ca5207 100644 --- a/thinkphp/library/think/cache/driver/Memcache.php +++ b/thinkphp/library/think/cache/driver/Memcache.php @@ -70,7 +70,7 @@ class Memcache extends Driver { $key = $this->getCacheKey($name); - return $this->handler->get($key) ? true : false; + return false !== $this->handler->get($key); } /** diff --git a/thinkphp/library/think/db/Connection.php b/thinkphp/library/think/db/Connection.php index 72722362b..82769b87d 100644 --- a/thinkphp/library/think/db/Connection.php +++ b/thinkphp/library/think/db/Connection.php @@ -584,20 +584,13 @@ abstract class Connection $this->bind = $bind; - // 释放前次的查询结果 - if (!empty($this->PDOStatement)) { - $this->free(); - } - Db::$queryTimes++; // 调试开始 $this->debug(true); // 预处理 - if (empty($this->PDOStatement)) { - $this->PDOStatement = $this->linkID->prepare($sql); - } + $this->PDOStatement = $this->linkID->prepare($sql); // 是否为存储过程调用 $procedure = in_array(strtolower(substr(trim($sql), 0, 4)), ['call', 'exec']); @@ -663,15 +656,8 @@ abstract class Connection // 调试开始 $this->debug(true); - // 释放前次的查询结果 - if (!empty($this->PDOStatement)) { - $this->free(); - } - // 预处理 - if (empty($this->PDOStatement)) { - $this->PDOStatement = $this->linkID->prepare($sql); - } + $this->PDOStatement = $this->linkID->prepare($sql); // 是否为存储过程调用 $procedure = in_array(strtolower(substr(trim($sql), 0, 4)), ['call', 'exec']); @@ -742,15 +728,8 @@ abstract class Connection // 调试开始 $this->debug(true); - //释放前次的查询结果 - if (!empty($this->PDOStatement) && $this->PDOStatement->queryString != $sql) { - $this->free(); - } - // 预处理 - if (empty($this->PDOStatement)) { - $this->PDOStatement = $this->linkID->prepare($sql); - } + $this->PDOStatement = $this->linkID->prepare($sql); // 是否为存储过程调用 $procedure = in_array(strtolower(substr(trim($sql), 0, 4)), ['call', 'exec']); @@ -1680,13 +1659,9 @@ abstract class Connection $this->parseSavepoint('trans' . $this->transTimes) ); } - } catch (\PDOException $e) { - if ($this->isBreak($e)) { - return $this->close()->startTrans(); - } - throw $e; } catch (\Exception $e) { if ($this->isBreak($e)) { + --$this->transTimes; return $this->close()->startTrans(); } throw $e; @@ -1826,6 +1801,9 @@ abstract class Connection $this->linkRead = null; $this->links = []; + // 释放查询 + $this->free(); + return $this; } @@ -2074,9 +2052,6 @@ abstract class Connection */ public function __destruct() { - // 释放查询 - $this->free(); - // 关闭连接 $this->close(); } diff --git a/thinkphp/library/think/db/Query.php b/thinkphp/library/think/db/Query.php index bd5b02f6f..7658ed13f 100644 --- a/thinkphp/library/think/db/Query.php +++ b/thinkphp/library/think/db/Query.php @@ -1033,17 +1033,6 @@ class Query return $this; } - /** - * 设置数据排除字段 - * @access public - * @param mixed $field 字段名或者数据 - * @return $this - */ - public function hidden($field) - { - return $this->field($field, true); - } - /** * 设置数据 * @access public @@ -2123,6 +2112,46 @@ class Query return $this; } + /** + * 设置需要隐藏的输出属性 + * @access public + * @param mixed $hidden 需要隐藏的字段名 + * @return $this + */ + public function hidden($hidden) + { + if ($this->model) { + $this->options['hidden'] = $hidden; + return $this; + } + + return $this->field($hidden, true); + } + + /** + * 设置需要输出的属性 + * @access public + * @param array $visible 需要输出的属性 + * @return $this + */ + public function visible(array $visible) + { + $this->options['visible'] = $visible; + return $this; + } + + /** + * 设置需要追加输出的属性 + * @access public + * @param array $append 需要追加的属性 + * @return $this + */ + public function append(array $append) + { + $this->options['append'] = $append; + return $this; + } + /** * 设置数据字段获取器 * @access public @@ -2133,14 +2162,8 @@ class Query public function withAttr($name, $callback = null) { if (is_array($name)) { - foreach ($name as $key => $val) { - $key = Loader::parseName($key); - - $this->options['with_attr'][$key] = $val; - } + $this->options['with_attr'] = $name; } else { - $name = Loader::parseName($name); - $this->options['with_attr'][$name] = $callback; } @@ -2219,6 +2242,31 @@ class Query return $this; } + /** + * 使用搜索器条件搜索字段 + * @access public + * @param array $fields 搜索字段 + * @param array $data 搜索数据 + * @return $this + */ + public function withSearch(array $fields, array $data = []) + { + foreach ($fields as $key => $field) { + if ($field instanceof \Closure) { + $field($this, isset($data[$key]) ? $data[$key] : null, $data); + } elseif ($this->model) { + // 检测搜索器 + $method = 'search' . Loader::parseName($field, 1) . 'Attr'; + + if (method_exists($this->model, $method)) { + $this->model->$method($this, isset($data[$field]) ? $data[$field] : null, $data); + } + } + } + + return $this; + } + /** * 指定数据表主键 * @access public @@ -2441,20 +2489,15 @@ class Query /** @var Model $class */ $class = $this->model; foreach ($with as $key => $relation) { - $subRelation = ''; - $closure = false; + $closure = null; if ($relation instanceof \Closure) { // 支持闭包查询过滤关联条件 - $closure = $relation; - $relation = $key; - $with[$key] = $key; + $closure = $relation; + $relation = $key; } elseif (is_array($relation)) { - $subRelation = $relation; - $relation = $key; + $relation = $key; } elseif (is_string($relation) && strpos($relation, '.')) { - $with[$key] = $relation; - list($relation, $subRelation) = explode('.', $relation, 2); } @@ -2463,20 +2506,74 @@ class Query $model = $class->$relation(); if ($model instanceof OneToOne && 0 == $model->getEagerlyType()) { - $model->removeOption()->eagerly($this, $relation, $subRelation, $closure, $first); + $table = $model->getTable(); + $model->removeOption() + ->table($table) + ->eagerly($this, $relation, true, '', $closure, $first); $first = false; - } elseif ($closure) { - $with[$key] = $closure; } } + $this->via(); - if (isset($this->options['with'])) { - $this->options['with'] = array_merge($this->options['with'], $with); - } else { - $this->options['with'] = $with; + $this->options['with'] = $with; + + return $this; + } + + /** + * 关联预载入 JOIN方式(不支持嵌套) + * @access protected + * @param string|array $with 关联方法名 + * @param string $joinType JOIN方式 + * @return $this + */ + public function withJoin($with, $joinType = '') + { + if (empty($with)) { + return $this; } + if (is_string($with)) { + $with = explode(',', $with); + } + + $first = true; + + /** @var Model $class */ + $class = $this->model; + foreach ($with as $key => $relation) { + $closure = null; + $field = true; + + if ($relation instanceof \Closure) { + // 支持闭包查询过滤关联条件 + $closure = $relation; + $relation = $key; + } elseif (is_array($relation)) { + $field = $relation; + $relation = $key; + } elseif (is_string($relation) && strpos($relation, '.')) { + list($relation, $subRelation) = explode('.', $relation, 2); + } + + /** @var Relation $model */ + $relation = Loader::parseName($relation, 1, false); + $model = $class->$relation(); + + if ($model instanceof OneToOne) { + $model->eagerly($this, $relation, $field, $joinType, $closure, $first); + $first = false; + } else { + // 不支持其它关联 + unset($with[$key]); + } + } + + $this->via(); + + $this->options['with_join'] = $with; + return $this; } @@ -2501,7 +2598,7 @@ class Query } foreach ($relations as $key => $relation) { - $closure = false; + $closure = null; if ($relation instanceof \Closure) { $closure = $relation; $relation = $key; @@ -2866,6 +2963,11 @@ class Query $result->eagerlyResultSet($resultSet, $this->options['with'], $withRelationAttr); } + if (!empty($this->options['with_join'])) { + // JOIN预载入 + $result->eagerlyResultSet($resultSet, $this->options['with_join'], $withRelationAttr, true); + } + // 模型数据集转换 $resultSet = $result->toCollection($resultSet); } else { @@ -3069,6 +3171,8 @@ class Query protected function getResultAttr(&$result, $withAttr = []) { foreach ($withAttr as $name => $closure) { + $name = Loader::parseName($name); + if (strpos($name, '.')) { // 支持JSON字段 获取器定义 list($key, $field) = explode('.', $name); @@ -3139,7 +3243,18 @@ class Query // 动态获取器 if (!empty($options['with_attr'])) { - $result->setModelAttrs($options['with_attr']); + $result->withAttribute($options['with_attr']); + } + + // 输出属性控制 + if (!empty($options['visible'])) { + $result->visible($options['visible']); + } elseif (!empty($options['hidden'])) { + $result->hidden($options['hidden']); + } + + if (!empty($options['append'])) { + $result->append($options['append']); } // 关联查询 @@ -3152,6 +3267,11 @@ class Query $result->eagerlyResult($result, $options['with'], $withRelationAttr); } + // JOIN预载入查询 + if (!$resultSet && !empty($options['with_join'])) { + $result->eagerlyResult($result, $options['with_join'], $withRelationAttr, true); + } + // 关联统计 if (!empty($options['with_count'])) { foreach ($options['with_count'] as $val) { diff --git a/thinkphp/library/think/facade/App.php b/thinkphp/library/think/facade/App.php index 37d995106..b375aa09f 100644 --- a/thinkphp/library/think/facade/App.php +++ b/thinkphp/library/think/facade/App.php @@ -51,4 +51,13 @@ use think\Facade; */ class App extends Facade { + /** + * 获取当前Facade对应类名(或者已经绑定的容器对象标识) + * @access protected + * @return string + */ + protected static function getFacadeClass() + { + return 'app'; + } } diff --git a/thinkphp/library/think/facade/Build.php b/thinkphp/library/think/facade/Build.php index 465962367..c051bea11 100644 --- a/thinkphp/library/think/facade/Build.php +++ b/thinkphp/library/think/facade/Build.php @@ -21,4 +21,13 @@ use think\Facade; */ class Build extends Facade { + /** + * 获取当前Facade对应类名(或者已经绑定的容器对象标识) + * @access protected + * @return string + */ + protected static function getFacadeClass() + { + return 'build'; + } } diff --git a/thinkphp/library/think/facade/Cache.php b/thinkphp/library/think/facade/Cache.php index 3011d6b3a..9743486eb 100644 --- a/thinkphp/library/think/facade/Cache.php +++ b/thinkphp/library/think/facade/Cache.php @@ -33,4 +33,13 @@ use think\Facade; */ class Cache extends Facade { + /** + * 获取当前Facade对应类名(或者已经绑定的容器对象标识) + * @access protected + * @return string + */ + protected static function getFacadeClass() + { + return 'cache'; + } } diff --git a/thinkphp/library/think/facade/Config.php b/thinkphp/library/think/facade/Config.php index 3332413b8..8646d1271 100644 --- a/thinkphp/library/think/facade/Config.php +++ b/thinkphp/library/think/facade/Config.php @@ -18,10 +18,19 @@ use think\Facade; * @mixin \think\Config * @method bool has(string $name) static 检测配置是否存在 * @method array pull(string $name) static 获取一级配置 - * @method mixed get(string $name) static 获取配置参数 + * @method mixed get(string $name,mixed $default = null) static 获取配置参数 * @method mixed set(string $name, mixed $value = null) static 设置配置参数 * @method array reset(string $prefix ='') static 重置配置参数 */ class Config extends Facade { + /** + * 获取当前Facade对应类名(或者已经绑定的容器对象标识) + * @access protected + * @return string + */ + protected static function getFacadeClass() + { + return 'config'; + } } diff --git a/thinkphp/library/think/facade/Cookie.php b/thinkphp/library/think/facade/Cookie.php index 18efbde0c..4d7cea250 100644 --- a/thinkphp/library/think/facade/Cookie.php +++ b/thinkphp/library/think/facade/Cookie.php @@ -27,4 +27,13 @@ use think\Facade; */ class Cookie extends Facade { + /** + * 获取当前Facade对应类名(或者已经绑定的容器对象标识) + * @access protected + * @return string + */ + protected static function getFacadeClass() + { + return 'cookie'; + } } diff --git a/thinkphp/library/think/facade/Debug.php b/thinkphp/library/think/facade/Debug.php index ac482a41e..df20086d1 100644 --- a/thinkphp/library/think/facade/Debug.php +++ b/thinkphp/library/think/facade/Debug.php @@ -28,4 +28,13 @@ use think\Facade; */ class Debug extends Facade { + /** + * 获取当前Facade对应类名(或者已经绑定的容器对象标识) + * @access protected + * @return string + */ + protected static function getFacadeClass() + { + return 'debug'; + } } diff --git a/thinkphp/library/think/facade/Env.php b/thinkphp/library/think/facade/Env.php index d430d683f..5d0472443 100644 --- a/thinkphp/library/think/facade/Env.php +++ b/thinkphp/library/think/facade/Env.php @@ -22,4 +22,13 @@ use think\Facade; */ class Env extends Facade { + /** + * 获取当前Facade对应类名(或者已经绑定的容器对象标识) + * @access protected + * @return string + */ + protected static function getFacadeClass() + { + return 'env'; + } } diff --git a/thinkphp/library/think/facade/Hook.php b/thinkphp/library/think/facade/Hook.php index e18f83b5d..e9e120838 100644 --- a/thinkphp/library/think/facade/Hook.php +++ b/thinkphp/library/think/facade/Hook.php @@ -25,4 +25,13 @@ use think\Facade; */ class Hook extends Facade { + /** + * 获取当前Facade对应类名(或者已经绑定的容器对象标识) + * @access protected + * @return string + */ + protected static function getFacadeClass() + { + return 'hook'; + } } diff --git a/thinkphp/library/think/facade/Lang.php b/thinkphp/library/think/facade/Lang.php index 3eb5d4acd..56c4777db 100644 --- a/thinkphp/library/think/facade/Lang.php +++ b/thinkphp/library/think/facade/Lang.php @@ -29,4 +29,13 @@ use think\Facade; */ class Lang extends Facade { + /** + * 获取当前Facade对应类名(或者已经绑定的容器对象标识) + * @access protected + * @return string + */ + protected static function getFacadeClass() + { + return 'lang'; + } } diff --git a/thinkphp/library/think/facade/Log.php b/thinkphp/library/think/facade/Log.php index 3a1fbf88f..ddf851ea4 100644 --- a/thinkphp/library/think/facade/Log.php +++ b/thinkphp/library/think/facade/Log.php @@ -37,4 +37,13 @@ use think\Facade; */ class Log extends Facade { + /** + * 获取当前Facade对应类名(或者已经绑定的容器对象标识) + * @access protected + * @return string + */ + protected static function getFacadeClass() + { + return 'log'; + } } diff --git a/thinkphp/library/think/facade/Middleware.php b/thinkphp/library/think/facade/Middleware.php index 468279642..5e4cac747 100644 --- a/thinkphp/library/think/facade/Middleware.php +++ b/thinkphp/library/think/facade/Middleware.php @@ -24,4 +24,13 @@ use think\Facade; */ class Middleware extends Facade { + /** + * 获取当前Facade对应类名(或者已经绑定的容器对象标识) + * @access protected + * @return string + */ + protected static function getFacadeClass() + { + return 'middleware'; + } } diff --git a/thinkphp/library/think/facade/Request.php b/thinkphp/library/think/facade/Request.php index d0eedb246..0989253f9 100644 --- a/thinkphp/library/think/facade/Request.php +++ b/thinkphp/library/think/facade/Request.php @@ -85,4 +85,13 @@ use think\Facade; */ class Request extends Facade { + /** + * 获取当前Facade对应类名(或者已经绑定的容器对象标识) + * @access protected + * @return string + */ + protected static function getFacadeClass() + { + return 'request'; + } } diff --git a/thinkphp/library/think/facade/Response.php b/thinkphp/library/think/facade/Response.php index 4a4de7129..d7de142f0 100644 --- a/thinkphp/library/think/facade/Response.php +++ b/thinkphp/library/think/facade/Response.php @@ -35,4 +35,13 @@ use think\Facade; */ class Response extends Facade { + /** + * 获取当前Facade对应类名(或者已经绑定的容器对象标识) + * @access protected + * @return string + */ + protected static function getFacadeClass() + { + return 'response'; + } } diff --git a/thinkphp/library/think/facade/Route.php b/thinkphp/library/think/facade/Route.php index c9f843d90..77196dfe4 100644 --- a/thinkphp/library/think/facade/Route.php +++ b/thinkphp/library/think/facade/Route.php @@ -45,4 +45,13 @@ use think\Facade; */ class Route extends Facade { + /** + * 获取当前Facade对应类名(或者已经绑定的容器对象标识) + * @access protected + * @return string + */ + protected static function getFacadeClass() + { + return 'route'; + } } diff --git a/thinkphp/library/think/facade/Session.php b/thinkphp/library/think/facade/Session.php index a68db382a..fb9206afa 100644 --- a/thinkphp/library/think/facade/Session.php +++ b/thinkphp/library/think/facade/Session.php @@ -34,4 +34,13 @@ use think\Facade; */ class Session extends Facade { + /** + * 获取当前Facade对应类名(或者已经绑定的容器对象标识) + * @access protected + * @return string + */ + protected static function getFacadeClass() + { + return 'session'; + } } diff --git a/thinkphp/library/think/facade/Template.php b/thinkphp/library/think/facade/Template.php new file mode 100644 index 000000000..f91b11821 --- /dev/null +++ b/thinkphp/library/think/facade/Template.php @@ -0,0 +1,36 @@ + +// +---------------------------------------------------------------------- + +namespace think\facade; + +use think\Facade; + +/** + * @see \think\Template + * @mixin \think\Template + * @method void assign(mixed $name, mixed $value = '') static 模板变量赋值 + * @method mixed get(string $name = '') static 获取模板变量 + * @method void fetch(string $template, array $vars = [], array $config = []) static 渲染模板文件 + * @method void display(string $content, array $vars = [], array $config = []) static 渲染模板内容 + * @method mixed layout(string $name, string $replace = '') static 设置模板布局 + */ +class Template extends Facade +{ + /** + * 获取当前Facade对应类名(或者已经绑定的容器对象标识) + * @access protected + * @return string + */ + protected static function getFacadeClass() + { + return 'template'; + } +} diff --git a/thinkphp/library/think/facade/Url.php b/thinkphp/library/think/facade/Url.php index db5a16f2b..639591ac8 100644 --- a/thinkphp/library/think/facade/Url.php +++ b/thinkphp/library/think/facade/Url.php @@ -21,4 +21,13 @@ use think\Facade; */ class Url extends Facade { + /** + * 获取当前Facade对应类名(或者已经绑定的容器对象标识) + * @access protected + * @return string + */ + protected static function getFacadeClass() + { + return 'url'; + } } diff --git a/thinkphp/library/think/facade/Validate.php b/thinkphp/library/think/facade/Validate.php index 423446d4d..a6eec23e4 100644 --- a/thinkphp/library/think/facade/Validate.php +++ b/thinkphp/library/think/facade/Validate.php @@ -62,4 +62,14 @@ use think\Facade; */ class Validate extends Facade { + /** + * 获取当前Facade对应类名(或者已经绑定的容器对象标识) + * @access protected + * @return string + */ + protected static function getFacadeClass() + { + return 'validate'; + } + } diff --git a/thinkphp/library/think/facade/View.php b/thinkphp/library/think/facade/View.php index 0309a760f..19b5f370f 100644 --- a/thinkphp/library/think/facade/View.php +++ b/thinkphp/library/think/facade/View.php @@ -28,4 +28,13 @@ use think\Facade; */ class View extends Facade { + /** + * 获取当前Facade对应类名(或者已经绑定的容器对象标识) + * @access protected + * @return string + */ + protected static function getFacadeClass() + { + return 'view'; + } } diff --git a/thinkphp/library/think/model/Collection.php b/thinkphp/library/think/model/Collection.php index 3a9b60f59..41b3bc91c 100644 --- a/thinkphp/library/think/model/Collection.php +++ b/thinkphp/library/think/model/Collection.php @@ -93,4 +93,20 @@ class Collection extends BaseCollection return $this; } + /** + * 设置数据字段获取器 + * @access public + * @param string|array $name 字段名 + * @param callable $callback 闭包获取器 + * @return $this + */ + public function withAttr($name, $callback = null) + { + $this->each(function ($model) use ($name, $callback) { + /** @var Model $model */ + $model && $model->withAttribute($name, $callback); + }); + + return $this; + } } diff --git a/thinkphp/library/think/model/concern/Attribute.php b/thinkphp/library/think/model/concern/Attribute.php index 615758847..a2fa4d7a3 100644 --- a/thinkphp/library/think/model/concern/Attribute.php +++ b/thinkphp/library/think/model/concern/Attribute.php @@ -599,14 +599,25 @@ trait Attribute } /** - * 动态设置获取器 - * @access protected - * @param array $attrs 值 + * 设置数据字段获取器 + * @access public + * @param string|array $name 字段名 + * @param callable $callback 闭包获取器 * @return $this */ - public function setModelAttrs(array $attrs = []) + public function withAttribute($name, $callback = null) { - $this->withAttr = $attrs; + if (is_array($name)) { + foreach ($name as $key => $val) { + $key = Loader::parseName($key); + + $this->withAttr[$key] = $val; + } + } else { + $name = Loader::parseName($name); + + $this->withAttr[$name] = $callback; + } return $this; } diff --git a/thinkphp/library/think/model/concern/RelationShip.php b/thinkphp/library/think/model/concern/RelationShip.php index 4379108b7..f4c091b60 100644 --- a/thinkphp/library/think/model/concern/RelationShip.php +++ b/thinkphp/library/think/model/concern/RelationShip.php @@ -219,15 +219,16 @@ trait RelationShip * @param array $resultSet 数据集 * @param string $relation 关联名 * @param array $withRelationAttr 关联获取器 + * @param bool $join 是否为JOIN方式 * @return array */ - public function eagerlyResultSet(&$resultSet, $relation, $withRelationAttr = []) + public function eagerlyResultSet(&$resultSet, $relation, $withRelationAttr = [], $join = false) { $relations = is_string($relation) ? explode(',', $relation) : $relation; foreach ($relations as $key => $relation) { $subRelation = ''; - $closure = false; + $closure = null; if ($relation instanceof \Closure) { $closure = $relation; @@ -250,7 +251,7 @@ trait RelationShip $relationResult->withAttr($withRelationAttr[$relationName]); } - $relationResult->eagerlyResultSet($resultSet, $relation, $subRelation, $closure); + $relationResult->eagerlyResultSet($resultSet, $relation, $subRelation, $closure, $join); } } @@ -260,15 +261,16 @@ trait RelationShip * @param Model $result 数据对象 * @param string $relation 关联名 * @param array $withRelationAttr 关联获取器 + * @param bool $join 是否为JOIN方式 * @return Model */ - public function eagerlyResult(&$result, $relation, $withRelationAttr = []) + public function eagerlyResult(&$result, $relation, $withRelationAttr = [], $join = false) { $relations = is_string($relation) ? explode(',', $relation) : $relation; foreach ($relations as $key => $relation) { $subRelation = ''; - $closure = false; + $closure = null; if ($relation instanceof \Closure) { $closure = $relation; @@ -291,7 +293,7 @@ trait RelationShip $relationResult->withAttr($withRelationAttr[$relationName]); } - $relationResult->eagerlyResult($result, $relation, $subRelation, $closure); + $relationResult->eagerlyResult($result, $relation, $subRelation, $closure, $join); } } @@ -307,7 +309,7 @@ trait RelationShip public function relationCount(&$result, $relations, $aggregate = 'sum', $field = '*') { foreach ($relations as $key => $relation) { - $closure = false; + $closure = null; if ($relation instanceof \Closure) { $closure = $relation; diff --git a/thinkphp/library/think/model/concern/TimeStamp.php b/thinkphp/library/think/model/concern/TimeStamp.php index 923b7d453..e55082cc5 100644 --- a/thinkphp/library/think/model/concern/TimeStamp.php +++ b/thinkphp/library/think/model/concern/TimeStamp.php @@ -50,6 +50,10 @@ trait TimeStamp */ protected function formatDateTime($time, $format, $timestamp = false) { + if (empty($time)) { + return; + } + if (false !== strpos($format, '\\')) { $time = new $format($time); } elseif (!$timestamp && false !== $format) { diff --git a/thinkphp/library/think/model/relation/BelongsToMany.php b/thinkphp/library/think/model/relation/BelongsToMany.php index 70d124437..d90430a8e 100644 --- a/thinkphp/library/think/model/relation/BelongsToMany.php +++ b/thinkphp/library/think/model/relation/BelongsToMany.php @@ -509,8 +509,7 @@ class BelongsToMany extends Relation } else { // 保存关联表数据 $model = new $this->model; - $model->save($data); - $id = $model->getLastInsID(); + $id = $model->insertGetId($data); } } elseif (is_numeric($data) || is_string($data)) { // 根据关联表主键直接写入中间表 diff --git a/thinkphp/library/think/model/relation/OneToOne.php b/thinkphp/library/think/model/relation/OneToOne.php index ac5d4e4c4..dbffcb774 100644 --- a/thinkphp/library/think/model/relation/OneToOne.php +++ b/thinkphp/library/think/model/relation/OneToOne.php @@ -50,12 +50,13 @@ abstract class OneToOne extends Relation * @access public * @param Query $query 查询对象 * @param string $relation 关联名 - * @param string $subRelation 子关联 + * @param mixed $field 关联字段 + * @param string $joinType JOIN方式 * @param \Closure $closure 闭包条件 * @param bool $first * @return void */ - public function eagerly(Query $query, $relation, $subRelation, $closure, $first) + public function eagerly(Query $query, $relation, $field, $joinType, $closure, $first) { $name = Loader::parseName(basename(str_replace('\\', '/', get_class($this->parent)))); @@ -64,24 +65,26 @@ abstract class OneToOne extends Relation $query->table([$table => $name]); if ($query->getOptions('field')) { - $field = $query->getOptions('field'); + $masterField = $query->getOptions('field'); $query->removeOption('field'); } else { - $field = true; + $masterField = true; } - $query->field($field, false, $table, $name); + $query->field($masterField, false, $table, $name); } // 预载入封装 $joinTable = $this->query->getTable(); $joinAlias = $relation; + $joinType = $joinType ?: $this->joinType; + $query->via($joinAlias); if ($this instanceof BelongsTo) { - $query->join([$joinTable => $joinAlias], $name . '.' . $this->foreignKey . '=' . $joinAlias . '.' . $this->localKey, $this->joinType); + $joinOn = $name . '.' . $this->foreignKey . '=' . $joinAlias . '.' . $this->localKey; } else { - $query->join([$joinTable => $joinAlias], $name . '.' . $this->localKey . '=' . $joinAlias . '.' . $this->foreignKey, $this->joinType); + $joinOn = $name . '.' . $this->localKey . '=' . $joinAlias . '.' . $this->foreignKey; } if ($closure) { @@ -92,16 +95,11 @@ abstract class OneToOne extends Relation if ($query->getOptions('with_field')) { $field = $query->getOptions('with_field'); $query->removeOption('with_field'); - } else { - $field = true; } - } elseif (isset($this->option['field'])) { - $field = $this->option['field']; - } else { - $field = true; } - $query->field($field, false, $joinTable, $joinAlias, $relation . '__'); + $query->join([$joinTable => $joinAlias], $joinOn, $joinType) + ->field($field, false, $joinTable, $joinAlias, $relation . '__'); } /** @@ -133,18 +131,19 @@ abstract class OneToOne extends Relation * @param string $relation 当前关联名 * @param string $subRelation 子关联名 * @param \Closure $closure 闭包 + * @param bool $join 是否为JOIN方式 * @return void */ - public function eagerlyResultSet(&$resultSet, $relation, $subRelation, $closure) + public function eagerlyResultSet(&$resultSet, $relation, $subRelation, $closure, $join = false) { - if (1 == $this->eagerlyType) { - // IN查询 - $this->eagerlySet($resultSet, $relation, $subRelation, $closure); - } else { - // 模型关联组装 + if ($join || 0 == $this->eagerlyType) { + // 模型JOIN关联组装 foreach ($resultSet as $result) { $this->match($this->model, $relation, $result); } + } else { + // IN查询 + $this->eagerlySet($resultSet, $relation, $subRelation, $closure); } } @@ -155,16 +154,17 @@ abstract class OneToOne extends Relation * @param string $relation 当前关联名 * @param string $subRelation 子关联名 * @param \Closure $closure 闭包 + * @param bool $join 是否为JOIN方式 * @return void */ - public function eagerlyResult(&$result, $relation, $subRelation, $closure) + public function eagerlyResult(&$result, $relation, $subRelation, $closure, $join = false) { - if (1 == $this->eagerlyType) { + if (0 == $this->eagerlyType || $join) { + // 模型JOIN关联组装 + $this->match($this->model, $relation, $result); + } else { // IN查询 $this->eagerlyOne($result, $relation, $subRelation, $closure); - } else { - // 模型关联组装 - $this->match($this->model, $relation, $result); } } @@ -272,9 +272,15 @@ abstract class OneToOne extends Relation } if (isset($list[$relation])) { - $relationModel = new $model($list[$relation]); - $relationModel->setParent(clone $result); - $relationModel->isUpdate(true); + $array = array_unique($list[$relation]); + + if (count($array) == 1 && null === current($array)) { + $relationModel = null; + } else { + $relationModel = new $model($list[$relation]); + $relationModel->setParent(clone $result); + $relationModel->isUpdate(true); + } if (!empty($this->bindAttr)) { $this->bindAttr($relationModel, $result, $this->bindAttr); diff --git a/thinkphp/library/think/route/Dispatch.php b/thinkphp/library/think/route/Dispatch.php index 05d6b018a..ecdf3ada5 100644 --- a/thinkphp/library/think/route/Dispatch.php +++ b/thinkphp/library/think/route/Dispatch.php @@ -182,7 +182,7 @@ abstract class Dispatch } else { $data = ob_get_clean(); $content = false === $data ? '' : $data; - $status = false === $data ? 204 : 200; + $status = '' === $content && $this->request->isAjax() ? 204 : 200; $response = Response::create($content, '', $status); } diff --git a/vendor/autoload.php b/vendor/autoload.php index a8f85193d..3b3f606c1 100644 --- a/vendor/autoload.php +++ b/vendor/autoload.php @@ -4,4 +4,4 @@ require_once __DIR__ . '/composer/autoload_real.php'; -return ComposerAutoloaderInit5d00137d1db4a58cf3bb528ee40ba5ec::getLoader(); +return ComposerAutoloaderInit8153982cf21eec76f214c39086ebcf52::getLoader(); diff --git a/vendor/composer/autoload_real.php b/vendor/composer/autoload_real.php index 987ed91c3..34f1927ca 100644 --- a/vendor/composer/autoload_real.php +++ b/vendor/composer/autoload_real.php @@ -2,7 +2,7 @@ // autoload_real.php @generated by Composer -class ComposerAutoloaderInit5d00137d1db4a58cf3bb528ee40ba5ec +class ComposerAutoloaderInit8153982cf21eec76f214c39086ebcf52 { private static $loader; @@ -19,15 +19,15 @@ class ComposerAutoloaderInit5d00137d1db4a58cf3bb528ee40ba5ec return self::$loader; } - spl_autoload_register(array('ComposerAutoloaderInit5d00137d1db4a58cf3bb528ee40ba5ec', 'loadClassLoader'), true, true); + spl_autoload_register(array('ComposerAutoloaderInit8153982cf21eec76f214c39086ebcf52', 'loadClassLoader'), true, true); self::$loader = $loader = new \Composer\Autoload\ClassLoader(); - spl_autoload_unregister(array('ComposerAutoloaderInit5d00137d1db4a58cf3bb528ee40ba5ec', 'loadClassLoader')); + spl_autoload_unregister(array('ComposerAutoloaderInit8153982cf21eec76f214c39086ebcf52', 'loadClassLoader')); $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded()); if ($useStaticLoader) { require_once __DIR__ . '/autoload_static.php'; - call_user_func(\Composer\Autoload\ComposerStaticInit5d00137d1db4a58cf3bb528ee40ba5ec::getInitializer($loader)); + call_user_func(\Composer\Autoload\ComposerStaticInit8153982cf21eec76f214c39086ebcf52::getInitializer($loader)); } else { $map = require __DIR__ . '/autoload_namespaces.php'; foreach ($map as $namespace => $path) { @@ -48,19 +48,19 @@ class ComposerAutoloaderInit5d00137d1db4a58cf3bb528ee40ba5ec $loader->register(true); if ($useStaticLoader) { - $includeFiles = Composer\Autoload\ComposerStaticInit5d00137d1db4a58cf3bb528ee40ba5ec::$files; + $includeFiles = Composer\Autoload\ComposerStaticInit8153982cf21eec76f214c39086ebcf52::$files; } else { $includeFiles = require __DIR__ . '/autoload_files.php'; } foreach ($includeFiles as $fileIdentifier => $file) { - composerRequire5d00137d1db4a58cf3bb528ee40ba5ec($fileIdentifier, $file); + composerRequire8153982cf21eec76f214c39086ebcf52($fileIdentifier, $file); } return $loader; } } -function composerRequire5d00137d1db4a58cf3bb528ee40ba5ec($fileIdentifier, $file) +function composerRequire8153982cf21eec76f214c39086ebcf52($fileIdentifier, $file) { if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { require $file; diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php index 254287825..b5f0413d1 100644 --- a/vendor/composer/autoload_static.php +++ b/vendor/composer/autoload_static.php @@ -4,7 +4,7 @@ namespace Composer\Autoload; -class ComposerStaticInit5d00137d1db4a58cf3bb528ee40ba5ec +class ComposerStaticInit8153982cf21eec76f214c39086ebcf52 { public static $files = array ( '1cfd2761b63b0a29ed23657ea394cb2d' => __DIR__ . '/..' . '/topthink/think-captcha/src/helper.php', @@ -303,9 +303,9 @@ class ComposerStaticInit5d00137d1db4a58cf3bb528ee40ba5ec public static function getInitializer(ClassLoader $loader) { return \Closure::bind(function () use ($loader) { - $loader->prefixLengthsPsr4 = ComposerStaticInit5d00137d1db4a58cf3bb528ee40ba5ec::$prefixLengthsPsr4; - $loader->prefixDirsPsr4 = ComposerStaticInit5d00137d1db4a58cf3bb528ee40ba5ec::$prefixDirsPsr4; - $loader->classMap = ComposerStaticInit5d00137d1db4a58cf3bb528ee40ba5ec::$classMap; + $loader->prefixLengthsPsr4 = ComposerStaticInit8153982cf21eec76f214c39086ebcf52::$prefixLengthsPsr4; + $loader->prefixDirsPsr4 = ComposerStaticInit8153982cf21eec76f214c39086ebcf52::$prefixDirsPsr4; + $loader->classMap = ComposerStaticInit8153982cf21eec76f214c39086ebcf52::$classMap; }, null, ClassLoader::class); } diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index 89e3468cf..d6ce869a9 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -50,17 +50,17 @@ }, { "name": "topthink/framework", - "version": "v5.1.21", - "version_normalized": "5.1.21.0", + "version": "v5.1.22", + "version_normalized": "5.1.22.0", "source": { "type": "git", "url": "https://github.com/top-think/framework.git", - "reference": "e670467e24399c98581db1b1d39191848f3e6b4d" + "reference": "35e9878a6ba06257502c5ba664d8e3407012ad00" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/top-think/framework/zipball/e670467e24399c98581db1b1d39191848f3e6b4d", - "reference": "e670467e24399c98581db1b1d39191848f3e6b4d", + "url": "https://api.github.com/repos/top-think/framework/zipball/35e9878a6ba06257502c5ba664d8e3407012ad00", + "reference": "35e9878a6ba06257502c5ba664d8e3407012ad00", "shasum": "", "mirrors": [ { @@ -82,7 +82,7 @@ "sebastian/phpcpd": "2.*", "squizlabs/php_codesniffer": "2.*" }, - "time": "2018-08-02T09:17:04+00:00", + "time": "2018-08-09T06:04:18+00:00", "type": "think-framework", "installation-source": "dist", "notification-url": "https://packagist.org/downloads/",