浏览代码

修复当表字段注释为空时,生成的语言文件格式错误

Chrisleung 6 年之前
父节点
当前提交
6facfcf894
共有 1 个文件被更改,包括 2 次插入4 次删除
  1. 2 4
      application/admin/command/Crud.php

+ 2 - 4
application/admin/command/Crud.php

@@ -807,7 +807,7 @@ class Crud extends Command
                 }
             }
             unset($line);
-            $langList = implode(",\n", array_filter($langList)) . ",";
+            $langList = implode(",\n", array_filter($langList));
 
             //表注释
             $tableComment = $modelTableInfo['Comment'];
@@ -934,9 +934,7 @@ class Crud extends Command
             // 生成JS文件
             $this->writeToFile('javascript', $data, $javascriptFile);
             // 生成语言文件
-            if ($langList) {
-                $this->writeToFile('lang', $data, $langFile);
-            }
+            $this->writeToFile('lang', $data, $langFile);
         } catch (ErrorException $e) {
             throw new Exception("Code: " . $e->getCode() . "\nLine: " . $e->getLine() . "\nMessage: " . $e->getMessage() . "\nFile: " . $e->getFile());
         }