Skip to content

Commit

Permalink
改进order方法解析
Browse files Browse the repository at this point in the history
  • Loading branch information
liu21st committed Aug 13, 2018
1 parent 9c98b15 commit 673e505
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions library/think/db/Builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -865,10 +865,12 @@ protected function parseOrder(Query $query, $order)
} else {
$sort = $val;
}

$sort = strtoupper($sort);
$sort = in_array($sort, ['ASC', 'DESC'], true) ? ' ' . $sort : '';
$array[] = $this->parseKey($query, $key, true) . $sort;

if (false === strpos($key, ')') && false === strpos($key, '#')) {
$sort = strtoupper($sort);
$sort = in_array($sort, ['ASC', 'DESC'], true) ? ' ' . $sort : '';
$array[] = $this->parseKey($query, $key, true) . $sort;
}
}
}

Expand Down

0 comments on commit 673e505

Please sign in to comment.