mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-07 23:22:48 +08:00
改进
This commit is contained in:
@@ -563,6 +563,10 @@ abstract class Builder
|
|||||||
*/
|
*/
|
||||||
protected function parseOrder($order, $options = [])
|
protected function parseOrder($order, $options = [])
|
||||||
{
|
{
|
||||||
|
if (empty($order)) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
$array = [];
|
$array = [];
|
||||||
foreach ($order as $key => $val) {
|
foreach ($order as $key => $val) {
|
||||||
if ($val instanceof Expression) {
|
if ($val instanceof Expression) {
|
||||||
|
|||||||
@@ -35,6 +35,9 @@ class Sqlsrv extends Builder
|
|||||||
*/
|
*/
|
||||||
protected function parseOrder($order, $options = [])
|
protected function parseOrder($order, $options = [])
|
||||||
{
|
{
|
||||||
|
if (empty($order)) {
|
||||||
|
return ' ORDER BY rand()';
|
||||||
|
}
|
||||||
|
|
||||||
$array = [];
|
$array = [];
|
||||||
foreach ($order as $key => $val) {
|
foreach ($order as $key => $val) {
|
||||||
@@ -55,7 +58,7 @@ class Sqlsrv extends Builder
|
|||||||
}
|
}
|
||||||
$order = implode(',', $array);
|
$order = implode(',', $array);
|
||||||
|
|
||||||
return !empty($order) ? ' ORDER BY ' . $order : ' ORDER BY rand()';
|
return ' ORDER BY ' . $order;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user