Explorar el Código

简化单文件配置逻辑

王虎 hace 7 años
padre
commit
8c34297174
Se han modificado 2 ficheros con 18 adiciones y 5 borrados
  1. 9 5
      dump.php
  2. 9 0
      projects/test/script/item.php

+ 9 - 5
dump.php

@@ -1,4 +1,5 @@
 <?php
+define('APP_PATH', __DIR__);
 include "vendor/autoload.php";
 
 // 调试输出
@@ -82,6 +83,10 @@ class Dump
     private $defaultConfigFile;
 
     /**
+     * 导出文件数
+     */
+    private $success = 0;
+    /**
      * Dump constructor.
      *
      * @param array $args
@@ -150,14 +155,11 @@ class Dump
         }
 
         // 执行导出
-        $success = 0;
         foreach ($files as $fileInfo) {
-            if ($this->dump($fileInfo)) {
-                ++$success;
-            }
+            $this->dump($fileInfo);
         }
 
-        vd(sprintf("导出完成,共[%d]个文件, 成功[%d]个文件.", count($files), $success));
+        vd(sprintf("导出完成,共[%d]个文件, 成功[%d]个文件.", count($files), $this->success));
     }
 
 
@@ -289,6 +291,8 @@ class Dump
 
         // 生成model文件
         $this->writeModel($sheetName, $clientColumns);
+
+        $this->success++;
     }
 
     /**

+ 9 - 0
projects/test/script/item.php

@@ -0,0 +1,9 @@
+<?php
+
+include APP_PATH . "/default-script.php";
+$keyColumn = 'item_id';
+
+function item_handle($data)
+{
+    return $data;
+}