mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-06 07:02:47 +08:00
改进Query类的join方法
This commit is contained in:
@@ -341,7 +341,7 @@ function trace($log = '[think]', $level = 'log')
|
|||||||
*/
|
*/
|
||||||
function view($template = '', $vars = [])
|
function view($template = '', $vars = [])
|
||||||
{
|
{
|
||||||
return View::instance(Config::get('template'))->fetch($template, $vars);
|
return View::instance(Config::get('template'), Config::get('view_replace_str'))->fetch($template, $vars);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -349,7 +349,7 @@ class Query
|
|||||||
if (count($join)) {
|
if (count($join)) {
|
||||||
// 有设置第二个元素则把第二元素作为表前缀
|
// 有设置第二个元素则把第二元素作为表前缀
|
||||||
$table = (string) current($join) . $table;
|
$table = (string) current($join) . $table;
|
||||||
} else {
|
} elseif (false === strpos($table, '.')) {
|
||||||
// 加上默认的表前缀
|
// 加上默认的表前缀
|
||||||
$table = $prefix . $table;
|
$table = $prefix . $table;
|
||||||
}
|
}
|
||||||
@@ -357,7 +357,7 @@ class Query
|
|||||||
$join = trim($join);
|
$join = trim($join);
|
||||||
if (0 === strpos($join, '__')) {
|
if (0 === strpos($join, '__')) {
|
||||||
$table = $this->connection->parseSqlTable($join);
|
$table = $this->connection->parseSqlTable($join);
|
||||||
} elseif (false === strpos($join, '(') && !empty($prefix) && 0 !== strpos($join, $prefix)) {
|
} elseif (false === strpos($join, '(') && false === strpos($join, '.') && !empty($prefix) && 0 !== strpos($join, $prefix)) {
|
||||||
// 传入的表名中不带有'('并且不以默认的表前缀开头时加上默认的表前缀
|
// 传入的表名中不带有'('并且不以默认的表前缀开头时加上默认的表前缀
|
||||||
$table = $prefix . $join;
|
$table = $prefix . $join;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user