|
@@ -254,7 +254,7 @@ class Dump
|
|
|
$this->writeJSON($fileInfo['filename'], $data);
|
|
|
|
|
|
// 生成model文件
|
|
|
- $this->writeModel($fileInfo['filename'], $columns);
|
|
|
+ $this->writeModel($fileInfo['filename'], $clientColumns);
|
|
|
|
|
|
|
|
|
return true;
|
|
@@ -311,15 +311,18 @@ TXT;
|
|
|
/**
|
|
|
* 写入php model 文件
|
|
|
*
|
|
|
- * @param string $filename 写入文件路径
|
|
|
- * @param array $columns 字段列表
|
|
|
+ * @param string $filename 写入文件路径
|
|
|
+ * @param array $clientColumns 输出给客户端的字段列表
|
|
|
* @return void
|
|
|
*/
|
|
|
- private function writeModel($filename, $columns)
|
|
|
+ private function writeModel($filename, $clientColumns)
|
|
|
{
|
|
|
- $columnString = '"' . join('", "', array_keys($columns)) . '"';
|
|
|
- $className = ucwords($filename);
|
|
|
- $file = $this->modelDir . self::$DS . $className . '.php';
|
|
|
+ $columnString = "[]";
|
|
|
+ if (count($clientColumns) > 0) {
|
|
|
+ $columnString = '["' . join('", "', $clientColumns) . '"]';
|
|
|
+ }
|
|
|
+ $className = ucwords($filename);
|
|
|
+ $file = $this->modelDir . self::$DS . $className . '.php';
|
|
|
// 整理输出格式
|
|
|
$config = <<<TXT
|
|
|
<?php
|
|
@@ -343,8 +346,7 @@ class {$className}
|
|
|
*/
|
|
|
public static function getToClientColumns()
|
|
|
{
|
|
|
- // return [{$columnString}];
|
|
|
- return [];
|
|
|
+ return {$columnString};
|
|
|
}
|
|
|
|
|
|
/**
|