diff --git a/library/think/Model.php b/library/think/Model.php index bab3c195..efa9b4e3 100644 --- a/library/think/Model.php +++ b/library/think/Model.php @@ -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; } // 数据读取成功后的回调方法