This commit is contained in:
thinkphp
2018-04-12 16:31:54 +08:00
parent 72ff856d27
commit ae442796eb
2 changed files with 8 additions and 1 deletions

View File

@@ -563,6 +563,10 @@ abstract class Builder
*/
protected function parseOrder($order, $options = [])
{
if (empty($order)) {
return '';
}
$array = [];
foreach ($order as $key => $val) {
if ($val instanceof Expression) {

View File

@@ -35,6 +35,9 @@ class Sqlsrv extends Builder
*/
protected function parseOrder($order, $options = [])
{
if (empty($order)) {
return ' ORDER BY rand()';
}
$array = [];
foreach ($order as $key => $val) {
@@ -55,7 +58,7 @@ class Sqlsrv extends Builder
}
$order = implode(',', $array);
return !empty($order) ? ' ORDER BY ' . $order : ' ORDER BY rand()';
return ' ORDER BY ' . $order;
}
/**