改进Query类的update和delete的缓存key判断

This commit is contained in:
thinkphp
2016-08-17 11:39:48 +08:00
parent dfb92fa9dd
commit 60af21b56e

View File

@@ -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;
}