mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-06 23:02:48 +08:00
修正model类join方法不能读取指定表前缀的问题
This commit is contained in:
@@ -1477,17 +1477,15 @@ class Model
|
|||||||
$prefix = $this->tablePrefix;
|
$prefix = $this->tablePrefix;
|
||||||
// 传入的表名为数组
|
// 传入的表名为数组
|
||||||
if (is_array($join)) {
|
if (is_array($join)) {
|
||||||
if (0 !== key($join)) {
|
if (0 !== $key = key($join)) {
|
||||||
// 键名为表名,键值作为表的别名
|
// 设置了键名则键名为表名,键值作为表的别名
|
||||||
$table = key($join) . ' ' . current($join);
|
$table = $key . ' ' . array_shift($join);
|
||||||
} else {
|
} else {
|
||||||
$table = current($join);
|
$table = array_shift($join);
|
||||||
}
|
}
|
||||||
if (isset($join[1])) {
|
if (count($join)) {
|
||||||
// 第二个元素为字符串则把第二元素作为表前缀
|
// 有设置第二个元素则把第二元素作为表前缀
|
||||||
if (is_string($join[1])) {
|
$table = (string) current($join) . $table;
|
||||||
$table = $join[1] . $table;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
// 加上默认的表前缀
|
// 加上默认的表前缀
|
||||||
$table = $prefix . $table;
|
$table = $prefix . $table;
|
||||||
|
|||||||
Reference in New Issue
Block a user