From 60af21b56ebc2508122c0ef336022524b8edadec Mon Sep 17 00:00:00 2001 From: thinkphp Date: Wed, 17 Aug 2016 11:39:48 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E8=BF=9BQuery=E7=B1=BB=E7=9A=84update?= =?UTF-8?q?=E5=92=8Cdelete=E7=9A=84=E7=BC=93=E5=AD=98key=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/db/Query.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/library/think/db/Query.php b/library/think/db/Query.php index f49d7d3d..c743ac18 100644 --- a/library/think/db/Query.php +++ b/library/think/db/Query.php @@ -1777,7 +1777,9 @@ class Query // 如果存在主键数据 则自动作为更新条件 if (is_string($pk) && isset($data[$pk])) { $where[$pk] = $data[$pk]; - $key = 'think:' . $options['table'] . '|' . $data[$pk]; + if (!isset($key)) { + $key = 'think:' . $options['table'] . '|' . $data[$pk]; + } unset($data[$pk]); } elseif (is_array($pk)) { // 增加复合主键支持 @@ -2104,7 +2106,7 @@ class Query } if (!is_null($data) && true !== $data) { - if (!is_array($data)) { + if (!isset($key) && !is_array($data)) { // 缓存标识 $key = 'think:' . $options['table'] . '|' . $data; }