mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-01 12:42:48 +08:00
collection助手函数调整
This commit is contained in:
2
base.php
2
base.php
@@ -9,7 +9,7 @@
|
||||
// | Author: liu21st <liu21st@gmail.com>
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
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');
|
||||
|
||||
11
helper.php
11
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\exception\HttpResponseException;
|
||||
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 @@ if (!function_exists('collection')) {
|
||||
/**
|
||||
* 数组转换为数据集对象
|
||||
* @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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user