Compare commits
No commits in common. "modern" and "master" have entirely different histories.
18
.env
18
.env
|
@ -1,17 +1 @@
|
|||
APP_DEBUG = true
|
||||
|
||||
[APP]
|
||||
DEFAULT_TIMEZONE = Asia/Shanghai
|
||||
|
||||
[DATABASE]
|
||||
TYPE = mysql
|
||||
HOSTNAME = 127.0.0.1
|
||||
DATABASE = test
|
||||
USERNAME = username
|
||||
PASSWORD = password
|
||||
HOSTPORT = 3306
|
||||
CHARSET = utf8mb4
|
||||
DEBUG = true
|
||||
|
||||
[LANG]
|
||||
default_lang = zh-cn
|
||||
APP_DEBUG = true
[APP]
DEFAULT_TIMEZONE = Asia/Shanghai
[DATABASE]
TYPE = mysql
HOSTNAME = 127.0.0.1
DATABASE = test
USERNAME = username
PASSWORD = password
HOSTPORT = 3306
CHARSET = utf8
DEBUG = true
[LANG]
default_lang = zh-cn
|
|
@ -32,6 +32,13 @@ function vae_input($name='')
|
|||
return $param;
|
||||
}
|
||||
|
||||
//随机字符串,默认长度10
|
||||
function vae_set_salt($num = 10){
|
||||
$str = 'qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM1234567890';
|
||||
$salt = substr(str_shuffle($str), 10, $num);
|
||||
return $salt;
|
||||
}
|
||||
|
||||
//递归排序
|
||||
function vae_set_recursion($result,$pid=0,$format="L "){
|
||||
/*记录排序后的类别数组*/
|
||||
|
@ -76,3 +83,8 @@ function vae_list_to_tree($list, $pk = 'id', $pid = 'pid', $child = 'children',
|
|||
}
|
||||
return $tree;
|
||||
}
|
||||
|
||||
//vaeThink加密方式
|
||||
function vae_set_password($pwd, $salt){
|
||||
return md5(md5($pwd.$salt).$salt);
|
||||
}
|
|
@ -65,7 +65,8 @@ class Admin extends BaseController
|
|||
'group_id' => 'require',
|
||||
]);
|
||||
|
||||
$param['pwd'] = password_hash($param['password'], PASSWORD_DEFAULT);
|
||||
$param['salt'] = vae_set_salt(20);
|
||||
$param['pwd'] = vae_set_password($param['password'],$param['salt']);
|
||||
$param['groups'] = implode(',',$param['group_id']);
|
||||
$param['create_time'] = time();
|
||||
|
||||
|
@ -113,9 +114,11 @@ class Admin extends BaseController
|
|||
if(empty($param['password_confirm']) or $param['password_confirm'] !== $param['password']) {
|
||||
return vae_assign(202,'两次密码不一致');
|
||||
}
|
||||
$param['pwd'] = password_hash($param['password'],PASSWORD_DEFAULT);
|
||||
$param['salt'] = vae_set_salt(20);
|
||||
$param['pwd'] = vae_set_password($param['password'],$param['salt']);
|
||||
} else {
|
||||
unset($param['pwd']);
|
||||
unset($param['salt']);
|
||||
}
|
||||
$param['groups'] = implode(',',$param['group_id']);
|
||||
$param['update_time'] = time();
|
||||
|
|
|
@ -226,11 +226,13 @@ class Index extends BaseController
|
|||
if(empty($param['password_confirm']) or $param['password_confirm'] !== $param['password']) {
|
||||
return vae_assign(202,'两次密码不一致');
|
||||
}
|
||||
$param['pwd'] = password_hash($param['password'],PASSWORD_DEFAULT);
|
||||
$param['salt'] = vae_set_salt(20);
|
||||
$param['pwd'] = vae_set_password($param['password'],$param['salt']);
|
||||
}
|
||||
else
|
||||
{
|
||||
unset($param['pwd']);
|
||||
unset($param['salt']);
|
||||
}
|
||||
|
||||
$param['update_time'] = time();
|
||||
|
|
|
@ -42,12 +42,10 @@ class Publicer extends BaseController
|
|||
if(empty($admin)) {
|
||||
return vae_assign(202,'用户名或密码错误');
|
||||
}
|
||||
if(!password_verify($param['password'],$admin['pwd'])) {
|
||||
$param['pwd'] = vae_set_password($param['password'],$admin['salt']);
|
||||
if($admin['pwd'] !== $param['pwd']) {
|
||||
return vae_assign(202,'用户名或密码错误');
|
||||
}
|
||||
if(password_needs_rehash($admin['pwd'],PASSWORD_DEFAULT)) {
|
||||
Db::name('admin')->where(['id'=>$admin['id']])->update(['pwd'=>password_hash($param['password'],PASSWORD_DEFAULT)]);
|
||||
}
|
||||
if($admin['status'] == 0){
|
||||
return vae_assign(202,'该用户禁止登陆,请于系统所有者联系');
|
||||
}
|
||||
|
|
|
@ -83,13 +83,13 @@ class Install extends BaseController
|
|||
return json(['code'=>0,'msg'=>'数据库链接失败:'.$error]);die;
|
||||
}
|
||||
// 设置字符集
|
||||
$link->query("SET NAMES 'utf8mb4'");
|
||||
$link->query("SET NAMES 'utf8'");
|
||||
if($link->server_info < 5.0){
|
||||
return json(['code'=>0,'msg'=>'请将您的mysql升级到5.0以上']);die;
|
||||
}
|
||||
// 创建数据库并选中
|
||||
if(!$link->select_db($data['DB_NAME'])){
|
||||
$create_sql='CREATE DATABASE IF NOT EXISTS '.$data['DB_NAME'].' DEFAULT CHARACTER SET utf8mb4;';
|
||||
$create_sql='CREATE DATABASE IF NOT EXISTS '.$data['DB_NAME'].' DEFAULT CHARACTER SET utf8;';
|
||||
if(!$link->query($create_sql)){
|
||||
return json(['code'=>0,'msg'=>'数据库连接失败']);die;
|
||||
}
|
||||
|
@ -109,14 +109,15 @@ class Install extends BaseController
|
|||
$password = $data['password'];
|
||||
$nickname = 'Admin';
|
||||
$thumb = '/static/admin_static/images/vae.jpg';
|
||||
$password = password_hash($password,PASSWORD_DEFAULT);
|
||||
$salt = substr(str_shuffle('qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM1234567890'), 10, 20);
|
||||
$password = md5(md5($password.$salt).$salt);
|
||||
$create_time = time();
|
||||
$update_time = time();
|
||||
|
||||
$caeate_admin_sql = "INSERT INTO ".$data['DB_PREFIX']."admin ".
|
||||
"(username,pwd, nickname,thumb,create_time,update_time) "
|
||||
"(username,pwd, nickname,thumb,salt,create_time,update_time) "
|
||||
."VALUES "
|
||||
."('$username','$password','$nickname','$thumb','$create_time','$update_time')";
|
||||
."('$username','$password','$nickname','$thumb','$salt','$create_time','$update_time')";
|
||||
if(!$link->query($caeate_admin_sql)) {
|
||||
return json(['code'=>0,'msg'=>'创建管理员信息失败']);
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@ CREATE TABLE `vae_admin` (
|
|||
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`username` varchar(255) NOT NULL DEFAULT '',
|
||||
`pwd` varchar(255) NOT NULL DEFAULT '',
|
||||
`salt` varchar(50) NOT NULL DEFAULT '',
|
||||
`status` int(1) NOT NULL DEFAULT '1' COMMENT '1正常-1禁止登陆',
|
||||
`create_time` int(11) NOT NULL DEFAULT '0',
|
||||
`update_time` int(11) NOT NULL DEFAULT '0',
|
||||
|
@ -34,7 +35,7 @@ CREATE TABLE `vae_admin` (
|
|||
`groups` varchar(255) NOT NULL DEFAULT '' COMMENT '权限组,隔开',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `username` (`id`,`username`) USING BTREE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='管理员';
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='管理员';
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of vae_admin
|
||||
|
@ -48,13 +49,13 @@ CREATE TABLE `vae_admin_group` (
|
|||
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`title` varchar(255) NOT NULL DEFAULT '',
|
||||
`status` int(1) NOT NULL DEFAULT '1',
|
||||
`rules` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci COMMENT '用户组拥有的规则id, 多个规则","隔开',
|
||||
`rules` text CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT '用户组拥有的规则id, 多个规则","隔开',
|
||||
`desc` text COMMENT '备注',
|
||||
`create_time` int(11) NOT NULL DEFAULT '0',
|
||||
`update_time` int(11) NOT NULL DEFAULT '0',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `id` (`id`) USING BTREE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='权限分组';
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='权限分组';
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of vae_admin_group
|
||||
|
@ -67,7 +68,7 @@ DROP TABLE IF EXISTS `vae_admin_rule`;
|
|||
CREATE TABLE `vae_admin_rule` (
|
||||
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`pid` int(11) unsigned NOT NULL DEFAULT '0',
|
||||
`src` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT '' COMMENT '规则',
|
||||
`src` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '规则',
|
||||
`title` varchar(255) NOT NULL DEFAULT '',
|
||||
`is_menu` int(1) NOT NULL DEFAULT '1' COMMENT '1是菜单2不是',
|
||||
`font_family` varchar(50) DEFAULT '' COMMENT '图标来源',
|
||||
|
@ -77,7 +78,7 @@ CREATE TABLE `vae_admin_rule` (
|
|||
`update_time` int(11) NOT NULL COMMENT '0',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `name` (`src`) USING BTREE
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=55 DEFAULT CHARSET=utf8mb4 COMMENT='权限节点';
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=55 DEFAULT CHARSET=utf8 COMMENT='权限节点';
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of vae_admin_rule
|
||||
|
@ -142,7 +143,7 @@ DROP TABLE IF EXISTS `vae_cate`;
|
|||
CREATE TABLE `vae_cate` (
|
||||
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`title` varchar(50) NOT NULL,
|
||||
`icon` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
|
||||
`icon` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL,
|
||||
`pid` int(11) NOT NULL DEFAULT '0',
|
||||
`status` int(1) NOT NULL DEFAULT '1' COMMENT '1正常0下架',
|
||||
`sort` int(11) NOT NULL DEFAULT '0' COMMENT '排序,值越大越靠前',
|
||||
|
@ -150,7 +151,7 @@ CREATE TABLE `vae_cate` (
|
|||
`create_time` int(11) NOT NULL DEFAULT '0',
|
||||
`update_time` int(11) NOT NULL DEFAULT '0',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='分类';
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='分类';
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of vae_cate
|
||||
|
@ -162,11 +163,11 @@ CREATE TABLE `vae_cate` (
|
|||
DROP TABLE IF EXISTS `vae_cate_group`;
|
||||
CREATE TABLE `vae_cate_group` (
|
||||
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
|
||||
`name` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
|
||||
`key` varchar(50) NOT NULL,
|
||||
`desc` varchar(255) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='分类分组';
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='分类分组';
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of vae_cate_group
|
||||
|
@ -178,9 +179,9 @@ CREATE TABLE `vae_cate_group` (
|
|||
DROP TABLE IF EXISTS `vae_content`;
|
||||
CREATE TABLE `vae_content` (
|
||||
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`img` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci COMMENT '图片,多图用,隔开',
|
||||
`img` text CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT '图片,多图用,隔开',
|
||||
`status` int(1) NOT NULL DEFAULT '1' COMMENT '1正常0下架',
|
||||
`title` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
|
||||
`title` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
|
||||
`desc` varchar(500) DEFAULT NULL COMMENT '概要',
|
||||
`content` text COMMENT '详情',
|
||||
`sort` int(11) NOT NULL DEFAULT '0' COMMENT '排序,值越大越靠前',
|
||||
|
@ -189,7 +190,7 @@ CREATE TABLE `vae_content` (
|
|||
`create_time` int(11) NOT NULL DEFAULT '0',
|
||||
`update_time` int(11) NOT NULL DEFAULT '0',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='内容';
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='内容';
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of vae_content
|
||||
|
@ -201,12 +202,12 @@ CREATE TABLE `vae_content` (
|
|||
DROP TABLE IF EXISTS `vae_content_group`;
|
||||
CREATE TABLE `vae_content_group` (
|
||||
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
|
||||
`name` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
|
||||
`key` varchar(50) NOT NULL,
|
||||
`cate_group_id` int(11) NOT NULL DEFAULT '0' COMMENT '分类组id',
|
||||
`desc` varchar(255) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='内容分组';
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='内容分组';
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of vae_content_group
|
||||
|
@ -220,14 +221,14 @@ CREATE TABLE `vae_nav` (
|
|||
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`title` varchar(50) NOT NULL,
|
||||
`icon` varchar(255) NOT NULL,
|
||||
`src` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
|
||||
`src` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL,
|
||||
`status` int(1) NOT NULL DEFAULT '1' COMMENT '1正常0下架',
|
||||
`sort` int(11) NOT NULL DEFAULT '0' COMMENT '排序,值越大越靠前',
|
||||
`nav_group_id` int(11) NOT NULL DEFAULT '0',
|
||||
`create_time` int(11) NOT NULL DEFAULT '0',
|
||||
`update_time` int(11) NOT NULL DEFAULT '0',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='导航';
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='导航';
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of vae_nav
|
||||
|
@ -239,11 +240,11 @@ CREATE TABLE `vae_nav` (
|
|||
DROP TABLE IF EXISTS `vae_nav_group`;
|
||||
CREATE TABLE `vae_nav_group` (
|
||||
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
|
||||
`name` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
|
||||
`key` varchar(50) NOT NULL,
|
||||
`desc` varchar(255) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='导航分组';
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='导航分组';
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of vae_nav_group
|
||||
|
@ -262,7 +263,7 @@ CREATE TABLE `vae_route` (
|
|||
`create_time` int(11) NOT NULL DEFAULT '0',
|
||||
`update_time` int(11) NOT NULL DEFAULT '0',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='路由设置';
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='路由设置';
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of vae_route
|
||||
|
@ -282,7 +283,7 @@ CREATE TABLE `vae_slide` (
|
|||
`create_time` int(11) NOT NULL DEFAULT '0',
|
||||
`update_time` int(11) NOT NULL DEFAULT '0',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='轮播';
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='轮播';
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of vae_slide
|
||||
|
@ -294,11 +295,11 @@ CREATE TABLE `vae_slide` (
|
|||
DROP TABLE IF EXISTS `vae_slide_group`;
|
||||
CREATE TABLE `vae_slide_group` (
|
||||
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
|
||||
`name` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
|
||||
`key` varchar(50) NOT NULL,
|
||||
`desc` varchar(255) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='轮播分组';
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='轮播分组';
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of vae_slide_group
|
||||
|
|
Loading…
Reference in New Issue