From 28e0bc0fc825fea1b5a2e022525159bc2257ce96 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Sun, 10 Jan 2016 12:46:53 +0800 Subject: [PATCH] =?UTF-8?q?model=E7=B1=BB=E7=9A=84=5Fafter=5Ffind=20?= =?UTF-8?q?=E5=92=8C=20=5Fafter=5Fselect=20=E5=9B=9E=E8=B0=83=E8=B0=83?= =?UTF-8?q?=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/Model.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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; } // 数据读取成功后的回调方法