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