mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-08 23:52:49 +08:00
改进
This commit is contained in:
@@ -769,7 +769,11 @@ class Query
|
|||||||
{
|
{
|
||||||
if (empty($field)) {
|
if (empty($field)) {
|
||||||
return $this;
|
return $this;
|
||||||
|
} elseif ($field instanceof Expression) {
|
||||||
|
$this->options['field'][] = $field;
|
||||||
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_string($field)) {
|
if (is_string($field)) {
|
||||||
$field = array_map('trim', explode(',', $field));
|
$field = array_map('trim', explode(',', $field));
|
||||||
}
|
}
|
||||||
@@ -1485,7 +1489,13 @@ class Query
|
|||||||
*/
|
*/
|
||||||
public function order($field, $order = null)
|
public function order($field, $order = null)
|
||||||
{
|
{
|
||||||
if (!empty($field)) {
|
if (empty($field)) {
|
||||||
|
return $this;
|
||||||
|
} elseif ($field instanceof Expression) {
|
||||||
|
$this->options['order'][] = $field;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
if (is_string($field)) {
|
if (is_string($field)) {
|
||||||
if (!empty($this->options['via'])) {
|
if (!empty($this->options['via'])) {
|
||||||
$field = $this->options['via'] . '.' . $field;
|
$field = $this->options['via'] . '.' . $field;
|
||||||
@@ -1509,7 +1519,7 @@ class Query
|
|||||||
} else {
|
} else {
|
||||||
$this->options['order'][] = $field;
|
$this->options['order'][] = $field;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user