From 6e76c173a77507b85db5b2c6d9c13078cfee8ff4 Mon Sep 17 00:00:00 2001 From: JaguarJack Date: Mon, 22 Jun 2020 07:55:39 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96catchQuery?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- extend/catcher/CatchQuery.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/extend/catcher/CatchQuery.php b/extend/catcher/CatchQuery.php index d0fa563..2b6bece 100644 --- a/extend/catcher/CatchQuery.php +++ b/extend/catcher/CatchQuery.php @@ -24,7 +24,7 @@ class CatchQuery extends Query $table = app($model)->getTable(); // 合并字段 - $this->options['field'] = array_merge($this->options['field'], array_map(function ($value) use ($table) { + $this->options['field'] = array_merge($this->options['field'] ?? [], array_map(function ($value) use ($table) { return $table . '.' . $value; }, $field)); @@ -222,7 +222,7 @@ class CatchQuery extends Query */ public function addSelectSub(callable $callable, string $as) { - $this->field(sprintf('%s as %s', $callable($this)->buildSql(), $as)); + $this->field(sprintf('%s as %s', $callable()->buildSql(), $as)); return $this; }