diff --git a/application/install/controller/Index.php b/application/install/controller/Index.php index 0eede32..05561ff 100644 --- a/application/install/controller/Index.php +++ b/application/install/controller/Index.php @@ -4,25 +4,103 @@ namespace app\install\controller; use think\Controller; class Index extends Controller { - public function index() { + public function index(){ session('step', 1); session('error', false); return $this->fetch(); } public function step2(){ - if($this->request->isAjax()){ - if(session('error')){ - $this->error('环境检测没有通过,请调整环境后重试!'); - }else{ - $this->success('恭喜您环境检测通过', url('step3')); + if( $this->request->isPost() ){ + $data = $this->request->post(); + if( empty($data['db']['DB_HOST']) ){ + $data['db']['DB_HOST'] = '127.0.0.1'; } + if( empty($data['db']['DB_NAME']) ){ + $this->error('数据库名称不能为空'); + } + if( empty($data['db']['DB_USER']) ){ + $this->error('数据库用户名不能为空'); + } + if( empty($data['db']['DB_PWD']) ){ + $this->error('数据库密码不能为空'); + } + if( empty($data['db']['DB_PORT']) ){ + if( $data['db']['DB_TYPE'] == 0 ){ + $data['db']['DB_PORT'] = 3306; + }else{ + $data['db']['DB_PORT'] = 27017; + } + } + if( $data['cache']['type'] != 0 ){ + if( empty($data['cache']['ip']) ){ + $data['cache']['ip'] = '127.0.0.1'; + } + if( empty($data['cache']['port']) ){ + $data['cache']['ip'] = 6379; + } + } + if( empty($data['admin']['name']) ){ + $this->error('管理员账号不能为空'); + } + if( empty($data['admin']['pass']) ){ + $this->error('管理员密码不能为空'); + } + session('step', 2); + session('dbConfig', $data['db']); + session('cacheConfig', $data['cache']); + session('adminConfig', $data['admin']); + session('isCover', $data['cover']); + $this->success('参数正确开始安装', url('step3')); }else{ - $step = 1; + $step = session('step'); if($step != 1){ - $this->error("请按顺序安装", url('step1')); + $this->error("请按顺序安装", url('index')); }else{ - session('step', 2); + session('error', false); + return $this->fetch(); + } + } + } + + public function step3(){ + $step = session('step'); + if( $step != 2){ + $this->error("请按顺序安装", url('index')); + }else{ +// session('step', 3); + session('error', false); + $dbConfig = session('dbConfig'); + $cacheConfig = session('cacheConfig'); + $adminConfig = session('adminConfig'); + $isCover = session('isCover'); + //环境检测 + $this->assign('checkEnv', checkEnv()); + //目录文件读写检测 + $this->assign('checkDirFile', checkDirFile()); + + if( $dbConfig['DB_TYPE'] == 0 ){ + $this->assign('checkDB', checkMySQL()); + }else{ + $this->assign('checkDB', checkMongoDB()); + } + if( $cacheConfig['type'] != 0 ){ + $this->assign('checkCache', checkRedis()); + } + $this->assign('checkOther', checkOther()); + return $this->fetch(); + } + } + + public function step4(){ + if(session('error')){ + $this->error('环境检测没有通过,请调整环境后重试!', url('step3')); + }else{ + $step = session('step'); + if( $step != 3){ + $this->error("请按顺序安装", url('index')); + }else{ + session('step', 4); session('error', false); //环境检测 @@ -38,4 +116,5 @@ class Index extends Controller { } } } + } diff --git a/application/install/view/index/index.html b/application/install/view/index/index.html index 2d7bdfe..9b15457 100644 --- a/application/install/view/index/index.html +++ b/application/install/view/index/index.html @@ -2,8 +2,8 @@ {block name="title"}系统安装Step1{/block} {block name="nav"}
  • 安装协议
  • -
  • 环境检测
  • 参数设置
  • +
  • 环境检测
  • 开始安装
  • 安装完成
  • {/block} diff --git a/application/install/view/index/step3.html b/application/install/view/index/step3.html new file mode 100644 index 0000000..831a54a --- /dev/null +++ b/application/install/view/index/step3.html @@ -0,0 +1,111 @@ +{extend name="public/base" /} +{block name="title"}系统安装Step3{/block} +{block name="nav"} +
  • 安装协议
  • +
  • 参数设置
  • +
  • 环境检测
  • +
  • 开始安装
  • +
  • 安装完成
  • +{/block} +{block name="main"} +
    +
    {:config('PRODUCT_NAME')} 环境检测
    +
    + + + + + + + + + + + {volist name="checkEnv" id="item"} + + + + + + {/volist} + +

    运行环境检查

    项目所需配置当前配置
    {$item['title']}{$item['limit']} {$item['current']}
    + + + + + + + + + + + {volist name="checkDirFile" id="item"} + + + + + + {/volist} + +

    目录、文件权限检查

    目录/文件所需状态当前状态
    {$item['path']}可写 {$item['title']}
    + + + + + + + + + + {volist name="checkDB" id="item"} + + + + + {/volist} + +

    数据库依赖检测

    名称检查结果
    {$item['name']} {$item['title']}
    + {if condition="isset($checkCache)"} + + + + + + + + + + {volist name="checkCache" id="item"} + + + + + {/volist} + +

    缓存依赖检测

    名称检查结果
    {$item['name']} {$item['title']}
    + {/if} + + + + + + + + + + {volist name="checkOther" id="item"} + + + + + {/volist} + +

    函数及扩展依赖性检查

    名称检查结果
    {$item['name']} {$item['title']}
    +
    + 下一步 + 上一步 +
    +
    +
    +{/block} \ No newline at end of file diff --git a/application/install/view/public/jump.html b/application/install/view/public/jump.html new file mode 100644 index 0000000..7460f53 --- /dev/null +++ b/application/install/view/public/jump.html @@ -0,0 +1,63 @@ +{__NOLAYOUT__} + + + + + ApiAdmin - 跳转提示 + + + + + + + +
    + + +
    + +
    + + +
    + +
    + + +
    + + + + + +
    + 将在S后自动跳转 +
    +
    + +
    +
    +
    +
    + + + \ No newline at end of file