改进Query类的order方法

This commit is contained in:
thinkphp
2016-04-20 18:16:55 +08:00
parent 02934b0d27
commit 87a128f231

View File

@@ -610,8 +610,12 @@ class Query
$field = empty($order) ? $field : [$field => $order];
} elseif (!empty($this->options['via'])) {
foreach ($field as $key => $val) {
$field[$this->options['via'] . '.' . $key] = $val;
unset($field[$key]);
if (is_numeric($key)) {
$field[$key] = $this->options['via'] . '.' . $val;
} else {
$field[$this->options['via'] . '.' . $key] = $val;
unset($field[$key]);
}
}
}
$this->options['order'] = $field;