Skip to content

Commit

Permalink
修正 ->column(['SUM(IF(total_price>0,total_price,apply_price))'], 'flee…
Browse files Browse the repository at this point in the history
…t_id') 用法报错
  • Loading branch information
big-dream committed Sep 9, 2024
1 parent dab5fc6 commit 79543ae
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/db/BaseQuery.php
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,11 @@ public function column(string | array $field, string $key = '', bool $useModelAt
$this->result($item);
return $item;
}

if (is_array($field) && 1 === count($field)) {
$field = current($field);

Check warning on line 421 in src/db/BaseQuery.php

View check run for this annotation

Codecov / codecov/patch

src/db/BaseQuery.php#L421

Added line #L421 was not covered by tests
}

$array[$field] = $item;
if ($this->model && $useModelAttr) {
if (!empty($this->options['json'])) {
Expand Down

0 comments on commit 79543ae

Please sign in to comment.