@@ -833,32 +833,23 @@ protected function getJoinTable($join, &$alias = null)
833
833
if (is_array ($ join )) {
834
834
$ table = $ join ;
835
835
$ alias = array_shift ($ join );
836
- } else {
837
- $ join = trim ( $ join );
836
+ return $ table ;
837
+ }
838
838
839
- if (false !== strpos ($ join , '( ' )) {
840
- // 使用子查询
841
- $ table = $ join ;
842
- } else {
843
- $ prefix = $ this ->prefix ;
844
- if (strpos ($ join , ' ' )) {
845
- // 使用别名
846
- list ($ table , $ alias ) = explode (' ' , $ join );
847
- } else {
848
- $ table = $ join ;
849
- if (false === strpos ($ join , '. ' ) && 0 !== strpos ($ join , '__ ' )) {
850
- $ alias = $ join ;
851
- }
852
- }
839
+ $ join = trim ($ join );
853
840
854
- if ($ prefix && false === strpos ($ table , '. ' ) && 0 !== strpos ($ table , $ prefix ) && 0 !== strpos ($ table , '__ ' )) {
855
- $ table = $ this ->getTable ($ table );
856
- }
857
- }
841
+ if (false !== strpos ($ join , '( ' )) {
842
+ // 使用子查询
843
+ $ table = $ join ;
844
+ } elseif (strpos ($ join , ' ' )) {
845
+ // 使用别名
846
+ list ($ table , $ alias ) = explode (' ' , $ join );
847
+ } else {
848
+ $ table = $ join ;
849
+ }
858
850
859
- if (isset ($ alias ) && $ table != $ alias ) {
860
- $ table = [$ table => $ alias ];
861
- }
851
+ if (isset ($ alias ) && $ table != $ alias ) {
852
+ $ table = [$ table => $ alias ];
862
853
}
863
854
864
855
return $ table ;
@@ -1673,7 +1664,7 @@ public function table($table)
1673
1664
if (is_string ($ table )) {
1674
1665
if (strpos ($ table , ') ' )) {
1675
1666
// 子查询
1676
- } elseif ( strpos ( $ table , ' , ' )) {
1667
+ } else {
1677
1668
$ tables = explode (', ' , $ table );
1678
1669
$ table = [];
1679
1670
@@ -1686,11 +1677,6 @@ public function table($table)
1686
1677
$ table [] = $ item ;
1687
1678
}
1688
1679
}
1689
- } elseif (strpos ($ table , ' ' )) {
1690
- list ($ table , $ alias ) = explode (' ' , $ table );
1691
-
1692
- $ table = [$ table => $ alias ];
1693
- $ this ->alias ($ table );
1694
1680
}
1695
1681
} else {
1696
1682
$ tables = $ table ;
@@ -1791,7 +1777,7 @@ public function orderRaw(string $field, array $bind = [])
1791
1777
}
1792
1778
1793
1779
/**
1794
- * 指定Field排序 order ('id',[1,2,3],'desc')
1780
+ * 指定Field排序 orderField ('id',[1,2,3],'desc')
1795
1781
* @access public
1796
1782
* @param string $field 排序字段
1797
1783
* @param array $values 排序值
@@ -1907,11 +1893,7 @@ public function alias($alias)
1907
1893
if (is_array ($ alias )) {
1908
1894
$ this ->options ['alias ' ] = $ alias ;
1909
1895
} else {
1910
- if (isset ($ this ->options ['table ' ])) {
1911
- $ table = is_array ($ this ->options ['table ' ]) ? key ($ this ->options ['table ' ]) : $ this ->options ['table ' ];
1912
- } else {
1913
- $ table = $ this ->getTable ();
1914
- }
1896
+ $ table = $ this ->getTable ();
1915
1897
1916
1898
$ this ->options ['alias ' ][$ table ] = $ alias ;
1917
1899
}
0 commit comments