修正安装程序

This commit is contained in:
liyukun 2022-01-13 00:15:43 +08:00
parent fa43c716fe
commit ff67babf51
7 changed files with 58 additions and 49 deletions

View File

@ -11,7 +11,7 @@
Target Server Version : 50726
File Encoding : 65001
Date: 12/01/2022 00:04:30
Date: 13/01/2022 00:14:49
*/
SET NAMES utf8mb4;
@ -295,7 +295,7 @@ CREATE TABLE `ape_document` (
PRIMARY KEY (`id`) USING BTREE,
INDEX `idx_category_status`(`category_id`, `status`) USING BTREE,
INDEX `idx_status_type_pid`(`status`, `uid`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '文档模型基础表' ROW_FORMAT = Dynamic;
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '文档模型基础表' ROW_FORMAT = DYNAMIC;
-- ----------------------------
-- Records of ape_document
@ -309,7 +309,7 @@ CREATE TABLE `ape_document_article` (
`id` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '文档ID',
`content` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '文章内容',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '文档模型文章表' ROW_FORMAT = Dynamic;
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '文档模型文章表' ROW_FORMAT = DYNAMIC;
-- ----------------------------
-- Records of ape_document_article
@ -337,7 +337,7 @@ CREATE TABLE `ape_document_category` (
`create_time` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '创建时间',
`update_time` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '更新时间',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '分类表' ROW_FORMAT = Dynamic;
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '分类表' ROW_FORMAT = DYNAMIC;
-- ----------------------------
-- Records of ape_document_category
@ -351,7 +351,7 @@ CREATE TABLE `ape_document_category_content` (
`id` int(11) NOT NULL,
`content` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL,
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '分类内容表' ROW_FORMAT = Dynamic;
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '分类内容表' ROW_FORMAT = DYNAMIC;
-- ----------------------------
-- Records of ape_document_category_content
@ -370,7 +370,7 @@ CREATE TABLE `ape_document_product` (
`create_time` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '创建时间',
`update_time` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '更新时间',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '文档模型文章表' ROW_FORMAT = Dynamic;
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '文档模型文章表' ROW_FORMAT = DYNAMIC;
-- ----------------------------
-- Records of ape_document_product
@ -392,7 +392,7 @@ CREATE TABLE `ape_friend_link` (
`update_time` int(10) NOT NULL DEFAULT 0 COMMENT '更新时间',
`status` int(10) NOT NULL DEFAULT 1 COMMENT '状态 0禁用',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '友链表' ROW_FORMAT = Dynamic;
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '友链表' ROW_FORMAT = DYNAMIC;
-- ----------------------------
-- Records of ape_friend_link
@ -432,7 +432,7 @@ CREATE TABLE `ape_message_form` (
`status` int(10) NOT NULL DEFAULT 1,
`create_time` int(10) NOT NULL DEFAULT 0 COMMENT '留言时间',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '反馈意见表' ROW_FORMAT = Dynamic;
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '反馈意见表' ROW_FORMAT = DYNAMIC;
-- ----------------------------
-- Records of ape_message_form
@ -580,11 +580,11 @@ DROP TABLE IF EXISTS `ape_user`;
CREATE TABLE `ape_user` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
`username` varchar(40) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '用户账号',
`nickname` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '里程密' COMMENT '昵称',
`nickname` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '昵称',
`password` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '用户密码',
`avatar` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '用户头像',
`avatar` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '用户头像',
`email` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '邮箱',
`tel` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '手机号',
`tel` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '手机号',
`ip` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '注册IP地址',
`status` int(11) NOT NULL DEFAULT 0 COMMENT '状态 0启用 1禁用',
`remark` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '简介',

View File

@ -226,7 +226,6 @@ a:visited{
box-shadow:0 3px 3px #ddd;
position:relative;
color:#fff;
background:#246fa6 url(../images/install/header.png) 0 0 repeat-x;
}
/*
===================
@ -314,18 +313,14 @@ LOGO
*/
.icon_install,
.icon_update{
float:left;
margin-top:35px;
width:90px;
height:30px;
overflow:hidden;
text-indent:-2000em;
}
.icon_install{
background:url(../images/install/icon_install.png) no-repeat;
}
.icon_update{
background:url(../images/install/icon_update.png) no-repeat;
float: left;
margin-top: 40px;
width: 90px;
height: 30px;
overflow: hidden;
font-size: 20px;
color: #050919;
font-weight: bold;
}
/*
@ -387,7 +382,7 @@ a.btn_old:visited{
width:33%;
text-align:center;
font-size:14px;
color:#6f7885;
color: #050919;
font-weight:700;
}
.step li em{
@ -644,7 +639,7 @@ loading
}
.updata_type .tab li.current a{
background:#fdfdfd;
color:#6F7885;
color: #050919;
border-bottom:1px solid #fdfdfd;
}
.updata_type .tab_cont{

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 699 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 KiB

After

Width:  |  Height:  |  Size: 34 KiB

View File

@ -193,29 +193,28 @@ switch ($step) {
case '4':
if (intval($_GET['install'])) {
$n = intval($_GET['n']);
if ($i == 999999)
exit;
if ($n == 999999) exit;
$arr = array();
$dbHost = trim($_POST['dbhost']);
$_POST['dbport'] = $_POST['dbport'] ? $_POST['dbport'] : '3306';
$dbName = strtolower(trim($_POST['dbname']));
$dbName = strtolower(trim($_POST['dbname']));
$dbUser = trim($_POST['dbuser']);
$dbPwd = trim($_POST['dbpw']);
$dbPrefix = empty($_POST['dbprefix']) ? 'ape_' : trim($_POST['dbprefix']);
$username = trim($_POST['manager']);
$password = trim($_POST['manager_pwd']);
$email = trim($_POST['manager_email']);
if (!function_exists('mysqli_connect')) {
$arr['msg'] = "请安装 mysqli 扩展!";
echo json_encode($arr);
exit;
}
;
$conn = @mysqli_connect($dbHost, $dbUser, $dbPwd,NULL,$_POST['dbport']);
if (mysqli_connect_errno($conn)){
$arr['msg'] = "连接数据库失败!".mysqli_connect_error($conn);
$arr['msg'] = "连接数据库失败!".mysqli_connect_error($conn);
echo json_encode($arr);
exit;
}
@ -226,7 +225,7 @@ switch ($step) {
echo json_encode($arr);
exit;
}
if (!mysqli_select_db($conn,$dbName)) {
//创建数据时同时设置编码
if (!mysqli_query($conn,"CREATE DATABASE IF NOT EXISTS `" . $dbName . "` DEFAULT CHARACTER SET utf8;")) {
@ -280,18 +279,28 @@ switch ($step) {
}
// 清理掉管理员表
mysqli_query($conn,"truncate table ".str_replace('ape_',$dbPrefix,'ape_admin'));
// 清空测试数据
// 清空测试数据
if(!$_POST['demo'])
{
$bl_table = array('ape_admin'
,'ape_admin_log'
,'ape_admin_notify'
,'ape_wechat_user'
,'ape_wechat_message'
,'ape_advert'
,'ape_attachment'
,'ape_attachment_category'
,'ape_document'
,'ape_document_article'
,'ape_document_category'
,'ape_document_category_content'
,'ape_document_product'
,'ape_friend_link'
,'ape_invitation_code'
,'ape_message_form'
,'ape_pv_log'
,'ape_tag'
,'ape_url_log'
,'ape_user'
,'ape_user_bill'
,'ape_user_message'
,'ape_user_order');
,'ape_uv_log');
foreach($bl_table as $k => $v)
{
$bl_table[$k] = str_replace('ape_',$dbPrefix,$v);
@ -312,18 +321,23 @@ switch ($step) {
$strConfig = str_replace('#DB_PORT#', $_POST['dbport'], $strConfig);
$strConfig = str_replace('#DB_PREFIX#', $dbPrefix, $strConfig);
$strConfig = str_replace('#DB_CHARSET#', 'utf8', $strConfig);
// $strConfig = str_replace('#DB_DEBUG#', false, $strConfig);
$strConfig = str_replace('#DB_DEBUG#', 'false', $strConfig);
@file_put_contents(APP_DIR . '.env', $strConfig); //数据库配置文件的地址
@chmod(APP_DIR . '.env',0777); //数据库配置文件的地址//
//更新网站配置信息2
//插入管理员表字段tp_admin表
//插入管理员表字段ape_admin表
$time = time();
$password = md5(md5(trim($_POST['manager_pwd'])));
mysqli_query($conn,"truncate table {$dbPrefix}system_admin");
$addadminsql = "INSERT INTO `{$dbPrefix}admin` (`id`, `name`, `nickname`, `password`, `role_id`, `status`, `create_time`, `create_user`) VALUES
(1, '".$username."', 'admin' ,'".$password."', 1, 1, $time, '1')";
$res = mysqli_query($conn,$addadminsql);
// 清理掉管理员表和用户表
mysqli_query($conn,"truncate table {$dbPrefix}admin");
mysqli_query($conn,"truncate table {$dbPrefix}user");
$addAdminSql = "INSERT INTO `{$dbPrefix}admin` (`id`, `uid`,`username`, `nickname`, `password`, `role_id`, `status`, `create_time`, `create_user`) VALUES".
"(1, 1,'".$username."', 'admin' ,'".$password."', 1, 1, $time, '1')";
$addUserSql = "INSERT INTO `{$dbPrefix}user` (`id`, `username`, `nickname`, `password`, `status`, `is_admin`, `create_time`) VALUES ".
"(1,'".$username."', 'admin' ,'".$password."', 1, 1, $time);";
//插入前台用户和管理员
mysqli_query($conn,$addUserSql);
$res = mysqli_query($conn,$addAdminSql);
if($res){
$message = '成功添加管理员<br />成功写入配置文件<br>安装完成.';
$arr = array('n' => 999999, 'msg' => $message);

View File

@ -47,13 +47,13 @@
</tr>
<tr>
<td class="tar">数据库名:</td>
<td><input type="text" name="dbname" id="dbname" value="leapy" class="input" onBlur="TestDbPwd(0)"></td>
<td><input type="text" name="dbname" id="dbname" value="ape_blog" class="input" onBlur="TestDbPwd(0)"></td>
<td><div id="J_install_tip_dbname"></div></td>
</tr>
<tr>
<td class="tar">数据库表前缀:</td>
<td><input type="text" name="dbprefix" id="dbprefix" value="lea_" class="input" ></td>
<td><div id="J_install_tip_dbprefix"><span class="gray">建议使用默认,同一数据库安装多个pai-admin时需修改</span></div></td>
<td><input type="text" name="dbprefix" id="dbprefix" value="ape_" class="input" ></td>
<td><div id="J_install_tip_dbprefix"><span class="gray">建议使用默认,同一数据库安装多个ape_blog时需修改</span></div></td>
</tr>
<tr>
<td class="tar">演示数据:</td>