mirror of
https://gitee.com/apiadmin/ApiAdmin.git
synced 2025-04-06 03:58:00 +08:00
modified 修改安装流程,完成依赖检测
This commit is contained in:
parent
50b5287703
commit
9eb3951762
@ -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 {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -2,8 +2,8 @@
|
||||
{block name="title"}系统安装Step1{/block}
|
||||
{block name="nav"}
|
||||
<li class="active"><a href="javascript:;">安装协议</a></li>
|
||||
<li><a href="javascript:;">环境检测</a></li>
|
||||
<li><a href="javascript:;">参数设置</a></li>
|
||||
<li><a href="javascript:;">环境检测</a></li>
|
||||
<li><a href="javascript:;">开始安装</a></li>
|
||||
<li><a href="javascript:;">安装完成</a></li>
|
||||
{/block}
|
||||
|
111
application/install/view/index/step3.html
Normal file
111
application/install/view/index/step3.html
Normal file
@ -0,0 +1,111 @@
|
||||
{extend name="public/base" /}
|
||||
{block name="title"}系统安装Step3{/block}
|
||||
{block name="nav"}
|
||||
<li><a href="javascript:;">安装协议</a></li>
|
||||
<li><a href="javascript:;">参数设置</a></li>
|
||||
<li class="active"><a href="javascript:;">环境检测</a></li>
|
||||
<li><a href="javascript:;">开始安装</a></li>
|
||||
<li><a href="javascript:;">安装完成</a></li>
|
||||
{/block}
|
||||
{block name="main"}
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">{:config('PRODUCT_NAME')} 环境检测</div>
|
||||
<div class="panel-body" style="font-size: 14px">
|
||||
<table class="table table-hover">
|
||||
<caption><h4>运行环境检查</h4></caption>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>项目</th>
|
||||
<th>所需配置</th>
|
||||
<th>当前配置</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{volist name="checkEnv" id="item"}
|
||||
<tr>
|
||||
<td>{$item['title']}</td>
|
||||
<td>{$item['limit']}</td>
|
||||
<td><i class="{$item['icon']}"></i> {$item['current']}</td>
|
||||
</tr>
|
||||
{/volist}
|
||||
</tbody>
|
||||
</table>
|
||||
<table class="table table-hover">
|
||||
<caption><h4>目录、文件权限检查</h4></caption>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>目录/文件</th>
|
||||
<th>所需状态</th>
|
||||
<th>当前状态</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{volist name="checkDirFile" id="item"}
|
||||
<tr>
|
||||
<td>{$item['path']}</td>
|
||||
<td>可写</td>
|
||||
<td><i class="{$item['icon']}"></i> {$item['title']}</td>
|
||||
</tr>
|
||||
{/volist}
|
||||
</tbody>
|
||||
</table>
|
||||
<table class="table table-hover">
|
||||
<caption><h4>数据库依赖检测</h4></caption>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>名称</th>
|
||||
<th>检查结果</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{volist name="checkDB" id="item"}
|
||||
<tr>
|
||||
<td>{$item['name']}</td>
|
||||
<td><i class="{$item['icon']}"></i> {$item['title']}</td>
|
||||
</tr>
|
||||
{/volist}
|
||||
</tbody>
|
||||
</table>
|
||||
{if condition="isset($checkCache)"}
|
||||
<table class="table table-hover">
|
||||
<caption><h4>缓存依赖检测</h4></caption>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>名称</th>
|
||||
<th>检查结果</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{volist name="checkCache" id="item"}
|
||||
<tr>
|
||||
<td>{$item['name']}</td>
|
||||
<td><i class="{$item['icon']}"></i> {$item['title']}</td>
|
||||
</tr>
|
||||
{/volist}
|
||||
</tbody>
|
||||
</table>
|
||||
{/if}
|
||||
<table class="table table-hover">
|
||||
<caption><h4>函数及扩展依赖性检查</h4></caption>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>名称</th>
|
||||
<th>检查结果</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{volist name="checkOther" id="item"}
|
||||
<tr>
|
||||
<td>{$item['name']}</td>
|
||||
<td><i class="{$item['icon']}"></i> {$item['title']}</td>
|
||||
</tr>
|
||||
{/volist}
|
||||
</tbody>
|
||||
</table>
|
||||
<form action="{:url('step3')}" id="form-setup">
|
||||
<a type="button" target-form="form-setup" class="ajax-post redirect btn btn-primary btn-block">下一步</a>
|
||||
<a type="button" href="{:url('step2')}" class="btn btn-default btn-block">上一步</a>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
{/block}
|
63
application/install/view/public/jump.html
Normal file
63
application/install/view/public/jump.html
Normal file
@ -0,0 +1,63 @@
|
||||
{__NOLAYOUT__}
|
||||
<!doctype html>
|
||||
<html lang="zh">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>ApiAdmin - 跳转提示</title>
|
||||
<script src="__PLUGIN__/jQuery/3.1.1/jquery.min.js"></script>
|
||||
<link href="//cdn.bootcss.com/semantic-ui/2.2.6/semantic.min.css" rel="stylesheet">
|
||||
<script src="//cdn.bootcss.com/semantic-ui/2.2.6/semantic.js"></script>
|
||||
<link rel="icon" href="__IMG__/favicon.ico">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="ui card" style="text-align:center;width:40%;position: fixed;top: 20%;left: 30%">
|
||||
<?php switch ($code) {?>
|
||||
<?php case 1:?>
|
||||
<div class="ui green inverted segment" style="margin: 0px;">
|
||||
<i class="ui smile icon massive"></i>
|
||||
</div>
|
||||
<?php break;?>
|
||||
<?php case 0:?>
|
||||
<div class="ui red inverted segment" style="margin: 0px;">
|
||||
<i class="ui frown icon massive"></i>
|
||||
</div>
|
||||
<?php break;?>
|
||||
<?php } ?>
|
||||
<div class="content" style="line-height: 2em">
|
||||
<?php if(isset($msg)) {?>
|
||||
<span class="header"><?php echo(strip_tags($msg));?></span>
|
||||
<?php }else{?>
|
||||
<span class="header"><?php echo($error); ?></span>
|
||||
<?php }?>
|
||||
<div class="meta">
|
||||
将在<span id="left"><?php echo($wait); ?></span>S后自动跳转
|
||||
</div>
|
||||
</div>
|
||||
<span style="display: none" id="href"><?php echo($url); ?></span>
|
||||
<div class="ui bottom attached indicating progress" id="amanege-bar">
|
||||
<div class="bar"></div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
<script type="text/javascript">
|
||||
(function(){
|
||||
var wait = 0,left = $('#left').text();
|
||||
var href = $('#href').text();
|
||||
var each = 100/left;
|
||||
var interval = setInterval(function(){
|
||||
wait = wait + each;
|
||||
left = left - 1;
|
||||
if(wait > 100) {
|
||||
location.href = href;
|
||||
clearInterval(interval);
|
||||
return ;
|
||||
}
|
||||
$('#left').text(left);
|
||||
$('#amanege-bar').progress({
|
||||
percent: wait
|
||||
});
|
||||
}, 1000);
|
||||
})();
|
||||
</script>
|
||||
</html>
|
Loading…
x
Reference in New Issue
Block a user