Browse Source

新增安装网页端安装
新增CRUD一键生成后继续生成菜单
移除无关的selectpage.min.js

Karson 8 years ago
parent
commit
ad69d21d5d
4 changed files with 412 additions and 5 deletions
  1. 13 3
      application/admin/command/Crud.php
  2. 9 2
      public/index.php
  3. 390 0
      public/install.php
  4. 0 0
      selectpage.min.js

+ 13 - 3
application/admin/command/Crud.php

@@ -40,7 +40,7 @@ class Crud extends Command
     protected $intDateSuffix = 'time';
 
     /**
-     * 开后缀
+     * 开后缀
      */
     protected $switchSuffix = 'switch';
 
@@ -52,7 +52,6 @@ class Crud extends Command
         'icon'   => 'icon',
         'flag'   => 'flag',
         'url'    => 'url',
-        'url'    => 'url',
         'image'  => 'image',
         'images' => 'images',
         'time'   => ['type' => ['int', 'timestamp'], 'name' => 'datetime']
@@ -98,6 +97,7 @@ class Crud extends Command
                 ->addOption('relationprimarykey', 'p', Option::VALUE_OPTIONAL, 'relation primary key', null)
                 ->addOption('mode', 'o', Option::VALUE_OPTIONAL, 'relation table mode,hasone or belongsto', 'belongsto')
                 ->addOption('delete', 'd', Option::VALUE_OPTIONAL, 'delete all files generated by CRUD', null)
+                ->addOption('menu', 'u', Option::VALUE_OPTIONAL, 'create menu when CRUD completed', null)
                 ->setDescription('Build CRUD controller and model from table');
     }
 
@@ -118,6 +118,8 @@ class Crud extends Command
         {
             throw new Exception('table name can\'t empty');
         }
+        //是否生成菜单
+        $menu = $input->getOption("menu");
         //关联表
         $relation = $input->getOption('relation');
         //自定义关联表模型
@@ -204,7 +206,8 @@ class Crud extends Command
             }
             foreach ($readyFiles as $k => $v)
             {
-                unlink($v);
+                if (file_exists($v))
+                    unlink($v);
             }
 
             $output->info("Delete Successed");
@@ -689,6 +692,13 @@ class Crud extends Command
         {
             throw new Exception("Code: " . $e->getCode() . "\nLine: " . $e->getLine() . "\nMessage: " . $e->getMessage() . "\nFile: " . $e->getFile());
         }
+
+        //继续生成菜单
+        if ($menu)
+        {
+            exec("php think menu -c {$controllerUrl}");
+        }
+
         $output->info("Build Successed");
     }
 

+ 9 - 2
public/index.php

@@ -1,4 +1,5 @@
 <?php
+
 // +----------------------------------------------------------------------
 // | ThinkPHP [ WE CAN DO IT JUST THINK ]
 // +----------------------------------------------------------------------
@@ -8,10 +9,16 @@
 // +----------------------------------------------------------------------
 // | Author: liu21st <liu21st@gmail.com>
 // +----------------------------------------------------------------------
-
 // [ 应用入口文件 ]
-
 // 定义应用目录
 define('APP_PATH', __DIR__ . '/../application/');
+
+// 判断是否安装FastAdmin
+if (!file_exists(APP_PATH . 'admin/command/Install/install.lock'))
+{
+    header("location:./install.php");
+    exit;
+}
+
 // 加载框架引导文件
 require __DIR__ . '/../thinkphp/start.php';

File diff suppressed because it is too large
+ 390 - 0
public/install.php


+ 0 - 0
selectpage.min.js