完善代码逻辑

完善前台登录
This commit is contained in:
liyukun 2022-01-05 23:42:48 +08:00
parent 88e9a6a50f
commit fadbc784a4
26 changed files with 273 additions and 320 deletions

View File

@ -11,7 +11,7 @@
Target Server Version : 50726
File Encoding : 65001
Date: 03/01/2022 04:00:40
Date: 05/01/2022 23:42:14
*/
SET NAMES utf8mb4;
@ -31,7 +31,7 @@ CREATE TABLE `ape_admin` (
`avatar` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '头像',
`role_id` int(4) NOT NULL DEFAULT 0 COMMENT '角色id',
`tel` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '电话',
`mail` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '邮箱',
`email` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '邮箱',
`remark` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '简介',
`status` tinyint(1) NOT NULL COMMENT '状态1:正常0冻结',
`ip` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '注册ip',
@ -39,13 +39,16 @@ CREATE TABLE `ape_admin` (
`update_user` int(32) NOT NULL DEFAULT 0 COMMENT '修改时间',
`create_time` int(10) NOT NULL COMMENT '添加时间',
`update_time` int(10) NOT NULL COMMENT '更新时间',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '后台人员列表' ROW_FORMAT = DYNAMIC;
PRIMARY KEY (`id`) USING BTREE,
UNIQUE INDEX `username_email_tel`(`username`, `tel`, `email`) USING BTREE COMMENT '用户名'
) ENGINE = InnoDB AUTO_INCREMENT = 4 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '后台人员列表' ROW_FORMAT = DYNAMIC;
-- ----------------------------
-- Records of ape_admin
-- ----------------------------
INSERT INTO `ape_admin` VALUES (1, 1, 'admin', '超级管理员', '14e1b600b1fd579f47433b88e8d85291', '', '/uploads/image/20210215/bc6445679240d4795e279860a6ab34e9.jpeg', 1, '17896852019', 'cfn@leapy.cn', '这家伙很懒,什么也没留下。', 1, '', 1, 1, 1580031132, 1635572650);
INSERT INTO `ape_admin` VALUES (2, 0, 'zhangsan', '张三', 'c4681d2b2c1a6b0d2585c18f43c49a78', '张三', '/uploads/images/20220103\\a05f958f10c840bc08be541daa2328b7.png', 2, '13510061234', '1111@qq.com', '', 1, '127.0.0.1', 1, 0, 1641393684, 1641393684);
INSERT INTO `ape_admin` VALUES (3, 0, 'lisi', '李四', '14e1b600b1fd579f47433b88e8d85291', '李四', '/uploads/images/20220103\\a05f958f10c840bc08be541daa2328b7.png', 2, '13510061234', '1111@qq.com', '', 1, '127.0.0.1', 1, 0, 1641394102, 1641394102);
-- ----------------------------
-- Table structure for ape_admin_auth
@ -126,11 +129,46 @@ CREATE TABLE `ape_admin_log` (
`user_agent` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT 'User-Agent',
`create_time` int(10) NOT NULL 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 = 36 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '操作日志表' ROW_FORMAT = DYNAMIC;
-- ----------------------------
-- Records of ape_admin_log
-- ----------------------------
INSERT INTO `ape_admin_log` VALUES (1, 1, 'admin', 'admin', 'login', 'login', '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.110 Safari/537.36 Edg/96.0.1054.62', 1641183566);
INSERT INTO `ape_admin_log` VALUES (2, 1, 'admin', 'admin', 'index', 'main', '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.110 Safari/537.36 Edg/96.0.1054.62', 1641183567);
INSERT INTO `ape_admin_log` VALUES (3, 1, 'admin', 'admin', 'admin', 'index', '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.110 Safari/537.36 Edg/96.0.1054.62', 1641183598);
INSERT INTO `ape_admin_log` VALUES (4, 1, 'admin', 'admin', 'admin_auth', 'index', '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.110 Safari/537.36 Edg/96.0.1054.62', 1641183599);
INSERT INTO `ape_admin_log` VALUES (5, 1, 'admin', 'admin', 'admin_role', 'index', '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.110 Safari/537.36 Edg/96.0.1054.62', 1641183600);
INSERT INTO `ape_admin_log` VALUES (6, 1, 'admin', 'admin', 'login', 'login', '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.110 Safari/537.36 Edg/96.0.1054.62', 1641393313);
INSERT INTO `ape_admin_log` VALUES (7, 1, 'admin', 'admin', 'login', 'login', '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.110 Safari/537.36 Edg/96.0.1054.62', 1641393323);
INSERT INTO `ape_admin_log` VALUES (8, 1, 'admin', 'admin', 'login', 'login', '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.110 Safari/537.36 Edg/96.0.1054.62', 1641393516);
INSERT INTO `ape_admin_log` VALUES (9, 1, 'admin', 'admin', 'login', 'login', '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.110 Safari/537.36 Edg/96.0.1054.62', 1641393542);
INSERT INTO `ape_admin_log` VALUES (10, 1, 'admin', 'admin', 'login', 'login', '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.110 Safari/537.36 Edg/96.0.1054.62', 1641393597);
INSERT INTO `ape_admin_log` VALUES (11, 1, 'admin', 'admin', 'index', 'main', '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.110 Safari/537.36 Edg/96.0.1054.62', 1641393598);
INSERT INTO `ape_admin_log` VALUES (12, 1, 'admin', 'admin', 'admin', 'index', '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.110 Safari/537.36 Edg/96.0.1054.62', 1641393601);
INSERT INTO `ape_admin_log` VALUES (13, 1, 'admin', 'admin', 'admin_auth', 'index', '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.110 Safari/537.36 Edg/96.0.1054.62', 1641393602);
INSERT INTO `ape_admin_log` VALUES (14, 1, 'admin', 'admin', 'admin_role', 'index', '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.110 Safari/537.36 Edg/96.0.1054.62', 1641393603);
INSERT INTO `ape_admin_log` VALUES (15, 1, 'admin', 'admin', 'system_config', 'clearCache', '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.110 Safari/537.36 Edg/96.0.1054.62', 1641393605);
INSERT INTO `ape_admin_log` VALUES (16, 1, 'admin', 'admin', 'system_config', 'clearCache', '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.110 Safari/537.36 Edg/96.0.1054.62', 1641393608);
INSERT INTO `ape_admin_log` VALUES (17, 1, 'admin', 'admin', 'index', 'main', '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.110 Safari/537.36 Edg/96.0.1054.62', 1641393615);
INSERT INTO `ape_admin_log` VALUES (18, 1, 'admin', 'admin', 'admin', 'index', '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.110 Safari/537.36 Edg/96.0.1054.62', 1641393618);
INSERT INTO `ape_admin_log` VALUES (19, 1, 'admin', 'admin', 'admin_auth', 'index', '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.110 Safari/537.36 Edg/96.0.1054.62', 1641393618);
INSERT INTO `ape_admin_log` VALUES (20, 1, 'admin', 'admin', 'admin_role', 'index', '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.110 Safari/537.36 Edg/96.0.1054.62', 1641393619);
INSERT INTO `ape_admin_log` VALUES (21, 1, 'admin', 'admin', 'admin_role', 'index', '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.110 Safari/537.36 Edg/96.0.1054.62', 1641393645);
INSERT INTO `ape_admin_log` VALUES (22, 1, 'admin', 'admin', 'admin', 'index', '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.110 Safari/537.36 Edg/96.0.1054.62', 1641393686);
INSERT INTO `ape_admin_log` VALUES (23, 1, 'admin', 'admin', 'user', 'index', '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.110 Safari/537.36 Edg/96.0.1054.62', 1641393689);
INSERT INTO `ape_admin_log` VALUES (24, 1, 'admin', 'admin', 'user', 'index', '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.110 Safari/537.36 Edg/96.0.1054.62', 1641393808);
INSERT INTO `ape_admin_log` VALUES (25, 1, 'admin', 'admin', 'admin', 'index', '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.110 Safari/537.36 Edg/96.0.1054.62', 1641394060);
INSERT INTO `ape_admin_log` VALUES (26, 1, 'admin', 'admin', 'admin', 'index', '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.110 Safari/537.36 Edg/96.0.1054.62', 1641394104);
INSERT INTO `ape_admin_log` VALUES (27, 1, 'admin', 'admin', 'login', 'login', '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.110 Safari/537.36 Edg/96.0.1054.62', 1641396078);
INSERT INTO `ape_admin_log` VALUES (28, 1, 'admin', 'admin', 'index', 'main', '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.110 Safari/537.36 Edg/96.0.1054.62', 1641396079);
INSERT INTO `ape_admin_log` VALUES (29, 1, 'admin', 'admin', 'index', 'main', '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.110 Safari/537.36 Edg/96.0.1054.62', 1641396088);
INSERT INTO `ape_admin_log` VALUES (30, 1, 'admin', 'admin', 'index', 'main', '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.110 Safari/537.36 Edg/96.0.1054.62', 1641396099);
INSERT INTO `ape_admin_log` VALUES (31, 1, 'admin', 'admin', 'index', 'main', '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.110 Safari/537.36 Edg/96.0.1054.62', 1641396361);
INSERT INTO `ape_admin_log` VALUES (32, 1, 'admin', 'admin', 'admin', 'index', '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.110 Safari/537.36 Edg/96.0.1054.62', 1641396367);
INSERT INTO `ape_admin_log` VALUES (33, 1, 'admin', 'admin', 'login', 'login', '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.110 Safari/537.36 Edg/96.0.1054.62', 1641396613);
INSERT INTO `ape_admin_log` VALUES (34, 1, 'admin', 'admin', 'index', 'main', '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.110 Safari/537.36 Edg/96.0.1054.62', 1641396613);
INSERT INTO `ape_admin_log` VALUES (35, 1, 'admin', 'admin', 'admin', 'pwd', '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.110 Safari/537.36 Edg/96.0.1054.62', 1641396622);
-- ----------------------------
-- Table structure for ape_admin_notify
@ -171,12 +209,13 @@ CREATE TABLE `ape_admin_role` (
`create_time` int(10) NOT NULL COMMENT '添加时间',
`update_time` int(10) NOT NULL COMMENT '更新时间',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '后台角色表' ROW_FORMAT = DYNAMIC;
) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '后台角色表' ROW_FORMAT = DYNAMIC;
-- ----------------------------
-- Records of ape_admin_role
-- ----------------------------
INSERT INTO `ape_admin_role` VALUES (1, 0, '超级管理员', '2,4,5,6,7,8,1,9,10,11,12,13,14,15,16,39,17,18,19,27,21,24,37,38,28,29,31,32,33,34,35', '2,4,5,6,7,8,1,9,10,11,12,13,14,15,16,39,17,18,19,27,21,24,37,38,28,29,31,32,33,34,35', 0, 1, '1', '1', 1580031132, 1635572662);
INSERT INTO `ape_admin_role` VALUES (2, 0, '普通用户', '17,18,19,27,21,37,38,28,29,31,32,33,34,35', '17,18,19,27,21,37,38,28,29,31,32,33,34,35', 0, 1, '1', NULL, 1641393643, 0);
-- ----------------------------
-- Table structure for ape_advert
@ -315,7 +354,7 @@ CREATE TABLE `ape_document` (
-- ----------------------------
-- Records of ape_document
-- ----------------------------
INSERT INTO `ape_document` VALUES (1, 1, '超级管理员', '每日必应图片接口', 1, '/uploads/images/20211226\\8635d7429bfffd07ddd0f4ef891b9669.jpg', 'article', '', 0, 0, 0, '', 1, 72, '必应,必应图片,api', '<p>必应</p>', '', '', 99, 1640528547, 1640528547, 1, '');
INSERT INTO `ape_document` VALUES (1, 1, '超级管理员', '每日必应图片接口', 1, '/uploads/images/20211226\\8635d7429bfffd07ddd0f4ef891b9669.jpg', 'article', '', 0, 0, 0, '', 1, 73, '必应,必应图片,api', '<p>必应</p>', '', '', 99, 1640528547, 1640528547, 1, '');
-- ----------------------------
-- Table structure for ape_document_article
@ -469,11 +508,16 @@ CREATE TABLE `ape_pv_log` (
`create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
`update_time` datetime NULL DEFAULT NULL COMMENT '修改时间',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = DYNAMIC;
) ENGINE = InnoDB AUTO_INCREMENT = 6 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = DYNAMIC;
-- ----------------------------
-- Records of ape_pv_log
-- ----------------------------
INSERT INTO `ape_pv_log` VALUES (1, 12, 8, '2022-01-03', '2022-01-03 12:10:39', '2022-01-03 12:10:39');
INSERT INTO `ape_pv_log` VALUES (2, 20, 5, '2022-01-03', '2022-01-03 20:42:30', '2022-01-03 20:42:30');
INSERT INTO `ape_pv_log` VALUES (3, 22, 5, '2022-01-04', '2022-01-04 22:36:04', '2022-01-04 22:36:04');
INSERT INTO `ape_pv_log` VALUES (4, 22, 45, '2022-01-05', '2022-01-05 22:18:45', '2022-01-05 22:18:45');
INSERT INTO `ape_pv_log` VALUES (5, 23, 20, '2022-01-05', '2022-01-05 23:08:22', '2022-01-05 23:08:22');
-- ----------------------------
-- Table structure for ape_system_config
@ -589,11 +633,16 @@ CREATE TABLE `ape_url_log` (
`create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
`update_time` datetime NULL DEFAULT NULL COMMENT '修改时间',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = 'pv记录表' ROW_FORMAT = DYNAMIC;
) ENGINE = InnoDB AUTO_INCREMENT = 6 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = 'pv记录表' ROW_FORMAT = DYNAMIC;
-- ----------------------------
-- Records of ape_url_log
-- ----------------------------
INSERT INTO `ape_url_log` VALUES (1, 'http://apeblog.io/', 1, '网站首页', '2022-01-03', NULL, NULL);
INSERT INTO `ape_url_log` VALUES (2, 'http://apeblog.io/index/article/detail.html?id=1', 1, '每日必应图片接口', '2022-01-03', NULL, NULL);
INSERT INTO `ape_url_log` VALUES (3, 'http://apeblog.io/', 1, '网站首页', '2022-01-04', NULL, NULL);
INSERT INTO `ape_url_log` VALUES (4, 'http://apeblog.io/admin1', 1, '网站首页', '2022-01-05', NULL, NULL);
INSERT INTO `ape_url_log` VALUES (5, 'http://apeblog.io/', 6, '网站首页', '2022-01-05', NULL, NULL);
-- ----------------------------
-- Table structure for ape_user
@ -605,7 +654,7 @@ CREATE TABLE `ape_user` (
`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 '用户头像',
`mail` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL 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 '手机号',
`ip` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '注册IP地址',
`status` int(11) NOT NULL DEFAULT 0 COMMENT '状态 0启用 1禁用',
@ -613,12 +662,15 @@ CREATE TABLE `ape_user` (
`is_admin` int(11) NOT NULL DEFAULT 0 COMMENT '是否是管理员',
`create_time` int(11) NOT NULL COMMENT '创建时间',
`update_time` int(11) NOT NULL COMMENT '上次登录时间',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '用户表' ROW_FORMAT = COMPACT;
PRIMARY KEY (`id`) USING BTREE,
UNIQUE INDEX `username_email_tel`(`username`, `tel`, `email`) USING BTREE COMMENT '用户名'
) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '用户表' ROW_FORMAT = COMPACT;
-- ----------------------------
-- Records of ape_user
-- ----------------------------
INSERT INTO `ape_user` VALUES (1, 'zhangsan', '张三', '14e1b600b1fd579f47433b88e8d85291', '/uploads/images/20220103\\a05f958f10c840bc08be541daa2328b7.png', '1111@qq.com', '13510061234', '127.0.0.1', 1, '', 1, 1641393684, 1641393806);
INSERT INTO `ape_user` VALUES (2, 'lisi', '李四', '14e1b600b1fd579f47433b88e8d85291', '/uploads/images/20220103\\a05f958f10c840bc08be541daa2328b7.png', '', '13510061234', '127.0.0.1', 1, '', 1, 1641394102, 1641394102);
-- ----------------------------
-- Table structure for ape_uv_log
@ -632,10 +684,13 @@ CREATE TABLE `ape_uv_log` (
`create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
`update_time` datetime NULL DEFAULT NULL COMMENT '修改时间',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = 'Uv记录表' ROW_FORMAT = DYNAMIC;
) ENGINE = InnoDB AUTO_INCREMENT = 4 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = 'Uv记录表' ROW_FORMAT = DYNAMIC;
-- ----------------------------
-- Records of ape_uv_log
-- ----------------------------
INSERT INTO `ape_uv_log` VALUES (1, '127.0.0.1', 12, '2022-01-03', '2022-01-03 12:10:39', '2022-01-03 12:10:39');
INSERT INTO `ape_uv_log` VALUES (2, '127.0.0.1', 22, '2022-01-04', '2022-01-04 22:36:04', '2022-01-04 22:36:04');
INSERT INTO `ape_uv_log` VALUES (3, '127.0.0.1', 22, '2022-01-05', '2022-01-05 22:18:45', '2022-01-05 22:18:45');
SET FOREIGN_KEY_CHECKS = 1;

View File

@ -78,7 +78,7 @@ class Admin extends AuthController
return $menus;
})->col(10);
$form[] = Elm::input('tel', '电话')->col(10);
$form[] = Elm::email('mail', '邮箱')->col(10);
$form[] = Elm::email('email', '邮箱')->col(10);
$form[] = Elm::radio('status', '状态', 1)->options([['label' => '启用', 'value' => 1], ['label' => '冻结', 'value' => 0]])->col(10);
$form = Form::make_post_form($form, url('save')->build());
$this->assign(compact('form'));
@ -110,7 +110,7 @@ class Admin extends AuthController
return $menus;
})->col(10);
$form[] = Elm::input('tel', '电话', $ainfo['tel'])->col(10);
$form[] = Elm::email('mail', '邮箱', $ainfo['mail'])->col(10);
$form[] = Elm::email('email', '邮箱', $ainfo['email'])->col(10);
$form[] = Elm::radio('status', '状态', $ainfo['status'])->options([['label' => '启用', 'value' => 1], ['label' => '冻结', 'value' => 0]])->col(10);
$form = Form::make_post_form($form, url('save', ['id' => $id])->build());
$this->assign(compact('form'));
@ -132,13 +132,13 @@ class Admin extends AuthController
['realname', ''],
['role_id', ''],
['tel', ''],
['mail', ''],
['email', ''],
['status', '']
]);
if ($data['username'] == "") return app("json")->fail("登录账号不能为空");
if ($data['password'] == "") return app("json")->fail("密码不能为空");
if ($data['tel'] == "") return app("json")->fail("手机号不能为空");
if ($data['mail'] == "") return app("json")->fail("邮箱不能为空");
if ($data['email'] == "") return app("json")->fail("邮箱不能为空");
if (is_array($data['avatar'])) $data['avatar'] = $data['avatar'][0];
// 启动事务
Db::startTrans();
@ -228,10 +228,10 @@ class Admin extends AuthController
['nickname', ''],
['avatar', ''],
['tel', ''],
['mail', ''],
['email', ''],
['remark', '']
]);
if ($data['nickname'] == '' || $data['avatar'] == '' || $data['tel'] == '' || $data['mail'] == '') return app("json")->fail("必选项不能为空!");
return aModel::update(['nickname' => $data['nickname'], 'avatar' => $data['avatar'], 'tel' => $data['tel'], 'mail' => $data['mail'], 'remark' => $data['remark']], ['id' => $this->adminId]) ? app("json")->success("操作成功") : app("json")->fail("操作失败");
if ($data['nickname'] == '' || $data['avatar'] == '' || $data['tel'] == '' || $data['email'] == '') return app("json")->fail("必选项不能为空!");
return aModel::update(['nickname' => $data['nickname'], 'avatar' => $data['avatar'], 'tel' => $data['tel'], 'email' => $data['email'], 'remark' => $data['remark']], ['id' => $this->adminId]) ? app("json")->success("操作成功") : app("json")->fail("操作失败");
}
}

View File

@ -47,6 +47,7 @@ class AdminAuth extends AuthController
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @throws \Exception
*/
public function add($pid = 0)
{

View File

@ -100,6 +100,7 @@ class Article extends AuthController
if ($data['display']) $data['display'] = 1;
if ($data['is_top']) $data['is_top'] = 1;
if ($id == "") {
$data['uid'] = $this->adminInfo['uid'];
$data['author'] = $data['author'] ?: $this->adminInfo['nickname'];
$data['create_time'] = time();
$data['update_time'] = time();

View File

@ -2,6 +2,7 @@
namespace app\admin\controller;
use app\common\constant\Data;
use app\common\model\AdminAuth;
use think\facade\App;
use think\facade\Lang;
@ -83,8 +84,8 @@ abstract class AuthController extends SystemBasic
protected function initialize()
{
parent::initialize();
$this->adminInfo = Session::get("adminInfo");
$this->adminId = Session::get("adminId");
$this->adminInfo = Session::get(Data::SESSION_KEY_ADMIN_INFO);
$this->adminId = Session::get(Data::SESSION_KEY_ADMIN_ID);
$this->module = App::getInstance()->http->getName();
$this->controller = un_camelize($this->request->controller());
$this->action = $this->request->action();
@ -127,7 +128,7 @@ abstract class AuthController extends SystemBasic
*/
protected static function isActive()
{
return Session::has('adminId') && Session::has('adminInfo');
return Session::has(Data::SESSION_KEY_ADMIN_ID) && Session::has(Data::SESSION_KEY_ADMIN_INFO);
}
/**

View File

@ -145,7 +145,7 @@
field: 'tel',
title: '电话'
}, {
field: 'mail',
field: 'email',
title: '邮箱'
}, {
field: 'create_time',

View File

@ -239,13 +239,13 @@
if ($("input[name='nickname']").val() == '') lightyear.notify('昵称不能为空', 'danger', 3000, 'mdi mdi-emoticon-neutral', 'top', 'center');
else if ($("input[name='avatar']").val() == '') lightyear.notify('头像不能为空', 'danger', 3000, 'mdi mdi-emoticon-neutral', 'top', 'center');
else if ($("input[name='tel']").val() == '') lightyear.notify('电话不能为空', 'danger', 3000, 'mdi mdi-emoticon-neutral', 'top', 'center');
else if ($("input[name='mail']").val() == '') lightyear.notify('邮箱不能为空', 'danger', 3000, 'mdi mdi-emoticon-neutral', 'top', 'center');
else if ($("input[name='email']").val() == '') lightyear.notify('邮箱不能为空', 'danger', 3000, 'mdi mdi-emoticon-neutral', 'top', 'center');
else
$.post(url = "/admin/admin/changProfile", {
"nickname": $("input[name='nickname']").val(),
"avatar": $("input[name='avatar']").val(),
"tel": $("input[name='tel']").val(),
"mail": $("input[name='mail']").val(),
"mail": $("input[name='email']").val(),
"remark": $("textarea[name='remark']").val()
}, function (res) {
if (res.status === 200) lightyear.notify(res.msg, 'success', 3000, 'mdi mdi-emoticon-happy', 'top', 'center');

View File

@ -9,10 +9,18 @@ namespace app\common\constant;
class Data
{
//缓存数据key
const DATA_FRIEND_LINK = 'data_friend_link'; //友链
const DATA_DOCUMENT_CATEGORY_LIST = 'data_document_category_list'; //文章分类
const CURR_CATEGORY_PATENT_ID = 'curr_category_patent_id'; //当前分类腹肌id
const DATA_SYSTEM_CONFIG = 'data_system_config'; //系统配置
const DATA_ADVERT = 'data_advert'; //广告
//后台用户sessionKey
const SESSION_KEY_ADMIN_ID = 'admin_id';
const SESSION_KEY_ADMIN_INFO = 'admin_info';
//前台用户session
const SESSION_KEY_USER_ID = 'user_id';
const SESSION_KEY_USER_INFO = 'user_info';
}

View File

@ -1,63 +0,0 @@
<?php
namespace app\common\extend;
use Exception;
use Firebase\JWT\BeforeValidException;
use Firebase\JWT\ExpiredException;
use Firebase\JWT\JWT as jt;
use Firebase\JWT\SignatureInvalidException;
/**
* Class Jwt
* @package app\common\utils
*/
class Jwt
{
/**
* 生成 toekn
* @param array $param
* @return string
*/
public static function signToken(array $param): string
{
$salt = '!@$@#%^%&^%*' . app()->request->ip() . app()->request->domain();
$token = array(
"iss" => $salt,
"aud" => $salt,
"iat" => time(),
"nbf" => time(),
"exp" => time() + 60 * 60 * 24,
"data" => $param
);
return "Bearer " . jt::encode($token, $salt, "HS256");
}
/**
* 解析token
* @param string $token
* @return array
*/
public static function checkToken(string $token)
{
$salt = '!@$@#%^%&^%*' . app()->request->ip() . app()->request->domain();
try {
$data = jt::decode(trim(ltrim($token, 'Bearer')), $salt, ["HS256"]);
$data = (array)$data;
return (array)$data['data'];
} catch (SignatureInvalidException $e) {
$status['msg'] = "签名不正确";
return $status;
} catch (BeforeValidException $e) {
$status['msg'] = "token失效";
return $status;
} catch (ExpiredException $e) {
$status['msg'] = "token失效";
return $status;
} catch (Exception $e) {
$status['msg'] = "未知错误";
return $status;
}
}
}

View File

@ -1,90 +0,0 @@
<?php
namespace app\common\extend;
/**
* 宝塔邮件发送
* Class Mail
* @package app\common\utils
*/
class Mail
{
/**
* 邮件服务器地址
* @var null
*/
public $host = null;
/**
* 发件人邮箱地址
* @var null
*/
public $mail_from = null;
/**
* 发件人邮箱密码
* @var null
*/
public $password = null;
/**
* 收件人,多个逗号隔开
* @var null
*/
public $mail_to = null;
/**
* 邮件类型
* @var string
*/
public $subtype = "plain";
/**
* 主题
* @var string
*/
public $Subject = "";
/**
* 内容
* @var string
*/
public $Body = "";
/**
* @param string $to
* @return $this
*/
public function addAddress(string $to)
{
$this->mail_to = $to;
return $this;
}
/**
* @param string $subtype
* @return $this
*/
public function subtype(string $subtype)
{
$this->subtype = $subtype;
return $this;
}
/**
* @return Curl
*/
public function send()
{
$param = [
'mail_from' => $this->mail_from,
'password' => $this->password,
'mail_to' => $this->mail_to,
'subject' => $this->Subject,
'content' => $this->Body,
'subtype' => $this->subtype,
];
return Curl::app($this->host, "POST", $param)->run();
}
}

View File

@ -3,6 +3,7 @@
namespace app\common\model;
use app\common\constant\Data;
use think\db\exception\DataNotFoundException;
use think\db\exception\DbException;
use think\db\exception\ModelNotFoundException;
@ -43,8 +44,8 @@ class Admin extends BaseModel
{
unset($info->password);//去除密码字段
$info->role_auth = AdminRole::getAuth($info['role_id'] ?? 0);//提前缓存auth字段避免频繁查询
Session::set("adminId", $info['id']);
Session::set("adminInfo", $info->toArray());
Session::set(Data::SESSION_KEY_ADMIN_ID, $info['id']);
Session::set(Data::SESSION_KEY_ADMIN_INFO, $info->toArray());
event("AdminLog", [$info->toArray(), "admin", "login", "login"]);
return true;
}
@ -54,21 +55,12 @@ class Admin extends BaseModel
*/
public static function clearLoginInfo()
{
Session::delete("adminId");
Session::delete("adminInfo");
Session::delete(Data::SESSION_KEY_ADMIN_ID);
Session::delete(Data::SESSION_KEY_ADMIN_INFO);
Session::clear();
return true;
}
/**
* 是否登录
* @return bool
*/
public static function isActive(): bool
{
return Session::has('adminId') && Session::has('adminInfo');
}
/**
* 列表
* @param array $where

View File

@ -58,6 +58,7 @@ class BaseModel extends Model
/**
* 设置错误信息
* @param string $errorMsg
* @param bool $rollback
* @return bool
*/
protected static function setErrorInfo($errorMsg = self::DEFAULT_ERROR_MSG, $rollback = false)

View File

@ -3,6 +3,7 @@
namespace app\common\model;
use app\common\constant\Data;
use think\db\exception\DataNotFoundException;
use think\db\exception\DbException;
use think\db\exception\ModelNotFoundException;
@ -17,7 +18,7 @@ use think\facade\Session;
*/
class User extends BaseModel
{
public static $adminColumn = ["username", "nickname", "password", "avatar", "mail", "tel",
public static $adminColumn = ["username", "nickname", "password", "avatar", "email", "tel",
"ip", "status", "remark", "is_admin", "create_time", "update_time"];
/**
@ -31,7 +32,7 @@ class User extends BaseModel
*/
public static function login(string $name, string $pwd): bool
{
$info = self::where("username|tel", "=", $name)->find();
$info = self::where("username|email|tel", "=", $name)->find();
if (!$info) return self::setErrorInfo("登录账号不存在");
if ($info['password'] != md5(md5($pwd))) return self::setErrorInfo("密码不正确!");
if ($info['status'] == 2) return self::setErrorInfo("账号已被冻结!");
@ -46,9 +47,8 @@ class User extends BaseModel
*/
public static function setLoginInfo($info)
{
Session::set("adminId", $info['id']);
Session::set("adminInfo", $info->toArray());
event("AdminLog", [$info->toArray(), "admin", "login", "login"]);
Session::set(Data::SESSION_KEY_USER_ID, $info['id']);
Session::set(Data::SESSION_KEY_USER_INFO, $info->toArray());
return true;
}
@ -102,8 +102,8 @@ class User extends BaseModel
*/
public static function clearLoginInfo()
{
Session::delete("adminId");
Session::delete("adminInfo");
Session::delete(Data::SESSION_KEY_USER_ID);
Session::delete(Data::SESSION_KEY_USER_INFO);
Session::clear();
return true;
}
@ -114,7 +114,7 @@ class User extends BaseModel
*/
public static function isActive(): bool
{
return Session::has('adminId') && Session::has('adminInfo');
return Session::has(Data::SESSION_KEY_USER_ID) && Session::has(Data::SESSION_KEY_USER_INFO);
}
/**

View File

@ -7,6 +7,30 @@ use think\Paginator;
class Layer extends Paginator
{
/**
* 渲染分页html
* @return mixed
*/
public function render()
{
if ($this->hasPages()) {
if ($this->simple) {
return sprintf(
'<div class="layui-box layui-laypage layui-laypage-default">%s %s</div>',
$this->getPreviousButton(),
$this->getNextButton()
);
} else {
return sprintf(
'<div class="layui-box layui-laypage layui-laypage-default">%s %s %s</div>',
$this->getPreviousButton(),
$this->getLinks(),
$this->getNextButton()
);
}
}
}
/**
* 上一页按钮
* @param string $text
@ -26,6 +50,56 @@ class Layer extends Paginator
return $this->getPageLinkWrapper($url, $text);
}
/**
* 生成一个禁用的按钮
*
* @param string $text
* @return string
*/
protected function getDisabledTextWrapper($text)
{
return '<a class="layui-laypage-prev layui-disabled">' . $text . '</a>';
}
/**
* 生成普通页码按钮
*
* @param string $url
* @param int $page
* @return string
*/
protected function getPageLinkWrapper($url, $page)
{
if ($page == $this->currentPage()) {
return $this->getActivePageWrapper($page);
}
return $this->getAvailablePageWrapper($url, $page);
}
/**
* 生成一个激活的按钮
*
* @param string $text
* @return string
*/
protected function getActivePageWrapper($text)
{
return '<span class="layui-laypage-curr"><em class="layui-laypage-em"></em><em>' . $text . '</em></span>';
}
/**
* 生成一个可点击的按钮
*
* @param string $url
* @param int $page
* @return string
*/
protected function getAvailablePageWrapper($url, $page)
{
return '<a href="' . htmlentities($url) . '">' . $page . '</a>';
}
/**
* 下一页按钮
* @param string $text
@ -93,74 +167,6 @@ class Layer extends Paginator
return $html;
}
/**
* 渲染分页html
* @return mixed
*/
public function render()
{
if ($this->hasPages()) {
if ($this->simple) {
return sprintf(
'<div class="layui-box layui-laypage layui-laypage-default">%s %s</div>',
$this->getPreviousButton(),
$this->getNextButton()
);
} else {
return sprintf(
'<div class="layui-box layui-laypage layui-laypage-default">%s %s %s</div>',
$this->getPreviousButton(),
$this->getLinks(),
$this->getNextButton()
);
}
}
}
/**
* 生成一个可点击的按钮
*
* @param string $url
* @param int $page
* @return string
*/
protected function getAvailablePageWrapper($url, $page)
{
return '<a href="' . htmlentities($url) . '">' . $page . '</a>';
}
/**
* 生成一个禁用的按钮
*
* @param string $text
* @return string
*/
protected function getDisabledTextWrapper($text)
{
return '<a class="layui-laypage-prev layui-disabled">' . $text . '</a>';
}
/**
* 生成一个激活的按钮
*
* @param string $text
* @return string
*/
protected function getActivePageWrapper($text)
{
return '<span class="layui-laypage-curr"><em class="layui-laypage-em"></em><em>' . $text . '</em></span>';
}
/**
* 生成省略号按钮
*
* @return string
*/
protected function getDots()
{
return $this->getDisabledTextWrapper('...');
}
/**
* 批量生成页码按钮.
*
@ -179,18 +185,12 @@ class Layer extends Paginator
}
/**
* 生成普通页码按钮
* 生成省略号按钮
*
* @param string $url
* @param int $page
* @return string
*/
protected function getPageLinkWrapper($url, $page)
protected function getDots()
{
if ($page == $this->currentPage()) {
return $this->getActivePageWrapper($page);
}
return $this->getAvailablePageWrapper($url, $page);
return $this->getDisabledTextWrapper('...');
}
}

View File

@ -7,7 +7,7 @@ use think\Validate;
/**
* 后台菜单验证器
*/
class Adminaction extends Validate
class AdminAction extends Validate
{
protected $rule = [

View File

@ -7,7 +7,7 @@ use think\Validate;
/**
* 后台菜单验证器
*/
class Adminactionlog extends Validate
class AdminActionLog extends Validate
{
protected $rule = [

View File

@ -14,7 +14,7 @@ use think\Validate;
/**
* 后台菜单验证器
*/
class Friendlink extends Validate
class FriendLink extends Validate
{
protected $rule = [

View File

@ -4,18 +4,41 @@ declare (strict_types=1);
namespace app\index\controller;
use app\BaseController;
use app\common\constant\Data;
use app\common\model\PvLog;
use app\common\model\UrlLog;
use think\facade\Session;
/**
* 控制器基础类
*/
class Base extends BaseController
{
/**
* 当前登陆用户信息
* @var
*/
protected $userInfo;
/**
* 当前登陆用户ID
* @var int
*/
protected $userId;
// 初始化
protected function initialize()
{
parent::initialize();
$this->userInfo = Session::get(Data::SESSION_KEY_USER_INFO);
$this->userId = Session::get(Data::SESSION_KEY_USER_ID);
if ($this->userId){
//模板兼容性标签
$this->assign('user_info', $this->userInfo);
$this->assign('user_id', $this->userId);
}
//判断是否关闭站点。
if (!web_config('web_close')) {
$this->error('网站暂时关闭!', '', 'stop');

View File

@ -7,6 +7,7 @@
namespace app\index\controller;
use app\admin\extend\Util;
use app\common\constant\Data;
use app\common\model\User as userModel;
use Exception;
use think\db\exception\DataNotFoundException;
@ -23,6 +24,10 @@ class Login extends Base
*/
public function login()
{
//清除可能存在的栏目分类树id
cache(Data::CURR_CATEGORY_PATENT_ID, false);
//模板兼容性标签
$this->assign('id', false);
$this->assign('cid', false);
return $this->fetch();
}
@ -36,12 +41,12 @@ class Login extends Base
*/
public function verify()
{
list($account, $pwd, $verify) = Util::postMore(['account', 'password', 'verify'], null, true);
if (empty($account) || empty($pwd)) return app("json")->fail("账号、密码和验证码不能为空!");
list($username, $password, $captcha) = Util::postMore(['username', 'password', 'captcha'], null, true);
if (empty($username) || empty($password)) return app("json")->fail("账号、密码和验证码不能为空!");
// 验证码验证
if (!captcha_check($verify)) return app("json")->fail("验证码不正确!");
if (!captcha_check($captcha)) return app("json")->fail("验证码不正确!");
// 验证登录
if (!userModel::login($account, $pwd)) return app("json")->fail("登录失败!");
if (!userModel::login($username, $password)) return app("json")->fail(userModel::getErrorInfo());
return app("json")->success("登录成功!");
}
@ -72,13 +77,7 @@ class Login extends Base
*/
public function logout()
{
$res = userModel::clearLoginInfo();
if ($res) {
$this->success('留言成功');
} else {
$this->error('留言失败');
}
return userModel::clearLoginInfo() ? $this->success("操作成功", "/admin/login/login") : $this->error("操作失败", "/admin/index/index");
}
/**

View File

@ -1 +0,0 @@
1635613086

View File

@ -5,7 +5,7 @@
<meta name="keywords" content="{:web_config('keywords')}">
<meta name="description" content="{:web_config('description')}">
{include file="public/head" /}
<link rel="stylesheet" href="__LIB__/swiper/swiper.min.css" />
<link rel="stylesheet" href="__LIB__/swiper/swiper.min.css"/>
<script type="text/javascript" src="__LIB__/swiper/swiper.min.js"></script>
</head>
<body>
@ -25,12 +25,13 @@
<div class="login-form">
<div class="login-title"><h3>登录账户</h3></div>
<i class="fa fa-user ico-login" aria-hidden="true"></i>
<input class="input-login input-user" name="user" type="text" placeholder="请输入用户名/电子邮箱"/>
<input class="input-login input-user" name="username" type="text" placeholder="请输入用户名/电子邮箱"/>
<i class="fa fa-key ico-login" aria-hidden="true"></i>
<input class="input-login input-pass" name="pass" type="password" placeholder="请输入密码"/>
<input class="input-login input-pass" name="password" type="password" placeholder="请输入密码"/>
<div class="code-plane">
<img class="img-code" src="/index/login/captcha" style="cursor: pointer;width: 120px;height: 38px;" alt=""/>
<input class="input-login input-code" name="code" type="text" placeholder="验证码"/>
<img class="img-code" src="/index/login/captcha"
style="cursor: pointer;width: 120px;height: 38px;" alt=""/>
<input class="input-login input-code" name="captcha" type="text" placeholder="验证码"/>
</div>
<div class="login-title">
<label>
@ -38,13 +39,13 @@
记住我的登录状态</label>
<a href="wp-login-lostpassword.html">忘记密码?</a>
</div>
<!-- <div class="thirdparty-plane">-->
<!-- <span class="login-thirdparty-btn">-->
<!-- <a href="javascript:;">-->
<!-- <img src="__IMG__/share-qq.svg"/>QQ登录-->
<!-- </a>-->
<!-- </span>-->
<!-- </div>-->
<!-- <div class="thirdparty-plane">-->
<!-- <span class="login-thirdparty-btn">-->
<!-- <a href="javascript:;">-->
<!-- <img src="__IMG__/share-qq.svg"/>QQ登录-->
<!-- </a>-->
<!-- </span>-->
<!-- </div>-->
<div>
<button class="login-button" id="btn-login">登录</button>
</div>
@ -66,34 +67,34 @@
});
function login() {
var user = $('input[name="user"]').val();
var pass = $('input[name="pass"]').val();
var code = $('input[name="code"]').val();
if (user == "" || pass == "") {
let username = $('input[name="username"]').val();
let password = $('input[name="password"]').val();
let captcha = $('input[name="captcha"]').val();
if (username === "" || password === "") {
return;
}
var remember = $("#remember").val();
let remember = $("#remember").val();
$("#login-note").text("登录中,请稍后");
$("#login-note").css("visibility", "visible");
$.post(
"{:url('/index/login/verify')}",
{
action: "corepress_login",
user: user,
pass: pass,
action: "login",
username: username,
password: password,
remember: remember,
code: code,
captcha: captcha,
},
(data) => {
var obj = JSON.parse(data);
if (obj) {
if (obj.code === 1) {
console.log(data)
if (data) {
if (data.status === 200) {
$("#login-note").text("登录成功,跳转中");
window.location.href = getQueryVariable("redirect_to")
? decodeURIComponent(getQueryVariable("redirect_to"))
: "/";
} else {
$("#login-note").text(obj.msg);
$("#login-note").text(data.msg);
recodeimg();
}
} else {
@ -105,7 +106,7 @@
function recodeimg() {
$(".img-code").attr(
"src",
"/index/login/captcha?d="+Math.random()
"/index/login/captcha?d=" + Math.random()
);
}
</script>

View File

@ -117,9 +117,34 @@
<div class="user-menu-pc-search" onclick="openSearch()" title="搜索">
<i class="fal fa-search"></i>
</div>
<span class="user-menu-main user-menu-main-notlogin">
{notempty name="user_info"}
<ul class="user-menu">
<li>
<a class="user-menu-main">
<img class="user-avatar" width="30" height="30" src="{$user_info.avatar}" data-pagespeed-url-hash="801193799">
<span class="user-menu-name">{$user_info.username}</span>
</a>
<ul class="user-sub-menu sub-menu">
<li>
<a href="{:url('index/login/profile')}"><i class="fas fa-user-cog"></i> 账号设置</a>
</li>
<li>
<a href="{:url('index/login/pwd')}"><i class="fas fa-user-cog"></i> 修改密码</a>
</li>
<!-- <li>-->
<!-- <a href="{:url('index/login/loginout')}"><i class="far fa-edit"></i>新建文章</a>-->
<!-- </li>-->
<li>
<a href="{:url('index/login/logout')}"><i class="fas fa-sign-out-alt"></i> 退出登录</a>
</li>
</ul>
</li>
</ul>
{else /}
<span class="user-menu-main user-menu-main-notlogin">
<a href="{:url('/index/login/login')}"><button class="login-btn-header">登录</button></a>
</span>
{/notempty}
</div>
</div>
</div>