diff --git a/base.php b/base.php index fdbd5d9098..cbe288bf37 100644 --- a/base.php +++ b/base.php @@ -9,7 +9,7 @@ // | Author: liu21st // +---------------------------------------------------------------------- -define('THINK_VERSION', '5.0.5beta'); +define('THINK_VERSION', '5.0.5'); define('THINK_START_TIME', microtime(true)); define('THINK_START_MEM', memory_get_usage()); define('EXT', '.php'); diff --git a/helper.php b/helper.php index d5946fb275..543942bef1 100644 --- a/helper.php +++ b/helper.php @@ -14,7 +14,6 @@ //------------------------- use think\Cache; -use think\Collection; use think\Config; use think\Cookie; use think\Db; @@ -24,6 +23,7 @@ use think\Lang; use think\Loader; use think\Log; +use think\Model; use think\Request; use think\Response; use think\Session; @@ -571,10 +571,15 @@ function load_relation($resultSet, $relation) /** * 数组转换为数据集对象 * @param array $resultSet 数据集数组 - * @return Collection + * @return \think\model\Collection|\think\Collection */ function collection($resultSet) { - return new Collection($resultSet); + $item = current($resultSet); + if ($item instanceof Model) { + return \think\model\Collection::make($resultSet); + } else { + return \think\Collection::make($resultSet); + } } }