From 34875308aeed35d3e159d22a45c17b80b3189150 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Sun, 28 Jan 2018 22:44:25 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E8=BF=9Bjoin=E8=87=AA=E5=85=B3?= =?UTF-8?q?=E8=81=94=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/db/Builder.php | 3 --- library/think/db/Query.php | 14 +++----------- 2 files changed, 3 insertions(+), 14 deletions(-) diff --git a/library/think/db/Builder.php b/library/think/db/Builder.php index a9b5b143..bbc20374 100644 --- a/library/think/db/Builder.php +++ b/library/think/db/Builder.php @@ -207,9 +207,6 @@ abstract class Builder $item = []; foreach ((array) $tables as $key => $table) { if (!is_numeric($key)) { - if (strpos($key, '@think')) { - $key = strstr($key, '@think', true); - } $key = $this->parseSqlTable($key); $item[] = $this->parseKey($key) . ' ' . (isset($options['alias'][$table]) ? $this->parseKey($options['alias'][$table]) : $this->parseKey($table)); } else { diff --git a/library/think/db/Query.php b/library/think/db/Query.php index cf65e4c3..d425d78a 100644 --- a/library/think/db/Query.php +++ b/library/think/db/Query.php @@ -707,8 +707,7 @@ class Query { // 传入的表名为数组 if (is_array($join)) { - $table = key($join); - $alias = current($join); + $table = $join; } else { $join = trim($join); if (false !== strpos($join, '(')) { @@ -729,16 +728,9 @@ class Query $table = $this->getTable($table); } } - } - if (isset($alias) && $table != $alias) { - if (isset($this->options['alias'][$table])) { - $table = $table . '@think' . uniqid(); - } elseif ($this->gettable() == $table) { - $table = $table . '@think' . uniqid(); + if (isset($alias) && $table != $alias) { + $table = [$table => $alias]; } - - $table = [$table => $alias]; - $this->alias($table); } return $table; }