diff --git a/extend/catcher/CatchQuery.php b/extend/catcher/CatchQuery.php index 9ae49ee..79a0ebf 100644 --- a/extend/catcher/CatchQuery.php +++ b/extend/catcher/CatchQuery.php @@ -87,12 +87,14 @@ class CatchQuery extends Query $field = array_merge((array) $this->options['field'], $field); } + $this->options['field'] = array_unique($field); + if ($needAlias) { $alias = $this->getAlias(); $this->options['field'] = array_map(function ($field) use ($alias) { return $alias . '.' . $field; - }, array_unique($field)); + }, $this->options['field']); } return $this; @@ -145,4 +147,18 @@ class CatchQuery extends Query return parent::whereLike($this->getAlias() . '.' . $field, $condition, $logic); } + + /** + * 额外的字段 + * + * @time 2020年01月13日 + * @param array $fields + * @return CatchQuery + */ + public function addFields(array $fields): CatchQuery + { + $this->options['field'] = array_merge($this->options['field'], $fields); + + return $this; + } }