From 70ffc62bf929c77aa4d42304362b5247d588cb3c Mon Sep 17 00:00:00 2001 From: oldrind <1401019000@qq.com> Date: Sat, 26 Mar 2016 10:17:26 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E8=A7=86=E5=9B=BE=E6=A8=A1?= =?UTF-8?q?=E5=9E=8B=E4=B8=AD=E6=89=80=E5=BC=95=E7=94=A8=E7=9A=84=E8=A1=A8?= =?UTF-8?q?=E6=89=BE=E4=B8=8D=E5=88=B0=E6=A8=A1=E5=9E=8B=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98=EF=BC=8C=E5=AD=97=E6=AE=B5=E5=B8=A6=E6=9C=89()?= =?UTF-8?q?=E6=97=B6=E5=88=AB=E5=90=8D=E4=B8=A2=E5=A4=B1=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/traits/model/View.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/library/traits/model/View.php b/library/traits/model/View.php index a304fedb..872dc70c 100644 --- a/library/traits/model/View.php +++ b/library/traits/model/View.php @@ -38,7 +38,7 @@ trait View // 2011/10/17 添加实际表名定义支持 可以实现同一个表的视图 $tableName .= $view['_table']; } else { - $tableName .= \think\Loader::model($name)->getTableName(); + $tableName .= \think\Loader::table($name)->getTableName(); } // 表别名定义 $tableName .= !empty($view['_as']) ? ' ' . $view['_as'] : ' ' . $name; @@ -111,7 +111,7 @@ trait View { if (false !== $pos = array_search('*', $fields)) { // 定义所有字段 - $fields = array_merge($fields, \think\Loader::model($name)->getFields()); + $fields = array_merge($fields, \think\Loader::table($name)->getFields()); unset($fields[$pos]); } @@ -213,7 +213,6 @@ trait View */ protected function checkFields($fields = '*', $viewFields) { - var_dump($fields); if (is_string($fields)) { if ('*' == $fields) { return $viewFields; @@ -246,9 +245,9 @@ trait View } } elseif (false !== $k = array_search($field, $viewFields, true)) { // 存在视图字段 - $field = $k . $alias; + $field = $k; } - $_fields[] = $field; + $_fields[] = $field . $alias; } return $_fields;