model类的_after_find 和 _after_select 回调调整

This commit is contained in:
thinkphp
2016-01-10 12:46:53 +08:00
parent 119e04b1d7
commit 28e0bc0fc8

View File

@@ -507,6 +507,8 @@ class Model
// 数据列表读取后的处理
$resultSet = $this->_read_datalist($resultSet, $options);
// 回调
$this->_after_select($resultSet, $options);
if (isset($options['index'])) {
// 对数据集进行索引
$index = explode(',', $options['index']);
@@ -538,7 +540,6 @@ class Model
protected function _read_datalist($resultSet, $options)
{
$resultSet = array_map([$this, '_read_data'], $resultSet);
$this->_after_select($resultSet, $options);
return $resultSet;
}
// 查询成功后的回调方法
@@ -879,6 +880,8 @@ class Model
$data = $this->_read_data($resultSet[0], $options);
// 数据对象赋值
$this->data = $data;
// 回调
$this->_after_find($data, $options);
if (isset($cache)) {
Cache::set($key, $data, $cache['expire']);
}
@@ -902,7 +905,6 @@ class Model
}
}
}
$this->_after_find($data, $options);
return $data;
}
// 数据读取成功后的回调方法