更新若干代码
This commit is contained in:
parent
a7b82e1e26
commit
3f7b87cdb5
@ -1,354 +0,0 @@
|
||||
/*
|
||||
Navicat MySQL Data Transfer
|
||||
|
||||
Source Server : php
|
||||
Source Server Type : MySQL
|
||||
Source Server Version : 50726
|
||||
Source Host : 127.0.0.1:3306
|
||||
Source Schema : admin-thinkphp-layui-learning
|
||||
|
||||
Target Server Type : MySQL
|
||||
Target Server Version : 50726
|
||||
File Encoding : 65001
|
||||
|
||||
Date: 28/04/2022 14:37:03
|
||||
*/
|
||||
|
||||
SET NAMES utf8mb4;
|
||||
SET FOREIGN_KEY_CHECKS = 0;
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for bew_admin_config
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `bew_admin_config`;
|
||||
CREATE TABLE `bew_admin_config` (
|
||||
`config_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '系统设置ID',
|
||||
`config_name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '功能名,代码参照使用',
|
||||
`config_info` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '中文名',
|
||||
`config_type` tinyint(4) UNSIGNED NOT NULL DEFAULT 1 COMMENT '类型 1文本 2图片 3富文本',
|
||||
`config_value` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '值',
|
||||
`config_desc` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '描述',
|
||||
`config_sort` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '排序',
|
||||
`config_status` tinyint(1) UNSIGNED NOT NULL DEFAULT 1 COMMENT '状态 1启用 0禁用',
|
||||
PRIMARY KEY (`config_id`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 7 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '配置表' ROW_FORMAT = DYNAMIC;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of bew_admin_config
|
||||
-- ----------------------------
|
||||
INSERT INTO `bew_admin_config` VALUES (1, 'admin_domain', '本地域名', 1, 'http://admin-thinkphp-layui-learning.ouyangke.com', '项目域名', 0, 1);
|
||||
INSERT INTO `bew_admin_config` VALUES (2, 'admin_route', '项目路径', 1, '/index.php/bews/', '后台项目路径', 0, 1);
|
||||
INSERT INTO `bew_admin_config` VALUES (3, 'admin_name', '系统名称', 1, 'phpAdmin后台管理', '后台系统名称,在后台显示', 0, 1);
|
||||
INSERT INTO `bew_admin_config` VALUES (4, 'admin_page', '每页数量', 1, '10', '列表数据,每页数量', 0, 1);
|
||||
INSERT INTO `bew_admin_config` VALUES (5, 'logo', 'logo', 2, '/static/bews/images/logo.jpg', '请上传logo', 0, 1);
|
||||
INSERT INTO `bew_admin_config` VALUES (6, 'admin_info', '系统介绍', 3, '', '系统介绍', 0, 1);
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for bew_admin_sys_menu
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `bew_admin_sys_menu`;
|
||||
CREATE TABLE `bew_admin_sys_menu` (
|
||||
`smid` int(11) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'ID',
|
||||
`label` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '菜单名称',
|
||||
`type` tinyint(3) UNSIGNED NOT NULL DEFAULT 1 COMMENT '菜单类型,0:分组,1:内部链接,2:超链接,3:隐藏按钮',
|
||||
`src` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '链接源',
|
||||
`parent_id` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '上级菜单ID',
|
||||
`icon_class` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '图标class',
|
||||
`sort` mediumint(6) UNSIGNED NOT NULL DEFAULT 0 COMMENT '排序值,升序',
|
||||
`status` tinyint(1) UNSIGNED NOT NULL DEFAULT 1 COMMENT '状态 1开启 0关闭',
|
||||
PRIMARY KEY (`smid`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 8003 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '左侧菜单' ROW_FORMAT = DYNAMIC;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of bew_admin_sys_menu
|
||||
-- ----------------------------
|
||||
INSERT INTO `bew_admin_sys_menu` VALUES (1, '项目核心', 0, '', 0, 'layui-icon-template-1', 999999, 1);
|
||||
INSERT INTO `bew_admin_sys_menu` VALUES (2, '项目配置', 1, 'bew/configvalue', 1, 'layui-icon-set-fill', 100, 1);
|
||||
INSERT INTO `bew_admin_sys_menu` VALUES (3, '配置管理', 3, 'bew/configlist', 1, NULL, 0, 1);
|
||||
INSERT INTO `bew_admin_sys_menu` VALUES (4, '配置添加', 3, 'bew/configadd', 1, NULL, 0, 1);
|
||||
INSERT INTO `bew_admin_sys_menu` VALUES (5, '配置修改', 3, 'bew/configedit', 1, NULL, 0, 1);
|
||||
INSERT INTO `bew_admin_sys_menu` VALUES (6, '配置删除', 3, 'bew/configdel', 1, NULL, 0, 1);
|
||||
INSERT INTO `bew_admin_sys_menu` VALUES (10, '导航管理', 1, 'bew/menuinfo', 1, 'layui-icon-layer', 0, 1);
|
||||
INSERT INTO `bew_admin_sys_menu` VALUES (11, '导航添加', 3, 'bew/menuadd', 1, NULL, 0, 1);
|
||||
INSERT INTO `bew_admin_sys_menu` VALUES (12, '导航修改', 3, 'bew/menuedit', 1, NULL, 0, 1);
|
||||
INSERT INTO `bew_admin_sys_menu` VALUES (13, '导航删除', 3, 'bew/menudel', 1, NULL, 0, 1);
|
||||
INSERT INTO `bew_admin_sys_menu` VALUES (14, '按钮列表', 3, 'bew/buttoninfo', 1, NULL, 0, 1);
|
||||
INSERT INTO `bew_admin_sys_menu` VALUES (15, '按钮添加', 3, 'bew/buttonadd', 1, NULL, 0, 1);
|
||||
INSERT INTO `bew_admin_sys_menu` VALUES (16, '按钮修改', 3, 'bew/buttonedit', 1, NULL, 0, 1);
|
||||
INSERT INTO `bew_admin_sys_menu` VALUES (17, '按钮删除', 3, 'bew/buttondel', 1, NULL, 0, 1);
|
||||
INSERT INTO `bew_admin_sys_menu` VALUES (5000, '系统配置', 0, '', 0, 'layui-icon-set', 999996, 1);
|
||||
INSERT INTO `bew_admin_sys_menu` VALUES (5002, '部门管理', 1, 'bewadmin/groupinfo', 5000, 'layui-icon-group', 0, 1);
|
||||
INSERT INTO `bew_admin_sys_menu` VALUES (5003, '管理员管理', 1, 'bewadmin/userinfo', 5000, 'layui-icon-username', 0, 1);
|
||||
INSERT INTO `bew_admin_sys_menu` VALUES (5004, '个人中心', 1, 'bewadmin/admininfo', 5000, 'layui-icon-edit', 0, 1);
|
||||
INSERT INTO `bew_admin_sys_menu` VALUES (5005, '部门添加', 3, 'bewadmin/groupadd', 5000, NULL, 0, 1);
|
||||
INSERT INTO `bew_admin_sys_menu` VALUES (5006, '部门修改', 3, 'bewadmin/groupedit', 5000, NULL, 0, 1);
|
||||
INSERT INTO `bew_admin_sys_menu` VALUES (5007, '部门删除', 3, 'bewadmin/groupdel', 5000, NULL, 0, 1);
|
||||
INSERT INTO `bew_admin_sys_menu` VALUES (5008, '管理员添加', 3, 'bewadmin/useradd', 5000, NULL, 0, 1);
|
||||
INSERT INTO `bew_admin_sys_menu` VALUES (5009, '管理员修改', 3, 'bewadmin/useredit', 5000, NULL, 0, 1);
|
||||
INSERT INTO `bew_admin_sys_menu` VALUES (5010, '管理员删除', 3, 'bewadmin/userdel', 5000, NULL, 0, 1);
|
||||
INSERT INTO `bew_admin_sys_menu` VALUES (7000, '代码示例', 0, '', 0, 'layui-icon-app', 999995, 1);
|
||||
INSERT INTO `bew_admin_sys_menu` VALUES (7001, '图标', 1, 'bewtest/icon_list', 7000, 'layui-icon-theme', 0, 1);
|
||||
INSERT INTO `bew_admin_sys_menu` VALUES (7002, '演示列表-方法渲染', 1, 'bewtest/test_list', 7000, 'layui-icon-list', 0, 1);
|
||||
INSERT INTO `bew_admin_sys_menu` VALUES (7003, '演示列表-静态表格', 1, 'bewtest/test_static_list', 7000, 'layui-icon-list', 0, 1);
|
||||
INSERT INTO `bew_admin_sys_menu` VALUES (7004, '演示添加-方法渲染', 3, 'bewtest/test_add', 7000, NULL, 0, 1);
|
||||
INSERT INTO `bew_admin_sys_menu` VALUES (7005, '演示修改-方法渲染', 3, 'bewtest/test_edit', 7000, NULL, 0, 1);
|
||||
INSERT INTO `bew_admin_sys_menu` VALUES (7006, '演示添加-静态表格', 3, 'bewtest/test_static_add', 7000, NULL, 0, 1);
|
||||
INSERT INTO `bew_admin_sys_menu` VALUES (7007, '演示修改-静态表格', 3, 'bewtest/test_static_edit', 7000, NULL, 0, 1);
|
||||
INSERT INTO `bew_admin_sys_menu` VALUES (8000, '友情链接', 0, NULL, 0, 'layui-icon-link', 0, 1);
|
||||
INSERT INTO `bew_admin_sys_menu` VALUES (8001, '欧阳克博客', 2, 'http://www.ouyangke.com', 8000, 'layui-icon-link', 0, 1);
|
||||
INSERT INTO `bew_admin_sys_menu` VALUES (8002, 'php中文网', 2, 'https://www.php.cn', 8000, 'layui-icon-link', 0, 1);
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for bew_admin_user
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `bew_admin_user`;
|
||||
CREATE TABLE `bew_admin_user` (
|
||||
`uid` int(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '用户ID',
|
||||
`account` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '账号邮箱',
|
||||
`password` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '密码',
|
||||
`name` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '姓名',
|
||||
`phone` varchar(18) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '手机号',
|
||||
`qq` varchar(16) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT 'QQ号',
|
||||
`sex` tinyint(1) UNSIGNED NOT NULL DEFAULT 0 COMMENT '性别 0未知 1男 2女',
|
||||
`group_id` int(10) UNSIGNED NOT NULL COMMENT '分组ID',
|
||||
`times_login` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '登陆次数',
|
||||
`status` tinyint(1) UNSIGNED NOT NULL DEFAULT 1 COMMENT '状态 1开启 0禁用',
|
||||
`time_add` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '创建时间',
|
||||
`time_last` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '最后更新时间',
|
||||
PRIMARY KEY (`uid`) USING BTREE,
|
||||
UNIQUE INDEX `one_account`(`account`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '用户信息表' ROW_FORMAT = DYNAMIC;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of bew_admin_user
|
||||
-- ----------------------------
|
||||
INSERT INTO `bew_admin_user` VALUES (1, '428188207@qq.com', 'e10adc3949ba59abbe56e057f20f883e', '欧阳克', '0', '428188207', 1, 1, 274, 1, 1564124524, 1651804007);
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for bew_admin_user_group
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `bew_admin_user_group`;
|
||||
CREATE TABLE `bew_admin_user_group` (
|
||||
`group_id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`group_name` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '部门名',
|
||||
`status` tinyint(1) UNSIGNED NOT NULL DEFAULT 1 COMMENT '是否生效',
|
||||
`time_add` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '添加时间',
|
||||
`rights` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '角色权限,json',
|
||||
PRIMARY KEY (`group_id`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '组管理' ROW_FORMAT = DYNAMIC;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of bew_admin_user_group
|
||||
-- ----------------------------
|
||||
INSERT INTO `bew_admin_user_group` VALUES (1, '管理', 1, 1564124524, '[1,2,10,3,4,5,6,15,11,12,13,14,17,16,5000,5004,5003,5002,5010,5009,5008,5007,5006,5005,8000,8002,8001,7000,7003,7002,7001,7007,7006,7005,7004]');
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for bew_z_iconfont
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `bew_z_iconfont`;
|
||||
CREATE TABLE `bew_z_iconfont` (
|
||||
`icon_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '图标ID',
|
||||
`icon_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '图标名称',
|
||||
`icon_css` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '图标css',
|
||||
`icon_html` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '图标html',
|
||||
`icon_source` tinyint(1) UNSIGNED NULL DEFAULT 1 COMMENT '来源 1layui',
|
||||
`status` tinyint(1) UNSIGNED NOT NULL DEFAULT 1 COMMENT '状态 1开启 0关闭',
|
||||
PRIMARY KEY (`icon_id`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 169 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '图标库' ROW_FORMAT = DYNAMIC;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of bew_z_iconfont
|
||||
-- ----------------------------
|
||||
INSERT INTO `bew_z_iconfont` VALUES (1, '实心', 'layui-icon-heart-fill', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (2, '空心', 'layui-icon-heart', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (3, '亮度/晴', 'layui-icon-light', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (4, '时间/历史', 'layui-icon-time', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (5, '蓝牙', 'layui-icon-bluetooth', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (6, '@艾特', 'layui-icon-at', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (7, '静音', 'layui-icon-mute', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (8, '录音/麦克风', 'layui-icon-mike', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (9, '密钥/钥匙', 'layui-icon-key', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (10, '礼物/活动', 'layui-icon-gift', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (11, '邮箱', 'layui-icon-email', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (12, 'RSS', 'layui-icon-rss', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (13, 'WiFi', 'layui-icon-wifi', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (14, '退出/注销', 'layui-icon-logout', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (15, 'Android 安卓', 'layui-icon-android', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (16, 'Apple IOS 苹果', 'layui-icon-ios', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (17, 'Windows', 'layui-icon-windows', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (18, '穿梭框', 'layui-icon-transfer', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (19, '客服', 'layui-icon-service', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (20, '减', 'layui-icon-subtraction', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (21, '加', 'layui-icon-addition', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (22, '滑块', 'layui-icon-slider', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (23, '打印', 'layui-icon-print', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (24, '导出', 'layui-icon-export', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (25, '列', 'layui-icon-cols', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (26, '退出全屏', 'layui-icon-screen-restore', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (27, '全屏', 'layui-icon-screen-full', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (28, '半星', 'layui-icon-rate-half', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (29, '星星-空心', 'layui-icon-rate', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (30, '星星-实心', 'layui-icon-rate-solid', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (31, '手机', 'layui-icon-cellphone', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (32, '验证码', 'layui-icon-vercode', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (33, '微信', 'layui-icon-login-wechat', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (34, 'QQ', 'layui-icon-login-qq', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (35, '微博', 'layui-icon-login-weibo', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (36, '密码', 'layui-icon-password', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (37, '用户名', 'layui-icon-username', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (38, '刷新-粗', 'layui-icon-refresh-3', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (39, '授权', 'layui-icon-auz', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (40, '左向右伸缩菜单', 'layui-icon-spread-left', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (41, '右向左伸缩菜单', 'layui-icon-shrink-right', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (42, '雪花', 'layui-icon-snowflake', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (43, '提示说明', 'layui-icon-tips', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (44, '便签', 'layui-icon-note', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (45, '主页', 'layui-icon-home', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (46, '高级', 'layui-icon-senior', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (47, '刷新', 'layui-icon-refresh', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (48, '刷新', 'layui-icon-refresh-1', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (49, '旗帜', 'layui-icon-flag', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (50, '主题', 'layui-icon-theme', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (51, '消息-通知', 'layui-icon-notice', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (52, '网站', 'layui-icon-website', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (53, '控制台', 'layui-icon-console', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (54, '表情-惊讶', 'layui-icon-face-surprised', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (55, '设置-空心', 'layui-icon-set', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (56, '模板', 'layui-icon-template-1', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (57, '应用', 'layui-icon-app', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (58, '模板', 'layui-icon-template', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (59, '赞', 'layui-icon-praise', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (60, '踩', 'layui-icon-tread', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (61, '男', 'layui-icon-male', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (62, '女', 'layui-icon-female', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (63, '相机-空心', 'layui-icon-camera', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (64, '相机-实心', 'layui-icon-camera-fill', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (65, '菜单-水平', 'layui-icon-more', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (66, '菜单-垂直', 'layui-icon-more-vertical', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (67, '金额-人民币', 'layui-icon-rmb', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (68, '金额-美元', 'layui-icon-dollar', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (69, '钻石-等级', 'layui-icon-diamond', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (70, '火', 'layui-icon-fire', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (71, '返回', 'layui-icon-return', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (72, '位置-地图', 'layui-icon-location', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (73, '办公-阅读', 'layui-icon-read', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (74, '调查', 'layui-icon-survey', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (75, '表情-微笑', 'layui-icon-face-smile', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (76, '表情-哭泣', 'layui-icon-face-cry', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (77, '购物车', 'layui-icon-cart-simple', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (78, '购物车', 'layui-icon-cart', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (79, '下一页', 'layui-icon-next', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (80, '上一页', 'layui-icon-prev', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (81, '上传-空心-拖拽', 'layui-icon-upload-drag', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (82, '上传-实心', 'layui-icon-upload', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (83, '下载-圆圈', 'layui-icon-download-circle', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (84, '组件', 'layui-icon-component', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (85, '文件-粗', 'layui-icon-file-b', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (86, '用户', 'layui-icon-user', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (87, '发现-实心', 'layui-icon-find-fill', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (88, 'loading', 'layui-icon-loading', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (89, 'loading', 'layui-icon-loading-1', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (90, '添加', 'layui-icon-add-1', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (91, '播放', 'layui-icon-play', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (92, '暂停', 'layui-icon-pause', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (93, '音频-耳机', 'layui-icon-headset', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (94, '视频', 'layui-icon-video', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (95, '语音-声音', 'layui-icon-voice', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (96, '消息-通知-喇叭', 'layui-icon-speaker', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (97, '删除线', 'layui-icon-fonts-del', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (98, '代码', 'layui-icon-fonts-code', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (99, 'HTML', 'layui-icon-fonts-html', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (100, '字体加粗', 'layui-icon-fonts-strong', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (101, '删除链接', 'layui-icon-unlink', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (102, '图片', 'layui-icon-picture', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (103, '链接', 'layui-icon-link', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (104, '表情-笑-粗', 'layui-icon-face-smile-b', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (105, '左对齐', 'layui-icon-align-left', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (106, '右对齐', 'layui-icon-align-right', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (107, '居中对齐', 'layui-icon-align-center', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (108, '字体-下划线', 'layui-icon-fonts-u', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (109, '字体-斜体', 'layui-icon-fonts-i', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (110, 'Tabs 选项卡', 'layui-icon-tabs', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (111, '单选框-选中', 'layui-icon-radio', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (112, '单选框-候选', 'layui-icon-circle', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (113, '编辑', 'layui-icon-edit', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (114, '分享', 'layui-icon-share', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (115, '删除', 'layui-icon-delete', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (116, '表单', 'layui-icon-form', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (117, '手机-细体', 'layui-icon-cellphone-fine', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (118, '聊天 对话 沟通', 'layui-icon-dialogue', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (119, '文字格式化', 'layui-icon-fonts-clear', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (120, '窗口', 'layui-icon-layer', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (121, '日期', 'layui-icon-date', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (122, '水 下雨', 'layui-icon-water', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (123, '代码-圆圈', 'layui-icon-code-circle', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (124, '轮播组图', 'layui-icon-carousel', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (125, '翻页', 'layui-icon-prev-circle', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (126, '布局', 'layui-icon-layouts', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (127, '工具', 'layui-icon-util', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (128, '选择模板', 'layui-icon-templeate-1', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (129, '上传-圆圈', 'layui-icon-upload-circle', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (130, '树', 'layui-icon-tree', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (131, '表格', 'layui-icon-table', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (132, '图表', 'layui-icon-chart', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (133, '图标 报表 屏幕', 'layui-icon-chart-screen', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (134, '引擎', 'layui-icon-engine', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (135, '下三角', 'layui-icon-triangle-d', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (136, '右三角', 'layui-icon-triangle-r', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (137, '文件', 'layui-icon-file', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (138, '设置-小型', 'layui-icon-set-sm', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (139, '减少-圆圈', 'layui-icon-reduce-circle', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (140, '添加-圆圈', 'layui-icon-add-circle', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (141, '404', 'layui-icon-404', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (142, '关于', 'layui-icon-about', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (143, '箭头 向上', 'layui-icon-up', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (144, '箭头 向下', 'layui-icon-down', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (145, '箭头 向左', 'layui-icon-left', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (146, '箭头 向右', 'layui-icon-right', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (147, '圆点', 'layui-icon-circle-dot', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (148, '搜索', 'layui-icon-search', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (149, '设置-实心', 'layui-icon-set-fill', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (150, '群组', 'layui-icon-group', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (151, '好友', 'layui-icon-friends', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (152, '回复 评论 实心', 'layui-icon-reply-fill', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (153, '菜单 隐身 实心', 'layui-icon-menu-fill', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (154, '记录', 'layui-icon-log', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (155, '图片-细体', 'layui-icon-picture-fine', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (156, '表情-笑-细体', 'layui-icon-face-smile-fine', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (157, '列表', 'layui-icon-list', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (158, '发布 纸飞机', 'layui-icon-release', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (159, '对 OK', 'layui-icon-ok', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (160, '帮助', 'layui-icon-help', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (161, '客服', 'layui-icon-chat', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (162, 'top 置顶', 'layui-icon-top', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (163, '收藏-空心', 'layui-icon-star', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (164, '收藏-实心', 'layui-icon-star-fill', '', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (165, '关闭-实心', 'layui-icon-close-fill', 'ဇ', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (166, '关闭-空心', 'layui-icon-close', 'ဆ', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (167, '正确', 'layui-icon-ok-circle', 'စ', 1, 1);
|
||||
INSERT INTO `bew_z_iconfont` VALUES (168, '添加-圆圈-细体', 'layui-icon-add-circle-fine', '', 1, 1);
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for bew_z_test
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `bew_z_test`;
|
||||
CREATE TABLE `bew_z_test` (
|
||||
`test_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'ID',
|
||||
`test_input` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '文本',
|
||||
`test_rich` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '富文本',
|
||||
`test_rich_baidu` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '百度富文本',
|
||||
`test_img` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '图片',
|
||||
`test_reference` tinyint(1) UNSIGNED NULL DEFAULT NULL COMMENT '参照',
|
||||
`test_time` int(10) UNSIGNED NULL DEFAULT NULL COMMENT '时间戳',
|
||||
`test_data` date NULL DEFAULT NULL COMMENT '日期',
|
||||
`test_datatime` datetime NULL DEFAULT NULL COMMENT '日期时间',
|
||||
`test_url` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '网址',
|
||||
PRIMARY KEY (`test_id`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '演示表' ROW_FORMAT = DYNAMIC;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of bew_z_test
|
||||
-- ----------------------------
|
||||
INSERT INTO `bew_z_test` VALUES (1, '输入框', '富文本', '百度富文本', '/static/bews/images/logo.jpg', 1, 1618848000, '2021-04-21', '2021-04-22 00:00:00', 'http://www.ouyangke.cn');
|
||||
|
||||
SET FOREIGN_KEY_CHECKS = 1;
|
||||
@ -5,7 +5,7 @@
|
||||
namespace app\admin\controller;
|
||||
use app\admin\controller\Base;
|
||||
use app\admin\model\Article\Article;
|
||||
use app\admin\model\ArticleCategory;
|
||||
use app\admin\model\Article\ArticleCategory;
|
||||
use think\facade\Db;
|
||||
use think\facade\View;
|
||||
use think\facade\Request;
|
||||
@ -18,20 +18,18 @@ class Articles extends Base
|
||||
{
|
||||
if (Request::isPost()) {
|
||||
$category = input('post.category');
|
||||
$page = input('post.page', 1);
|
||||
$limit = input('post.limit', 10);
|
||||
$page = intval(input('post.page', 1));
|
||||
$limit = intval(input('post.limit', 10));
|
||||
$title = input('post.title');
|
||||
$author = input('post.author');
|
||||
|
||||
$query = Db::name('article')
|
||||
->where('delete_time', null)
|
||||
$query = Article::where('delete_time', null)
|
||||
->where('status', '<>', 3);
|
||||
|
||||
// 分类筛选
|
||||
if (!empty($category)) {
|
||||
// 先获取分类ID
|
||||
$cateInfo = Db::name('article_category')
|
||||
->where('name', $category)
|
||||
$cateInfo = ArticleCategory::where('name', $category)
|
||||
->where('delete_time', null)
|
||||
->where('status', 1)
|
||||
->find();
|
||||
@ -60,22 +58,21 @@ class Articles extends Base
|
||||
->select()
|
||||
->each(function ($item) {
|
||||
// 获取分类信息
|
||||
$cateInfo = Db::name('article_category')
|
||||
->where('id', $item['cate'])
|
||||
$cateInfo = ArticleCategory::where('id', $item['cate'])
|
||||
->field('name, image')
|
||||
->find();
|
||||
|
||||
// 设置分类名称
|
||||
$item['cate'] = $cateInfo['name'];
|
||||
$item['cate'] = $cateInfo ? $cateInfo['name'] : '';
|
||||
|
||||
// 如果文章没有图片,使用分类的图片
|
||||
if (empty($item['image']) && !empty($cateInfo['image'])) {
|
||||
if (empty($item['image']) && $cateInfo && !empty($cateInfo['image'])) {
|
||||
$item['image'] = $cateInfo['image'];
|
||||
}
|
||||
|
||||
// 格式化时间
|
||||
$item['create_time'] = date('Y-m-d H:i:s', $item['create_time']);
|
||||
$item['publishdate'] = $item['publishdate'] ? date('Y-m-d H:i:s', $item['publishdate']) : '';
|
||||
$item['create_time'] = is_numeric($item['create_time']) ? date('Y-m-d H:i:s', $item['create_time']) : $item['create_time'];
|
||||
$item['publishdate'] = is_numeric($item['publishdate']) ? date('Y-m-d H:i:s', $item['publishdate']) : '';
|
||||
|
||||
return $item;
|
||||
});
|
||||
@ -88,8 +85,7 @@ class Articles extends Base
|
||||
]);
|
||||
} else {
|
||||
// 获取所有分类并构建父子结构
|
||||
$allCategories = Db::name('article_category')
|
||||
->where('delete_time', null)
|
||||
$allCategories = ArticleCategory::where('delete_time', null)
|
||||
->where('status', 1)
|
||||
->order('sort asc, id asc')
|
||||
->select()
|
||||
@ -131,7 +127,7 @@ class Articles extends Base
|
||||
'create_time' => time()
|
||||
];
|
||||
|
||||
$insert = Db::name('article')->insert($data);
|
||||
$insert = Article::insert($data);
|
||||
if (empty($insert)) {
|
||||
Log::record('添加文章', 0, '添加文章失败', '文章管理');
|
||||
return json(['code' => 1, 'msg' => '添加失败', 'data' => []]);
|
||||
@ -139,8 +135,7 @@ class Articles extends Base
|
||||
Log::record('添加文章', 1, '', '文章管理');
|
||||
return json(['code' => 0, 'msg' => '添加成功', 'data' => []]);
|
||||
} else {
|
||||
$lists = Db::name('article')
|
||||
->order('id DESC')
|
||||
$lists = Article::order('id DESC')
|
||||
->select()
|
||||
->each(function ($item, $key) {
|
||||
$item['create_time'] = time();
|
||||
@ -169,7 +164,7 @@ class Articles extends Base
|
||||
'update_time' => time()
|
||||
];
|
||||
|
||||
$update = Db::name('article')->where('id', $id)->update($data);
|
||||
$update = Article::where('id', $id)->update($data);
|
||||
if ($update === false) {
|
||||
Log::record('编辑文章', 0, '编辑文章失败', '文章管理');
|
||||
return json(['code' => 1, 'msg' => '更新失败', 'data' => []]);
|
||||
@ -178,13 +173,12 @@ class Articles extends Base
|
||||
return json(['code' => 0, 'msg' => '更新成功', 'data' => []]);
|
||||
} else {
|
||||
$id = input('get.id');
|
||||
$info = Db::name('article')->where('id', $id)->find();
|
||||
$info = Article::where('id', $id)->find();
|
||||
if ($info === null) {
|
||||
return json(['code' => 1, 'msg' => '文章不存在', 'data' => []]);
|
||||
}
|
||||
|
||||
$cates = Db::name('article_category')
|
||||
->where('delete_time', null)
|
||||
$cates = ArticleCategory::where('delete_time', null)
|
||||
->where('status', 1)
|
||||
->order('sort asc, id asc')
|
||||
->select()
|
||||
@ -192,8 +186,7 @@ class Articles extends Base
|
||||
|
||||
$info['content'] = !empty($info['content']) ? htmlspecialchars_decode(str_replace(["\r\n", "\r", "\n"], '', addslashes($info['content']))) : '';
|
||||
|
||||
$currentCate = Db::name('article_category')
|
||||
->where('id', $info['cate'])
|
||||
$currentCate = ArticleCategory::where('id', $info['cate'])
|
||||
->where('delete_time', null)
|
||||
->where('status', 1)
|
||||
->find();
|
||||
@ -214,7 +207,7 @@ class Articles extends Base
|
||||
$data = [
|
||||
'delete_time' => time(),
|
||||
];
|
||||
$delete = Db::name('article')->where('id', $id)->update($data);
|
||||
$delete = Article::where('id', $id)->update($data);
|
||||
if ($delete === false) {
|
||||
Log::record('删除文章', 0, '删除文章失败', '文章管理');
|
||||
return json(['code' => 1, 'msg' => '删除失败', 'data' => []]);
|
||||
@ -227,8 +220,7 @@ class Articles extends Base
|
||||
public function articlecate()
|
||||
{
|
||||
if (Request::isPost()) {
|
||||
$lists = Db::name('article_category')
|
||||
->where('delete_time', null)
|
||||
$lists = ArticleCategory::where('delete_time', null)
|
||||
->where('status', 1)
|
||||
->order('sort asc, id asc')
|
||||
->select()
|
||||
@ -270,8 +262,7 @@ class Articles extends Base
|
||||
public function getcate()
|
||||
{
|
||||
// 获取所有分类
|
||||
$lists = Db::name('article_category')
|
||||
->where('delete_time', null)
|
||||
$lists = ArticleCategory::where('delete_time', null)
|
||||
->where('status', 1)
|
||||
->order('sort asc, id asc')
|
||||
->select()
|
||||
@ -313,7 +304,7 @@ class Articles extends Base
|
||||
'create_time' => time()
|
||||
];
|
||||
|
||||
$insert = Db::name('article_category')->insert($data);
|
||||
$insert = ArticleCategory::insert($data);
|
||||
if (empty($insert)) {
|
||||
Log::record('添加文章分类', 0, '添加文章分类失败', '文章分类');
|
||||
return json(['code' => 1, 'msg' => '添加失败', 'data' => []]);
|
||||
@ -322,8 +313,7 @@ class Articles extends Base
|
||||
return json(['code' => 0, 'msg' => '添加成功', 'data' => []]);
|
||||
} else {
|
||||
// 获取所有可选的父级分类
|
||||
$parentCategories = Db::name('article_category')
|
||||
->where('delete_time', null)
|
||||
$parentCategories = ArticleCategory::where('delete_time', null)
|
||||
->where('status', 1)
|
||||
->where('cid', 0)
|
||||
->field('id, name')
|
||||
@ -354,8 +344,7 @@ class Articles extends Base
|
||||
'update_time' => time()
|
||||
];
|
||||
|
||||
$update = Db::name('article_category')
|
||||
->where('id', $data['id'])
|
||||
$update = ArticleCategory::where('id', $data['id'])
|
||||
->update($data);
|
||||
|
||||
if ($update === false) {
|
||||
@ -366,11 +355,10 @@ class Articles extends Base
|
||||
return json(['code' => 0, 'msg' => '更新成功', 'data' => []]);
|
||||
} else {
|
||||
$id = input('get.id');
|
||||
$info = Db::name('article_category')->where('id', $id)->find();
|
||||
$info = ArticleCategory::where('id', $id)->find();
|
||||
|
||||
// 获取所有可选的父级分类
|
||||
$parentCategories = Db::name('article_category')
|
||||
->where('delete_time', null)
|
||||
$parentCategories = ArticleCategory::where('delete_time', null)
|
||||
->where('status', 1)
|
||||
->where('id', '<>', $id) // 排除自己
|
||||
->where(function ($query) use ($id) {
|
||||
@ -409,8 +397,7 @@ class Articles extends Base
|
||||
$id = input('post.id');
|
||||
|
||||
// 检查是否有子分类
|
||||
$hasChildren = Db::name('article_category')
|
||||
->where('cid', $id)
|
||||
$hasChildren = ArticleCategory::where('cid', $id)
|
||||
->where('delete_time', null)
|
||||
->find();
|
||||
|
||||
@ -419,8 +406,7 @@ class Articles extends Base
|
||||
return json(['code' => 1, 'msg' => '该分类下有子分类,无法删除', 'data' => []]);
|
||||
}
|
||||
|
||||
$delete = Db::name('article_category')
|
||||
->where('id', $id)
|
||||
$delete = ArticleCategory::where('id', $id)
|
||||
->update(['delete_time' => time()]);
|
||||
|
||||
if ($delete === false) {
|
||||
@ -433,8 +419,7 @@ class Articles extends Base
|
||||
|
||||
//统计文章数量
|
||||
public function counts() {
|
||||
$total = Db::name('article')
|
||||
->where('delete_time', null)
|
||||
$total = Article::where('delete_time', null)
|
||||
->where('status', '<>', 3)
|
||||
->count();
|
||||
|
||||
|
||||
@ -6,6 +6,8 @@ use think\facade\Db;
|
||||
use think\facade\Request;
|
||||
use think\facade\View;
|
||||
use think\facade\Cookie;
|
||||
use app\admin\model\Log\LogsLogin;
|
||||
use app\admin\model\Log\LogsOperation;
|
||||
|
||||
class Log extends Base
|
||||
{
|
||||
@ -23,27 +25,25 @@ class Log extends Base
|
||||
$startTime = input('post.start_time');
|
||||
$endTime = input('post.end_time');
|
||||
|
||||
$query = Db::name('yz_logs_login');
|
||||
|
||||
// 搜索条件
|
||||
if ($username) {
|
||||
$query = $query->where('username', 'like', "%{$username}%");
|
||||
$query = LogsLogin::where('username', 'like', "%{$username}%");
|
||||
}
|
||||
if ($ip) {
|
||||
$query = $query->where('ip_address', 'like', "%{$ip}%");
|
||||
$query = LogsLogin::where('ip_address', 'like', "%{$ip}%");
|
||||
}
|
||||
if ($status !== '') {
|
||||
$query = $query->where('login_status', $status);
|
||||
$query = LogsLogin::where('login_status', $status);
|
||||
}
|
||||
if ($startTime) {
|
||||
$query = $query->where('login_time', '>=', $startTime);
|
||||
$query = LogsLogin::where('login_time', '>=', $startTime);
|
||||
}
|
||||
if ($endTime) {
|
||||
$query = $query->where('login_time', '<=', $endTime);
|
||||
$query = LogsLogin::where('login_time', '<=', $endTime);
|
||||
}
|
||||
|
||||
$count = $query->count();
|
||||
$list = $query->order('id desc')
|
||||
$count = LogsLogin::count();
|
||||
$list = LogsLogin::order('id desc')
|
||||
->page($page, $limit)
|
||||
->select();
|
||||
|
||||
@ -67,8 +67,6 @@ class Log extends Base
|
||||
$page = $params['page'] ?? 1;
|
||||
$limit = $params['limit'] ?? 10;
|
||||
|
||||
$query = Db::name('yz_logs_operation');
|
||||
|
||||
// 构建搜索条件
|
||||
$searchFields = [
|
||||
'username' => ['field' => 'username', 'type' => 'like'],
|
||||
@ -79,6 +77,8 @@ class Log extends Base
|
||||
'end_time' => ['field' => 'operation_time', 'type' => '<=']
|
||||
];
|
||||
|
||||
$query = LogsOperation::where('1=1');
|
||||
|
||||
foreach ($searchFields as $param => $config) {
|
||||
if (!empty($params[$param])) {
|
||||
$value = $params[$param];
|
||||
@ -89,8 +89,9 @@ class Log extends Base
|
||||
}
|
||||
}
|
||||
|
||||
$count = $query->count();
|
||||
$list = $query->order('id desc')
|
||||
$count = LogsOperation::where('1=1')->count();
|
||||
$list = LogsOperation::where('1=1')
|
||||
->order('id desc')
|
||||
->page($page, $limit)
|
||||
->select();
|
||||
|
||||
@ -129,7 +130,7 @@ class Log extends Base
|
||||
'execution_time' => 0
|
||||
];
|
||||
|
||||
Db::name('yz_logs_operation')->insert($data);
|
||||
LogsOperation::insert($data);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -142,8 +143,7 @@ class Log extends Base
|
||||
return json(['code' => 1, 'msg' => '参数错误']);
|
||||
}
|
||||
|
||||
$info = Db::name('yz_logs_operation')
|
||||
->where('id', $id)
|
||||
$info = LogsOperation::where('id', $id)
|
||||
->find();
|
||||
|
||||
if (!$info) {
|
||||
|
||||
@ -10,53 +10,104 @@ use think\facade\View;
|
||||
use think\facade\Cookie;
|
||||
use think\facade\Request;
|
||||
use app\admin\model\YzAdminConfig;
|
||||
use app\admin\model\AdminUser;
|
||||
use app\admin\model\Log\LogsLogin;
|
||||
|
||||
class Login
|
||||
{
|
||||
protected $app;
|
||||
protected $config;
|
||||
|
||||
public function __construct(App $app)
|
||||
{
|
||||
$this->app = $app;
|
||||
$this->config = new YzAdminConfig();
|
||||
}
|
||||
|
||||
// 登录页面
|
||||
public function index()
|
||||
{
|
||||
# 获取配置
|
||||
$YzAdminConfig = new YzAdminConfig();
|
||||
$this->config = $YzAdminConfig->getAll();
|
||||
$config = $this->config->getAll();
|
||||
View::assign([
|
||||
'config' => $this->config
|
||||
'config' => $config
|
||||
]);
|
||||
return View::fetch();
|
||||
}
|
||||
|
||||
// 记录登录日志
|
||||
protected function recordLoginLog($username, $status, $reason = '')
|
||||
{
|
||||
$data = [
|
||||
'username' => $username,
|
||||
'ip_address' => Request::ip(),
|
||||
'location' => $this->getLocation(Request::ip()),
|
||||
'device_type' => $this->getDeviceType(),
|
||||
'user_agent' => Request::header('user-agent'),
|
||||
'login_status' => $status,
|
||||
'failure_reason' => $reason,
|
||||
'login_time' => date('Y-m-d H:i:s')
|
||||
];
|
||||
LogsLogin::create($data);
|
||||
}
|
||||
|
||||
// 获取IP地址位置
|
||||
protected function getLocation($ip)
|
||||
{
|
||||
// 这里可以接入IP地址库或第三方API
|
||||
return '未知';
|
||||
}
|
||||
|
||||
// 获取设备类型
|
||||
protected function getDeviceType()
|
||||
{
|
||||
$agent = Request::header('user-agent');
|
||||
if (preg_match('/(iPhone|iPod|Android|ios|iPad|Mobile)/i', $agent)) {
|
||||
return '移动端';
|
||||
}
|
||||
return 'PC端';
|
||||
}
|
||||
|
||||
// 登录
|
||||
public function login()
|
||||
{
|
||||
if (Request::isPost()) {
|
||||
$account = trim(input('post.account'));
|
||||
if (empty($account)) {
|
||||
$this->returnCode(1, '账号不能为空');
|
||||
$this->recordLoginLog($account, 0, '账号不能为空');
|
||||
return json(['code' => 1, 'msg' => '账号不能为空']);
|
||||
}
|
||||
$pattern = "/^([0-9A-Za-z-_.]+)@([0-9a-z]+.[a-z]{2,3}(.[a-z]{2})?)$/i";
|
||||
if (!preg_match($pattern, $account)) {
|
||||
$this->returnCode(1, '邮箱格式不正确');
|
||||
$this->recordLoginLog($account, 0, '邮箱格式不正确');
|
||||
return json(['code' => 1, 'msg' => '邮箱格式不正确']);
|
||||
}
|
||||
$password = trim(input('post.password'));
|
||||
if (empty($password)) {
|
||||
$this->returnCode(1, '密码不能为空');
|
||||
$this->recordLoginLog($account, 0, '密码不能为空');
|
||||
return json(['code' => 1, 'msg' => '密码不能为空']);
|
||||
}
|
||||
$code = trim(input('post.code'));
|
||||
if ($code == '') {
|
||||
$this->returnCode(1, '验证码不能为空');
|
||||
$this->recordLoginLog($account, 0, '验证码不能为空');
|
||||
return json(['code' => 1, 'msg' => '验证码不能为空']);
|
||||
}
|
||||
if (!captcha_check($code)) {
|
||||
$this->returnCode(1, '验证码错误');
|
||||
$this->recordLoginLog($account, 0, '验证码错误');
|
||||
return json(['code' => 1, 'msg' => '验证码错误']);
|
||||
}
|
||||
$aUser = Db::table('yz_admin_user')->where('account', $account)->find();
|
||||
$aUser = AdminUser::where('account', $account)->find();
|
||||
if (empty($aUser)) {
|
||||
$this->returnCode(1, '账号不存在');
|
||||
$this->recordLoginLog($account, 0, '账号不存在');
|
||||
return json(['code' => 1, 'msg' => '账号不存在']);
|
||||
}
|
||||
if ($aUser['status'] != 1) {
|
||||
$this->returnCode(1, '账号已被禁用');
|
||||
$this->recordLoginLog($account, 0, '账号已被禁用');
|
||||
return json(['code' => 1, 'msg' => '账号已被禁用']);
|
||||
}
|
||||
if ($aUser['password'] != md5($password)) {
|
||||
$this->returnCode(1, '密码错误');
|
||||
$this->recordLoginLog($account, 0, '密码错误');
|
||||
return json(['code' => 1, 'msg' => '密码错误']);
|
||||
}
|
||||
$remember = input('post.remember');
|
||||
if (!empty($remember)) {
|
||||
@ -66,10 +117,12 @@ class Login
|
||||
Cookie::set('admin_id', $aUser['uid']);
|
||||
Cookie::set('admin_name', $aUser['name']);
|
||||
}
|
||||
Db::table('yz_admin_user')->where('uid', $aUser['uid'])->update(
|
||||
AdminUser::where('uid', $aUser['uid'])->update(
|
||||
['login_count' => $aUser['login_count'] + 1, 'update_time' => time()]
|
||||
);
|
||||
$this->returnCode(0, [], '登录成功');
|
||||
// 记录登录成功日志
|
||||
$this->recordLoginLog($account, 1);
|
||||
return json(['code' => 0, 'msg' => '登录成功', 'data' => []]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -78,35 +131,7 @@ class Login
|
||||
{
|
||||
Cookie::delete('admin_id');
|
||||
Cookie::delete('admin_name');
|
||||
$this->returnCode(0, [], '退出成功');
|
||||
}
|
||||
|
||||
// 返回代码
|
||||
protected function returnCode($code, $data = [], $msg = '')
|
||||
{
|
||||
header('Content-type:application/json');
|
||||
if ($code == 0) {
|
||||
$arr = array(
|
||||
'code' => $code,
|
||||
'msg' => $msg,
|
||||
'data' => $data
|
||||
);
|
||||
} else if ($code == 1) {
|
||||
$arr = array(
|
||||
'code' => 1,
|
||||
'msg' => $data
|
||||
);
|
||||
} else {
|
||||
$appapi = new AppApi();
|
||||
$arr = array(
|
||||
'code' => $code,
|
||||
'msg' => $appapi::errorTip($code)
|
||||
);
|
||||
}
|
||||
echo json_encode($arr);
|
||||
if ($code != 0) {
|
||||
exit;
|
||||
}
|
||||
return json(['code' => 0, 'msg' => '退出成功', 'data' => []]);
|
||||
}
|
||||
|
||||
// 密码重置页面
|
||||
@ -120,34 +145,34 @@ class Login
|
||||
{
|
||||
$account = trim(input('post.account'));
|
||||
if (empty($account)) {
|
||||
$this->returnCode(1, '账号不能为空');
|
||||
return json(['code' => 1, 'msg' => '账号不能为空']);
|
||||
}
|
||||
|
||||
$user = Db::table('yz_admin_user')->where('account', $account)->find();
|
||||
$user = AdminUser::where('account', $account)->find();
|
||||
|
||||
if (!$user) {
|
||||
$this->returnCode(1, '未找到该用户名');
|
||||
return json(['code' => 1, 'msg' => '未找到该用户名']);
|
||||
}
|
||||
|
||||
// 使用md5进行密码加密处理
|
||||
$password = md5('123456');
|
||||
|
||||
try {
|
||||
$res = Db::table('yz_admin_user')
|
||||
->where('account', $account)
|
||||
$res = AdminUser::where('account', $account)
|
||||
->update(['password' => $password]);
|
||||
|
||||
if ($res === false) {
|
||||
$this->returnCode(1, '数据库更新失败');
|
||||
return json(['code' => 1, 'msg' => '数据库更新失败']);
|
||||
}
|
||||
|
||||
if ($res === 0) {
|
||||
$this->returnCode(1, '密码未发生变化');
|
||||
return json(['code' => 1, 'msg' => '密码未发生变化']);
|
||||
}
|
||||
|
||||
$this->returnCode(0, [], '密码重置成功');
|
||||
return json(['code' => 0, 'msg' => '密码重置成功', 'data' => []]);
|
||||
} catch (\Exception $e) {
|
||||
$this->returnCode(1, '系统错误:' . $e->getMessage());
|
||||
return json(['code' => 1, 'msg' => '系统错误:' . $e->getMessage()]);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -9,11 +9,15 @@ use think\facade\View;
|
||||
use think\facade\Request;
|
||||
use app\admin\model\YzAdminConfig;
|
||||
use app\admin\controller\Log;
|
||||
use app\admin\model\AdminSysMenu;
|
||||
use app\admin\model\AdminUserGroup;
|
||||
use app\admin\model\AdminConfig;
|
||||
use app\admin\model\ZIconfont;
|
||||
|
||||
class Yunzer extends Base{
|
||||
# 菜单列表
|
||||
public function menuinfo(){
|
||||
$lists = Db::table('yz_admin_sys_menu')->where('parent_id',0)->order('sort DESC,smid DESC')->select();
|
||||
$lists = AdminSysMenu::where('parent_id', 0)->order('sort DESC,smid DESC')->select();
|
||||
View::assign([
|
||||
'lists' => $lists
|
||||
]);
|
||||
@ -49,17 +53,17 @@ class Yunzer extends Base{
|
||||
$data['src'] = '';
|
||||
}
|
||||
// 保存菜单
|
||||
$res = Db::table('yz_admin_sys_menu')->insert($data);
|
||||
$res = AdminSysMenu::insert($data);
|
||||
if (!$res) {
|
||||
Log::record('添加菜单', 0, '添加菜单失败', '菜单管理');
|
||||
$this->returnCode(1, '添加菜单失败');
|
||||
}
|
||||
|
||||
// 获取新插入的菜单ID
|
||||
$newMenuId = Db::table('yz_admin_sys_menu')->getLastInsID();
|
||||
$newMenuId = AdminSysMenu::getLastInsID();
|
||||
|
||||
// 获取所有管理员用户组
|
||||
$adminGroups = Db::table('yz_admin_user_group')->select();
|
||||
$adminGroups = AdminUserGroup::select();
|
||||
foreach ($adminGroups as $group) {
|
||||
// 获取现有权限
|
||||
$rights = [];
|
||||
@ -72,8 +76,7 @@ class Yunzer extends Base{
|
||||
$rights[] = $newMenuId;
|
||||
|
||||
// 更新用户组权限
|
||||
Db::table('yz_admin_user_group')
|
||||
->where('group_id', $group['group_id'])
|
||||
AdminUserGroup::where('group_id', $group['group_id'])
|
||||
->update(['rights' => json_encode($rights)]);
|
||||
}
|
||||
}
|
||||
@ -81,7 +84,7 @@ class Yunzer extends Base{
|
||||
Log::record('添加菜单', 1, '', '菜单管理');
|
||||
$this->returnCode(0);
|
||||
} else {
|
||||
$iconfont = Db::table('yz_z_iconfont')->where('status', 1)->select();
|
||||
$iconfont = ZIconfont::where('status', 1)->select();
|
||||
View::assign([
|
||||
'iconfont' => $iconfont
|
||||
]);
|
||||
@ -118,7 +121,7 @@ class Yunzer extends Base{
|
||||
$data['src'] = '';
|
||||
}
|
||||
// 保存用户
|
||||
$res = Db::table('yz_admin_sys_menu')->where('smid',$smid)->update($data);
|
||||
$res = AdminSysMenu::where('smid',$smid)->update($data);
|
||||
if(!$res){
|
||||
Log::record('编辑菜单', 0, '修改菜单失败', '菜单管理');
|
||||
$this->returnCode(1, '修改菜单失败');
|
||||
@ -127,8 +130,8 @@ class Yunzer extends Base{
|
||||
$this->returnCode(0);
|
||||
}else{
|
||||
$smid = (int)input('get.smid');
|
||||
$lists = Db::table('yz_admin_sys_menu')->where('smid',$smid)->find();
|
||||
$iconfont = Db::table('yz_z_iconfont')->where('status',1)->select();
|
||||
$lists = AdminSysMenu::where('smid',$smid)->find();
|
||||
$iconfont = ZIconfont::where('status',1)->select();
|
||||
View::assign([
|
||||
'lists' => $lists,
|
||||
'iconfont' => $iconfont
|
||||
@ -139,12 +142,12 @@ class Yunzer extends Base{
|
||||
# 菜单删除
|
||||
public function menudel(){
|
||||
$smid = (int)input('post.smid');
|
||||
$count = Db::table('yz_admin_sys_menu')->where('parent_id',$smid)->count();
|
||||
$count = AdminSysMenu::where('parent_id',$smid)->count();
|
||||
if($count > 0){
|
||||
Log::record('删除菜单', 0, '该菜单下还有子菜单,不能删除', '菜单管理');
|
||||
$this->returnCode(1, '该菜单下还有子菜单,不能删除');
|
||||
}
|
||||
$res = Db::table('yz_admin_sys_menu')->where('smid',$smid)->delete();
|
||||
$res = AdminSysMenu::where('smid',$smid)->delete();
|
||||
if(empty($res)){
|
||||
Log::record('删除菜单', 0, '删除菜单失败', '菜单管理');
|
||||
$this->returnCode(1, '删除菜单失败');
|
||||
@ -155,7 +158,7 @@ class Yunzer extends Base{
|
||||
# 按钮管理
|
||||
public function buttoninfo(){
|
||||
$smid = (int)input('get.smid');
|
||||
$lists = Db::table('yz_admin_sys_menu')->where('parent_id',$smid)->order('sort DESC')->select()->toArray();
|
||||
$lists = AdminSysMenu::where('parent_id',$smid)->order('sort DESC')->select()->toArray();
|
||||
if(!empty($lists)){
|
||||
foreach($lists as &$v){
|
||||
switch ($v['type']) {
|
||||
@ -212,7 +215,7 @@ class Yunzer extends Base{
|
||||
}
|
||||
}
|
||||
$data['parent_id'] = $smid;
|
||||
$res = Db::table('yz_admin_sys_menu')->insert($data);
|
||||
$res = AdminSysMenu::insert($data);
|
||||
if(!$res){
|
||||
Log::record('添加按钮', 0, '添加按钮失败', '按钮管理');
|
||||
$this->returnCode(1, '添加按钮失败');
|
||||
@ -221,7 +224,7 @@ class Yunzer extends Base{
|
||||
$this->returnCode(0);
|
||||
}else{
|
||||
$smid = (int)input('get.smid');
|
||||
$iconfont = Db::table('yz_z_iconfont')->where('status',1)->select();
|
||||
$iconfont = ZIconfont::where('status',1)->select();
|
||||
View::assign([
|
||||
'smid' => $smid,
|
||||
'iconfont' => $iconfont
|
||||
@ -260,7 +263,7 @@ class Yunzer extends Base{
|
||||
$this->returnCode(1, '请输入超链接地址');
|
||||
}
|
||||
}
|
||||
$res = Db::table('yz_admin_sys_menu')->where('smid',$smid)->update($data);
|
||||
$res = AdminSysMenu::where('smid',$smid)->update($data);
|
||||
if(!$res){
|
||||
Log::record('编辑按钮', 0, '修改按钮失败', '按钮管理');
|
||||
$this->returnCode(1, '修改按钮失败');
|
||||
@ -269,8 +272,8 @@ class Yunzer extends Base{
|
||||
$this->returnCode(0);
|
||||
}else{
|
||||
$smid = (int)input('get.smid');
|
||||
$lists = Db::table('yz_admin_sys_menu')->where('smid',$smid)->find();
|
||||
$iconfont = Db::table('yz_z_iconfont')->where('status',1)->select();
|
||||
$lists = AdminSysMenu::where('smid',$smid)->find();
|
||||
$iconfont = ZIconfont::where('status',1)->select();
|
||||
View::assign([
|
||||
'lists' => $lists,
|
||||
'iconfont' => $iconfont
|
||||
@ -281,7 +284,7 @@ class Yunzer extends Base{
|
||||
# 按钮删除
|
||||
public function buttondel(){
|
||||
$smid = (int)input('post.smid');
|
||||
$res = Db::table('yz_admin_sys_menu')->where('smid',$smid)->delete();
|
||||
$res = AdminSysMenu::where('smid',$smid)->delete();
|
||||
if(empty($res)){
|
||||
Log::record('删除按钮', 0, '删除按钮失败', '按钮管理');
|
||||
$this->returnCode(1, '删除按钮失败');
|
||||
@ -295,8 +298,8 @@ class Yunzer extends Base{
|
||||
if($req->isPost()){
|
||||
$page = (int)input('post.page',1);
|
||||
$limit = (int)input('post.limit',$this->config['admin_page']);
|
||||
$count = Db::table('yz_admin_config')->count();
|
||||
$lists = Db::table('yz_admin_config')->page($page,$limit)->order('config_sort DESC,config_id DESC')->select();
|
||||
$count = AdminConfig::count();
|
||||
$lists = AdminConfig::page($page,$limit)->order('config_sort DESC,config_id DESC')->select();
|
||||
$this->returnCode(0,$lists,$count);
|
||||
}else{
|
||||
return View::fetch();
|
||||
@ -320,7 +323,7 @@ class Yunzer extends Base{
|
||||
$data['config_desc'] = trim(input('post.config_desc'));
|
||||
$data['config_status'] = trim(input('post.config_status'));
|
||||
$data['config_sort'] = trim(input('post.config_sort'));
|
||||
$res = Db::table('yz_admin_config')->insert($data);
|
||||
$res = AdminConfig::insert($data);
|
||||
if(empty($res)){
|
||||
Log::record('添加配置', 0, '添加配置失败', '系统配置');
|
||||
$this->returnCode(1, '添加配置失败');
|
||||
@ -354,7 +357,7 @@ class Yunzer extends Base{
|
||||
$data['config_desc'] = trim(input('post.config_desc'));
|
||||
$data['config_status'] = trim(input('post.config_status'));
|
||||
$data['config_sort'] = trim(input('post.config_sort'));
|
||||
$res = Db::table('yz_admin_config')->where('config_id',$config_id)->update($data);
|
||||
$res = AdminConfig::where('config_id',$config_id)->update($data);
|
||||
if(empty($res)){
|
||||
Log::record('编辑配置', 0, '修改配置失败', '系统配置');
|
||||
$this->returnCode(1, '修改配置失败');
|
||||
@ -363,7 +366,7 @@ class Yunzer extends Base{
|
||||
$this->returnCode(0);
|
||||
}else{
|
||||
$config_id = (int)input('get.config_id');
|
||||
$find = Db::table('yz_admin_config')->where('config_id',$config_id)->find();
|
||||
$find = AdminConfig::where('config_id',$config_id)->find();
|
||||
View::assign([
|
||||
'find' => $find
|
||||
]);
|
||||
@ -377,7 +380,7 @@ class Yunzer extends Base{
|
||||
Log::record('删除配置', 0, '请选择一条数据', '系统配置');
|
||||
$this->returnCode(1,'请选择一条数据');
|
||||
}
|
||||
$res = Db::table('yz_admin_config')->where('config_id',$config_id)->delete();
|
||||
$res = AdminConfig::where('config_id',$config_id)->delete();
|
||||
if(empty($res)){
|
||||
Log::record('删除配置', 0, '删除配置失败', '系统配置');
|
||||
$this->returnCode(1, '删除配置失败');
|
||||
@ -403,7 +406,7 @@ class Yunzer extends Base{
|
||||
Log::record('更新配置值', 1, '', '系统配置');
|
||||
$this->returnCode(0);
|
||||
}else{
|
||||
$lists = Db::table('yz_admin_config')->order('config_sort DESC,config_id')->select();
|
||||
$lists = AdminConfig::order('config_sort DESC,config_id')->select();
|
||||
View::assign([
|
||||
'lists' => $lists
|
||||
]);
|
||||
|
||||
@ -5,13 +5,18 @@ use think\facade\Db;
|
||||
use think\facade\View;
|
||||
use think\facade\Request;
|
||||
use app\admin\controller\Log;
|
||||
use app\admin\model\AdminSysMenu;
|
||||
use app\admin\model\AdminUserGroup;
|
||||
use app\admin\model\AdminUser;
|
||||
use app\admin\model\Banner;
|
||||
|
||||
|
||||
class Yunzeradmin extends Base
|
||||
{
|
||||
// 角色列表
|
||||
public function groupinfo()
|
||||
{
|
||||
$group = Db::table('yz_admin_user_group')->select();
|
||||
$group = AdminUserGroup::select();
|
||||
View::assign([
|
||||
'group' => $group
|
||||
]);
|
||||
@ -27,13 +32,13 @@ class Yunzeradmin extends Base
|
||||
Log::record('添加角色', 0, '角色名称不能为空', '角色管理');
|
||||
return json(['code' => 1, 'msg' => '角色名称不能为空']);
|
||||
}
|
||||
$data['status'] = (int) trim(input('post.status'));
|
||||
$data['status'] = intval(trim(input('post.status')));
|
||||
$data['create_time'] = time();
|
||||
$menus = input('post.menu/a');
|
||||
if ($menus) {
|
||||
$data['rights'] = json_encode(array_keys($menus));
|
||||
}
|
||||
$res = Db::table('yz_admin_user_group')->insert($data);
|
||||
$res = AdminUserGroup::insert($data);
|
||||
if (!$res) {
|
||||
Log::record('添加角色', 0, '添加角色失败', '角色管理');
|
||||
return json(['code' => 1, 'msg' => '添加角色失败']);
|
||||
@ -41,7 +46,7 @@ class Yunzeradmin extends Base
|
||||
Log::record('添加角色', 1, '', '角色管理');
|
||||
return json(['code' => 0, 'msg' => '添加成功']);
|
||||
} else {
|
||||
$menus = Db::table('yz_admin_sys_menu')->order('type,sort desc')->where('status', '=', 1)->select();
|
||||
$menus = AdminSysMenu::order('type,sort desc')->where('status', '=', 1)->select();
|
||||
$menu = [];
|
||||
|
||||
// 先处理所有父菜单
|
||||
@ -83,7 +88,7 @@ class Yunzeradmin extends Base
|
||||
} else {
|
||||
$data['rights'] = '';
|
||||
}
|
||||
$res = Db::table('yz_admin_user_group')->where('group_id', $group_id)->update($data);
|
||||
$res = AdminUserGroup::where('group_id', $group_id)->update($data);
|
||||
if (!$res) {
|
||||
Log::record('编辑角色', 0, '更新角色失败', '角色管理');
|
||||
return json(['code' => 1, 'msg' => '更新角色失败']);
|
||||
@ -92,12 +97,12 @@ class Yunzeradmin extends Base
|
||||
return json(['code' => 0, 'msg' => '更新成功']);
|
||||
} else {
|
||||
$group_id = (int) input('get.group_id');
|
||||
$group = Db::table('yz_admin_user_group')->where('group_id', $group_id)->find();
|
||||
$group = AdminUserGroup::where('group_id', $group_id)->find();
|
||||
if ($group && $group['rights']) {
|
||||
$group['rights'] = json_decode($group['rights']);
|
||||
}
|
||||
|
||||
$menus = Db::table('yz_admin_sys_menu')->order('type,sort desc')->where('status', '=', 1)->select();
|
||||
$menus = AdminSysMenu::order('type,sort desc')->where('status', '=', 1)->select();
|
||||
$menu = [];
|
||||
|
||||
// 先处理所有父菜单
|
||||
@ -127,7 +132,7 @@ class Yunzeradmin extends Base
|
||||
public function groupdel()
|
||||
{
|
||||
$group_id = (int) input('post.group_id');
|
||||
$res = Db::table('yz_admin_user_group')->where('group_id', $group_id)->delete();
|
||||
$res = AdminUserGroup::where('group_id', $group_id)->delete();
|
||||
if (empty($res)) {
|
||||
Log::record('删除角色', 0, '删除角色失败', '角色管理');
|
||||
return json(['code' => 1, 'msg' => '删除角色失败']);
|
||||
@ -139,9 +144,9 @@ class Yunzeradmin extends Base
|
||||
// 管理员列表
|
||||
public function userinfo()
|
||||
{
|
||||
$lists = Db::table('yz_admin_user')->select();
|
||||
$lists = AdminUser::select();
|
||||
$group = [];
|
||||
$groups = Db::table('yz_admin_user_group')->select();
|
||||
$groups = AdminUserGroup::select();
|
||||
foreach ($groups as $key => $value) {
|
||||
$group[$value['group_id']] = $value;
|
||||
}
|
||||
@ -166,7 +171,7 @@ class Yunzeradmin extends Base
|
||||
Log::record('添加管理员', 0, '邮箱格式不正确', '管理员管理');
|
||||
return json(['code' => 1, 'msg' => '邮箱格式不正确']);
|
||||
}
|
||||
$item = Db::table('yz_admin_user')->where('account', $data['account'])->find();
|
||||
$item = AdminUser::where('account', $data['account'])->find();
|
||||
if ($item) {
|
||||
Log::record('添加管理员', 0, '该账号已存在', '管理员管理');
|
||||
return json(['code' => 1, 'msg' => '该账号已存在']);
|
||||
@ -198,7 +203,7 @@ class Yunzeradmin extends Base
|
||||
}
|
||||
$data['create_time'] = time();
|
||||
$data['update_time'] = time();
|
||||
$res = Db::table('yz_admin_user')->insert($data);
|
||||
$res = AdminUser::insert($data);
|
||||
if (!$res) {
|
||||
Log::record('添加管理员', 0, '添加管理员失败', '管理员管理');
|
||||
return json(['code' => 1, 'msg' => '添加管理员失败']);
|
||||
@ -207,7 +212,7 @@ class Yunzeradmin extends Base
|
||||
return json(['code' => 0, 'msg' => '添加成功']);
|
||||
} else {
|
||||
$group = [];
|
||||
$groups = Db::table('yz_admin_user_group')->select();
|
||||
$groups = AdminUserGroup::select();
|
||||
foreach ($groups as $key => $value) {
|
||||
$group[$value['group_id']] = $value;
|
||||
}
|
||||
@ -241,7 +246,7 @@ class Yunzeradmin extends Base
|
||||
Log::record('编辑管理员', 0, '请选择角色', '管理员管理');
|
||||
return json(['code' => 1, 'msg' => '请选择角色']);
|
||||
}
|
||||
$res = Db::table('yz_admin_user')->where('uid', $uid)->update($data);
|
||||
$res = AdminUser::where('uid', $uid)->update($data);
|
||||
if (!$res) {
|
||||
Log::record('编辑管理员', 0, '更新管理员信息失败', '管理员管理');
|
||||
return json(['code' => 1, 'msg' => '更新管理员信息失败']);
|
||||
@ -251,10 +256,10 @@ class Yunzeradmin extends Base
|
||||
} else {
|
||||
$uid = (int) input('get.uid');
|
||||
// 加载管理员
|
||||
$lists = Db::table('yz_admin_user')->where('uid', $uid)->find();
|
||||
$lists = AdminUser::where('uid', $uid)->find();
|
||||
// 加载角色
|
||||
$group = [];
|
||||
$groups = Db::table('yz_admin_user_group')->select();
|
||||
$groups = AdminUserGroup::select();
|
||||
foreach ($groups as $key => $value) {
|
||||
$group[$value['group_id']] = $value;
|
||||
}
|
||||
@ -270,7 +275,7 @@ class Yunzeradmin extends Base
|
||||
public function userdel()
|
||||
{
|
||||
$uid = (int) input('post.uid');
|
||||
$res = Db::table('yz_admin_user')->where('uid', $uid)->delete();
|
||||
$res = AdminUser::where('uid', $uid)->delete();
|
||||
if (empty($res)) {
|
||||
Log::record('删除管理员', 0, '删除管理员失败', '管理员管理');
|
||||
return json(['code' => 1, 'msg' => '删除管理员失败']);
|
||||
@ -283,7 +288,7 @@ class Yunzeradmin extends Base
|
||||
public function admininfo()
|
||||
{
|
||||
if (Request::isPost()) {
|
||||
$find = Db::table('yz_admin_user')->where('uid', $this->adminId)->find();
|
||||
$find = AdminUser::where('uid', $this->adminId)->find();
|
||||
if (empty($find)) {
|
||||
Log::record('修改个人信息', 0, '当前账户不存在', '个人信息');
|
||||
return json(['code' => 1, 'msg' => '当前账户不存在']);
|
||||
@ -312,7 +317,7 @@ class Yunzeradmin extends Base
|
||||
$data['password'] = md5($new_pw);
|
||||
}
|
||||
|
||||
$res = Db::table('yz_admin_user')->where('uid', $this->adminId)->update($data);
|
||||
$res = AdminUser::where('uid', $this->adminId)->update($data);
|
||||
if (!$res) {
|
||||
Log::record('修改个人信息', 0, '更新管理员信息失败', '个人信息');
|
||||
return json(['code' => 1, 'msg' => '更新管理员信息失败']);
|
||||
@ -334,11 +339,10 @@ class Yunzeradmin extends Base
|
||||
public function bannerlist()
|
||||
{
|
||||
if (Request::isGet()) {
|
||||
$page = input('page', 1);
|
||||
$limit = input('limit', 10);
|
||||
$page = intval(input('post.page', 1));
|
||||
$limit = intval(input('post.limit', 10));
|
||||
|
||||
$query = Db::table('yz_banner')
|
||||
->where('delete_time', null)
|
||||
$query = Banner::where('delete_time', null)
|
||||
->field('id, title, image, url, sort, create_time, update_time');
|
||||
|
||||
// 获取总记录数
|
||||
@ -352,8 +356,8 @@ class Yunzeradmin extends Base
|
||||
|
||||
// 处理数据
|
||||
foreach ($lists as &$item) {
|
||||
$item['create_time'] = $item['create_time'] ? date('Y-m-d H:i:s', $item['create_time']) : '';
|
||||
$item['update_time'] = $item['update_time'] ? date('Y-m-d H:i:s', $item['update_time']) : '';
|
||||
$item['create_time'] = is_numeric($item['create_time']) ? date('Y-m-d H:i:s', $item['create_time']) : $item['create_time'];
|
||||
$item['update_time'] = is_numeric($item['update_time']) ? date('Y-m-d H:i:s', $item['update_time']) : $item['update_time'];
|
||||
}
|
||||
|
||||
return json([
|
||||
@ -379,7 +383,7 @@ class Yunzeradmin extends Base
|
||||
'create_time' => time()
|
||||
];
|
||||
|
||||
$res = Db::table('yz_banner')->insert($data);
|
||||
$res = Banner::insert($data);
|
||||
if (!$res) {
|
||||
Log::record('添加Banner', 0, '添加Banner失败', 'Banner管理');
|
||||
return json(['code' => 1, 'msg' => '添加Banner失败']);
|
||||
@ -408,7 +412,7 @@ class Yunzeradmin extends Base
|
||||
'update_time' => time()
|
||||
];
|
||||
|
||||
$res = Db::table('yz_banner')->where('id', $id)->update($data);
|
||||
$res = Banner::where('id', $id)->update($data);
|
||||
if ($res === false) {
|
||||
Log::record('编辑Banner', 0, '更新Banner失败', 'Banner管理');
|
||||
return json(['code' => 1, 'msg' => '更新Banner失败']);
|
||||
@ -429,7 +433,7 @@ class Yunzeradmin extends Base
|
||||
return json(['code' => 1, 'msg' => 'ID不能为空']);
|
||||
}
|
||||
|
||||
$res = Db::table('yz_banner')->where('id', $id)->update(['delete_time' => time()]);
|
||||
$res = Banner::where('id', $id)->update(['delete_time' => time()]);
|
||||
if (!$res) {
|
||||
Log::record('删除Banner', 0, '删除Banner失败', 'Banner管理');
|
||||
return json(['code' => 1, 'msg' => '删除Banner失败']);
|
||||
@ -452,7 +456,7 @@ class Yunzeradmin extends Base
|
||||
return json(['code' => 1, 'msg' => 'ID不能为空']);
|
||||
}
|
||||
|
||||
$res = Db::table('yz_banner')->where('id', $id)->update(['status' => $status]);
|
||||
$res = Banner::where('id', $id)->update(['status' => $status]);
|
||||
if ($res === false) {
|
||||
Log::record('修改Banner状态', 0, '更新状态失败', 'Banner管理');
|
||||
return json(['code' => 1, 'msg' => '更新状态失败']);
|
||||
|
||||
8
app/admin/model/AdminConfig.php
Normal file
8
app/admin/model/AdminConfig.php
Normal file
@ -0,0 +1,8 @@
|
||||
<?php
|
||||
namespace app\admin\model;
|
||||
|
||||
use think\Model;
|
||||
|
||||
class AdminConfig extends Model
|
||||
{
|
||||
}
|
||||
9
app/admin/model/AdminSysMenu.php
Normal file
9
app/admin/model/AdminSysMenu.php
Normal file
@ -0,0 +1,9 @@
|
||||
<?php
|
||||
namespace app\admin\model;
|
||||
|
||||
use think\Model;
|
||||
|
||||
class AdminSysMenu extends Model
|
||||
{
|
||||
|
||||
}
|
||||
8
app/admin/model/AdminUser.php
Normal file
8
app/admin/model/AdminUser.php
Normal file
@ -0,0 +1,8 @@
|
||||
<?php
|
||||
namespace app\admin\model;
|
||||
|
||||
use think\Model;
|
||||
|
||||
class AdminUser extends Model
|
||||
{
|
||||
}
|
||||
8
app/admin/model/AdminUserGroup.php
Normal file
8
app/admin/model/AdminUserGroup.php
Normal file
@ -0,0 +1,8 @@
|
||||
<?php
|
||||
namespace app\admin\model;
|
||||
|
||||
use think\Model;
|
||||
|
||||
class AdminUserGroup extends Model
|
||||
{
|
||||
}
|
||||
8
app/admin/model/Banner.php
Normal file
8
app/admin/model/Banner.php
Normal file
@ -0,0 +1,8 @@
|
||||
<?php
|
||||
namespace app\admin\model;
|
||||
|
||||
use think\Model;
|
||||
|
||||
class Banner extends Model
|
||||
{
|
||||
}
|
||||
8
app/admin/model/Log/LogsLogin.php
Normal file
8
app/admin/model/Log/LogsLogin.php
Normal file
@ -0,0 +1,8 @@
|
||||
<?php
|
||||
namespace app\admin\model\Log;
|
||||
|
||||
use think\Model;
|
||||
|
||||
class LogsLogin extends Model
|
||||
{
|
||||
}
|
||||
8
app/admin/model/Log/LogsOperation.php
Normal file
8
app/admin/model/Log/LogsOperation.php
Normal file
@ -0,0 +1,8 @@
|
||||
<?php
|
||||
namespace app\admin\model\Log;
|
||||
|
||||
use think\Model;
|
||||
|
||||
class LogsOperation extends Model
|
||||
{
|
||||
}
|
||||
8
app/admin/model/ZIconfont.php
Normal file
8
app/admin/model/ZIconfont.php
Normal file
@ -0,0 +1,8 @@
|
||||
<?php
|
||||
namespace app\admin\model;
|
||||
|
||||
use think\Model;
|
||||
|
||||
class ZIconfont extends Model
|
||||
{
|
||||
}
|
||||
@ -132,7 +132,7 @@
|
||||
});
|
||||
|
||||
// 获取分类列表
|
||||
$.get('{:url("article/getcate")}', function (res) {
|
||||
$.get('{:url("articles/getcate")}', function (res) {
|
||||
if (res.code == 0) {
|
||||
var html = '<option value="">请选择分类</option>';
|
||||
res.data.forEach(function (item) {
|
||||
@ -166,7 +166,7 @@
|
||||
data.field.content = content;
|
||||
|
||||
$.ajax({
|
||||
url: '{:url("article/add")}',
|
||||
url: '{:url("articles/add")}',
|
||||
type: 'POST',
|
||||
data: data.field,
|
||||
success: function (res) {
|
||||
@ -174,7 +174,7 @@
|
||||
if (res.code == 0) {
|
||||
layer.msg(res.msg, { icon: 1 });
|
||||
setTimeout(function () {
|
||||
window.location.href = '{:url("article/articlelist")}';
|
||||
window.location.href = '{:url("articles/articlelist")}';
|
||||
}, 1000);
|
||||
} else {
|
||||
layer.msg(res.msg, { icon: 2 });
|
||||
@ -269,6 +269,6 @@
|
||||
<script>
|
||||
//返回文章列表
|
||||
function goBack() {
|
||||
window.location.href = '{:url("article/articlelist")}';
|
||||
window.location.href = '{:url("articles/articlelist")}';
|
||||
}
|
||||
</script>
|
||||
@ -44,7 +44,7 @@
|
||||
var cid = urlParams.get('cid');
|
||||
|
||||
// 获取分类列表
|
||||
$.get('{:url("article/getcate")}', function (res) {
|
||||
$.get('{:url("articles/getcate")}', function (res) {
|
||||
if (res.code == 0) {
|
||||
var html = '<option value="0">顶级分类</option>';
|
||||
res.data.forEach(function (item) {
|
||||
@ -59,7 +59,7 @@
|
||||
|
||||
// 表单提交
|
||||
form.on('submit(formSubmit)', function (data) {
|
||||
$.post('{:url("article/cateadd")}', data.field, function (res) {
|
||||
$.post('{:url("articles/cateadd")}', data.field, function (res) {
|
||||
if (res.code == 0) {
|
||||
layer.msg(res.msg, { icon: 1 });
|
||||
setTimeout(function () {
|
||||
@ -115,7 +115,7 @@
|
||||
});
|
||||
|
||||
// 获取分类列表
|
||||
$.get('{:url("article/getcate")}', function (res) {
|
||||
$.get('{:url("articles/getcate")}', function (res) {
|
||||
if (res.code == 0) {
|
||||
var html = '<option value="0">顶级分类</option>';
|
||||
res.data.forEach(function (item) {
|
||||
@ -136,7 +136,7 @@
|
||||
|
||||
// 表单提交
|
||||
form.on('submit(formSubmit)', function (data) {
|
||||
$.post('{:url("article/cateedit")}', data.field, function (res) {
|
||||
$.post('{:url("articles/cateedit")}', data.field, function (res) {
|
||||
if (res.code == 0) {
|
||||
layer.msg(res.msg, { icon: 1 });
|
||||
setTimeout(function () {
|
||||
@ -135,7 +135,7 @@
|
||||
});
|
||||
|
||||
// 获取分类列表
|
||||
$.get('{:url("article/getcate")}', function (res) {
|
||||
$.get('{:url("articles/getcate")}', function (res) {
|
||||
if (res.code == 0) {
|
||||
var html = '<option value="">请选择分类</option>';
|
||||
res.data.forEach(function (item) {
|
||||
@ -171,7 +171,7 @@
|
||||
data.field.content = content;
|
||||
|
||||
$.ajax({
|
||||
url: '{:url("article/edit")}?id={$info.id}',
|
||||
url: '{:url("articles/edit")}?id={$info.id}',
|
||||
type: 'POST',
|
||||
data: data.field,
|
||||
success: function (res) {
|
||||
@ -179,7 +179,7 @@
|
||||
if (res.code == 0) {
|
||||
layer.msg(res.msg, { icon: 1 });
|
||||
setTimeout(function () {
|
||||
window.location.href = '{:url("article/articlelist")}';
|
||||
window.location.href = '{:url("articles/articlelist")}';
|
||||
}, 1000);
|
||||
} else {
|
||||
layer.msg(res.msg, { icon: 2 });
|
||||
@ -280,6 +280,6 @@
|
||||
<script>
|
||||
//返回文章列表
|
||||
function goBack() {
|
||||
window.location.href = '{:url("article/articlelist")}';
|
||||
window.location.href = '{:url("articles/articlelist")}';
|
||||
}
|
||||
</script>
|
||||
@ -99,10 +99,10 @@
|
||||
<!-- 侧边菜单 -->
|
||||
<div class="layui-side layui-side-menu">
|
||||
<div class="layui-side-scroll">
|
||||
<div class="layui-logo" lay-href="" style="display: flex;align-items: center;">
|
||||
<!-- <div class="layui-logo" lay-href="" style="display: flex;align-items: center;">
|
||||
<img src="/static/images/logo-l-w.png" alt="{$config['admin_name']}"
|
||||
style="max-width: 100%; max-height: 100%;">
|
||||
</div>
|
||||
</div> -->
|
||||
<ul class="layui-nav layui-nav-tree" lay-shrink="all" id="LAY-system-side-menu"
|
||||
lay-filter="layadmin-system-side-menu">
|
||||
<!-- 固定的工作台菜单项 -->
|
||||
|
||||
@ -316,7 +316,7 @@ function updateTime() {
|
||||
|
||||
// 获取文章统计数据
|
||||
function getArticleCounts() {
|
||||
fetch('{:url("article/counts")}')
|
||||
fetch('{:url("articles/counts")}')
|
||||
.then(response => response.json())
|
||||
.then(res => {
|
||||
console.log('文章统计接口返回数据:', res);
|
||||
|
||||
@ -47,18 +47,6 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/html" id="tableToolbar">
|
||||
<div class="layui-btn-container">
|
||||
<button class="layui-btn layui-btn-sm layui-btn-danger" lay-event="clearAll">
|
||||
<i class="layui-icon layui-icon-delete"></i> 清空日志
|
||||
</button>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script type="text/html" id="tableBar">
|
||||
<a class="layui-btn layui-btn-xs layui-btn-danger" lay-event="del">删除</a>
|
||||
</script>
|
||||
|
||||
<script src="/static/layui/layui.js"></script>
|
||||
<script>
|
||||
layui.use(['table', 'form', 'laydate'], function(){
|
||||
@ -78,7 +66,6 @@
|
||||
elem: '#loginLogTable',
|
||||
url: '{:url("log/login")}',
|
||||
method: 'post',
|
||||
toolbar: '#tableToolbar',
|
||||
defaultToolbar: ['filter', 'exports', 'print'],
|
||||
parseData: function(res) {
|
||||
return {
|
||||
@ -89,20 +76,19 @@
|
||||
};
|
||||
},
|
||||
cols: [[
|
||||
{field: 'id', title: 'ID', width: 80, sort: true},
|
||||
{field: 'username', title: '用户名', width: 120},
|
||||
{field: 'ip_address', title: 'IP地址', width: 130},
|
||||
{field: 'location', title: '登录地点', width: 120},
|
||||
{field: 'device_type', title: '设备类型', width: 100},
|
||||
{field: 'user_agent', title: '浏览器', width: 200},
|
||||
{field: 'login_status', title: '状态', width: 100, templet: function(d){
|
||||
{field: 'id', title: 'ID', width: 80, sort: true, align: 'center'},
|
||||
{field: 'username', title: '用户名', align: 'center'},
|
||||
{field: 'ip_address', title: 'IP地址', width: 130, align: 'center'},
|
||||
{field: 'location', title: '登录地点', width: 120, align: 'center'},
|
||||
{field: 'device_type', title: '设备类型', width: 100, align: 'center'},
|
||||
{field: 'user_agent', title: '浏览器', width: 200, align: 'center'},
|
||||
{field: 'login_status', title: '状态', width: 100, align: 'center', templet: function(d){
|
||||
return d.login_status == 1 ?
|
||||
'<span class="layui-badge layui-bg-green">成功</span>' :
|
||||
'<span class="layui-badge layui-bg-red">失败</span>';
|
||||
}},
|
||||
{field: 'failure_reason', title: '失败原因', width: 150},
|
||||
{field: 'login_time', title: '登录时间', width: 180, sort: true},
|
||||
{title: '操作', toolbar: '#tableBar', width: 80, fixed: 'right'}
|
||||
{field: 'failure_reason', title: '失败原因', width: 150, align: 'center'},
|
||||
{field: 'login_time', title: '登录时间', width: 180, sort: true, align: 'center'}
|
||||
]],
|
||||
page: true,
|
||||
limit: 10,
|
||||
@ -125,41 +111,6 @@
|
||||
});
|
||||
return false;
|
||||
});
|
||||
|
||||
// 监听工具条
|
||||
table.on('tool(loginLogTable)', function(obj){
|
||||
var data = obj.data;
|
||||
if(obj.event === 'del'){
|
||||
layer.confirm('确定删除这条日志吗?', function(index){
|
||||
$.post('{:url("log/deleteLogin")}', {id: data.id}, function(res){
|
||||
if(res.code === 0){
|
||||
layer.msg(res.msg, {icon: 1});
|
||||
obj.del();
|
||||
}else{
|
||||
layer.msg(res.msg, {icon: 2});
|
||||
}
|
||||
});
|
||||
layer.close(index);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// 监听头工具栏事件
|
||||
table.on('toolbar(loginLogTable)', function(obj){
|
||||
if(obj.event === 'clearAll'){
|
||||
layer.confirm('确定要清空所有登录日志吗?', function(index){
|
||||
$.post('{:url("log/clearLogin")}', function(res){
|
||||
if(res.code === 0){
|
||||
layer.msg(res.msg, {icon: 1});
|
||||
table.reload('loginLogTable');
|
||||
}else{
|
||||
layer.msg(res.msg, {icon: 2});
|
||||
}
|
||||
});
|
||||
layer.close(index);
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
<div class="location-item">
|
||||
<a href="/">首页</a>
|
||||
<span>></span>
|
||||
<a href="/index/article/index" id="cateLink"></a>
|
||||
<a href="/index/articles/index" id="cateLink"></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -461,7 +461,7 @@
|
||||
const prevArticle = document.getElementById('prevArticle');
|
||||
if (data.prevArticle) {
|
||||
prevArticle.innerHTML = `
|
||||
<a href="/index/article/detail?id=${data.prevArticle.id}">
|
||||
<a href="/index/articles/detail?id=${data.prevArticle.id}">
|
||||
<i class="fa fa-arrow-left"></i> 上一篇:${data.prevArticle.title}
|
||||
</a>
|
||||
`;
|
||||
@ -473,7 +473,7 @@
|
||||
const nextArticle = document.getElementById('nextArticle');
|
||||
if (data.nextArticle) {
|
||||
nextArticle.innerHTML = `
|
||||
<a href="/index/article/detail?id=${data.nextArticle.id}">
|
||||
<a href="/index/articles/detail?id=${data.nextArticle.id}">
|
||||
下一篇:${data.nextArticle.title} <i class="fa fa-arrow-right"></i>
|
||||
</a>
|
||||
`;
|
||||
@ -486,7 +486,7 @@
|
||||
if (data.relatedArticles && data.relatedArticles.length > 0) {
|
||||
relatedArticles.innerHTML = data.relatedArticles.map(article => `
|
||||
<div class="related-item">
|
||||
<a href="/index/article/detail?id=${article.id}">
|
||||
<a href="/index/articles/detail?id=${article.id}">
|
||||
<div class="related-image">
|
||||
<img src="${article.image}" alt="${article.title}">
|
||||
</div>
|
||||
@ -512,7 +512,7 @@
|
||||
}
|
||||
|
||||
// 获取文章详情
|
||||
fetch(`/index/article/detail?id=${articleId}`, {
|
||||
fetch(`/index/articles/detail?id=${articleId}`, {
|
||||
headers: {
|
||||
'X-Requested-With': 'XMLHttpRequest'
|
||||
}
|
||||
@ -546,7 +546,7 @@
|
||||
const likeBtn = document.querySelector('.like-btn');
|
||||
if (likeBtn) {
|
||||
likeBtn.addEventListener('click', function() {
|
||||
fetch('/index/article/like?id=' + articleId, {
|
||||
fetch('/index/articles/like?id=' + articleId, {
|
||||
method: 'POST'
|
||||
})
|
||||
.then(response => response.json())
|
||||
@ -590,7 +590,7 @@
|
||||
|
||||
// 更新文章访问次数
|
||||
function updateArticleViews(articleId) {
|
||||
fetch('/index/article/updateViews', {
|
||||
fetch('/index/articles/updateViews', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
|
||||
@ -347,7 +347,7 @@
|
||||
});
|
||||
|
||||
return `
|
||||
<div class="opencourse product-item" onclick="window.open('/index/article/detail?id=${article.id || ''}', '_blank')">
|
||||
<div class="opencourse product-item" onclick="window.open('/index/articles/detail?id=${article.id || ''}', '_blank')">
|
||||
<div class="video">
|
||||
<img src="${article.image || ''}" alt="" class="cover">
|
||||
</div>
|
||||
|
||||
@ -10,7 +10,7 @@ return [
|
||||
// 自动写入时间戳字段
|
||||
// true为自动识别类型 false关闭
|
||||
// 字符串则明确指定时间字段类型 支持 int timestamp datetime date
|
||||
'auto_timestamp' => true,
|
||||
'auto_timestamp' => false,
|
||||
|
||||
// 时间字段取出后的默认时间格式
|
||||
'datetime_format' => 'Y-m-d H:i:s',
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
<?php /*a:3:{s:68:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\yunzertest\test_list.php";i:1745483534;s:61:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\public\header.php";i:1745500576;s:59:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\public\tail.php";i:1745482530;}*/ ?>
|
||||
<?php /*a:3:{s:68:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\yunzertest\test_list.php";i:1746709977;s:61:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\public\header.php";i:1746849526;s:59:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\public\tail.php";i:1746709977;}*/ ?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
@ -6,7 +6,9 @@
|
||||
<meta name="renderer" content="webkit">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
||||
<link rel="stylesheet" type="text/css" href="/static/third/layui/css/layui.css" media="all"/>
|
||||
<link rel="stylesheet" type="text/css" href="/static/layui/css/layui.css" media="all"/>
|
||||
<link rel="stylesheet" type="text/css" href="/static/css/moban.css" media="all"/>
|
||||
<link rel="stylesheet" type="text/css" href="/static/css/wangeditor.css" media="all"/>
|
||||
<style type="text/css">
|
||||
.header span{background:#009688;margin-left:30px;padding:10px;color:#ffffff;}
|
||||
.header div{border-bottom:solid 2px #009688;margin-top: 8px;}
|
||||
@ -77,7 +79,7 @@
|
||||
}
|
||||
.close-img { background: url(/static/images/close_img.png); background-size: 20px 20px; width:20px; height: 20px; position: absolute; right: 5px; top: 5px; z-index: 2;}
|
||||
</style>
|
||||
<script type="text/javascript" src="/static/third/layui/layui.js"></script>
|
||||
<script type="text/javascript" src="/static/layui/layui.js"></script>
|
||||
<script type="text/javascript">
|
||||
layui.use(['layer','form','table','laydate','element','upload'],function(){
|
||||
layer = layui.layer; // layui 弹框
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
<?php /*a:3:{s:61:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\index\welcome.php";i:1747615358;s:61:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\public\header.php";i:1746849526;s:59:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\public\tail.php";i:1746709977;}*/ ?>
|
||||
<?php /*a:3:{s:61:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\index\welcome.php";i:1747626653;s:61:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\public\header.php";i:1746849526;s:59:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\public\tail.php";i:1746709977;}*/ ?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
@ -410,7 +410,7 @@ function updateTime() {
|
||||
|
||||
// 获取文章统计数据
|
||||
function getArticleCounts() {
|
||||
fetch('<?php echo url("article/counts"); ?>')
|
||||
fetch('<?php echo url("articles/counts"); ?>')
|
||||
.then(response => response.json())
|
||||
.then(res => {
|
||||
console.log('文章统计接口返回数据:', res);
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
<?php /*a:3:{s:75:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\yunzertest\test_static_list.php";i:1746709977;s:61:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\public\header.php";i:1746709977;s:59:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\public\tail.php";i:1746709977;}*/ ?>
|
||||
<?php /*a:3:{s:75:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\yunzertest\test_static_list.php";i:1746709977;s:61:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\public\header.php";i:1746849526;s:59:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\public\tail.php";i:1746709977;}*/ ?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
@ -6,8 +6,9 @@
|
||||
<meta name="renderer" content="webkit">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
||||
<link rel="stylesheet" type="text/css" href="/static/layui/css/layui.css" media="all"/>
|
||||
<link rel="stylesheet" type="text/css" href="/static/css/moban.css" media="all"/>
|
||||
<link rel="stylesheet" type="text/css" href="/static/third/layui/css/layui.css" media="all"/>
|
||||
<link rel="stylesheet" type="text/css" href="/static/css/wangeditor.css" media="all"/>
|
||||
<style type="text/css">
|
||||
.header span{background:#009688;margin-left:30px;padding:10px;color:#ffffff;}
|
||||
.header div{border-bottom:solid 2px #009688;margin-top: 8px;}
|
||||
@ -78,7 +79,7 @@
|
||||
}
|
||||
.close-img { background: url(/static/images/close_img.png); background-size: 20px 20px; width:20px; height: 20px; position: absolute; right: 5px; top: 5px; z-index: 2;}
|
||||
</style>
|
||||
<script type="text/javascript" src="/static/third/layui/layui.js"></script>
|
||||
<script type="text/javascript" src="/static/layui/layui.js"></script>
|
||||
<script type="text/javascript">
|
||||
layui.use(['layer','form','table','laydate','element','upload'],function(){
|
||||
layer = layui.layer; // layui 弹框
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
<?php /*a:1:{s:59:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\index\index.php";i:1747615358;}*/ ?>
|
||||
<?php /*a:1:{s:59:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\index\index.php";i:1747638193;}*/ ?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
@ -100,10 +100,10 @@
|
||||
<!-- 侧边菜单 -->
|
||||
<div class="layui-side layui-side-menu">
|
||||
<div class="layui-side-scroll">
|
||||
<div class="layui-logo" lay-href="" style="display: flex;align-items: center;">
|
||||
<!-- <div class="layui-logo" lay-href="" style="display: flex;align-items: center;">
|
||||
<img src="/static/images/logo-l-w.png" alt="<?php echo htmlentities((string) $config['admin_name']); ?>"
|
||||
style="max-width: 100%; max-height: 100%;">
|
||||
</div>
|
||||
</div> -->
|
||||
<ul class="layui-nav layui-nav-tree" lay-shrink="all" id="LAY-system-side-menu"
|
||||
lay-filter="layadmin-system-side-menu">
|
||||
<!-- 固定的工作台菜单项 -->
|
||||
|
||||
298
runtime/admin/temp/84edc0bba962f694a2d0f88ed9174143.php
Normal file
298
runtime/admin/temp/84edc0bba962f694a2d0f88ed9174143.php
Normal file
@ -0,0 +1,298 @@
|
||||
<?php /*a:2:{s:68:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\articles\articlelist.php";i:1747623409;s:61:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\public\header.php";i:1746849526;}*/ ?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title><?php echo htmlentities((string) $config['admin_name']); ?></title>
|
||||
<meta name="renderer" content="webkit">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
||||
<link rel="stylesheet" type="text/css" href="/static/layui/css/layui.css" media="all"/>
|
||||
<link rel="stylesheet" type="text/css" href="/static/css/moban.css" media="all"/>
|
||||
<link rel="stylesheet" type="text/css" href="/static/css/wangeditor.css" media="all"/>
|
||||
<style type="text/css">
|
||||
.header span{background:#009688;margin-left:30px;padding:10px;color:#ffffff;}
|
||||
.header div{border-bottom:solid 2px #009688;margin-top: 8px;}
|
||||
.header button{float:right;margin-top:-5px;}
|
||||
.pagination {
|
||||
display: inline-block;
|
||||
padding-left: 0;
|
||||
margin: 20px 0;
|
||||
border-radius: 4px;
|
||||
}
|
||||
.pagination > li {
|
||||
display: inline;
|
||||
}
|
||||
.pagination > li > a,
|
||||
.pagination > li > span {
|
||||
position: relative;
|
||||
float: left;
|
||||
padding: 6px 12px;
|
||||
margin-left: -1px;
|
||||
line-height: 1.42857143;
|
||||
color: #337ab7;
|
||||
text-decoration: none;
|
||||
background-color: #fff;
|
||||
border: 1px solid #ddd;
|
||||
}
|
||||
.pagination > li:first-child > a,
|
||||
.pagination > li:first-child > span {
|
||||
margin-left: 0;
|
||||
border-top-left-radius: 4px;
|
||||
border-bottom-left-radius: 4px;
|
||||
}
|
||||
.pagination > li:last-child > a,
|
||||
.pagination > li:last-child > span {
|
||||
border-top-right-radius: 4px;
|
||||
border-bottom-right-radius: 4px;
|
||||
}
|
||||
.pagination > li > a:hover,
|
||||
.pagination > li > span:hover,
|
||||
.pagination > li > a:focus,
|
||||
.pagination > li > span:focus {
|
||||
z-index: 2;
|
||||
color: #23527c;
|
||||
background-color: #eee;
|
||||
border-color: #ddd;
|
||||
}
|
||||
.pagination > .active > a,
|
||||
.pagination > .active > span,
|
||||
.pagination > .active > a:hover,
|
||||
.pagination > .active > span:hover,
|
||||
.pagination > .active > a:focus,
|
||||
.pagination > .active > span:focus {
|
||||
z-index: 3;
|
||||
color: #fff;
|
||||
cursor: default;
|
||||
background-color: #337ab7;
|
||||
border-color: #337ab7;
|
||||
}
|
||||
.pagination > .disabled > span,
|
||||
.pagination > .disabled > span:hover,
|
||||
.pagination > .disabled > span:focus,
|
||||
.pagination > .disabled > a,
|
||||
.pagination > .disabled > a:hover,
|
||||
.pagination > .disabled > a:focus {
|
||||
color: #777;
|
||||
cursor: not-allowed;
|
||||
background-color: #fff;
|
||||
border-color: #ddd;
|
||||
}
|
||||
.close-img { background: url(/static/images/close_img.png); background-size: 20px 20px; width:20px; height: 20px; position: absolute; right: 5px; top: 5px; z-index: 2;}
|
||||
</style>
|
||||
<script type="text/javascript" src="/static/layui/layui.js"></script>
|
||||
<script type="text/javascript">
|
||||
layui.use(['layer','form','table','laydate','element','upload'],function(){
|
||||
layer = layui.layer; // layui 弹框
|
||||
form = layui.form; // layui form表单
|
||||
table = layui.table; // layui 表格
|
||||
laydate = layui.laydate; // layui 时间框
|
||||
element = layui.element; // layui element
|
||||
upload = layui.upload; // layui 上传
|
||||
$ = layui.jquery; // layui jquery
|
||||
})
|
||||
</script>
|
||||
</head>
|
||||
<body style="padding:10px; box-sizing: border-box;">
|
||||
<div class="config-container">
|
||||
<!-- 页面头部样式 -->
|
||||
<div class="config-header" style="display: flex;flex-direction: column;flex-wrap: wrap;align-items: flex-start;">
|
||||
<div class="maintitle">
|
||||
<i class="layui-icon layui-icon-list"></i>
|
||||
<span>文章列表</span>
|
||||
</div>
|
||||
<div style="display: flex;align-items: flex-start;flex-direction: column;gap: 15px;margin-bottom: 10px;">
|
||||
<div class="shaixuan">
|
||||
<label>筛选:</label>
|
||||
<div class="layui-form" style="display: flex; gap: 10px;">
|
||||
<div class="layui-input-inline">
|
||||
<select id="categoryFilter" lay-filter="categoryFilter" lay-verify="">
|
||||
<option value="">全部分类</option>
|
||||
<?php if(is_array($categories) || $categories instanceof \think\Collection || $categories instanceof \think\Paginator): $i = 0; $__LIST__ = $categories;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$category): $mod = ($i % 2 );++$i;?>
|
||||
<optgroup label="<?php echo htmlentities((string) $category['name']); ?>">
|
||||
<?php if(is_array($category['children']) || $category['children'] instanceof \think\Collection || $category['children'] instanceof \think\Paginator): $i = 0; $__LIST__ = $category['children'];if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$subCategory): $mod = ($i % 2 );++$i;?>
|
||||
<option value="<?php echo htmlentities((string) $subCategory['id']); ?>"><?php echo htmlentities((string) $subCategory['name']); ?></option>
|
||||
<?php endforeach; endif; else: echo "" ;endif; ?>
|
||||
</optgroup>
|
||||
<?php endforeach; endif; else: echo "" ;endif; ?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" id="titleSearch" placeholder="搜索标题" class="layui-input">
|
||||
</div>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" id="authorSearch" placeholder="搜索作者" class="layui-input">
|
||||
</div>
|
||||
<button type="button" class="layui-btn layui-btn-normal" onclick="doSearch()">
|
||||
<i class="layui-icon layui-icon-search"></i>搜索
|
||||
</button>
|
||||
<button type="button" class="layui-btn layui-btn-primary layui-border-blue" onclick="doRefresh()">
|
||||
<i class="layui-icon layui-icon-refresh"></i>重置
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<button type="button" class="layui-btn layui-btn-normal" onclick="add()">
|
||||
<i class="layui-icon layui-icon-add-1"></i>添加文章
|
||||
</button>
|
||||
<button type="button" class="layui-btn layui-btn-primary layui-border-blue" onclick="refresh()">
|
||||
<i class="layui-icon layui-icon-refresh"></i>刷新
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<table id="articleTable" lay-filter="articleTable"></table>
|
||||
</div>
|
||||
|
||||
<script type="text/html" id="imageTemplate">
|
||||
{{# if(d.image){ }}
|
||||
<img src="{{ d.image }}" style="max-width: 50px; max-height: 50px;">
|
||||
{{# } }}
|
||||
</script>
|
||||
|
||||
<script type="text/html" id="statusTemplate">
|
||||
{{# if(d.status === 0){ }}
|
||||
<span style="color:red;">草稿</span>
|
||||
{{# } else if(d.status === 1){ }}
|
||||
<span style="color:orange;">待审核</span>
|
||||
{{# } else if(d.status === 2){ }}
|
||||
<span style="color:green;">已发布</span>
|
||||
{{# } else if(d.status === 3){ }}
|
||||
<span style="color:gray;">隐藏</span>
|
||||
{{# } }}
|
||||
</script>
|
||||
|
||||
<script type="text/html" id="operationBar">
|
||||
<button type="button" class="layui-btn layui-btn-normal layui-btn-xs" lay-event="edit">
|
||||
<i class="layui-icon layui-icon-edit"></i>编辑
|
||||
</button>
|
||||
<button type="button" class="layui-btn layui-btn-primary layui-btn-xs" lay-event="del">
|
||||
<i class="layui-icon layui-icon-delete"></i>删除
|
||||
</button>
|
||||
</script>
|
||||
|
||||
<script type="text/javascript">
|
||||
layui.use(['layer', 'form', 'table'], function () {
|
||||
var layer = layui.layer;
|
||||
var $ = layui.jquery;
|
||||
var form = layui.form;
|
||||
var table = layui.table;
|
||||
|
||||
// 初始化表格
|
||||
table.render({
|
||||
elem: '#articleTable',
|
||||
url: '/admin/articles/articlelist',
|
||||
method: 'post',
|
||||
cols: [[
|
||||
{ field: 'id', title: 'ID', align: 'center', width: 80 },
|
||||
{ field: 'title', title: '标题' },
|
||||
{ field: 'cate', title: '分类', align: 'center', width: 180 },
|
||||
{ field: 'image', title: '封面', templet: '#imageTemplate', align: 'center', width: 180 },
|
||||
{ field: 'author', title: '作者', align: 'center', width: 120 },
|
||||
{ field: 'status', title: '状态', templet: '#statusTemplate', align: 'center', width: 80 },
|
||||
{ field: 'publishdate', title: '发布时间', align: 'center', width: 180 },
|
||||
{ title: '操作', toolbar: '#operationBar', align: 'center', width: 150 }
|
||||
]],
|
||||
page: true,
|
||||
limit: 10,
|
||||
limits: [10, 50, 100],
|
||||
//height: 'full-220'
|
||||
});
|
||||
|
||||
// 监听工具条事件
|
||||
table.on('tool(articleTable)', function (obj) {
|
||||
var data = obj.data;
|
||||
if (obj.event === 'edit') {
|
||||
edit(data.id);
|
||||
} else if (obj.event === 'del') {
|
||||
del(data.id);
|
||||
}
|
||||
});
|
||||
|
||||
// 监听分类筛选变化
|
||||
form.on('select(categoryFilter)', function (data) {
|
||||
filterByCategory(data.value);
|
||||
});
|
||||
});
|
||||
|
||||
function filterByCategory(categoryId) {
|
||||
reloadTable();
|
||||
}
|
||||
|
||||
function doSearch() {
|
||||
var titleKeyword = $('#titleSearch').val().trim();
|
||||
var authorKeyword = $('#authorSearch').val().trim();
|
||||
|
||||
if (!titleKeyword && !authorKeyword && !$('#categoryFilter').val()) {
|
||||
layer.msg('请输入搜索条件', { icon: 0 });
|
||||
return;
|
||||
}
|
||||
|
||||
reloadTable();
|
||||
}
|
||||
|
||||
function doRefresh() {
|
||||
// 清空搜索条件
|
||||
$('#titleSearch').val('');
|
||||
$('#authorSearch').val('');
|
||||
$('#categoryFilter').val('');
|
||||
layui.form.render('select'); // 重新渲染select
|
||||
|
||||
// 重新加载表格,不带任何筛选条件
|
||||
layui.table.reload('articleTable', {
|
||||
where: {},
|
||||
page: {
|
||||
curr: 1
|
||||
}
|
||||
});
|
||||
|
||||
layer.msg('已重置', { icon: 1 });
|
||||
}
|
||||
|
||||
function reloadTable() {
|
||||
var categoryId = $('#categoryFilter').val();
|
||||
var categoryName = categoryId ? $('#categoryFilter option[value="' + categoryId + '"]').text() : '';
|
||||
var titleKeyword = $('#titleSearch').val().trim();
|
||||
var authorKeyword = $('#authorSearch').val().trim();
|
||||
|
||||
layui.table.reload('articleTable', {
|
||||
where: {
|
||||
category: categoryName,
|
||||
title: titleKeyword,
|
||||
author: authorKeyword
|
||||
},
|
||||
page: {
|
||||
curr: 1
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function add() {
|
||||
window.location.href = '/admin/articles/add';
|
||||
}
|
||||
|
||||
function edit(id) {
|
||||
window.location.href = '/admin/articles/edit?id=' + id;
|
||||
}
|
||||
|
||||
function del(id) {
|
||||
layer.confirm('确定要删除该文章吗?', {
|
||||
btn: ['确定', '取消']
|
||||
}, function () {
|
||||
$.post('/admin/articles/delete', { id: id }, function (res) {
|
||||
if (res.code == 0) {
|
||||
layer.msg(res.msg, { icon: 1 });
|
||||
setTimeout(function () {
|
||||
layui.table.reload('articleTable');
|
||||
}, 1000);
|
||||
} else {
|
||||
layer.msg(res.msg, { icon: 2 });
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function refresh() {
|
||||
layui.table.reload('articleTable');
|
||||
}
|
||||
</script>
|
||||
619
runtime/admin/temp/9d1675bab256bcb1262f747ef7d94459.php
Normal file
619
runtime/admin/temp/9d1675bab256bcb1262f747ef7d94459.php
Normal file
@ -0,0 +1,619 @@
|
||||
<?php /*a:2:{s:68:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\articles\articlecate.php";i:1747623415;s:61:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\public\header.php";i:1746849526;}*/ ?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title><?php echo htmlentities((string) $config['admin_name']); ?></title>
|
||||
<meta name="renderer" content="webkit">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
||||
<link rel="stylesheet" type="text/css" href="/static/layui/css/layui.css" media="all"/>
|
||||
<link rel="stylesheet" type="text/css" href="/static/css/moban.css" media="all"/>
|
||||
<link rel="stylesheet" type="text/css" href="/static/css/wangeditor.css" media="all"/>
|
||||
<style type="text/css">
|
||||
.header span{background:#009688;margin-left:30px;padding:10px;color:#ffffff;}
|
||||
.header div{border-bottom:solid 2px #009688;margin-top: 8px;}
|
||||
.header button{float:right;margin-top:-5px;}
|
||||
.pagination {
|
||||
display: inline-block;
|
||||
padding-left: 0;
|
||||
margin: 20px 0;
|
||||
border-radius: 4px;
|
||||
}
|
||||
.pagination > li {
|
||||
display: inline;
|
||||
}
|
||||
.pagination > li > a,
|
||||
.pagination > li > span {
|
||||
position: relative;
|
||||
float: left;
|
||||
padding: 6px 12px;
|
||||
margin-left: -1px;
|
||||
line-height: 1.42857143;
|
||||
color: #337ab7;
|
||||
text-decoration: none;
|
||||
background-color: #fff;
|
||||
border: 1px solid #ddd;
|
||||
}
|
||||
.pagination > li:first-child > a,
|
||||
.pagination > li:first-child > span {
|
||||
margin-left: 0;
|
||||
border-top-left-radius: 4px;
|
||||
border-bottom-left-radius: 4px;
|
||||
}
|
||||
.pagination > li:last-child > a,
|
||||
.pagination > li:last-child > span {
|
||||
border-top-right-radius: 4px;
|
||||
border-bottom-right-radius: 4px;
|
||||
}
|
||||
.pagination > li > a:hover,
|
||||
.pagination > li > span:hover,
|
||||
.pagination > li > a:focus,
|
||||
.pagination > li > span:focus {
|
||||
z-index: 2;
|
||||
color: #23527c;
|
||||
background-color: #eee;
|
||||
border-color: #ddd;
|
||||
}
|
||||
.pagination > .active > a,
|
||||
.pagination > .active > span,
|
||||
.pagination > .active > a:hover,
|
||||
.pagination > .active > span:hover,
|
||||
.pagination > .active > a:focus,
|
||||
.pagination > .active > span:focus {
|
||||
z-index: 3;
|
||||
color: #fff;
|
||||
cursor: default;
|
||||
background-color: #337ab7;
|
||||
border-color: #337ab7;
|
||||
}
|
||||
.pagination > .disabled > span,
|
||||
.pagination > .disabled > span:hover,
|
||||
.pagination > .disabled > span:focus,
|
||||
.pagination > .disabled > a,
|
||||
.pagination > .disabled > a:hover,
|
||||
.pagination > .disabled > a:focus {
|
||||
color: #777;
|
||||
cursor: not-allowed;
|
||||
background-color: #fff;
|
||||
border-color: #ddd;
|
||||
}
|
||||
.close-img { background: url(/static/images/close_img.png); background-size: 20px 20px; width:20px; height: 20px; position: absolute; right: 5px; top: 5px; z-index: 2;}
|
||||
</style>
|
||||
<script type="text/javascript" src="/static/layui/layui.js"></script>
|
||||
<script type="text/javascript">
|
||||
layui.use(['layer','form','table','laydate','element','upload'],function(){
|
||||
layer = layui.layer; // layui 弹框
|
||||
form = layui.form; // layui form表单
|
||||
table = layui.table; // layui 表格
|
||||
laydate = layui.laydate; // layui 时间框
|
||||
element = layui.element; // layui element
|
||||
upload = layui.upload; // layui 上传
|
||||
$ = layui.jquery; // layui jquery
|
||||
})
|
||||
</script>
|
||||
</head>
|
||||
<body style="padding:10px; box-sizing: border-box;">
|
||||
<div class="config-container">
|
||||
<!-- 页面头部样式 -->
|
||||
<div class="config-header" style="display: flex;flex-direction: column;flex-wrap: wrap;align-items: flex-start;">
|
||||
<div class="maintitle">
|
||||
<i class="layui-icon layui-icon-app"></i>
|
||||
<span>文章分类管理</span>
|
||||
</div>
|
||||
<div style="display: flex;align-items: flex-start;flex-direction: column;gap: 15px;margin-bottom: 10px;">
|
||||
<div>
|
||||
<button type="button" class="layui-btn layui-btn-normal" onclick="add()">
|
||||
<i class="layui-icon layui-icon-add-1"></i>添加分类
|
||||
</button>
|
||||
<button type="button" class="layui-btn layui-btn-primary layui-border-blue" onclick="refresh()">
|
||||
<i class="layui-icon layui-icon-refresh"></i>刷新
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 主要内容区 -->
|
||||
<div class="main-content">
|
||||
<div class="layui-row layui-col-space20">
|
||||
<!-- 左侧分类列表 -->
|
||||
<div class="layui-col-md7">
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-header">
|
||||
<span>分类列表</span>
|
||||
<small class="text-muted">支持两级分类结构</small>
|
||||
</div>
|
||||
<div class="layui-card-body">
|
||||
<div id="categoryList" class="category-tree"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 右侧分类信息 -->
|
||||
<div class="layui-col-md5">
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-header">
|
||||
<span>分类信息</span>
|
||||
</div>
|
||||
<div class="layui-card-body">
|
||||
<!-- 默认提示 -->
|
||||
<div id="defaultTip" class="empty-tip">
|
||||
<i class="layui-icon layui-icon-face-surprised"></i>
|
||||
<p>请选择左侧分类或点击新增按钮</p>
|
||||
</div>
|
||||
|
||||
<!-- 分类表单 -->
|
||||
<form class="layui-form category-form" lay-filter="categoryForm" style="display: none;">
|
||||
<input type="hidden" name="id" id="categoryId">
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">分类名称</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="name" required lay-verify="required" placeholder="请输入分类名称"
|
||||
autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">父级分类</label>
|
||||
<div class="layui-input-block">
|
||||
<select name="cid" lay-verify="required">
|
||||
<option value="0">顶级分类</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">封面图片</label>
|
||||
<div class="layui-input-block">
|
||||
<div class="layui-upload-drag" id="uploadImage">
|
||||
<i class="layui-icon layui-icon-upload"></i>
|
||||
<p>点击上传或拖拽图片至此处</p>
|
||||
<div class="layui-hide" id="uploadPreview">
|
||||
<hr>
|
||||
<img src="" alt="封面图片" style="max-width: 100%">
|
||||
</div>
|
||||
</div>
|
||||
<input type="hidden" name="image" id="imageInput">
|
||||
<div class="layui-form-mid layui-word-aux">建议尺寸:250px * 140px</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">排序</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="number" name="sort" value="0" class="layui-input"
|
||||
placeholder="数字越大越靠前">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">状态</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="radio" name="status" value="1" title="正常" checked>
|
||||
<input type="radio" name="status" value="0" title="禁用">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item form-actions">
|
||||
<div class="layui-input-block">
|
||||
<button class="layui-btn" lay-submit lay-filter="saveCategory">保存</button>
|
||||
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
|
||||
<button type="button" class="layui-btn layui-btn-danger" id="deleteBtn"
|
||||
style="display: none;">删除</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
/* 页面整体样式 */
|
||||
.config-container {
|
||||
padding: 15px;
|
||||
/* background: #f2f2f2; */
|
||||
}
|
||||
|
||||
.layui-col-md7 .layui-btn-primary {
|
||||
border-color: #d2d2d2;
|
||||
background: 0 0;
|
||||
color: #5f5f5f
|
||||
}
|
||||
|
||||
.layui-col-md7 .layui-btn-primary:hover {
|
||||
background-color: #1e9fff;
|
||||
color: #efefef
|
||||
}
|
||||
|
||||
/* 页面头部样式 */
|
||||
.page-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 15px;
|
||||
padding: 10px 15px;
|
||||
background: #fff;
|
||||
border-radius: 2px;
|
||||
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
|
||||
}
|
||||
|
||||
.header-title {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
font-size: 16px;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.header-title .layui-icon {
|
||||
margin-right: 8px;
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
.header-actions .layui-btn {
|
||||
margin-left: 8px;
|
||||
}
|
||||
|
||||
/* 主要内容区样式 */
|
||||
.main-content {
|
||||
min-height: calc(100vh - 170px);
|
||||
}
|
||||
|
||||
.layui-card {
|
||||
margin-bottom: 0;
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 3px 6px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
.layui-card-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
height: auto;
|
||||
padding: 12px 15px;
|
||||
font-size: 15px;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.text-muted {
|
||||
margin-left: 10px;
|
||||
font-size: 12px;
|
||||
font-weight: normal;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
/* 分类树样式 */
|
||||
.category-tree {
|
||||
padding: 10px 0;
|
||||
}
|
||||
|
||||
.category-item {
|
||||
margin: 5px 0;
|
||||
}
|
||||
|
||||
.category-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 10px 15px;
|
||||
background-color: #f8f8f8;
|
||||
border-radius: 2px;
|
||||
transition: all 0.3s;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.category-header:hover {
|
||||
background-color: #f2f2f2;
|
||||
}
|
||||
|
||||
.category-header.active {
|
||||
background-color: #e6f7ff;
|
||||
border-right: 3px solid #1890ff;
|
||||
}
|
||||
|
||||
.category-name {
|
||||
flex: 1;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.category-actions {
|
||||
/* opacity: 0; */
|
||||
transition: opacity 0.3s;
|
||||
}
|
||||
|
||||
.category-header:hover .category-actions {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.category-children {
|
||||
margin-left: 20px;
|
||||
padding-left: 15px;
|
||||
border-left: 1px dashed #e6e6e6;
|
||||
}
|
||||
|
||||
.add-child {
|
||||
padding: 3px 8px;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.add-child .layui-icon {
|
||||
font-size: 12px;
|
||||
margin-right: 3px;
|
||||
}
|
||||
|
||||
/* 空状态提示 */
|
||||
.empty-tip {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 40px 0;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.empty-tip .layui-icon {
|
||||
font-size: 32px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
/* 表单样式优化 */
|
||||
.category-form {
|
||||
padding: 10px 0;
|
||||
}
|
||||
|
||||
.layui-form-label {
|
||||
width: 100px;
|
||||
}
|
||||
|
||||
.layui-input-block {
|
||||
margin-left: 130px;
|
||||
}
|
||||
|
||||
.form-actions {
|
||||
margin-top: 30px;
|
||||
}
|
||||
|
||||
.layui-upload-drag {
|
||||
padding: 20px;
|
||||
border: 1px dashed #e2e2e2;
|
||||
background-color: #fff;
|
||||
text-align: center;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.layui-upload-drag:hover {
|
||||
border-color: #009688;
|
||||
}
|
||||
|
||||
.layui-upload-drag img {
|
||||
max-width: 100%;
|
||||
margin: 10px 0;
|
||||
}
|
||||
|
||||
.layui-btn-xs {
|
||||
height: 30px;
|
||||
line-height: 25px;
|
||||
font-size: 12px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script>
|
||||
// 定义全局变量和函数
|
||||
var categoryManager = {
|
||||
init: function () {
|
||||
this.initLayui();
|
||||
},
|
||||
|
||||
initLayui: function () {
|
||||
var that = this;
|
||||
layui.use(['layer', 'form', 'upload'], function () {
|
||||
var layer = layui.layer;
|
||||
var form = layui.form;
|
||||
var upload = layui.upload;
|
||||
var $ = layui.jquery;
|
||||
|
||||
// 初始化分类列表
|
||||
that.initCategoryList = function () {
|
||||
$.ajax({
|
||||
url: '/admin/articles/articlecate',
|
||||
type: 'POST',
|
||||
success: function (res) {
|
||||
if (res.code === 0) {
|
||||
var html = '';
|
||||
res.data.forEach(function (item) {
|
||||
html += that.renderCategory(item);
|
||||
});
|
||||
$('#categoryList').html(html);
|
||||
that.bindEvents();
|
||||
} else {
|
||||
layer.msg('获取分类数据失败', { icon: 2 });
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
// 渲染分类项
|
||||
that.renderCategory = function (category, level = 0) {
|
||||
var html = '<div class="category-item" data-id="' + category.id + '">';
|
||||
html += '<div class="category-header">';
|
||||
html += '<div class="category-name">' + category.title + '</div>';
|
||||
if (level === 0) {
|
||||
html += '<div class="category-actions">';
|
||||
html += '<button type="button" class="layui-btn layui-btn-primary layui-btn-xs add-child">';
|
||||
html += '<i class="layui-icon layui-icon-add-1"></i>添加子分类</button>';
|
||||
html += '</div>';
|
||||
}
|
||||
html += '</div>';
|
||||
|
||||
if (category.children && category.children.length > 0) {
|
||||
html += '<div class="category-children">';
|
||||
category.children.forEach(function (child) {
|
||||
html += that.renderCategory(child, level + 1);
|
||||
});
|
||||
html += '</div>';
|
||||
}
|
||||
html += '</div>';
|
||||
return html;
|
||||
};
|
||||
|
||||
// 绑定事件
|
||||
that.bindEvents = function () {
|
||||
// 点击分类项加载编辑信息
|
||||
$('.category-header').off('click').on('click', function (e) {
|
||||
if (!$(e.target).closest('.add-child').length) {
|
||||
var id = $(this).closest('.category-item').data('id');
|
||||
that.loadCategoryInfo(id);
|
||||
|
||||
// 添加选中效果
|
||||
$('.category-header').removeClass('active');
|
||||
$(this).addClass('active');
|
||||
}
|
||||
});
|
||||
|
||||
// 添加子分类
|
||||
$('.add-child').off('click').on('click', function (e) {
|
||||
e.stopPropagation();
|
||||
var parentId = $(this).closest('.category-item').data('id');
|
||||
that.showCategoryForm(parentId);
|
||||
});
|
||||
};
|
||||
|
||||
// 加载分类信息
|
||||
that.loadCategoryInfo = function (id) {
|
||||
$.get('/admin/articles/cateedit?id=' + id, function (res) {
|
||||
if (res.code === 0) {
|
||||
that.showCategoryForm(0, res.data);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
// 显示分类表单
|
||||
that.showCategoryForm = function (parentId = 0, data = null) {
|
||||
$('#defaultTip').hide();
|
||||
$('.category-form').show();
|
||||
|
||||
// 重置表单
|
||||
form.val('categoryForm', {
|
||||
id: data ? data.info.id : '',
|
||||
name: data ? data.info.name : '',
|
||||
cid: data ? data.info.cid : parentId,
|
||||
sort: data ? data.info.sort : 0,
|
||||
status: data ? data.info.status : 1
|
||||
});
|
||||
|
||||
// 更新父级分类选项
|
||||
var $select = $('select[name="cid"]');
|
||||
$select.empty().append('<option value="0">顶级分类</option>');
|
||||
// 获取所有分类作为父级选项
|
||||
$.ajax({
|
||||
url: '/admin/articles/articlecate',
|
||||
type: 'POST',
|
||||
async: false,
|
||||
success: function (res) {
|
||||
if (res.code === 0) {
|
||||
// 当前编辑的分类ID
|
||||
var currentId = data ? data.info.id : 0;
|
||||
// 递归构建分类选项
|
||||
function buildOptions(categories, level) {
|
||||
categories.forEach(function (category) {
|
||||
// 不能选择自己或自己的子分类作为父级
|
||||
if (category.id != currentId) {
|
||||
var prefix = new Array(level + 1).join('├─ ');
|
||||
$select.append('<option value="' + category.id + '">' + prefix + category.title + '</option>'); if (category.children && category.children.length > 0) { buildOptions(category.children, level + 1); }
|
||||
}
|
||||
});
|
||||
} buildOptions(res.data, 0);
|
||||
}
|
||||
}
|
||||
});
|
||||
// 设置选中的父级分类
|
||||
if (data && data.info.cid) {
|
||||
$select.val(data.info.cid);
|
||||
}
|
||||
|
||||
// 更新图片预览
|
||||
if (data && data.info.image) {
|
||||
$('#uploadPreview').removeClass('layui-hide').find('img').attr('src', data.info.image);
|
||||
$('#imageInput').val(data.info.image);
|
||||
} else {
|
||||
$('#uploadPreview').addClass('layui-hide').find('img').attr('src', '');
|
||||
$('#imageInput').val('');
|
||||
}
|
||||
|
||||
// 显示/隐藏删除按钮
|
||||
$('#deleteBtn')[data ? 'show' : 'hide']();
|
||||
|
||||
form.render();
|
||||
};
|
||||
|
||||
// 初始化上传组件
|
||||
upload.render({
|
||||
elem: '#uploadImage',
|
||||
url: '/admin/upload/image',
|
||||
accept: 'images',
|
||||
acceptMime: 'image/*',
|
||||
done: function (res) {
|
||||
if (res.code === 0) {
|
||||
$('#uploadPreview').removeClass('layui-hide').find('img').attr('src', res.data.url);
|
||||
$('#imageInput').val(res.data.url);
|
||||
layer.msg('上传成功');
|
||||
} else {
|
||||
layer.msg('上传失败');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// 监听表单提交
|
||||
form.on('submit(saveCategory)', function (data) {
|
||||
var url = data.field.id ? '/admin/articles/cateedit' : '/admin/articles/cateadd';
|
||||
$.post(url, data.field, function (res) {
|
||||
if (res.code === 0) {
|
||||
layer.msg(res.msg, { icon: 1 });
|
||||
that.initCategoryList();
|
||||
} else {
|
||||
layer.msg(res.msg, { icon: 2 });
|
||||
}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
|
||||
// 监听删除按钮
|
||||
$('#deleteBtn').on('click', function () {
|
||||
var id = $('#categoryId').val();
|
||||
if (!id) return;
|
||||
|
||||
layer.confirm('确定要删除该分类吗?', function (index) {
|
||||
$.post('/admin/articles/catedel', { id: id }, function (res) {
|
||||
if (res.code === 0) {
|
||||
layer.msg(res.msg, { icon: 1 });
|
||||
that.initCategoryList();
|
||||
$('#defaultTip').show();
|
||||
$('.category-form').hide();
|
||||
} else {
|
||||
layer.msg(res.msg, { icon: 2 });
|
||||
}
|
||||
});
|
||||
layer.close(index);
|
||||
});
|
||||
});
|
||||
|
||||
// 初始化页面
|
||||
that.initCategoryList();
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
// 初始化
|
||||
categoryManager.init();
|
||||
|
||||
// 新增分类
|
||||
function add() {
|
||||
categoryManager.showCategoryForm();
|
||||
}
|
||||
|
||||
// 刷新列表
|
||||
function refresh() {
|
||||
categoryManager.initCategoryList();
|
||||
}
|
||||
</script>
|
||||
@ -1,4 +1,4 @@
|
||||
<?php /*a:2:{s:57:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\log\login.php";i:1747615358;s:61:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\public\header.php";i:1746849526;}*/ ?>
|
||||
<?php /*a:2:{s:57:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\log\login.php";i:1747639417;s:61:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\public\header.php";i:1746849526;}*/ ?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
@ -141,18 +141,6 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/html" id="tableToolbar">
|
||||
<div class="layui-btn-container">
|
||||
<button class="layui-btn layui-btn-sm layui-btn-danger" lay-event="clearAll">
|
||||
<i class="layui-icon layui-icon-delete"></i> 清空日志
|
||||
</button>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script type="text/html" id="tableBar">
|
||||
<a class="layui-btn layui-btn-xs layui-btn-danger" lay-event="del">删除</a>
|
||||
</script>
|
||||
|
||||
<script src="/static/layui/layui.js"></script>
|
||||
<script>
|
||||
layui.use(['table', 'form', 'laydate'], function(){
|
||||
@ -172,7 +160,6 @@
|
||||
elem: '#loginLogTable',
|
||||
url: '<?php echo url("log/login"); ?>',
|
||||
method: 'post',
|
||||
toolbar: '#tableToolbar',
|
||||
defaultToolbar: ['filter', 'exports', 'print'],
|
||||
parseData: function(res) {
|
||||
return {
|
||||
@ -183,20 +170,19 @@
|
||||
};
|
||||
},
|
||||
cols: [[
|
||||
{field: 'id', title: 'ID', width: 80, sort: true},
|
||||
{field: 'username', title: '用户名', width: 120},
|
||||
{field: 'ip_address', title: 'IP地址', width: 130},
|
||||
{field: 'location', title: '登录地点', width: 120},
|
||||
{field: 'device_type', title: '设备类型', width: 100},
|
||||
{field: 'user_agent', title: '浏览器', width: 200},
|
||||
{field: 'login_status', title: '状态', width: 100, templet: function(d){
|
||||
{field: 'id', title: 'ID', width: 80, sort: true, align: 'center'},
|
||||
{field: 'username', title: '用户名', align: 'center'},
|
||||
{field: 'ip_address', title: 'IP地址', width: 130, align: 'center'},
|
||||
{field: 'location', title: '登录地点', width: 120, align: 'center'},
|
||||
{field: 'device_type', title: '设备类型', width: 100, align: 'center'},
|
||||
{field: 'user_agent', title: '浏览器', width: 200, align: 'center'},
|
||||
{field: 'login_status', title: '状态', width: 100, align: 'center', templet: function(d){
|
||||
return d.login_status == 1 ?
|
||||
'<span class="layui-badge layui-bg-green">成功</span>' :
|
||||
'<span class="layui-badge layui-bg-red">失败</span>';
|
||||
}},
|
||||
{field: 'failure_reason', title: '失败原因', width: 150},
|
||||
{field: 'login_time', title: '登录时间', width: 180, sort: true},
|
||||
{title: '操作', toolbar: '#tableBar', width: 80, fixed: 'right'}
|
||||
{field: 'failure_reason', title: '失败原因', width: 150, align: 'center'},
|
||||
{field: 'login_time', title: '登录时间', width: 180, sort: true, align: 'center'}
|
||||
]],
|
||||
page: true,
|
||||
limit: 10,
|
||||
@ -219,41 +205,6 @@
|
||||
});
|
||||
return false;
|
||||
});
|
||||
|
||||
// 监听工具条
|
||||
table.on('tool(loginLogTable)', function(obj){
|
||||
var data = obj.data;
|
||||
if(obj.event === 'del'){
|
||||
layer.confirm('确定删除这条日志吗?', function(index){
|
||||
$.post('<?php echo url("log/deleteLogin"); ?>', {id: data.id}, function(res){
|
||||
if(res.code === 0){
|
||||
layer.msg(res.msg, {icon: 1});
|
||||
obj.del();
|
||||
}else{
|
||||
layer.msg(res.msg, {icon: 2});
|
||||
}
|
||||
});
|
||||
layer.close(index);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// 监听头工具栏事件
|
||||
table.on('toolbar(loginLogTable)', function(obj){
|
||||
if(obj.event === 'clearAll'){
|
||||
layer.confirm('确定要清空所有登录日志吗?', function(index){
|
||||
$.post('<?php echo url("log/clearLogin"); ?>', function(res){
|
||||
if(res.code === 0){
|
||||
layer.msg(res.msg, {icon: 1});
|
||||
table.reload('loginLogTable');
|
||||
}else{
|
||||
layer.msg(res.msg, {icon: 2});
|
||||
}
|
||||
});
|
||||
layer.close(index);
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
368
runtime/admin/temp/d04910006695a190f91404debb0c9683.php
Normal file
368
runtime/admin/temp/d04910006695a190f91404debb0c9683.php
Normal file
@ -0,0 +1,368 @@
|
||||
<?php /*a:2:{s:60:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\articles\add.php";i:1747626013;s:61:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\public\header.php";i:1746849526;}*/ ?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title><?php echo htmlentities((string) $config['admin_name']); ?></title>
|
||||
<meta name="renderer" content="webkit">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
||||
<link rel="stylesheet" type="text/css" href="/static/layui/css/layui.css" media="all"/>
|
||||
<link rel="stylesheet" type="text/css" href="/static/css/moban.css" media="all"/>
|
||||
<link rel="stylesheet" type="text/css" href="/static/css/wangeditor.css" media="all"/>
|
||||
<style type="text/css">
|
||||
.header span{background:#009688;margin-left:30px;padding:10px;color:#ffffff;}
|
||||
.header div{border-bottom:solid 2px #009688;margin-top: 8px;}
|
||||
.header button{float:right;margin-top:-5px;}
|
||||
.pagination {
|
||||
display: inline-block;
|
||||
padding-left: 0;
|
||||
margin: 20px 0;
|
||||
border-radius: 4px;
|
||||
}
|
||||
.pagination > li {
|
||||
display: inline;
|
||||
}
|
||||
.pagination > li > a,
|
||||
.pagination > li > span {
|
||||
position: relative;
|
||||
float: left;
|
||||
padding: 6px 12px;
|
||||
margin-left: -1px;
|
||||
line-height: 1.42857143;
|
||||
color: #337ab7;
|
||||
text-decoration: none;
|
||||
background-color: #fff;
|
||||
border: 1px solid #ddd;
|
||||
}
|
||||
.pagination > li:first-child > a,
|
||||
.pagination > li:first-child > span {
|
||||
margin-left: 0;
|
||||
border-top-left-radius: 4px;
|
||||
border-bottom-left-radius: 4px;
|
||||
}
|
||||
.pagination > li:last-child > a,
|
||||
.pagination > li:last-child > span {
|
||||
border-top-right-radius: 4px;
|
||||
border-bottom-right-radius: 4px;
|
||||
}
|
||||
.pagination > li > a:hover,
|
||||
.pagination > li > span:hover,
|
||||
.pagination > li > a:focus,
|
||||
.pagination > li > span:focus {
|
||||
z-index: 2;
|
||||
color: #23527c;
|
||||
background-color: #eee;
|
||||
border-color: #ddd;
|
||||
}
|
||||
.pagination > .active > a,
|
||||
.pagination > .active > span,
|
||||
.pagination > .active > a:hover,
|
||||
.pagination > .active > span:hover,
|
||||
.pagination > .active > a:focus,
|
||||
.pagination > .active > span:focus {
|
||||
z-index: 3;
|
||||
color: #fff;
|
||||
cursor: default;
|
||||
background-color: #337ab7;
|
||||
border-color: #337ab7;
|
||||
}
|
||||
.pagination > .disabled > span,
|
||||
.pagination > .disabled > span:hover,
|
||||
.pagination > .disabled > span:focus,
|
||||
.pagination > .disabled > a,
|
||||
.pagination > .disabled > a:hover,
|
||||
.pagination > .disabled > a:focus {
|
||||
color: #777;
|
||||
cursor: not-allowed;
|
||||
background-color: #fff;
|
||||
border-color: #ddd;
|
||||
}
|
||||
.close-img { background: url(/static/images/close_img.png); background-size: 20px 20px; width:20px; height: 20px; position: absolute; right: 5px; top: 5px; z-index: 2;}
|
||||
</style>
|
||||
<script type="text/javascript" src="/static/layui/layui.js"></script>
|
||||
<script type="text/javascript">
|
||||
layui.use(['layer','form','table','laydate','element','upload'],function(){
|
||||
layer = layui.layer; // layui 弹框
|
||||
form = layui.form; // layui form表单
|
||||
table = layui.table; // layui 表格
|
||||
laydate = layui.laydate; // layui 时间框
|
||||
element = layui.element; // layui element
|
||||
upload = layui.upload; // layui 上传
|
||||
$ = layui.jquery; // layui jquery
|
||||
})
|
||||
</script>
|
||||
</head>
|
||||
<body style="padding:10px; box-sizing: border-box;">
|
||||
<div class="config-container">
|
||||
<div class="config-header" style="display:flex;justify-content: space-between;">
|
||||
<div>
|
||||
<span>添加文章</span>
|
||||
</div>
|
||||
<div>
|
||||
<button type="button" class="layui-btn layui-btn-primary layui-btn-sm" onclick="goBack()">
|
||||
<i class="layui-icon layui-icon-return"></i>返回
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<form class="layui-form" action="" method="post">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">标题</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="title" required lay-verify="required" placeholder="请输入文章标题" autocomplete="off"
|
||||
class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">分类</label>
|
||||
<div class="layui-input-block">
|
||||
<select name="cate" lay-verify="required">
|
||||
<option value="">请选择分类</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">描述</label>
|
||||
<div class="layui-input-block">
|
||||
<textarea name="desc" placeholder="请输入描述内容" class="layui-textarea"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">作者</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="author" required lay-verify="required" placeholder="请输入作者" autocomplete="off"
|
||||
class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">封面</label>
|
||||
<div class="layui-input-block">
|
||||
<button type="button" class="layui-btn" id="upload-btn">
|
||||
<i class="layui-icon layui-icon-upload"></i> 图片上传
|
||||
</button>
|
||||
<div style="width: 120px;">
|
||||
<div class="layui-upload-list">
|
||||
<img class="layui-upload-img" id="upload-img"
|
||||
style="width: 118px; height: 118px;object-fit: cover;">
|
||||
<div id="upload-text"></div>
|
||||
</div>
|
||||
<div class="layui-progress layui-progress-big" lay-showPercent="yes" lay-filter="filter-demo">
|
||||
<div class="layui-progress-bar" lay-percent=""></div>
|
||||
</div>
|
||||
<input type="hidden" name="image" id="image" value="">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item layui-form-text">
|
||||
<label class="layui-form-label">内容</label>
|
||||
<div class="layui-input-block">
|
||||
<div id="editor—wrapper" id="content" name="content" style="border: 1px solid #ccc;">
|
||||
<div id="toolbar-container" style="border-bottom: 1px solid #ccc;"><!-- 工具栏 --></div>
|
||||
<div id="editor-container" style="height: 800px;"><!-- 编辑器 --></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-input-block">
|
||||
<button class="layui-btn" lay-submit lay-filter="formSubmit">立即提交</button>
|
||||
<button class="layui-btn layui-btn-primary" lay-submit lay-filter="formDraft">存草稿</button>
|
||||
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<script src="/static/js/wangeditor.js"></script>
|
||||
<script>
|
||||
layui.use(['form', 'layer'], function () {
|
||||
var form = layui.form;
|
||||
var layer = layui.layer;
|
||||
var $ = layui.jquery;
|
||||
var upload = layui.upload;
|
||||
var element = layui.element;
|
||||
|
||||
// 图片上传
|
||||
var uploadInst = upload.render({
|
||||
elem: '#upload-btn',
|
||||
url: '<?php echo url("index/upload_img"); ?>', // 上传图片接口
|
||||
before: function (obj) {
|
||||
// 预读本地文件示例,不支持ie8
|
||||
obj.preview(function (index, file, result) {
|
||||
$('#upload-img').attr('src', result); // 图片链接(base64)
|
||||
});
|
||||
element.progress('filter-demo', '0%'); // 进度条复位
|
||||
layer.msg('上传中', { icon: 16, time: 0 });
|
||||
},
|
||||
done: function (res) {
|
||||
// 若上传失败
|
||||
if (res.code > 0) {
|
||||
return layer.msg('上传失败');
|
||||
}
|
||||
// 上传成功
|
||||
$('#image').val(res.data); // 设置图片路径到隐藏输入框
|
||||
$('#upload-text').html(''); // 置空上传失败的状态
|
||||
layer.msg('上传成功', { icon: 1 });
|
||||
},
|
||||
uploadError: function () { // 这里改为 uploadError
|
||||
// 演示失败状态,并实现重传
|
||||
var demoText = $('#upload-text');
|
||||
demoText.html('<span style="color: #FF5722;">上传失败</span> <a class="layui-btn layui-btn-xs demo-reload">重试</a>');
|
||||
demoText.find('.demo-reload').on('click', function () {
|
||||
uploadInst.upload();
|
||||
});
|
||||
},
|
||||
// 进度条
|
||||
progress: function (n, elem, e) {
|
||||
element.progress('filter-demo', n + '%'); // 可配合 layui 进度条元素使用
|
||||
if (n == 100) {
|
||||
layer.msg('上传完毕', { icon: 1 });
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// 获取分类列表
|
||||
$.get('<?php echo url("articles/getcate"); ?>', function (res) {
|
||||
if (res.code == 0) {
|
||||
var html = '<option value="">请选择分类</option>';
|
||||
res.data.forEach(function (item) {
|
||||
// 如果cid为0,则设置为禁用
|
||||
var disabled = item.cid == 0 ? 'disabled' : '';
|
||||
html += '<option value="' + item.id + '" ' + disabled + '>' + item.name + '</option>';
|
||||
// 如果有子分类,添加子分类选项
|
||||
if (item.children && item.children.length > 0) {
|
||||
item.children.forEach(function (child) {
|
||||
html += '<option value="' + child.id + '">├─ ' + child.name + '</option>';
|
||||
});
|
||||
}
|
||||
});
|
||||
$('select[name="cate"]').html(html);
|
||||
form.render('select');
|
||||
} else {
|
||||
layer.msg(res.msg, { icon: 2 });
|
||||
}
|
||||
});
|
||||
|
||||
// 表单提交
|
||||
form.on('submit(formSubmit)', function (data) {
|
||||
// 获取编辑器内容
|
||||
var content = editor.getHtml();
|
||||
if (!content || content === '<p><br></p>') {
|
||||
layer.msg('请输入文章内容', { icon: 2 });
|
||||
return false;
|
||||
}
|
||||
|
||||
var loadIndex = layer.load(2);
|
||||
data.field.content = content;
|
||||
|
||||
$.ajax({
|
||||
url: '<?php echo url("articles/add"); ?>',
|
||||
type: 'POST',
|
||||
data: data.field,
|
||||
success: function (res) {
|
||||
layer.close(loadIndex);
|
||||
if (res.code == 0) {
|
||||
layer.msg(res.msg, { icon: 1 });
|
||||
setTimeout(function () {
|
||||
window.location.href = '<?php echo url("articles/articlelist"); ?>';
|
||||
}, 1000);
|
||||
} else {
|
||||
layer.msg(res.msg, { icon: 2 });
|
||||
}
|
||||
}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
<!-- wangeditor编辑器脚本 -->
|
||||
<script>
|
||||
const { createEditor, createToolbar } = window.wangEditor
|
||||
|
||||
const editorConfig = {
|
||||
MENU_CONF: {},
|
||||
placeholder: '请输入内容...',
|
||||
onChange(editor) {
|
||||
const html = editor.getHtml()
|
||||
},
|
||||
}
|
||||
|
||||
// 配置图片上传
|
||||
editorConfig.MENU_CONF['uploadImage'] = {
|
||||
server: '<?php echo url("index/upload_imgs"); ?>',
|
||||
fieldName: 'file',
|
||||
maxFileSize: 10 * 1024 * 1024, // 10M
|
||||
maxNumberOfFiles: 10,
|
||||
allowedFileTypes: ['image/*'],
|
||||
meta: {
|
||||
token: 'xxx'
|
||||
},
|
||||
metaWithUrl: true,
|
||||
headers: {
|
||||
Accept: 'text/x-json'
|
||||
},
|
||||
timeout: 5 * 1000, // 5s
|
||||
|
||||
onBeforeUpload(file) {
|
||||
console.log('准备上传图片', file)
|
||||
return file
|
||||
},
|
||||
onProgress(progress) {
|
||||
console.log('上传进度', progress)
|
||||
},
|
||||
onSuccess(file, res) {
|
||||
console.log('上传成功', file, res)
|
||||
},
|
||||
onFailed(file, res) {
|
||||
layer.msg('上传失败:' + res.msg, { icon: 2 })
|
||||
console.log('上传失败', file, res)
|
||||
},
|
||||
onError(file, err, res) {
|
||||
layer.msg('上传出错:' + err.message, { icon: 2 })
|
||||
console.error('上传出错', file, err, res)
|
||||
},
|
||||
customInsert(res, insertFn) {
|
||||
// res 即服务端的返回结果
|
||||
if (res.code === 0 && res.data) {
|
||||
// 从res.data中获取src字段
|
||||
const url = String(res.data.src || '');
|
||||
if (url) {
|
||||
insertFn(url);
|
||||
} else {
|
||||
layer.msg('图片地址无效', { icon: 2 });
|
||||
}
|
||||
} else {
|
||||
layer.msg('图片上传失败', { icon: 2 });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const editor = createEditor({
|
||||
selector: '#editor-container',
|
||||
html: '<p><br></p>',
|
||||
config: editorConfig,
|
||||
mode: 'default', // or 'simple'
|
||||
})
|
||||
|
||||
const toolbarConfig = {}
|
||||
|
||||
const toolbar = createToolbar({
|
||||
editor,
|
||||
selector: '#toolbar-container',
|
||||
config: toolbarConfig,
|
||||
mode: 'default', // or 'simple'
|
||||
})
|
||||
</script>
|
||||
|
||||
<script>
|
||||
//返回文章列表
|
||||
function goBack() {
|
||||
window.location.href = '<?php echo url("articles/articlelist"); ?>';
|
||||
}
|
||||
</script>
|
||||
@ -1 +0,0 @@
|
||||
a:1:{s:7:"captcha";a:1:{s:3:"key";s:60:"$2y$10$ElMjfwS/Yfdt4SJWe1bo7uS8gfLv8ZTge6Fu87kNO/b/m5yGxkKUe";}}
|
||||
BIN
vendor.zip
BIN
vendor.zip
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user