diff --git a/.gitignore b/.gitignore
index 27c96cf74..c0fb87220 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,9 +1,11 @@
!.gitignore
!.gitattributes
-/.idea
-/.svn
+*.DS_Store
+*.idea
+*.svn
+*.git
/runtime
/nbproject
+!composer.json
/composer.lock
-/public/upload
/static/upload
\ No newline at end of file
diff --git a/.htaccess b/.htaccess
index 2cfa33ed1..cbc786893 100644
--- a/.htaccess
+++ b/.htaccess
@@ -1,6 +1,7 @@
Options +FollowSymlinks -Multiviews
RewriteEngine On
+
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]
diff --git a/README.md b/README.md
index 9b6fd5224..2af29deab 100644
--- a/README.md
+++ b/README.md
@@ -1,34 +1,59 @@
-Think.Admin
----
+ThinkAdmin for PHP
+--
+## 大道至简 · 悟在天成
-`Think.Admin`是一个基于`Thinkphp5`开发的后台管理系统,集成后台系统常用功能。
+* ThinkAdmin 是一个基于 Thinkphp 5.1.x 开发的后台管理系统,集成后台系统常用功能。
+* 项目安装及二次开发请参考 ThinkPHP 官方文档及下面的服务环境说明,数据库 sql 文件存放于项目根目录下。
+>* 注意:项目测试请另行搭建环境并创建数据库(数据库配置 config/database.php), 切勿直接使用测试环境数据!
+>* 如果系统提示“测试系统禁止操作等字样”,可以删除项目演示路由配置(route/demo.php)或清空里面的路由记录。
+>* 当前版本使用 ThinkPHP 5.1.x 版本,对PHP版本要求不低于php5.6,具体请查阅ThinkPHP官方文档。
-项目安装请参考`ThinkPHP`官方文档及下面的服务环境说明,数据库`sql`文件存放于项目根目录下。
-注意:项目测试请另行搭建环境并创建数据库(数据库配置`application/database.php`), 切勿直接使用测试环境数据!
+Documentation
+--
+认真看看文档可能会对你的开发有所帮助哦!
-`Think.Admin`及`微信开发`技术交流QQ群
-[](http://shang.qq.com/wpa/qunwpa?idkey=ae25cf789dafbef62e50a980ffc31242f150bc61a61164458216dd98c411832a)
+文档地址:[ThinkAdmin 开发文档](https://www.kancloud.cn/zoujingli/thinkadmin/content)
-**`Think.Admin`开发手册 ( 撰写中 )** : http://doc.think.ctolog.com
-`Think.Admin`已集成模块
----
+PHP开发技术交流(QQ群 513350915)
+
+[](http://shang.qq.com/wpa/qunwpa?idkey=ae25cf789dafbef62e50a980ffc31242f150bc61a61164458216dd98c411832a)
+
+
+Repositorie
+--
+ ThinkAdmin 为开源项目,允许把它用于任何地方,不受任何约束,欢迎 fork 项目。
+* Gitee 托管地址:https://gitee.com/zoujingli/Think.Admin
+* GitHub 托管地址:https://github.com/zoujingli/ThinkAdmin
+
+对于新版本的微信模块使用的是授权模式,需要用到 ThinkService 项目。
+* Gitee 托管地址:https://gitee.com/zoujingli/ThinkService
+* GitHub 托管地址:https://github.com/zoujingli/ThinkService
+
+其安装与 ThinkAdmin 相似,这里就不多说了。具体可以参见微信开放平台官网
+https://open.weixin.qq.com ,ThinkService 后台具体可以配置对应参数。
+
+ThinkAdmin 与 ThinkService 对接是通过 WebService 通信的,因此运行环境需要安装 Soap 模块支持。
+
+
+Module
+--
* 简易`RBAC`权限管理(用户、权限、节点、菜单控制)
* 自建秒传文件上载组件(本地存储、七牛云存储,阿里云OSS存储)
* 基站数据服务组件(唯一随机序号、表单更新)
* `Http`服务组件(原生`CURL`封装,兼容PHP多版本)
-* 微信公众号服务组件(基于[wechat-php-sdk](https://github.com/zoujingli/wechat-php-sdk),微信网页授权获取用户信息、已关注粉丝管理、自定义菜单管理等等)
-* 微信商户支付服务组件(基于[wechat-php-sdk](https://github.com/zoujingli/wechat-php-sdk),支持JSAPI支付、扫码模式一支付、扫码模式二支付)
-* 测试公众号名称:思过崖思过 (大家可以关注它来进行简单的测试)
+* 微信公众号服务组件(基于[WeChatDeveloper](https://github.com/zoujingli/WeChatDeveloper),微信网页授权获取用户信息、已关注粉丝管理、自定义菜单管理等等)
+* 微信商户支付服务组件(基于[WeChatDeveloper](https://github.com/zoujingli/WeChatDeveloper),支持JSAPI支付、扫码模式一支付、扫码模式二支付)
* 更多组件开发中...
-服务器环境
+Environment
---
-* `PHP`版本不低于`PHP5.4`,推荐使用`PHP7`以达到最优效果
-* 项目运行需支持`PATHINFO`,项目不支持`ThinkPHP`的`URL`兼容模式运行(源于如何优雅的展示)
-* `Apache`:已在项目根目录加入`.htaccess`文件,只需开启`rewrite`模块
+>1. PHP 版本不低于 PHP5.6,推荐使用 PHP7 以达到最优效果;
+>2. 需开启 PATHINFO,不再支持 ThinkPHP 的 URL 兼容模式运行(源于如何优雅的展示)。
+
+* Apache
```xml
@@ -40,13 +65,13 @@ Think.Admin
```
-* `Nginx`:配置参考下面的`demo`代码
+* Nginx
```
server {
listen 80;
server_name wealth.demo.cuci.cc;
- root /home/wwwroot/Think.Admin;
+ root /home/wwwroot/ThinkAdmin;
index index.php index.html index.htm;
add_header X-Powered-Host $hostname;
@@ -87,3 +112,13 @@ server {
}
}
```
+
+Copyright
+--
+* ThinkAdmin 基于`MIT`协议发布,任何人可以用在任何地方,不受约束
+* ThinkAdmin 部分代码来自互联网,若有异议,可以联系作者进行删除
+
+
+Sponsor
+--
+
\ No newline at end of file
diff --git a/_composer.cmd b/_composer.cmd
deleted file mode 100644
index f0c7ac58a..000000000
--- a/_composer.cmd
+++ /dev/null
@@ -1,13 +0,0 @@
-:: Composer װ½ű
-@echo off
-title Composer Plugs Install And Optimize
-echo.
-echo ========= 1. Ѱװ =========
-rmdir /s/q vendor thinkphp runtime
-echo.
-echo ========= 2. زװ =========
-composer update --profile --prefer-dist --optimize-autoloader
-echo.
-echo ========= 3. ѹ =========
-composer dump-autoload --optimize
-exit
\ No newline at end of file
diff --git a/admin_v3.sql b/admin_v3.sql
new file mode 100644
index 000000000..1789db95c
--- /dev/null
+++ b/admin_v3.sql
@@ -0,0 +1,947 @@
+/*
+Navicat MySQL Data Transfer
+
+Source Server : server.cuci.cc
+Source Server Version : 50558
+Source Host : server.cuci.cc:3306
+Source Database : admin_v3
+
+Target Server Type : MYSQL
+Target Server Version : 50558
+File Encoding : 65001
+
+Date: 2018-05-04 11:40:19
+*/
+
+SET FOREIGN_KEY_CHECKS=0;
+
+-- ----------------------------
+-- Table structure for store_express
+-- ----------------------------
+DROP TABLE IF EXISTS `store_express`;
+CREATE TABLE `store_express` (
+ `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
+ `express_title` varchar(50) DEFAULT '' COMMENT '快递公司名称',
+ `express_code` varchar(50) DEFAULT '' COMMENT '快递公司代码',
+ `express_desc` text COMMENT '快递公司描述',
+ `status` tinyint(1) unsigned DEFAULT '1' COMMENT '状态(0.无效,1.有效)',
+ `sort` bigint(20) unsigned DEFAULT '0' COMMENT '排序',
+ `is_deleted` tinyint(1) unsigned DEFAULT '0' COMMENT '删除状态(1删除,0未删除)',
+ `create_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB AUTO_INCREMENT=95 DEFAULT CHARSET=utf8 COMMENT='商城快递配置';
+
+-- ----------------------------
+-- Records of store_express
+-- ----------------------------
+INSERT INTO `store_express` VALUES ('5', 'AAE全球专递', 'aae', '顺丰快递公司', '0', '0', '0', '2017-09-12 11:53:40');
+INSERT INTO `store_express` VALUES ('6', '安捷快递', 'anjie', '', '0', '0', '0', '2017-09-13 15:27:26');
+INSERT INTO `store_express` VALUES ('7', '安信达快递', 'anxindakuaixi', null, '0', '0', '0', '2017-09-13 16:05:19');
+INSERT INTO `store_express` VALUES ('8', '彪记快递', 'biaojikuaidi', null, '0', '0', '0', '2017-09-13 16:05:26');
+INSERT INTO `store_express` VALUES ('9', 'BHT', 'bht', '', '0', '0', '0', '2017-09-13 16:05:37');
+INSERT INTO `store_express` VALUES ('10', '百福东方国际物流', 'baifudongfang', null, '0', '0', '0', '2017-09-13 16:05:41');
+INSERT INTO `store_express` VALUES ('11', '中国东方(COE)', 'coe', null, '0', '0', '0', '2017-09-13 16:05:48');
+INSERT INTO `store_express` VALUES ('12', '长宇物流', 'changyuwuliu', null, '0', '0', '0', '2017-09-13 16:05:58');
+INSERT INTO `store_express` VALUES ('13', '大田物流', 'datianwuliu', null, '0', '0', '0', '2017-09-13 16:06:06');
+INSERT INTO `store_express` VALUES ('14', '德邦物流', 'debangwuliu', null, '1', '1', '0', '2017-09-13 16:06:14');
+INSERT INTO `store_express` VALUES ('15', 'DHL', 'dhl', null, '0', '0', '0', '2017-09-13 16:06:24');
+INSERT INTO `store_express` VALUES ('16', 'DPEX', 'dpex', null, '0', '0', '0', '2017-09-13 16:06:29');
+INSERT INTO `store_express` VALUES ('17', 'd速快递', 'dsukuaidi', null, '0', '0', '0', '2017-09-13 16:06:34');
+INSERT INTO `store_express` VALUES ('18', '递四方', 'disifang', null, '0', '0', '0', '2017-09-13 16:06:40');
+INSERT INTO `store_express` VALUES ('19', 'EMS快递', 'ems', '', '1', '0', '0', '2017-09-13 16:06:47');
+INSERT INTO `store_express` VALUES ('20', 'FEDEX(国外)', 'fedex', null, '0', '0', '0', '2017-09-13 16:06:56');
+INSERT INTO `store_express` VALUES ('21', '飞康达物流', 'feikangda', null, '0', '0', '0', '2017-09-13 16:07:03');
+INSERT INTO `store_express` VALUES ('22', '凤凰快递', 'fenghuangkuaidi', null, '0', '0', '0', '2017-09-13 16:07:10');
+INSERT INTO `store_express` VALUES ('23', '飞快达', 'feikuaida', null, '0', '0', '0', '2017-09-13 16:07:16');
+INSERT INTO `store_express` VALUES ('24', '国通快递', 'guotongkuaidi', null, '0', '0', '0', '2017-09-13 16:07:27');
+INSERT INTO `store_express` VALUES ('25', '港中能达物流', 'ganzhongnengda', null, '0', '0', '0', '2017-09-13 16:07:33');
+INSERT INTO `store_express` VALUES ('26', '广东邮政物流', 'guangdongyouzhengwuliu', null, '0', '0', '0', '2017-09-13 16:08:22');
+INSERT INTO `store_express` VALUES ('27', '共速达', 'gongsuda', null, '0', '0', '0', '2017-09-13 16:08:48');
+INSERT INTO `store_express` VALUES ('28', '汇通快运', 'huitongkuaidi', null, '0', '0', '0', '2017-09-13 16:08:56');
+INSERT INTO `store_express` VALUES ('29', '恒路物流', 'hengluwuliu', null, '0', '0', '0', '2017-09-13 16:09:02');
+INSERT INTO `store_express` VALUES ('30', '华夏龙物流', 'huaxialongwuliu', null, '0', '0', '0', '2017-09-13 16:09:12');
+INSERT INTO `store_express` VALUES ('31', '海红', 'haihongwangsong', null, '0', '0', '0', '2017-09-13 16:09:20');
+INSERT INTO `store_express` VALUES ('32', '海外环球', 'haiwaihuanqiu', null, '0', '0', '0', '2017-09-13 16:09:27');
+INSERT INTO `store_express` VALUES ('33', '佳怡物流', 'jiayiwuliu', null, '0', '0', '0', '2017-09-13 16:09:35');
+INSERT INTO `store_express` VALUES ('34', '京广速递', 'jinguangsudikuaijian', null, '0', '0', '0', '2017-09-13 16:09:42');
+INSERT INTO `store_express` VALUES ('35', '急先达', 'jixianda', null, '0', '0', '0', '2017-09-13 16:09:49');
+INSERT INTO `store_express` VALUES ('36', '佳吉物流', 'jjwl', null, '0', '0', '0', '2017-09-13 16:10:01');
+INSERT INTO `store_express` VALUES ('37', '加运美物流', 'jymwl', null, '0', '0', '0', '2017-09-13 16:10:13');
+INSERT INTO `store_express` VALUES ('38', '金大物流', 'jindawuliu', null, '0', '0', '0', '2017-09-13 16:10:22');
+INSERT INTO `store_express` VALUES ('39', '嘉里大通', 'jialidatong', null, '0', '0', '0', '2017-09-13 16:10:33');
+INSERT INTO `store_express` VALUES ('40', '晋越快递', 'jykd', null, '0', '0', '0', '2017-09-13 16:10:40');
+INSERT INTO `store_express` VALUES ('41', '快捷速递', 'kuaijiesudi', null, '0', '0', '0', '2017-09-13 16:10:49');
+INSERT INTO `store_express` VALUES ('42', '联邦快递(国内)', 'lianb', null, '0', '0', '0', '2017-09-13 16:10:58');
+INSERT INTO `store_express` VALUES ('43', '联昊通物流', 'lianhaowuliu', null, '0', '0', '0', '2017-09-13 16:11:07');
+INSERT INTO `store_express` VALUES ('44', '龙邦物流', 'longbanwuliu', null, '0', '0', '0', '2017-09-13 16:11:15');
+INSERT INTO `store_express` VALUES ('45', '立即送', 'lijisong', null, '0', '0', '0', '2017-09-13 16:11:25');
+INSERT INTO `store_express` VALUES ('46', '乐捷递', 'lejiedi', null, '0', '0', '0', '2017-09-13 16:11:36');
+INSERT INTO `store_express` VALUES ('47', '民航快递', 'minghangkuaidi', null, '0', '0', '0', '2017-09-13 16:11:45');
+INSERT INTO `store_express` VALUES ('48', '美国快递', 'meiguokuaidi', null, '0', '0', '0', '2017-09-13 16:11:53');
+INSERT INTO `store_express` VALUES ('49', '门对门', 'menduimen', null, '0', '0', '0', '2017-09-13 16:12:01');
+INSERT INTO `store_express` VALUES ('50', 'OCS', 'ocs', null, '0', '0', '0', '2017-09-13 16:12:10');
+INSERT INTO `store_express` VALUES ('51', '配思货运', 'peisihuoyunkuaidi', null, '0', '0', '0', '2017-09-13 16:12:18');
+INSERT INTO `store_express` VALUES ('52', '全晨快递', 'quanchenkuaidi', null, '0', '0', '0', '2017-09-13 16:12:26');
+INSERT INTO `store_express` VALUES ('53', '全峰快递', 'quanfengkuaidi', null, '0', '0', '0', '2017-09-13 16:12:34');
+INSERT INTO `store_express` VALUES ('54', '全际通物流', 'quanjitong', null, '0', '0', '0', '2017-09-13 16:12:41');
+INSERT INTO `store_express` VALUES ('55', '全日通快递', 'quanritongkuaidi', null, '0', '0', '0', '2017-09-13 16:12:49');
+INSERT INTO `store_express` VALUES ('56', '全一快递', 'quanyikuaidi', null, '0', '0', '0', '2017-09-13 16:12:56');
+INSERT INTO `store_express` VALUES ('57', '如风达', 'rufengda', null, '0', '0', '0', '2017-09-13 16:13:03');
+INSERT INTO `store_express` VALUES ('58', '三态速递', 'santaisudi', null, '0', '0', '0', '2017-09-13 16:13:15');
+INSERT INTO `store_express` VALUES ('59', '盛辉物流', 'shenghuiwuliu', null, '0', '0', '0', '2017-09-13 16:13:22');
+INSERT INTO `store_express` VALUES ('60', '申通', 'shentong', null, '0', '0', '0', '2017-09-13 16:13:34');
+INSERT INTO `store_express` VALUES ('61', '顺丰', 'shunfeng', '', '1', '0', '0', '2017-09-13 16:13:41');
+INSERT INTO `store_express` VALUES ('62', '速尔物流', 'sue', null, '0', '0', '0', '2017-09-13 16:13:48');
+INSERT INTO `store_express` VALUES ('63', '盛丰物流', 'shengfeng', null, '0', '0', '0', '2017-09-13 16:13:55');
+INSERT INTO `store_express` VALUES ('64', '赛澳递', 'saiaodi', null, '0', '0', '0', '2017-09-13 16:14:02');
+INSERT INTO `store_express` VALUES ('65', '天地华宇', 'tiandihuayu', null, '0', '0', '0', '2017-09-13 16:14:11');
+INSERT INTO `store_express` VALUES ('66', '天天快递', 'tiantian', null, '0', '0', '0', '2017-09-13 16:14:19');
+INSERT INTO `store_express` VALUES ('67', 'TNT', 'tnt', null, '0', '0', '0', '2017-09-13 16:14:26');
+INSERT INTO `store_express` VALUES ('68', 'UPS', 'ups', null, '0', '0', '0', '2017-09-13 16:14:29');
+INSERT INTO `store_express` VALUES ('69', '万家物流', 'wanjiawuliu', null, '0', '0', '0', '2017-09-13 16:14:37');
+INSERT INTO `store_express` VALUES ('70', '文捷航空速递', 'wenjiesudi', null, '0', '0', '0', '2017-09-13 16:14:46');
+INSERT INTO `store_express` VALUES ('71', '伍圆', 'wuyuan', null, '0', '0', '0', '2017-09-13 16:14:52');
+INSERT INTO `store_express` VALUES ('72', '万象物流', 'wxwl', null, '0', '0', '0', '2017-09-13 16:15:00');
+INSERT INTO `store_express` VALUES ('73', '新邦物流', 'xinbangwuliu', null, '0', '0', '0', '2017-09-13 16:15:06');
+INSERT INTO `store_express` VALUES ('74', '信丰物流', 'xinfengwuliu', null, '0', '0', '0', '2017-09-13 16:15:15');
+INSERT INTO `store_express` VALUES ('75', '亚风速递', 'yafengsudi', null, '0', '0', '0', '2017-09-13 16:15:23');
+INSERT INTO `store_express` VALUES ('76', '一邦速递', 'yibangwuliu', null, '0', '0', '0', '2017-09-13 16:15:30');
+INSERT INTO `store_express` VALUES ('77', '优速物流', 'youshuwuliu', null, '0', '0', '0', '2017-09-13 16:15:36');
+INSERT INTO `store_express` VALUES ('78', '邮政包裹挂号信', 'youzhengguonei', null, '0', '3', '0', '2017-09-13 16:15:44');
+INSERT INTO `store_express` VALUES ('79', '邮政国际包裹挂号信', 'youzhengguoji', null, '0', '2', '0', '2017-09-13 16:15:51');
+INSERT INTO `store_express` VALUES ('80', '远成物流', 'yuanchengwuliu', null, '0', '0', '0', '2017-09-13 16:15:57');
+INSERT INTO `store_express` VALUES ('81', '圆通速递', 'yuantong', null, '1', '1', '0', '2017-09-13 16:16:03');
+INSERT INTO `store_express` VALUES ('82', '源伟丰快递', 'yuanweifeng', null, '0', '0', '0', '2017-09-13 16:16:10');
+INSERT INTO `store_express` VALUES ('83', '元智捷诚快递', 'yuanzhijiecheng', null, '0', '0', '0', '2017-09-13 16:16:17');
+INSERT INTO `store_express` VALUES ('84', '韵达快运', 'yunda', null, '0', '0', '0', '2017-09-13 16:16:24');
+INSERT INTO `store_express` VALUES ('85', '运通快递', 'yuntongkuaidi', null, '0', '0', '0', '2017-09-13 16:16:33');
+INSERT INTO `store_express` VALUES ('86', '越丰物流', 'yuefengwuliu', null, '0', '0', '0', '2017-09-13 16:16:40');
+INSERT INTO `store_express` VALUES ('87', '源安达', 'yad', null, '0', '0', '0', '2017-09-13 16:16:47');
+INSERT INTO `store_express` VALUES ('88', '银捷速递', 'yinjiesudi', null, '0', '0', '0', '2017-09-13 16:16:56');
+INSERT INTO `store_express` VALUES ('89', '宅急送', 'zhaijisong', null, '0', '0', '0', '2017-09-13 16:17:03');
+INSERT INTO `store_express` VALUES ('90', '中铁快运', 'zhongtiekuaiyun', null, '0', '0', '0', '2017-09-13 16:17:10');
+INSERT INTO `store_express` VALUES ('91', '中通速递', 'zhongtong', '', '0', '0', '0', '2017-09-13 16:17:16');
+INSERT INTO `store_express` VALUES ('92', '中邮物流', 'zhongyouwuliu', null, '0', '0', '0', '2017-09-13 16:17:27');
+INSERT INTO `store_express` VALUES ('93', '忠信达', 'zhongxinda', null, '0', '0', '0', '2017-09-13 16:17:34');
+INSERT INTO `store_express` VALUES ('94', '芝麻开门', 'zhimakaimen', null, '0', '0', '0', '2017-09-13 16:17:41');
+
+-- ----------------------------
+-- Table structure for store_goods
+-- ----------------------------
+DROP TABLE IF EXISTS `store_goods`;
+CREATE TABLE `store_goods` (
+ `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
+ `brand_id` bigint(20) unsigned DEFAULT '0' COMMENT '品牌ID',
+ `cate_id` bigint(20) unsigned DEFAULT '0' COMMENT '商品分类id',
+ `unit_id` bigint(20) DEFAULT NULL COMMENT '商品单位ID',
+ `spec_id` bigint(20) unsigned DEFAULT '0' COMMENT '规格ID',
+ `tags_id` varchar(255) DEFAULT '' COMMENT '商品标签ID',
+ `is_code` bigint(1) DEFAULT '1' COMMENT '是否有码商品',
+ `goods_title` varchar(255) DEFAULT '' COMMENT '商品标签',
+ `goods_content` text COMMENT '商品内容',
+ `goods_logo` varchar(255) DEFAULT '' COMMENT '商品LOGO',
+ `goods_image` text COMMENT '商品图片地址',
+ `goods_video` varchar(500) DEFAULT '' COMMENT '商品视频URL',
+ `goods_desc` varchar(500) DEFAULT '' COMMENT '商品描述',
+ `package_stock` bigint(20) unsigned DEFAULT '0' COMMENT '总库存数量',
+ `package_sale` bigint(20) unsigned DEFAULT '0' COMMENT '已销售数量',
+ `favorite_num` bigint(20) unsigned DEFAULT '0' COMMENT '收藏次数',
+ `sort` bigint(20) unsigned DEFAULT '0' COMMENT '数据排序',
+ `status` bigint(1) unsigned DEFAULT '1' COMMENT '商品状态(1有效,0无效)',
+ `is_deleted` bigint(1) unsigned DEFAULT '0' COMMENT '删除状态(1删除,0未删除)',
+ `create_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='商城商品主表';
+
+-- ----------------------------
+-- Records of store_goods
+-- ----------------------------
+
+-- ----------------------------
+-- Table structure for store_goods_brand
+-- ----------------------------
+DROP TABLE IF EXISTS `store_goods_brand`;
+CREATE TABLE `store_goods_brand` (
+ `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
+ `brand_logo` varchar(1024) DEFAULT '' COMMENT '品牌logo',
+ `brand_cover` varchar(1024) DEFAULT '' COMMENT '品牌封面',
+ `brand_title` varchar(255) DEFAULT '' COMMENT '商品品牌名称',
+ `brand_desc` text COMMENT '商品品牌描述',
+ `brand_detail` text COMMENT '品牌图文信息',
+ `sort` int(11) unsigned DEFAULT '0' COMMENT '商品分类排序',
+ `status` tinyint(1) unsigned DEFAULT '1' COMMENT '商品状态(1有效,0无效)',
+ `is_deleted` tinyint(1) unsigned DEFAULT '0' COMMENT '删除状态(1删除,0未删除)',
+ `create_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='产品品牌';
+
+-- ----------------------------
+-- Records of store_goods_brand
+-- ----------------------------
+
+-- ----------------------------
+-- Table structure for store_goods_cate
+-- ----------------------------
+DROP TABLE IF EXISTS `store_goods_cate`;
+CREATE TABLE `store_goods_cate` (
+ `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
+ `pid` bigint(20) unsigned DEFAULT '0' COMMENT '上级分类编号',
+ `brand_id` bigint(20) DEFAULT '0' COMMENT '品牌ID',
+ `cate_title` varchar(255) DEFAULT '' COMMENT '商品分类名称',
+ `cate_desc` text COMMENT '商品分类',
+ `sort` bigint(20) unsigned DEFAULT '0' COMMENT '商品分类排序',
+ `status` bigint(1) unsigned DEFAULT '1' COMMENT '商品状态(1有效,0无效)',
+ `is_deleted` bigint(1) unsigned DEFAULT '0' COMMENT '删除状态(1删除,0未删除)',
+ `create_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='商城商品分类';
+
+-- ----------------------------
+-- Records of store_goods_cate
+-- ----------------------------
+
+-- ----------------------------
+-- Table structure for store_goods_list
+-- ----------------------------
+DROP TABLE IF EXISTS `store_goods_list`;
+CREATE TABLE `store_goods_list` (
+ `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
+ `goods_id` bigint(20) unsigned DEFAULT '0' COMMENT '商品ID',
+ `goods_spec` varchar(255) DEFAULT '' COMMENT '商品规格名称',
+ `goods_number` bigint(20) unsigned DEFAULT '0' COMMENT '商品礼品-商品数量',
+ `market_price` decimal(20,2) unsigned DEFAULT '0.00' COMMENT '销售价格',
+ `selling_price` decimal(20,2) unsigned DEFAULT '0.00' COMMENT '商品价格',
+ `goods_stock` bigint(20) unsigned DEFAULT '0' COMMENT '商品库存统计',
+ `goods_sale` bigint(20) unsigned DEFAULT '0' COMMENT '已销售数量',
+ `status` bigint(1) unsigned DEFAULT '1' COMMENT '商品状态(1有效,0无效)',
+ `is_deleted` bigint(1) unsigned DEFAULT '0' COMMENT '删除状态(1删除,0未删除)',
+ `create_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='商城商品列表';
+
+-- ----------------------------
+-- Records of store_goods_list
+-- ----------------------------
+
+-- ----------------------------
+-- Table structure for store_goods_spec
+-- ----------------------------
+DROP TABLE IF EXISTS `store_goods_spec`;
+CREATE TABLE `store_goods_spec` (
+ `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
+ `mch_id` bigint(20) unsigned DEFAULT '0' COMMENT '商户ID',
+ `spec_title` varchar(255) DEFAULT '' COMMENT '商品规格名称',
+ `spec_param` varchar(255) DEFAULT '' COMMENT '商品规格参数',
+ `spec_desc` varchar(255) DEFAULT '' COMMENT '商品规格描述',
+ `sort` bigint(20) unsigned DEFAULT '0' COMMENT '商品规格排序',
+ `status` bigint(1) unsigned DEFAULT '1' COMMENT '商品状态(1有效,0无效)',
+ `is_deleted` bigint(1) unsigned DEFAULT '0' COMMENT '删除状态(1删除,0未删除)',
+ `create_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+ PRIMARY KEY (`id`),
+ KEY `index_store_goods_spec_mch_id` (`mch_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='商城商品规格';
+
+-- ----------------------------
+-- Records of store_goods_spec
+-- ----------------------------
+
+-- ----------------------------
+-- Table structure for store_member
+-- ----------------------------
+DROP TABLE IF EXISTS `store_member`;
+CREATE TABLE `store_member` (
+ `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
+ `openid` varchar(100) DEFAULT '' COMMENT '会员微信OPENID',
+ `phone` varchar(16) DEFAULT '' COMMENT '会员手机号',
+ `password` varchar(64) NOT NULL DEFAULT '' COMMENT '登录密码',
+ `nickname` varchar(20) DEFAULT '' COMMENT '会员昵称',
+ `headimg` varchar(500) DEFAULT '' COMMENT '会员头像',
+ `sex` char(2) DEFAULT '' COMMENT '性别',
+ `level` tinyint(2) unsigned DEFAULT '1' COMMENT '会员级别',
+ `remark` varchar(500) DEFAULT '' COMMENT '会员个性签名',
+ `status` tinyint(1) unsigned DEFAULT '1' COMMENT '会员状态(1有效,0无效)',
+ `create_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `index_store_member_openid` (`openid`) USING BTREE,
+ KEY `index_store_member_phone` (`phone`) USING BTREE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='商城会员信息';
+
+-- ----------------------------
+-- Records of store_member
+-- ----------------------------
+
+-- ----------------------------
+-- Table structure for store_member_address
+-- ----------------------------
+DROP TABLE IF EXISTS `store_member_address`;
+CREATE TABLE `store_member_address` (
+ `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
+ `mid` bigint(20) unsigned DEFAULT '0' COMMENT '会员ID',
+ `username` varchar(20) DEFAULT '' COMMENT '收货人姓名',
+ `phone` varchar(16) DEFAULT '' COMMENT '收货手机号',
+ `province` varchar(50) DEFAULT '' COMMENT '收货地址省份',
+ `city` varchar(50) DEFAULT '' COMMENT '收货地址城市',
+ `area` varchar(255) DEFAULT '' COMMENT '收货地址区域',
+ `address` varchar(255) DEFAULT '' COMMENT '收货详细地址',
+ `status` tinyint(1) unsigned DEFAULT '1' COMMENT '状态(0无效, 1新快递)',
+ `is_default` tinyint(1) unsigned DEFAULT '1' COMMENT '默认收货地址',
+ `is_deleted` bigint(1) unsigned DEFAULT '0' COMMENT '删除状态(1删除,0未删除)',
+ `create_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='商城会员收货地址';
+
+-- ----------------------------
+-- Records of store_member_address
+-- ----------------------------
+
+-- ----------------------------
+-- Table structure for store_order
+-- ----------------------------
+DROP TABLE IF EXISTS `store_order`;
+CREATE TABLE `store_order` (
+ `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
+ `type` tinyint(1) unsigned DEFAULT '1' COMMENT '订单类型(1普通订单,2积分订单)',
+ `mid` bigint(20) unsigned DEFAULT '0' COMMENT '会员ID',
+ `order_no` char(10) DEFAULT '' COMMENT '订单号',
+ `freight_price` decimal(20,2) unsigned DEFAULT '0.00' COMMENT '快递费',
+ `goods_price` decimal(20,2) unsigned DEFAULT '0.00' COMMENT '商品总金额(不含快递费)',
+ `real_price` decimal(20,2) unsigned DEFAULT '0.00' COMMENT '真实支付金额(商品金额+快递金额)',
+ `is_pay` tinyint(1) unsigned DEFAULT '0' COMMENT '订单支付状态(0.未支付,1.已支付)',
+ `pay_type` varchar(255) DEFAULT '' COMMENT '支付方式 (wechat微信支付, alipay支付宝支付)',
+ `pay_no` varchar(100) DEFAULT '' COMMENT '商户交易号',
+ `pay_price` decimal(20,2) unsigned DEFAULT '0.00' COMMENT '实际支付金额',
+ `pay_at` datetime DEFAULT NULL COMMENT '支付时间',
+ `desc` text COMMENT '订单描述',
+ `status` bigint(1) unsigned DEFAULT '1' COMMENT '订单状态(0.无效,1.新订单,2.待发货,3.已发货,4.已收货,5.已完成,6.已退货及退款)',
+ `is_deleted` tinyint(1) unsigned DEFAULT '0' COMMENT '删除状态(1删除,0未删除)',
+ `create_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+ PRIMARY KEY (`id`),
+ KEY `index_store_order_order_no` (`order_no`) USING BTREE,
+ KEY `index_store_order_status` (`status`) USING BTREE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='商城订单主表';
+
+-- ----------------------------
+-- Records of store_order
+-- ----------------------------
+
+-- ----------------------------
+-- Table structure for store_order_express
+-- ----------------------------
+DROP TABLE IF EXISTS `store_order_express`;
+CREATE TABLE `store_order_express` (
+ `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
+ `mid` bigint(20) unsigned DEFAULT '0' COMMENT '会员ID',
+ `type` tinyint(1) unsigned DEFAULT '0' COMMENT '快递类型(0.订单快递,1.退货快递)',
+ `order_no` char(10) DEFAULT '' COMMENT '订单编号',
+ `company_title` varchar(50) DEFAULT '' COMMENT '物流公司名称',
+ `company_code` varchar(50) DEFAULT '' COMMENT '物流公司编码',
+ `username` varchar(20) DEFAULT '' COMMENT '收货人姓名',
+ `phone` varchar(16) DEFAULT '' COMMENT '收货手机号',
+ `province` varchar(50) DEFAULT NULL COMMENT '收货地址省份',
+ `city` varchar(50) DEFAULT '' COMMENT '收货地址城市',
+ `area` varchar(255) DEFAULT '' COMMENT '收货地址区域',
+ `address` varchar(255) DEFAULT '' COMMENT '收货详细地址',
+ `send_no` varchar(50) DEFAULT '' COMMENT '实际物流公司单号',
+ `send_company_title` varchar(50) DEFAULT '' COMMENT '实际发货快递公司',
+ `send_company_code` varchar(50) DEFAULT '' COMMENT '实际发货快递代码',
+ `send_username` varchar(255) DEFAULT '' COMMENT '寄件人名称',
+ `send_phone` varchar(16) DEFAULT '' COMMENT '寄件人手机号',
+ `send_province` varchar(50) DEFAULT '' COMMENT '寄件人地址省份',
+ `send_city` varchar(50) DEFAULT '' COMMENT '寄件人地址城市',
+ `send_area` varchar(255) DEFAULT '' COMMENT '寄件人地址区域',
+ `send_address` varchar(255) DEFAULT '' COMMENT '寄件人详细地址',
+ `send_at` datetime DEFAULT NULL COMMENT '快递发货时间',
+ `desc` text COMMENT '发货描述',
+ `status` tinyint(1) unsigned DEFAULT '1' COMMENT '状态(0.无效,1.新快递,2.已签收,3.签收失败)',
+ `is_deleted` bigint(1) unsigned DEFAULT '0' COMMENT '删除状态(1删除,0未删除)',
+ `create_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='商城订单快递';
+
+-- ----------------------------
+-- Records of store_order_express
+-- ----------------------------
+
+-- ----------------------------
+-- Table structure for store_order_goods
+-- ----------------------------
+DROP TABLE IF EXISTS `store_order_goods`;
+CREATE TABLE `store_order_goods` (
+ `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
+ `mid` bigint(20) unsigned DEFAULT '0' COMMENT '会员ID',
+ `order_no` char(10) DEFAULT '' COMMENT '订单编号',
+ `goods_id` bigint(20) DEFAULT '0' COMMENT '商品ID',
+ `goods_title` varchar(255) DEFAULT '' COMMENT '商品标签',
+ `goods_spec` varchar(255) DEFAULT '' COMMENT '商品规格',
+ `goods_logo` varchar(255) DEFAULT '' COMMENT '商品LOGO',
+ `goods_image` text COMMENT '商品图片地址',
+ `market_price` decimal(20,2) unsigned DEFAULT '0.00' COMMENT '市场价格',
+ `selling_price` decimal(20,2) unsigned DEFAULT '0.00' COMMENT '商品销售价格',
+ `price_field` varchar(20) DEFAULT 'selling_price' COMMENT '计价字段',
+ `number` bigint(20) unsigned DEFAULT '0' COMMENT '订单商品数量',
+ `status` bigint(1) unsigned DEFAULT '1' COMMENT '商品状态(1有效,0无效)',
+ `is_deleted` bigint(1) unsigned DEFAULT '0' COMMENT '删除状态(1删除,0未删除)',
+ `create_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+ PRIMARY KEY (`id`),
+ KEY `index_store_order_list_order_no` (`order_no`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='商城订单关联商品';
+
+-- ----------------------------
+-- Records of store_order_goods
+-- ----------------------------
+
+-- ----------------------------
+-- Table structure for system_auth
+-- ----------------------------
+DROP TABLE IF EXISTS `system_auth`;
+CREATE TABLE `system_auth` (
+ `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
+ `title` varchar(20) NOT NULL COMMENT '权限名称',
+ `status` tinyint(1) unsigned DEFAULT '1' COMMENT '状态(1:禁用,2:启用)',
+ `sort` smallint(6) unsigned DEFAULT '0' COMMENT '排序权重',
+ `desc` varchar(255) DEFAULT NULL COMMENT '备注说明',
+ `create_by` bigint(11) unsigned DEFAULT '0' COMMENT '创建人',
+ `create_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `index_system_auth_title` (`title`) USING BTREE,
+ KEY `index_system_auth_status` (`status`) USING BTREE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='系统权限表';
+
+-- ----------------------------
+-- Records of system_auth
+-- ----------------------------
+
+-- ----------------------------
+-- Table structure for system_auth_node
+-- ----------------------------
+DROP TABLE IF EXISTS `system_auth_node`;
+CREATE TABLE `system_auth_node` (
+ `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
+ `auth` bigint(20) unsigned DEFAULT NULL COMMENT '角色ID',
+ `node` varchar(200) DEFAULT NULL COMMENT '节点路径',
+ PRIMARY KEY (`id`),
+ KEY `index_system_auth_auth` (`auth`) USING BTREE,
+ KEY `index_system_auth_node` (`node`) USING BTREE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='系统角色与节点绑定';
+
+-- ----------------------------
+-- Records of system_auth_node
+-- ----------------------------
+
+-- ----------------------------
+-- Table structure for system_config
+-- ----------------------------
+DROP TABLE IF EXISTS `system_config`;
+CREATE TABLE `system_config` (
+ `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
+ `name` varchar(100) DEFAULT NULL COMMENT '配置编码',
+ `value` varchar(500) DEFAULT NULL COMMENT '配置值',
+ PRIMARY KEY (`id`),
+ KEY `index_system_config_name` (`name`)
+) ENGINE=InnoDB AUTO_INCREMENT=43 DEFAULT CHARSET=utf8 COMMENT='系统参数配置';
+
+-- ----------------------------
+-- Records of system_config
+-- ----------------------------
+INSERT INTO `system_config` VALUES ('1', 'app_name', 'ThinkAdmin');
+INSERT INTO `system_config` VALUES ('2', 'site_name', 'ThinkAdmin');
+INSERT INTO `system_config` VALUES ('3', 'app_version', '3.0 dev');
+INSERT INTO `system_config` VALUES ('4', 'site_copy', '©版权所有 2014-2018 楚才科技');
+INSERT INTO `system_config` VALUES ('5', 'browser_icon', 'http://localhost/ThinkAdmin/static/upload/f47b8fe06e38ae99/08e8398da45583b9.png');
+INSERT INTO `system_config` VALUES ('6', 'tongji_baidu_key', '');
+INSERT INTO `system_config` VALUES ('7', 'miitbeian', '粤ICP备16006642号-2');
+INSERT INTO `system_config` VALUES ('8', 'storage_type', 'local');
+INSERT INTO `system_config` VALUES ('9', 'storage_local_exts', 'png,jpg,rar,doc,icon,mp4');
+INSERT INTO `system_config` VALUES ('10', 'storage_qiniu_bucket', '');
+INSERT INTO `system_config` VALUES ('11', 'storage_qiniu_domain', '');
+INSERT INTO `system_config` VALUES ('12', 'storage_qiniu_access_key', '');
+INSERT INTO `system_config` VALUES ('13', 'storage_qiniu_secret_key', '');
+INSERT INTO `system_config` VALUES ('14', 'storage_oss_bucket', 'cuci');
+INSERT INTO `system_config` VALUES ('15', 'storage_oss_endpoint', 'oss-cn-beijing.aliyuncs.com');
+INSERT INTO `system_config` VALUES ('16', 'storage_oss_domain', 'cuci.oss-cn-beijing.aliyuncs.com');
+INSERT INTO `system_config` VALUES ('17', 'storage_oss_keyid', '用你自己的吧');
+INSERT INTO `system_config` VALUES ('18', 'storage_oss_secret', '用你自己的吧');
+INSERT INTO `system_config` VALUES ('34', 'wechat_appid', 'wx60a43dd8161666d4');
+INSERT INTO `system_config` VALUES ('35', 'wechat_appkey', '9890a0d7c91801a609d151099e95b61a');
+INSERT INTO `system_config` VALUES ('36', 'storage_oss_is_https', 'http');
+INSERT INTO `system_config` VALUES ('37', 'wechat_type', 'thr');
+INSERT INTO `system_config` VALUES ('38', 'wechat_token', 'test');
+INSERT INTO `system_config` VALUES ('39', 'wechat_appsecret', 'a041bec98ed015d52b99acea5c6a16ef');
+INSERT INTO `system_config` VALUES ('40', 'wechat_encodingaeskey', 'BJIUzE0gqlWy0GxfPp4J1oPTBmOrNDIGPNav1YFH5Z5');
+INSERT INTO `system_config` VALUES ('41', 'wechat_thr_appid', 'wx60a43dd8161666d4');
+INSERT INTO `system_config` VALUES ('42', 'wechat_thr_appkey', '05db2aa335382c66ab56d69b1a9ad0ee');
+
+-- ----------------------------
+-- Table structure for system_log
+-- ----------------------------
+DROP TABLE IF EXISTS `system_log`;
+CREATE TABLE `system_log` (
+ `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
+ `ip` char(15) NOT NULL DEFAULT '' COMMENT '操作者IP地址',
+ `node` char(200) NOT NULL DEFAULT '' COMMENT '当前操作节点',
+ `username` varchar(32) NOT NULL DEFAULT '' COMMENT '操作人用户名',
+ `action` varchar(200) NOT NULL DEFAULT '' COMMENT '操作行为',
+ `content` text NOT NULL COMMENT '操作内容描述',
+ `create_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='系统操作日志表';
+
+-- ----------------------------
+-- Records of system_log
+-- ----------------------------
+
+-- ----------------------------
+-- Table structure for system_menu
+-- ----------------------------
+DROP TABLE IF EXISTS `system_menu`;
+CREATE TABLE `system_menu` (
+ `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
+ `pid` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT '父id',
+ `title` varchar(100) NOT NULL DEFAULT '' COMMENT '名称',
+ `node` varchar(200) NOT NULL DEFAULT '' COMMENT '节点代码',
+ `icon` varchar(100) NOT NULL DEFAULT '' COMMENT '菜单图标',
+ `url` varchar(400) NOT NULL DEFAULT '' COMMENT '链接',
+ `params` varchar(500) DEFAULT '' COMMENT '链接参数',
+ `target` varchar(20) NOT NULL DEFAULT '_self' COMMENT '链接打开方式',
+ `sort` int(11) unsigned DEFAULT '0' COMMENT '菜单排序',
+ `status` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '状态(0:禁用,1:启用)',
+ `create_by` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT '创建人',
+ `create_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+ PRIMARY KEY (`id`),
+ KEY `index_system_menu_node` (`node`) USING BTREE
+) ENGINE=InnoDB AUTO_INCREMENT=43 DEFAULT CHARSET=utf8 COMMENT='系统菜单表';
+
+-- ----------------------------
+-- Records of system_menu
+-- ----------------------------
+INSERT INTO `system_menu` VALUES ('1', '0', '系统设置', '', '', '#', '', '_self', '9000', '1', '10000', '2018-01-19 15:27:00');
+INSERT INTO `system_menu` VALUES ('2', '10', '后台菜单', '', 'fa fa-leaf', 'admin/menu/index', '', '_self', '10', '1', '10000', '2018-01-19 15:27:17');
+INSERT INTO `system_menu` VALUES ('3', '10', '系统参数', '', 'fa fa-modx', 'admin/config/index', '', '_self', '20', '1', '10000', '2018-01-19 15:27:57');
+INSERT INTO `system_menu` VALUES ('4', '11', '访问授权', '', 'fa fa-group', 'admin/auth/index', '', '_self', '20', '1', '10000', '2018-01-22 11:13:02');
+INSERT INTO `system_menu` VALUES ('5', '11', '用户管理', '', 'fa fa-user', 'admin/user/index', '', '_self', '10', '1', '0', '2018-01-23 12:15:12');
+INSERT INTO `system_menu` VALUES ('6', '11', '访问节点', '', 'fa fa-fort-awesome', 'admin/node/index', '', '_self', '30', '1', '0', '2018-01-23 12:36:54');
+INSERT INTO `system_menu` VALUES ('7', '0', '后台首页', '', '', 'admin/index/main', '', '_self', '1000', '1', '0', '2018-01-23 13:42:30');
+INSERT INTO `system_menu` VALUES ('8', '16', '系统日志', '', 'fa fa-code', 'admin/log/index', '', '_self', '10', '1', '0', '2018-01-24 13:52:58');
+INSERT INTO `system_menu` VALUES ('9', '10', '文件存储', '', 'fa fa-stop-circle', 'admin/config/file', '', '_self', '30', '1', '0', '2018-01-25 10:54:28');
+INSERT INTO `system_menu` VALUES ('10', '1', '系统管理', '', '', '#', '', '_self', '200', '1', '0', '2018-01-25 18:14:28');
+INSERT INTO `system_menu` VALUES ('11', '1', '访问权限', '', '', '#', '', '_self', '300', '1', '0', '2018-01-25 18:15:08');
+INSERT INTO `system_menu` VALUES ('16', '1', '日志管理', '', '', '#', '', '_self', '400', '1', '0', '2018-02-10 16:31:15');
+INSERT INTO `system_menu` VALUES ('17', '0', '微信管理', '', '', '#', '', '_self', '8000', '1', '0', '2018-03-06 14:42:49');
+INSERT INTO `system_menu` VALUES ('18', '17', '公众号配置', '', '', '#', '', '_self', '0', '1', '0', '2018-03-06 14:43:05');
+INSERT INTO `system_menu` VALUES ('19', '18', '微信授权绑定', '', 'fa fa-cog', 'wechat/config/index', '', '_self', '0', '1', '0', '2018-03-06 14:43:26');
+INSERT INTO `system_menu` VALUES ('20', '18', '关注默认回复', '', 'fa fa-comment-o', 'wechat/keys/subscribe', '', '_self', '0', '1', '0', '2018-03-06 14:44:45');
+INSERT INTO `system_menu` VALUES ('21', '18', '无反馈默认回复', '', 'fa fa-commenting', 'wechat/keys/defaults', '', '_self', '0', '1', '0', '2018-03-06 14:45:55');
+INSERT INTO `system_menu` VALUES ('22', '18', '微信关键字管理', '', 'fa fa-hashtag', 'wechat/keys/index', '', '_self', '0', '1', '0', '2018-03-06 14:46:23');
+INSERT INTO `system_menu` VALUES ('23', '17', '微信服务定制', '', '', '#', '', '_self', '0', '1', '0', '2018-03-06 14:47:11');
+INSERT INTO `system_menu` VALUES ('24', '23', '微信菜单管理', '', 'fa fa-gg-circle', 'wechat/menu/index', '', '_self', '0', '1', '0', '2018-03-06 14:47:39');
+INSERT INTO `system_menu` VALUES ('25', '23', '微信图文管理', '', 'fa fa-map-o', 'wechat/news/index', '', '_self', '0', '1', '0', '2018-03-06 14:48:14');
+INSERT INTO `system_menu` VALUES ('26', '17', '微信粉丝管理', '', 'fa fa-user', '#', '', '_self', '0', '1', '0', '2018-03-06 14:48:33');
+INSERT INTO `system_menu` VALUES ('27', '26', '微信粉丝列表', '', 'fa fa-users', 'wechat/fans/index', '', '_self', '20', '1', '0', '2018-03-06 14:49:04');
+INSERT INTO `system_menu` VALUES ('28', '26', '微信黑名单管理', '', 'fa fa-user-times', 'wechat/fans_block/index', '', '_self', '30', '1', '0', '2018-03-06 14:49:22');
+INSERT INTO `system_menu` VALUES ('29', '26', '微信标签管理', '', 'fa fa-tags', 'wechat/tags/index', '', '_self', '10', '1', '0', '2018-03-06 14:49:39');
+INSERT INTO `system_menu` VALUES ('32', '0', '商城管理', '', '', '#', '', '_self', '2000', '1', '0', '2018-03-20 16:46:07');
+INSERT INTO `system_menu` VALUES ('33', '32', '商品管理', '', '', '#', '', '_self', '0', '1', '0', '2018-03-20 16:46:21');
+INSERT INTO `system_menu` VALUES ('34', '33', '产品管理', '', 'fa fa-modx', 'store/goods/index', '', '_self', '0', '1', '0', '2018-03-20 16:46:45');
+INSERT INTO `system_menu` VALUES ('35', '33', '规格管理', '', 'fa fa-hashtag', 'store/goods_spec/index', '', '_self', '0', '1', '0', '2018-03-20 16:47:08');
+INSERT INTO `system_menu` VALUES ('36', '33', '分类管理', '', 'fa fa-product-hunt', 'store/goods_cate/index', '', '_self', '0', '1', '0', '2018-03-20 16:47:50');
+INSERT INTO `system_menu` VALUES ('37', '33', '品牌管理', '', 'fa fa-scribd', 'store/goods_brand/index', '', '_self', '0', '1', '0', '2018-03-20 16:48:05');
+INSERT INTO `system_menu` VALUES ('38', '32', '订单管理', '', '', '#', '', '_self', '0', '1', '0', '2018-04-21 15:07:36');
+INSERT INTO `system_menu` VALUES ('39', '38', '订单列表', '', 'fa fa-adjust', 'store/order/index', '', '_self', '0', '1', '0', '2018-04-21 15:07:54');
+INSERT INTO `system_menu` VALUES ('40', '32', '商城配置', '', '', '#', '', '_self', '0', '1', '0', '2018-04-21 15:08:17');
+INSERT INTO `system_menu` VALUES ('41', '40', '参数管理', '', '', '#', '', '_self', '0', '0', '0', '2018-04-21 15:08:25');
+INSERT INTO `system_menu` VALUES ('42', '40', '快递公司', '', 'fa fa-mixcloud', 'store/express/index', '', '_self', '0', '1', '0', '2018-04-21 15:08:50');
+
+-- ----------------------------
+-- Table structure for system_node
+-- ----------------------------
+DROP TABLE IF EXISTS `system_node`;
+CREATE TABLE `system_node` (
+ `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
+ `node` varchar(100) DEFAULT NULL COMMENT '节点代码',
+ `title` varchar(500) DEFAULT NULL COMMENT '节点标题',
+ `is_menu` tinyint(1) unsigned DEFAULT '0' COMMENT '是否可设置为菜单',
+ `is_auth` tinyint(1) unsigned DEFAULT '1' COMMENT '是否启动RBAC权限控制',
+ `is_login` tinyint(1) unsigned DEFAULT '1' COMMENT '是否启动登录控制',
+ `create_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+ PRIMARY KEY (`id`),
+ KEY `index_system_node_node` (`node`)
+) ENGINE=InnoDB AUTO_INCREMENT=145 DEFAULT CHARSET=utf8 COMMENT='系统节点表';
+
+-- ----------------------------
+-- Records of system_node
+-- ----------------------------
+INSERT INTO `system_node` VALUES ('13', 'admin', '系统设置', '0', '1', '1', '2018-05-04 11:02:34');
+INSERT INTO `system_node` VALUES ('14', 'admin/auth', '权限管理', '0', '1', '1', '2018-05-04 11:06:55');
+INSERT INTO `system_node` VALUES ('15', 'admin/auth/index', '权限列表', '1', '1', '1', '2018-05-04 11:06:56');
+INSERT INTO `system_node` VALUES ('16', 'admin/auth/apply', '权限配置', '0', '1', '1', '2018-05-04 11:06:56');
+INSERT INTO `system_node` VALUES ('17', 'admin/auth/add', '添加权限', '0', '1', '1', '2018-05-04 11:06:56');
+INSERT INTO `system_node` VALUES ('18', 'admin/auth/edit', '编辑权限', '0', '1', '1', '2018-05-04 11:06:56');
+INSERT INTO `system_node` VALUES ('19', 'admin/auth/forbid', '禁用权限', '0', '1', '1', '2018-05-04 11:06:56');
+INSERT INTO `system_node` VALUES ('20', 'admin/auth/resume', '启用权限', '0', '1', '1', '2018-05-04 11:06:56');
+INSERT INTO `system_node` VALUES ('21', 'admin/auth/del', '删除权限', '0', '1', '1', '2018-05-04 11:06:56');
+INSERT INTO `system_node` VALUES ('22', 'admin/config', '系统配置', '0', '1', '1', '2018-05-04 11:08:18');
+INSERT INTO `system_node` VALUES ('23', 'admin/config/index', '系统参数', '1', '1', '1', '2018-05-04 11:08:25');
+INSERT INTO `system_node` VALUES ('24', 'admin/config/file', '文件存储', '1', '1', '1', '2018-05-04 11:08:27');
+INSERT INTO `system_node` VALUES ('25', 'admin/log', '日志管理', '0', '1', '1', '2018-05-04 11:08:43');
+INSERT INTO `system_node` VALUES ('26', 'admin/log/index', '日志管理', '1', '1', '1', '2018-05-04 11:08:43');
+INSERT INTO `system_node` VALUES ('28', 'admin/log/del', '日志删除', '0', '1', '1', '2018-05-04 11:08:43');
+INSERT INTO `system_node` VALUES ('29', 'admin/menu', '系统菜单', '0', '1', '1', '2018-05-04 11:09:54');
+INSERT INTO `system_node` VALUES ('30', 'admin/menu/index', '菜单列表', '1', '1', '1', '2018-05-04 11:09:54');
+INSERT INTO `system_node` VALUES ('31', 'admin/menu/add', '添加菜单', '0', '1', '1', '2018-05-04 11:09:55');
+INSERT INTO `system_node` VALUES ('32', 'admin/menu/edit', '编辑菜单', '0', '1', '1', '2018-05-04 11:09:55');
+INSERT INTO `system_node` VALUES ('33', 'admin/menu/del', '删除菜单', '0', '1', '1', '2018-05-04 11:09:55');
+INSERT INTO `system_node` VALUES ('34', 'admin/menu/forbid', '禁用菜单', '0', '1', '1', '2018-05-04 11:09:55');
+INSERT INTO `system_node` VALUES ('35', 'admin/menu/resume', '启用菜单', '0', '1', '1', '2018-05-04 11:09:55');
+INSERT INTO `system_node` VALUES ('36', 'admin/node', '节点管理', '0', '1', '1', '2018-05-04 11:10:20');
+INSERT INTO `system_node` VALUES ('37', 'admin/node/index', '节点列表', '1', '1', '1', '2018-05-04 11:10:20');
+INSERT INTO `system_node` VALUES ('38', 'admin/node/clear', '清理节点', '0', '1', '1', '2018-05-04 11:10:21');
+INSERT INTO `system_node` VALUES ('39', 'admin/node/save', '更新节点', '0', '1', '1', '2018-05-04 11:10:21');
+INSERT INTO `system_node` VALUES ('40', 'admin/user', '系统用户', '0', '1', '1', '2018-05-04 11:10:43');
+INSERT INTO `system_node` VALUES ('41', 'admin/user/index', '用户列表', '1', '1', '1', '2018-05-04 11:10:43');
+INSERT INTO `system_node` VALUES ('42', 'admin/user/auth', '用户授权', '0', '1', '1', '2018-05-04 11:10:43');
+INSERT INTO `system_node` VALUES ('43', 'admin/user/add', '添加用户', '0', '1', '1', '2018-05-04 11:10:43');
+INSERT INTO `system_node` VALUES ('44', 'admin/user/edit', '编辑用户', '0', '1', '1', '2018-05-04 11:10:43');
+INSERT INTO `system_node` VALUES ('45', 'admin/user/pass', '修改密码', '0', '1', '1', '2018-05-04 11:10:43');
+INSERT INTO `system_node` VALUES ('46', 'admin/user/del', '删除用户', '0', '1', '1', '2018-05-04 11:10:43');
+INSERT INTO `system_node` VALUES ('47', 'admin/user/forbid', '禁用启用', '0', '1', '1', '2018-05-04 11:10:43');
+INSERT INTO `system_node` VALUES ('48', 'admin/user/resume', '启用用户', '0', '1', '1', '2018-05-04 11:10:44');
+INSERT INTO `system_node` VALUES ('49', 'store', '商城管理', '0', '1', '1', '2018-05-04 11:11:28');
+INSERT INTO `system_node` VALUES ('50', 'store/express', '快递公司管理', '0', '1', '1', '2018-05-04 11:11:39');
+INSERT INTO `system_node` VALUES ('51', 'store/express/index', '快递公司列表', '1', '1', '1', '2018-05-04 11:11:39');
+INSERT INTO `system_node` VALUES ('52', 'store/express/add', '添加快递公司', '0', '1', '1', '2018-05-04 11:11:39');
+INSERT INTO `system_node` VALUES ('53', 'store/express/edit', '编辑快递公司', '0', '1', '1', '2018-05-04 11:11:39');
+INSERT INTO `system_node` VALUES ('54', 'store/express/del', '删除快递公司', '0', '1', '1', '2018-05-04 11:11:39');
+INSERT INTO `system_node` VALUES ('55', 'store/express/forbid', '禁用快递公司', '0', '1', '1', '2018-05-04 11:11:39');
+INSERT INTO `system_node` VALUES ('56', 'store/express/resume', '启用快递公司', '0', '1', '1', '2018-05-04 11:11:40');
+INSERT INTO `system_node` VALUES ('57', 'store/order', '订单管理', '0', '1', '1', '2018-05-04 11:12:14');
+INSERT INTO `system_node` VALUES ('58', 'store/order/index', '订单列表', '1', '1', '1', '2018-05-04 11:12:17');
+INSERT INTO `system_node` VALUES ('59', 'store/order/address', '修改地址', '0', '1', '1', '2018-05-04 11:12:19');
+INSERT INTO `system_node` VALUES ('76', 'wechat', '微信管理', '0', '1', '1', '2018-05-04 11:14:59');
+INSERT INTO `system_node` VALUES ('78', 'wechat/config', '微信对接管理', '0', '1', '1', '2018-05-04 11:16:20');
+INSERT INTO `system_node` VALUES ('79', 'wechat/config/index', '微信对接配置', '1', '1', '1', '2018-05-04 11:16:23');
+INSERT INTO `system_node` VALUES ('80', 'wechat/fans', '微信粉丝管理', '0', '1', '1', '2018-05-04 11:16:31');
+INSERT INTO `system_node` VALUES ('81', 'wechat/fans/index', '微信粉丝列表', '1', '1', '1', '2018-05-04 11:16:32');
+INSERT INTO `system_node` VALUES ('82', 'wechat/fans/backadd', '微信粉丝拉黑', '0', '1', '1', '2018-05-04 11:16:32');
+INSERT INTO `system_node` VALUES ('83', 'wechat/fans/tagset', '设置粉丝标签', '0', '1', '1', '2018-05-04 11:16:32');
+INSERT INTO `system_node` VALUES ('84', 'wechat/fans/tagadd', '添加粉丝标签', '0', '1', '1', '2018-05-04 11:16:32');
+INSERT INTO `system_node` VALUES ('85', 'wechat/fans/tagdel', '删除粉丝标签', '0', '1', '1', '2018-05-04 11:16:32');
+INSERT INTO `system_node` VALUES ('86', 'wechat/fans/sync', '同步粉丝列表', '0', '1', '1', '2018-05-04 11:16:32');
+INSERT INTO `system_node` VALUES ('87', 'wechat/fans_block', '粉丝黑名单管理', '0', '1', '1', '2018-05-04 11:17:25');
+INSERT INTO `system_node` VALUES ('88', 'wechat/fans_block/index', '粉丝黑名单列表', '1', '1', '1', '2018-05-04 11:17:50');
+INSERT INTO `system_node` VALUES ('89', 'wechat/fans_block/backdel', '移除粉丝黑名单', '0', '1', '1', '2018-05-04 11:17:51');
+INSERT INTO `system_node` VALUES ('90', 'wechat/keys', '微信关键字', '0', '1', '1', '2018-05-04 11:18:09');
+INSERT INTO `system_node` VALUES ('91', 'wechat/keys/index', '关键字列表', '1', '1', '1', '2018-05-04 11:18:09');
+INSERT INTO `system_node` VALUES ('92', 'wechat/keys/add', '添加关键字', '0', '1', '1', '2018-05-04 11:18:09');
+INSERT INTO `system_node` VALUES ('93', 'wechat/keys/edit', '编辑关键字', '0', '1', '1', '2018-05-04 11:18:09');
+INSERT INTO `system_node` VALUES ('94', 'wechat/keys/del', '删除关键字', '0', '1', '1', '2018-05-04 11:18:09');
+INSERT INTO `system_node` VALUES ('95', 'wechat/keys/forbid', '禁用关键字', '0', '1', '1', '2018-05-04 11:18:09');
+INSERT INTO `system_node` VALUES ('96', 'wechat/keys/resume', '启用关键字', '0', '1', '1', '2018-05-04 11:18:09');
+INSERT INTO `system_node` VALUES ('97', 'wechat/keys/subscribe', '关注回复', '1', '1', '1', '2018-05-04 11:18:09');
+INSERT INTO `system_node` VALUES ('98', 'wechat/keys/defaults', '默认回复', '1', '1', '1', '2018-05-04 11:18:09');
+INSERT INTO `system_node` VALUES ('99', 'wechat/menu', '微信菜单管理', '0', '1', '1', '2018-05-04 11:18:57');
+INSERT INTO `system_node` VALUES ('100', 'wechat/menu/index', '微信菜单展示', '1', '1', '1', '2018-05-04 11:19:10');
+INSERT INTO `system_node` VALUES ('101', 'wechat/menu/edit', '编辑微信菜单', '0', '1', '1', '2018-05-04 11:19:22');
+INSERT INTO `system_node` VALUES ('102', 'wechat/menu/cancel', '取消微信菜单', '0', '1', '1', '2018-05-04 11:19:26');
+INSERT INTO `system_node` VALUES ('103', 'wechat/news/index', '微信图文列表', '1', '1', '1', '2018-05-04 11:19:28');
+INSERT INTO `system_node` VALUES ('104', 'wechat/news/select', '微信图文选择', '0', '1', '1', '2018-05-04 11:19:28');
+INSERT INTO `system_node` VALUES ('105', 'wechat/news/image', '微信图片选择', '0', '1', '1', '2018-05-04 11:19:28');
+INSERT INTO `system_node` VALUES ('106', 'wechat/news/add', '添加微信图文', '0', '1', '1', '2018-05-04 11:19:28');
+INSERT INTO `system_node` VALUES ('107', 'wechat/news/edit', '编辑微信图文', '0', '1', '1', '2018-05-04 11:19:28');
+INSERT INTO `system_node` VALUES ('108', 'wechat/news/del', '删除微信图文', '0', '1', '1', '2018-05-04 11:19:28');
+INSERT INTO `system_node` VALUES ('109', 'wechat/news/push', '推送微信图文', '0', '1', '1', '2018-05-04 11:19:28');
+INSERT INTO `system_node` VALUES ('110', 'wechat/news', '微信图文管理', '0', '1', '1', '2018-05-04 11:19:35');
+INSERT INTO `system_node` VALUES ('111', 'wechat/tags', '微信粉丝标签管理', '0', '1', '1', '2018-05-04 11:20:28');
+INSERT INTO `system_node` VALUES ('112', 'wechat/tags/index', '粉丝标签列表', '1', '1', '1', '2018-05-04 11:20:28');
+INSERT INTO `system_node` VALUES ('113', 'wechat/tags/add', '添加粉丝标签', '0', '1', '1', '2018-05-04 11:20:28');
+INSERT INTO `system_node` VALUES ('114', 'wechat/tags/edit', '编辑粉丝标签', '0', '1', '1', '2018-05-04 11:20:29');
+INSERT INTO `system_node` VALUES ('115', 'wechat/tags/del', '删除粉丝标签', '0', '1', '1', '2018-05-04 11:20:29');
+INSERT INTO `system_node` VALUES ('116', 'wechat/tags/sync', '同步粉丝标签', '0', '1', '1', '2018-05-04 11:20:29');
+INSERT INTO `system_node` VALUES ('117', 'store/goods', '商品管理', '0', '1', '1', '2018-05-04 11:29:55');
+INSERT INTO `system_node` VALUES ('118', 'store/goods/index', '商品列表', '1', '1', '1', '2018-05-04 11:29:56');
+INSERT INTO `system_node` VALUES ('119', 'store/goods/add', '添加商品', '0', '1', '1', '2018-05-04 11:29:56');
+INSERT INTO `system_node` VALUES ('120', 'store/goods/edit', '编辑商品', '0', '1', '1', '2018-05-04 11:29:56');
+INSERT INTO `system_node` VALUES ('121', 'store/goods/del', '删除商品', '0', '1', '1', '2018-05-04 11:29:56');
+INSERT INTO `system_node` VALUES ('122', 'store/goods/forbid', '下架商品', '0', '1', '1', '2018-05-04 11:29:56');
+INSERT INTO `system_node` VALUES ('123', 'store/goods/resume', '上架商品', '0', '1', '1', '2018-05-04 11:29:57');
+INSERT INTO `system_node` VALUES ('124', 'store/goods_brand', '商品品牌管理', '0', '1', '1', '2018-05-04 11:30:44');
+INSERT INTO `system_node` VALUES ('125', 'store/goods_brand/index', '商品品牌列表', '1', '1', '1', '2018-05-04 11:30:52');
+INSERT INTO `system_node` VALUES ('126', 'store/goods_brand/add', '添加商品品牌', '0', '1', '1', '2018-05-04 11:30:55');
+INSERT INTO `system_node` VALUES ('127', 'store/goods_brand/edit', '编辑商品品牌', '0', '1', '1', '2018-05-04 11:30:56');
+INSERT INTO `system_node` VALUES ('128', 'store/goods_brand/del', '删除商品品牌', '0', '1', '1', '2018-05-04 11:30:56');
+INSERT INTO `system_node` VALUES ('129', 'store/goods_brand/forbid', '禁用商品品牌', '0', '1', '1', '2018-05-04 11:30:56');
+INSERT INTO `system_node` VALUES ('130', 'store/goods_brand/resume', '启用商品品牌', '0', '1', '1', '2018-05-04 11:30:56');
+INSERT INTO `system_node` VALUES ('131', 'store/goods_cate', '商品分类管理', '0', '1', '1', '2018-05-04 11:31:19');
+INSERT INTO `system_node` VALUES ('132', 'store/goods_cate/index', '商品分类列表', '1', '1', '1', '2018-05-04 11:31:23');
+INSERT INTO `system_node` VALUES ('133', 'store/goods_cate/add', '添加商品分类', '0', '1', '1', '2018-05-04 11:31:23');
+INSERT INTO `system_node` VALUES ('134', 'store/goods_cate/edit', '编辑商品分类', '0', '1', '1', '2018-05-04 11:31:23');
+INSERT INTO `system_node` VALUES ('135', 'store/goods_cate/del', '删除商品分类', '0', '1', '1', '2018-05-04 11:31:24');
+INSERT INTO `system_node` VALUES ('136', 'store/goods_cate/forbid', '禁用商品分类', '0', '1', '1', '2018-05-04 11:31:24');
+INSERT INTO `system_node` VALUES ('137', 'store/goods_cate/resume', '启用商品分类', '0', '1', '1', '2018-05-04 11:31:24');
+INSERT INTO `system_node` VALUES ('138', 'store/goods_spec', '商品规格管理', '0', '1', '1', '2018-05-04 11:31:47');
+INSERT INTO `system_node` VALUES ('139', 'store/goods_spec/index', '商品规格列表', '1', '1', '1', '2018-05-04 11:31:47');
+INSERT INTO `system_node` VALUES ('140', 'store/goods_spec/add', '添加商品规格', '0', '1', '1', '2018-05-04 11:31:47');
+INSERT INTO `system_node` VALUES ('141', 'store/goods_spec/edit', '编辑商品规格', '0', '1', '1', '2018-05-04 11:31:48');
+INSERT INTO `system_node` VALUES ('142', 'store/goods_spec/del', '删除商品规格', '0', '1', '1', '2018-05-04 11:31:48');
+INSERT INTO `system_node` VALUES ('143', 'store/goods_spec/forbid', '禁用商品规格', '0', '1', '1', '2018-05-04 11:31:48');
+INSERT INTO `system_node` VALUES ('144', 'store/goods_spec/resume', '启用商品规格', '0', '1', '1', '2018-05-04 11:31:48');
+
+-- ----------------------------
+-- Table structure for system_sequence
+-- ----------------------------
+DROP TABLE IF EXISTS `system_sequence`;
+CREATE TABLE `system_sequence` (
+ `id` bigint(20) NOT NULL AUTO_INCREMENT,
+ `type` varchar(20) DEFAULT NULL COMMENT '序号类型',
+ `sequence` char(50) NOT NULL COMMENT '序号值',
+ `create_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `index_system_sequence_unique` (`type`,`sequence`) USING BTREE,
+ KEY `index_system_sequence_type` (`type`),
+ KEY `index_system_sequence_number` (`sequence`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='系统序号表';
+
+-- ----------------------------
+-- Records of system_sequence
+-- ----------------------------
+
+-- ----------------------------
+-- Table structure for system_user
+-- ----------------------------
+DROP TABLE IF EXISTS `system_user`;
+CREATE TABLE `system_user` (
+ `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
+ `username` varchar(50) NOT NULL DEFAULT '' COMMENT '用户登录名',
+ `password` char(32) NOT NULL DEFAULT '' COMMENT '用户登录密码',
+ `qq` varchar(16) DEFAULT NULL COMMENT '联系QQ',
+ `mail` varchar(32) DEFAULT NULL COMMENT '联系邮箱',
+ `phone` varchar(16) DEFAULT NULL COMMENT '联系手机号',
+ `desc` varchar(255) DEFAULT '' COMMENT '备注说明',
+ `login_num` bigint(20) unsigned DEFAULT '0' COMMENT '登录次数',
+ `login_at` datetime DEFAULT NULL,
+ `status` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '状态(0:禁用,1:启用)',
+ `authorize` varchar(255) DEFAULT NULL,
+ `is_deleted` tinyint(1) unsigned DEFAULT '0' COMMENT '删除状态(1:删除,0:未删)',
+ `create_by` bigint(20) unsigned DEFAULT NULL COMMENT '创建人',
+ `create_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `index_system_user_username` (`username`) USING BTREE
+) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COMMENT='系统用户表';
+
+-- ----------------------------
+-- Records of system_user
+-- ----------------------------
+INSERT INTO `system_user` VALUES ('10000', 'admin', '21232f297a57a5a743894a0e4a801fc3', '22222222', '', '', '', '22973', '2018-03-26 17:06:48', '1', '2,4', '0', null, '2015-11-13 15:14:22');
+
+-- ----------------------------
+-- Table structure for wechat_fans
+-- ----------------------------
+DROP TABLE IF EXISTS `wechat_fans`;
+CREATE TABLE `wechat_fans` (
+ `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
+ `appid` char(50) DEFAULT '' COMMENT '公众号Appid',
+ `unionid` char(100) DEFAULT '' COMMENT 'unionid',
+ `openid` char(100) DEFAULT '' COMMENT '用户的标识,对当前公众号唯一',
+ `spread_openid` char(100) DEFAULT '' COMMENT '推荐人OPENID',
+ `spread_at` datetime DEFAULT NULL COMMENT '推荐时间',
+ `tagid_list` varchar(100) DEFAULT '' COMMENT '标签id',
+ `is_black` tinyint(1) unsigned DEFAULT '0' COMMENT '是否为黑名单用户',
+ `subscribe` tinyint(1) unsigned DEFAULT '0' COMMENT '用户是否关注该公众号(0:未关注, 1:已关注)',
+ `nickname` varchar(200) DEFAULT '' COMMENT '用户的昵称',
+ `sex` tinyint(1) unsigned DEFAULT NULL COMMENT '用户的性别,值为1时是男性,值为2时是女性,值为0时是未知',
+ `country` varchar(50) DEFAULT '' COMMENT '用户所在国家',
+ `province` varchar(50) DEFAULT '' COMMENT '用户所在省份',
+ `city` varchar(50) DEFAULT '' COMMENT '用户所在城市',
+ `language` varchar(50) DEFAULT '' COMMENT '用户的语言,简体中文为zh_CN',
+ `headimgurl` varchar(500) DEFAULT '' COMMENT '用户头像',
+ `subscribe_time` bigint(20) unsigned DEFAULT '0' COMMENT '用户关注时间',
+ `subscribe_at` datetime DEFAULT NULL COMMENT '关注时间',
+ `remark` varchar(50) DEFAULT '' COMMENT '备注',
+ `expires_in` bigint(20) unsigned DEFAULT '0' COMMENT '有效时间',
+ `refresh_token` varchar(200) DEFAULT '' COMMENT '刷新token',
+ `access_token` varchar(200) DEFAULT '' COMMENT '访问token',
+ `subscribe_scene` varchar(200) DEFAULT '' COMMENT '扫码关注场景',
+ `qr_scene` varchar(100) DEFAULT '' COMMENT '二维码场景值',
+ `qr_scene_str` varchar(200) DEFAULT '' COMMENT '二维码场景内容',
+ `create_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+ PRIMARY KEY (`id`),
+ KEY `index_wechat_fans_spread_openid` (`spread_openid`) USING BTREE,
+ KEY `index_wechat_fans_openid` (`openid`) USING BTREE,
+ KEY `index_wechat_fans_unionid` (`unionid`),
+ KEY `index_wechat_fans_is_back` (`is_black`),
+ KEY `index_wechat_fans_subscribe` (`subscribe`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='微信粉丝';
+
+-- ----------------------------
+-- Records of wechat_fans
+-- ----------------------------
+
+-- ----------------------------
+-- Table structure for wechat_fans_tags
+-- ----------------------------
+DROP TABLE IF EXISTS `wechat_fans_tags`;
+CREATE TABLE `wechat_fans_tags` (
+ `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '标签ID',
+ `appid` char(50) DEFAULT NULL COMMENT '公众号APPID',
+ `name` varchar(35) DEFAULT NULL COMMENT '标签名称',
+ `count` int(11) unsigned DEFAULT NULL COMMENT '总数',
+ `create_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建日期',
+ KEY `index_wechat_fans_tags_id` (`id`) USING BTREE,
+ KEY `index_wechat_fans_tags_appid` (`appid`) USING BTREE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='微信会员标签';
+
+-- ----------------------------
+-- Records of wechat_fans_tags
+-- ----------------------------
+
+-- ----------------------------
+-- Table structure for wechat_keys
+-- ----------------------------
+DROP TABLE IF EXISTS `wechat_keys`;
+CREATE TABLE `wechat_keys` (
+ `id` bigint(20) NOT NULL AUTO_INCREMENT,
+ `appid` char(100) DEFAULT '' COMMENT '公众号APPID',
+ `type` varchar(20) DEFAULT '' COMMENT '类型,text 文件消息,image 图片消息,news 图文消息',
+ `keys` varchar(100) DEFAULT NULL COMMENT '关键字',
+ `content` text COMMENT '文本内容',
+ `image_url` varchar(255) DEFAULT '' COMMENT '图片链接',
+ `voice_url` varchar(255) DEFAULT '' COMMENT '语音链接',
+ `music_title` varchar(100) DEFAULT '' COMMENT '音乐标题',
+ `music_url` varchar(255) DEFAULT '' COMMENT '音乐链接',
+ `music_image` varchar(255) DEFAULT '' COMMENT '音乐缩略图链接',
+ `music_desc` varchar(255) DEFAULT '' COMMENT '音乐描述',
+ `video_title` varchar(100) DEFAULT '' COMMENT '视频标题',
+ `video_url` varchar(255) DEFAULT '' COMMENT '视频URL',
+ `video_desc` varchar(255) DEFAULT '' COMMENT '视频描述',
+ `news_id` bigint(20) unsigned DEFAULT NULL COMMENT '图文ID',
+ `sort` bigint(20) unsigned DEFAULT '0' COMMENT '排序字段',
+ `status` tinyint(1) unsigned DEFAULT '1' COMMENT '0 禁用,1 启用',
+ `create_by` bigint(20) unsigned DEFAULT NULL COMMENT '创建人',
+ `create_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '创建时间',
+ PRIMARY KEY (`id`),
+ KEY `index_wechat_keys_appid` (`appid`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='微信关键字';
+
+-- ----------------------------
+-- Records of wechat_keys
+-- ----------------------------
+
+-- ----------------------------
+-- Table structure for wechat_menu
+-- ----------------------------
+DROP TABLE IF EXISTS `wechat_menu`;
+CREATE TABLE `wechat_menu` (
+ `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
+ `index` bigint(20) DEFAULT NULL,
+ `pindex` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT '父id',
+ `type` varchar(24) NOT NULL DEFAULT '' COMMENT '菜单类型 null主菜单 link链接 keys关键字',
+ `name` varchar(256) NOT NULL DEFAULT '' COMMENT '菜单名称',
+ `content` text NOT NULL COMMENT '文字内容',
+ `sort` bigint(20) unsigned DEFAULT '0' COMMENT '排序',
+ `status` tinyint(1) unsigned DEFAULT '1' COMMENT '状态(0禁用1启用)',
+ `create_by` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT '创建人',
+ `create_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+ PRIMARY KEY (`id`),
+ KEY `index_wechat_menu_pindex` (`pindex`) USING BTREE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='微信菜单配置';
+
+-- ----------------------------
+-- Records of wechat_menu
+-- ----------------------------
+
+-- ----------------------------
+-- Table structure for wechat_news
+-- ----------------------------
+DROP TABLE IF EXISTS `wechat_news`;
+CREATE TABLE `wechat_news` (
+ `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
+ `media_id` varchar(100) DEFAULT '' COMMENT '永久素材MediaID',
+ `local_url` varchar(300) DEFAULT '' COMMENT '永久素材显示URL',
+ `article_id` varchar(60) DEFAULT '' COMMENT '关联图文ID,用,号做分割',
+ `is_deleted` tinyint(1) unsigned DEFAULT '0' COMMENT '是否删除',
+ `create_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+ `create_by` bigint(20) DEFAULT NULL COMMENT '创建人',
+ PRIMARY KEY (`id`),
+ KEY `index_wechat_news_artcle_id` (`article_id`) USING BTREE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='微信图文表';
+
+-- ----------------------------
+-- Records of wechat_news
+-- ----------------------------
+
+-- ----------------------------
+-- Table structure for wechat_news_article
+-- ----------------------------
+DROP TABLE IF EXISTS `wechat_news_article`;
+CREATE TABLE `wechat_news_article` (
+ `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
+ `title` varchar(50) DEFAULT '' COMMENT '素材标题',
+ `local_url` varchar(300) DEFAULT '' COMMENT '永久素材显示URL',
+ `show_cover_pic` tinyint(4) unsigned DEFAULT '0' COMMENT '是否显示封面 0不显示,1 显示',
+ `author` varchar(20) DEFAULT '' COMMENT '作者',
+ `digest` varchar(300) DEFAULT '' COMMENT '摘要内容',
+ `content` longtext COMMENT '图文内容',
+ `content_source_url` varchar(200) DEFAULT '' COMMENT '图文消息原文地址',
+ `create_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+ `create_by` bigint(20) DEFAULT NULL COMMENT '创建人',
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='微信素材表';
+
+-- ----------------------------
+-- Records of wechat_news_article
+-- ----------------------------
+
+-- ----------------------------
+-- Table structure for wechat_news_image
+-- ----------------------------
+DROP TABLE IF EXISTS `wechat_news_image`;
+CREATE TABLE `wechat_news_image` (
+ `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
+ `md5` varchar(32) DEFAULT '' COMMENT '文件md5',
+ `local_url` varchar(300) DEFAULT '' COMMENT '本地文件链接',
+ `media_url` varchar(300) DEFAULT '' COMMENT '远程图片链接',
+ `create_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+ PRIMARY KEY (`id`),
+ KEY `index_wechat_news_image_md5` (`md5`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='微信服务器图片';
+
+-- ----------------------------
+-- Records of wechat_news_image
+-- ----------------------------
+
+-- ----------------------------
+-- Table structure for wechat_news_media
+-- ----------------------------
+DROP TABLE IF EXISTS `wechat_news_media`;
+CREATE TABLE `wechat_news_media` (
+ `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
+ `appid` varchar(100) DEFAULT '' COMMENT '公众号ID',
+ `md5` varchar(32) DEFAULT '' COMMENT '文件md5',
+ `type` varchar(20) DEFAULT '' COMMENT '媒体类型',
+ `media_id` varchar(100) DEFAULT '' COMMENT '永久素材MediaID',
+ `local_url` varchar(300) DEFAULT '' COMMENT '本地文件链接',
+ `media_url` varchar(300) DEFAULT '' COMMENT '远程图片链接',
+ `create_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='微信素材表';
+
+
+-- ----------------------------
+-- Table structure for store_goods_stock
+-- ----------------------------
+DROP TABLE IF EXISTS `store_goods_stock`;
+CREATE TABLE `store_goods_stock` (
+ `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
+ `goods_id` bigint(20) unsigned DEFAULT '0' COMMENT '商品ID',
+ `goods_spec` varchar(255) DEFAULT '' COMMENT '商品属性',
+ `goods_stock` bigint(20) unsigned DEFAULT '0' COMMENT '商品库存',
+ `stock_desc` varchar(255) DEFAULT '' COMMENT '商品库存描述',
+ `sort` bigint(20) unsigned DEFAULT '0' COMMENT '数据排序',
+ `status` bigint(1) unsigned DEFAULT '1' COMMENT '商品状态(1有效,0无效)',
+ `is_deleted` bigint(1) unsigned DEFAULT '0' COMMENT '删除状态(1删除,0未删除)',
+ `create_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB AUTO_INCREMENT=36 DEFAULT CHARSET=utf8 COMMENT='商城商品库存';
+
+-- ----------------------------
+-- Records of wechat_news_media
+-- ----------------------------
diff --git a/application/.htaccess b/application/.htaccess
new file mode 100644
index 000000000..3418e55a6
--- /dev/null
+++ b/application/.htaccess
@@ -0,0 +1 @@
+deny from all
\ No newline at end of file
diff --git a/application/admin/controller/Auth.php b/application/admin/controller/Auth.php
index 59c992922..b9beb8adb 100644
--- a/application/admin/controller/Auth.php
+++ b/application/admin/controller/Auth.php
@@ -1,7 +1,7 @@
* @date 2017/02/15 18:13
*/
-class Auth extends BasicAdmin {
+class Auth extends BasicAdmin
+{
/**
* 默认数据模型
@@ -37,44 +38,67 @@ class Auth extends BasicAdmin {
/**
* 权限列表
+ * @return array|string
+ * @throws \think\Exception
+ * @throws \think\db\exception\DataNotFoundException
+ * @throws \think\db\exception\ModelNotFoundException
+ * @throws \think\exception\DbException
*/
- public function index() {
+ public function index()
+ {
$this->title = '系统权限管理';
return parent::_list($this->table);
}
/**
* 权限授权
- * @return string|array
+ * @return string
+ * @throws \think\db\exception\DataNotFoundException
+ * @throws \think\db\exception\ModelNotFoundException
+ * @throws \think\exception\DbException
+ * @throws \think\Exception
*/
- public function apply() {
+ public function apply()
+ {
+ $this->title = '节点授权';
$auth_id = $this->request->get('id', '0');
- switch (strtolower($this->request->get('action', '0'))) {
- case 'getnode':
- $nodes = NodeService::get();
- $checked = Db::name('SystemAuthNode')->where('auth', $auth_id)->column('node');
- foreach ($nodes as $key => &$node) {
- $node['checked'] = in_array($node['node'], $checked);
- if (empty($node['is_auth']) && substr_count($node['node'], '/') > 1) {
- unset($nodes[$key]);
- }
- }
- $this->success('获取节点成功!', '', $this->_filterNodes($this->_filterNodes(ToolsService::arr2tree($nodes, 'node', 'pnode', '_sub_'))));
- break;
- case 'save':
- $data = [];
- $post = $this->request->post();
- foreach (isset($post['nodes']) ? $post['nodes'] : [] as $node) {
- $data[] = ['auth' => $auth_id, 'node' => $node];
- }
- Db::name('SystemAuthNode')->where('auth', $auth_id)->delete();
- Db::name('SystemAuthNode')->insertAll($data);
- $this->success('节点授权更新成功!', '');
- break;
- default :
- $this->assign('title', '节点授权');
- return $this->_form($this->table, 'apply');
+ $method = '_apply_' . strtolower($this->request->get('action', '0'));
+ if (method_exists($this, $method)) {
+ return $this->$method($auth_id);
}
+ return $this->_form($this->table, 'apply');
+ }
+
+ /**
+ * 读取授权节点
+ * @param string $auth
+ */
+ protected function _apply_getnode($auth)
+ {
+ $nodes = NodeService::get();
+ $checked = Db::name('SystemAuthNode')->where(['auth' => $auth])->column('node');
+ foreach ($nodes as &$node) {
+ $node['checked'] = in_array($node['node'], $checked);
+ }
+ $all = $this->_apply_filter(ToolsService::arr2tree($nodes, 'node', 'pnode', '_sub_'));
+ $this->success('获取节点成功!', '', $all);
+ }
+
+ /**
+ * 保存授权节点
+ * @param string $auth
+ * @throws \think\Exception
+ * @throws \think\exception\PDOException
+ */
+ protected function _apply_save($auth)
+ {
+ list($data, $post) = [[], $this->request->post()];
+ foreach (isset($post['nodes']) ? $post['nodes'] : [] as $node) {
+ $data[] = ['auth' => $auth, 'node' => $node];
+ }
+ Db::name('SystemAuthNode')->where(['auth' => $auth])->delete();
+ Db::name('SystemAuthNode')->insertAll($data);
+ $this->success('节点授权更新成功!', '');
}
/**
@@ -83,12 +107,11 @@ class Auth extends BasicAdmin {
* @param int $level
* @return array
*/
- protected function _filterNodes($nodes, $level = 1) {
- foreach ($nodes as $key => &$node) {
+ protected function _apply_filter($nodes, $level = 1)
+ {
+ foreach ($nodes as $key => $node) {
if (!empty($node['_sub_']) && is_array($node['_sub_'])) {
- $node['_sub_'] = $this->_filterNodes($node['_sub_'], $level + 1);
- } elseif ($level < 3) {
- unset($nodes[$key]);
+ $node[$key]['_sub_'] = $this->_apply_filter($node['_sub_'], $level + 1);
}
}
return $nodes;
@@ -96,22 +119,37 @@ class Auth extends BasicAdmin {
/**
* 权限添加
+ * @return array|string
+ * @throws \think\db\exception\DataNotFoundException
+ * @throws \think\db\exception\ModelNotFoundException
+ * @throws \think\exception\DbException
+ * @throws \think\Exception
*/
- public function add() {
+ public function add()
+ {
return $this->_form($this->table, 'form');
}
/**
* 权限编辑
+ * @return array|string
+ * @throws \think\db\exception\DataNotFoundException
+ * @throws \think\db\exception\ModelNotFoundException
+ * @throws \think\exception\DbException
+ * @throws \think\Exception
*/
- public function edit() {
+ public function edit()
+ {
return $this->_form($this->table, 'form');
}
/**
* 权限禁用
+ * @throws \think\Exception
+ * @throws \think\exception\PDOException
*/
- public function forbid() {
+ public function forbid()
+ {
if (DataService::update($this->table)) {
$this->success("权限禁用成功!", '');
}
@@ -120,8 +158,11 @@ class Auth extends BasicAdmin {
/**
* 权限恢复
+ * @throws \think\Exception
+ * @throws \think\exception\PDOException
*/
- public function resume() {
+ public function resume()
+ {
if (DataService::update($this->table)) {
$this->success("权限启用成功!", '');
}
@@ -130,11 +171,14 @@ class Auth extends BasicAdmin {
/**
* 权限删除
+ * @throws \think\Exception
+ * @throws \think\exception\PDOException
*/
- public function del() {
+ public function del()
+ {
if (DataService::update($this->table)) {
- $id = $this->request->post('id');
- Db::name('SystemAuthNode')->where('auth', $id)->delete();
+ $where = ['auth' => $this->request->post('id')];
+ Db::name('SystemAuthNode')->where($where)->delete();
$this->success("权限删除成功!", '');
}
$this->error("权限删除失败,请稍候再试!");
diff --git a/application/admin/controller/Config.php b/application/admin/controller/Config.php
index 6e0634aa5..2d4022100 100644
--- a/application/admin/controller/Config.php
+++ b/application/admin/controller/Config.php
@@ -1,7 +1,7 @@
* @date 2017/02/15 18:05
*/
-class Config extends BasicAdmin {
+class Config extends BasicAdmin
+{
/**
* 当前默认数据模型
@@ -36,32 +38,36 @@ class Config extends BasicAdmin {
* 当前页面标题
* @var string
*/
- public $title = '网站参数配置';
+ public $title = '系统参数配置';
/**
* 显示系统常规配置
+ * @return string
+ * @throws \think\Exception
+ * @throws \think\exception\PDOException
*/
- public function index() {
- if (!$this->request->isPost()) {
- $this->assign('title', $this->title);
- return view();
+ public function index()
+ {
+ if ($this->request->isGet()) {
+ return $this->fetch('', ['title' => $this->title]);
}
- foreach ($this->request->post() as $key => $vo) {
- sysconf($key, $vo);
+ if ($this->request->isPost()) {
+ foreach ($this->request->post() as $key => $vo) {
+ sysconf($key, $vo);
+ }
+ LogService::write('系统管理', '系统参数配置成功');
+ $this->success('系统参数配置成功!', '');
}
- LogService::write('系统管理', '修改系统配置参数成功');
- $this->success('数据修改成功!', '');
}
/**
* 文件存储配置
+ * @return string
+ * @throws \think\Exception
+ * @throws \think\exception\PDOException
*/
- public function file() {
- $this->assign('alert', [
- 'type' => 'success',
- 'title' => '操作提示',
- 'content' => '文件引擎参数影响全局文件上传功能,请勿随意修改!'
- ]);
+ public function file()
+ {
$this->title = '文件存储配置';
return $this->index();
}
diff --git a/application/admin/controller/Index.php b/application/admin/controller/Index.php
index 65dff1480..9658264b3 100644
--- a/application/admin/controller/Index.php
+++ b/application/admin/controller/Index.php
@@ -1,7 +1,7 @@
* @date 2017/02/15 10:41
*/
-class Index extends BasicAdmin {
+class Index extends BasicAdmin
+{
/**
* 后台框架布局
- * @return View
+ * @throws \think\db\exception\DataNotFoundException
+ * @throws \think\db\exception\ModelNotFoundException
+ * @throws \think\exception\DbException
*/
- public function index() {
+ public function index()
+ {
NodeService::applyAuthNode();
- $list = Db::name('SystemMenu')->where('status', '1')->order('sort asc,id asc')->select();
- $menus = $this->_filterMenu(ToolsService::arr2tree($list));
- $this->assign('title', '系统管理');
- $this->assign('menus', $menus);
- return view();
+ $list = (array)Db::name('SystemMenu')->where(['status' => '1'])->order('sort asc,id asc')->select();
+ $menus = $this->buildMenuData(ToolsService::arr2tree($list), NodeService::get(), !!session('user'));
+ if (empty($menus) && !session('user.id')) {
+ $this->redirect('@admin/login');
+ }
+ return $this->fetch('', ['title' => '系统管理', 'menus' => $menus]);
}
/**
* 后台主菜单权限过滤
- * @param array $menus
+ * @param array $menus 当前菜单列表
+ * @param array $nodes 系统权限节点数据
+ * @param bool $isLogin 是否已经登录
* @return array
*/
- private function _filterMenu($menus) {
+ private function buildMenuData($menus, $nodes, $isLogin)
+ {
foreach ($menus as $key => &$menu) {
- if (!empty($menu['sub'])) {
- $menu['sub'] = $this->_filterMenu($menu['sub']);
- }
+ !empty($menu['sub']) && $menu['sub'] = $this->buildMenuData($menu['sub'], $nodes, $isLogin);
if (!empty($menu['sub'])) {
$menu['url'] = '#';
- } elseif (stripos($menu['url'], 'http') === 0) {
+ } elseif (preg_match('/^https?\:/i', $menu['url'])) {
continue;
- } elseif ($menu['url'] !== '#' && auth(join('/', array_slice(explode('/', $menu['url']), 0, 3)))) {
- $menu['url'] = url($menu['url']);
+ } elseif ($menu['url'] !== '#') {
+ $node = join('/', array_slice(explode('/', preg_replace('/[\W]/', '/', $menu['url'])), 0, 3));
+ $menu['url'] = url($menu['url']) . (empty($menu['params']) ? '' : "?{$menu['params']}");
+ if (isset($nodes[$node]) && $nodes[$node]['is_login'] && empty($isLogin)) {
+ unset($menus[$key]);
+ } elseif (isset($nodes[$node]) && $nodes[$node]['is_auth'] && $isLogin && !auth($node)) {
+ unset($menus[$key]);
+ }
} else {
unset($menus[$key]);
}
@@ -68,66 +80,64 @@ class Index extends BasicAdmin {
/**
* 主机信息显示
- * @return View
+ * @return string
*/
- public function main() {
+ public function main()
+ {
$_version = Db::query('select version() as ver');
- $version = array_pop($_version);
- $this->assign('mysql_ver', $version['ver']);
- if (session('user.username') === 'admin' && session('user.password') === '21232f297a57a5a743894a0e4a801fc3') {
- $url = url('admin/index/pass') . '?id=' . session('user.id');
- $alert = [
- 'type' => 'danger',
- 'title' => '安全提示',
- 'content' => "超级管理员默认密码未修改,建议马上修改!"
- ];
- $this->assign('alert', $alert);
- $this->assign('title', '后台首页');
- }
- return view();
+ return $this->fetch('', [
+ 'title' => '后台首页',
+ 'think_ver' => App::VERSION,
+ 'mysql_ver' => array_pop($_version)['ver'],
+ ]);
}
/**
* 修改密码
+ * @return array|string
+ * @throws \think\Exception
+ * @throws \think\db\exception\DataNotFoundException
+ * @throws \think\db\exception\ModelNotFoundException
+ * @throws \think\exception\DbException
+ * @throws \think\exception\PDOException
*/
- public function pass() {
- if (in_array('10000', explode(',', $this->request->post('id')))) {
- $this->error('系统超级账号禁止操作!');
- }
+ public function pass()
+ {
if (intval($this->request->request('id')) !== intval(session('user.id'))) {
- $this->error('访问异常!');
+ $this->error('只能修改当前用户的密码!');
}
if ($this->request->isGet()) {
$this->assign('verify', true);
return $this->_form('SystemUser', 'user/pass');
- } else {
- $data = $this->request->post();
- if ($data['password'] !== $data['repassword']) {
- $this->error('两次输入的密码不一致,请重新输入!');
- }
- $user = Db::name('SystemUser')->where('id', session('user.id'))->find();
- if (md5($data['oldpassword']) !== $user['password']) {
- $this->error('旧密码验证失败,请重新输入!');
- }
- if (DataService::save('SystemUser', ['id' => session('user.id'), 'password' => md5($data['password'])])) {
- $this->success('密码修改成功,下次请使用新密码登录!', '');
- } else {
- $this->error('密码修改失败,请稍候再试!');
- }
}
+ $data = $this->request->post();
+ if ($data['password'] !== $data['repassword']) {
+ $this->error('两次输入的密码不一致,请重新输入!');
+ }
+ $user = Db::name('SystemUser')->where('id', session('user.id'))->find();
+ if (md5($data['oldpassword']) !== $user['password']) {
+ $this->error('旧密码验证失败,请重新输入!');
+ }
+ if (DataService::save('SystemUser', ['id' => session('user.id'), 'password' => md5($data['password'])])) {
+ $this->success('密码修改成功,下次请使用新密码登录!', '');
+ }
+ $this->error('密码修改失败,请稍候再试!');
}
/**
* 修改资料
+ * @return array|string
+ * @throws \think\Exception
+ * @throws \think\db\exception\DataNotFoundException
+ * @throws \think\db\exception\ModelNotFoundException
+ * @throws \think\exception\DbException
*/
- public function info() {
- if (in_array('10000', explode(',', $this->request->post('id')))) {
- $this->error('系统超级账号禁止操作!');
- }
+ public function info()
+ {
if (intval($this->request->request('id')) === intval(session('user.id'))) {
return $this->_form('SystemUser', 'user/form');
}
- $this->error('访问异常!');
+ $this->error('只能修改当前用户的资料!');
}
}
diff --git a/application/admin/controller/Log.php b/application/admin/controller/Log.php
index 197239ecd..d9ae070dd 100644
--- a/application/admin/controller/Log.php
+++ b/application/admin/controller/Log.php
@@ -1,7 +1,7 @@
* @date 2017/02/15 18:12
*/
-class Log extends BasicAdmin {
+class Log extends BasicAdmin
+{
/**
* 指定当前数据表
@@ -35,41 +36,56 @@ class Log extends BasicAdmin {
/**
* 日志列表
+ * @return array|string
+ * @throws \think\Exception
+ * @throws \think\db\exception\DataNotFoundException
+ * @throws \think\db\exception\ModelNotFoundException
+ * @throws \think\exception\DbException
*/
- public function index() {
- $this->title = '系统操作日志';
- $this->assign('actions', Db::name($this->table)->group('action')->column('action'));
+ public function index()
+ {
+ // 日志行为类别
+ $actions = Db::name($this->table)->group('action')->column('action');
+ $this->assign('actions', $actions);
+ // 日志数据库对象
+ list($this->title, $get) = ['系统操作日志', $this->request->get()];
$db = Db::name($this->table)->order('id desc');
- $get = $this->request->get();
foreach (['action', 'content', 'username'] as $key) {
- if (isset($get[$key]) && $get[$key] !== '') {
- $db->where($key, 'like', "%{$get[$key]}%");
- }
+ (isset($get[$key]) && $get[$key] !== '') && $db->whereLike($key, "%{$get[$key]}%");
+ }
+ if (isset($get['create_at']) && $get['create_at'] !== '') {
+ list($start, $end) = explode(' - ', $get['create_at']);
+ $db->whereBetween('create_at', ["{$start} 00:00:00", "{$end} 23:59:59"]);
}
return parent::_list($db);
}
/**
* 列表数据处理
- * @param $data
+ * @param array $data
+ * @throws \Exception
*/
- protected function _index_data_filter(&$data) {
+ protected function _index_data_filter(&$data)
+ {
$ip = new \Ip2Region();
foreach ($data as &$vo) {
$result = $ip->btreeSearch($vo['ip']);
$vo['isp'] = isset($result['region']) ? $result['region'] : '';
- $vo['isp'] = str_replace(['|0|0|0|0', '|'], ['', ' '], $vo['isp']);
+ $vo['isp'] = str_replace(['内网IP', '0', '|'], '', $vo['isp']);
}
}
/**
* 日志删除操作
+ * @throws \think\Exception
+ * @throws \think\exception\PDOException
*/
- public function del() {
+ public function del()
+ {
if (DataService::update($this->table)) {
- $this->success("日志删除成功!", '');
+ $this->success("日志删除成功!", '');
}
- $this->error("日志删除失败,请稍候再试!");
+ $this->error("日志删除失败, 请稍候再试!");
}
}
diff --git a/application/admin/controller/Login.php b/application/admin/controller/Login.php
index 5c1a16a6f..6e61de34d 100644
--- a/application/admin/controller/Login.php
+++ b/application/admin/controller/Login.php
@@ -1,7 +1,7 @@
* @date 2017/02/10 13:59
*/
-class Login extends BasicAdmin {
-
- /**
- * 默认检查用户登录状态
- * @var bool
- */
- public $checkLogin = false;
-
- /**
- * 默认检查节点访问权限
- * @var bool
- */
- public $checkAuth = false;
+class Login extends BasicAdmin
+{
/**
* 控制器基础方法
*/
- public function _initialize() {
- if (session('user') && $this->request->action() !== 'out') {
+ public function initialize()
+ {
+ if (session('user.id') && $this->request->action() !== 'out') {
$this->redirect('@admin');
}
}
@@ -52,34 +44,56 @@ class Login extends BasicAdmin {
/**
* 用户登录
* @return string
+ * @throws \think\Exception
+ * @throws \think\db\exception\DataNotFoundException
+ * @throws \think\db\exception\ModelNotFoundException
+ * @throws \think\exception\DbException
+ * @throws \think\exception\PDOException
*/
- public function index() {
+ public function index()
+ {
if ($this->request->isGet()) {
- $this->assign('title', '用户登录');
- return $this->fetch();
- } else {
- $username = $this->request->post('username', '', 'trim');
- $password = $this->request->post('password', '', 'trim');
- (empty($username) || strlen($username) < 4) && $this->error('登录账号长度不能少于4位有效字符!');
- (empty($password) || strlen($password) < 4) && $this->error('登录密码长度不能少于4位有效字符!');
- $user = Db::name('SystemUser')->where('username', $username)->find();
- empty($user) && $this->error('登录账号不存在,请重新输入!');
- ($user['password'] !== md5($password)) && $this->error('登录密码与账号不匹配,请重新输入!');
- Db::name('SystemUser')->where('id', $user['id'])->update(['login_at' => ['exp', 'now()'], 'login_num' => ['exp', 'login_num+1']]);
- session('user', $user);
- !empty($user['authorize']) && NodeService::applyAuthNode();
- LogService::write('系统管理', '用户登录系统成功');
- $this->success('登录成功,正在进入系统...', '@admin');
+ return $this->fetch('', ['title' => '用户登录']);
}
+ // 输入数据效验
+ $validate = Validate::make([
+ 'username' => 'require|min:4',
+ 'password' => 'require|min:4',
+ ], [
+ 'username.require' => '登录账号不能为空!',
+ 'username.min' => '登录账号长度不能少于4位有效字符!',
+ 'password.require' => '登录密码不能为空!',
+ 'password.min' => '登录密码长度不能少于4位有效字符!',
+ ]);
+ $data = [
+ 'username' => $this->request->post('username', ''),
+ 'password' => $this->request->post('password', ''),
+ ];
+ $validate->check($data) || $this->error($validate->getError());
+ // 用户信息验证
+ $user = Db::name('SystemUser')->where(['username' => $data['username'], 'is_deleted' => '0'])->find();
+ empty($user) && $this->error('登录账号不存在,请重新输入!');
+ empty($user['status']) && $this->error('账号已经被禁用,请联系管理员!');
+ $user['password'] !== md5($data['password']) && $this->error('登录密码错误,请重新输入!');
+ // 更新登录信息
+ Db::name('SystemUser')->where(['id' => $user['id']])->update([
+ 'login_at' => Db::raw('now()'),
+ 'login_num' => Db::raw('login_num+1'),
+ ]);
+ session('user', $user);
+ !empty($user['authorize']) && NodeService::applyAuthNode();
+ LogService::write('系统管理', '用户登录系统成功');
+ $this->success('登录成功,正在进入系统...', '@admin');
}
/**
* 退出登录
*/
- public function out() {
- LogService::write('系统管理', '用户退出系统成功');
- session('user', null);
- session_destroy();
+ public function out()
+ {
+ session('user') && LogService::write('系统管理', '用户退出系统成功');
+ !empty($_SESSION) && $_SESSION = [];
+ [session_unset(), session_destroy()];
$this->success('退出登录成功!', '@admin/login');
}
diff --git a/application/admin/controller/Menu.php b/application/admin/controller/Menu.php
index 74b69e7df..69fa9e63a 100644
--- a/application/admin/controller/Menu.php
+++ b/application/admin/controller/Menu.php
@@ -1,7 +1,7 @@
* @date 2017/02/15
*/
-class Menu extends BasicAdmin {
+class Menu extends BasicAdmin
+{
/**
* 绑定操作模型
@@ -37,9 +38,15 @@ class Menu extends BasicAdmin {
/**
* 菜单列表
+ * @return array|string
+ * @throws \think\db\exception\DataNotFoundException
+ * @throws \think\db\exception\ModelNotFoundException
+ * @throws \think\exception\DbException
+ * @throws \think\Exception
*/
- public function index() {
- $this->title = '系统菜单管理';
+ public function index()
+ {
+ $this->title = '后台菜单管理';
$db = Db::name($this->table)->order('sort asc,id asc');
return parent::_list($db, false);
}
@@ -48,9 +55,12 @@ class Menu extends BasicAdmin {
* 列表数据处理
* @param array $data
*/
- protected function _index_data_filter(&$data) {
+ protected function _index_data_filter(&$data)
+ {
foreach ($data as &$vo) {
- ($vo['url'] !== '#') && ($vo['url'] = url($vo['url']));
+ if ($vo['url'] !== '#') {
+ $vo['url'] = url($vo['url']) . (empty($vo['params']) ? '' : "?{$vo['params']}");
+ }
$vo['ids'] = join(',', ToolsService::getArrSubIds($data, $vo['id']));
}
$data = ToolsService::arr2table($data);
@@ -58,26 +68,42 @@ class Menu extends BasicAdmin {
/**
* 添加菜单
+ * @return array|string
+ * @throws \think\db\exception\DataNotFoundException
+ * @throws \think\db\exception\ModelNotFoundException
+ * @throws \think\exception\DbException
+ * @throws \think\Exception
*/
- public function add() {
+ public function add()
+ {
return $this->_form($this->table, 'form');
}
/**
* 编辑菜单
+ * @return array|string
+ * @throws \think\db\exception\DataNotFoundException
+ * @throws \think\db\exception\ModelNotFoundException
+ * @throws \think\exception\DbException
+ * @throws \think\Exception
*/
- public function edit() {
+ public function edit()
+ {
return $this->_form($this->table, 'form');
}
/**
* 表单数据前缀方法
* @param array $vo
+ * @throws \think\db\exception\DataNotFoundException
+ * @throws \think\db\exception\ModelNotFoundException
+ * @throws \think\exception\DbException
*/
- protected function _form_filter(&$vo) {
+ protected function _form_filter(&$vo)
+ {
if ($this->request->isGet()) {
// 上级菜单处理
- $_menus = Db::name($this->table)->where('status', '1')->order('sort desc,id desc')->select();
+ $_menus = Db::name($this->table)->where(['status' => '1'])->order('sort asc,id asc')->select();
$_menus[] = ['title' => '顶级菜单', 'id' => '0', 'pid' => '-1'];
$menus = ToolsService::arr2table($_menus);
foreach ($menus as $key => &$menu) {
@@ -89,49 +115,62 @@ class Menu extends BasicAdmin {
$current_path = "-{$vo['pid']}-{$vo['id']}";
if ($vo['pid'] !== '' && (stripos("{$menu['path']}-", "{$current_path}-") !== false || $menu['path'] === $current_path)) {
unset($menus[$key]);
+ continue;
}
}
}
// 读取系统功能节点
$nodes = NodeService::get();
- foreach ($nodes as $key => $_vo) {
- if (empty($_vo['is_menu'])) {
+ foreach ($nodes as $key => $node) {
+ if (empty($node['is_menu'])) {
unset($nodes[$key]);
}
}
- $this->assign('nodes', array_column($nodes, 'node'));
- $this->assign('menus', $menus);
+ // 设置上级菜单
+ if (!isset($vo['pid']) && $this->request->get('pid', '0')) {
+ $vo['pid'] = $this->request->get('pid', '0');
+ }
+ $this->assign(['nodes' => array_column($nodes, 'node'), 'menus' => $menus]);
}
}
/**
* 删除菜单
+ * @throws \think\Exception
+ * @throws \think\exception\PDOException
*/
- public function del() {
+ public function del()
+ {
if (DataService::update($this->table)) {
- $this->success("菜单删除成功!", '');
+ $this->success("菜单删除成功!", '');
}
- $this->error("菜单删除失败,请稍候再试!");
+ $this->error("菜单删除失败, 请稍候再试!");
}
/**
* 菜单禁用
+ * @throws \think\Exception
+ * @throws \think\exception\PDOException
*/
- public function forbid() {
+ public function forbid()
+ {
if (DataService::update($this->table)) {
- $this->success("菜单禁用成功!", '');
+ $this->success("菜单禁用成功!", '');
}
- $this->error("菜单禁用失败,请稍候再试!");
+ $this->error("菜单禁用失败, 请稍候再试!");
}
/**
* 菜单禁用
+ * @throws \think\Exception
+ * @throws \think\exception\PDOException
*/
- public function resume() {
+ public function resume()
+ {
if (DataService::update($this->table)) {
- $this->success("菜单启用成功!", '');
+ $this->success("菜单启用成功!", '');
}
- $this->error("菜单启用失败,请稍候再试!");
+ $this->error("菜单启用失败, 请稍候再试!");
}
}
diff --git a/application/admin/controller/Node.php b/application/admin/controller/Node.php
index 7eb633067..8e3d6e6bb 100644
--- a/application/admin/controller/Node.php
+++ b/application/admin/controller/Node.php
@@ -1,7 +1,7 @@
* @date 2017/02/15 18:13
*/
-class Node extends BasicAdmin {
+class Node extends BasicAdmin
+{
/**
* 指定当前默认模型
@@ -36,34 +38,55 @@ class Node extends BasicAdmin {
/**
* 显示节点列表
+ * @return string
*/
- public function index() {
- $this->assign('alert', [
- 'type' => 'danger',
- 'title' => '安全警告',
- 'content' => '结构为系统自动生成,状态数据请勿随意修改!'
- ]);
- $this->assign('title', '系统节点管理');
- $this->assign('nodes', ToolsService::arr2table(NodeService::get(), 'node', 'pnode'));
- return view();
+ public function index()
+ {
+ $nodes = ToolsService::arr2table(NodeService::get(), 'node', 'pnode');
+ $groups = [];
+ foreach ($nodes as $node) {
+ $pnode = explode('/', $node['node'])[0];
+ if ($node['node'] === $pnode) {
+ $groups[$pnode]['node'] = $node;
+ }
+ $groups[$pnode]['list'][] = $node;
+ }
+ return $this->fetch('', ['title' => '系统节点管理', 'nodes' => $nodes, 'groups' => $groups]);
+ }
+
+ /**
+ * 清理无效的节点记录
+ * @throws \think\Exception
+ * @throws \think\exception\PDOException
+ */
+ public function clear()
+ {
+ $nodes = array_keys(NodeService::get());
+ if (false !== Db::name($this->table)->whereNotIn('node', $nodes)->delete()) {
+ $this->success('清理无效节点记录成功!', '');
+ }
+ $this->error('清理无效记录失败,请稍候再试!');
}
/**
* 保存节点变更
+ * @throws \think\Exception
+ * @throws \think\exception\PDOException
*/
- public function save() {
+ public function save()
+ {
if ($this->request->isPost()) {
- $post = $this->request->post();
- if (isset($post['name']) && isset($post['value'])) {
- $nameattr = explode('.', $post['name']);
- $field = array_shift($nameattr);
- $data = ['node' => join(',', $nameattr), $field => $post['value']];
- DataService::save($this->table, $data, 'node');
- $this->success('参数保存成功!', '');
+ list($post, $data) = [$this->request->post(), []];
+ foreach ($post['list'] as $vo) {
+ if (!empty($vo['node'])) {
+ $data['node'] = $vo['node'];
+ $data[$vo['name']] = $vo['value'];
+ }
}
- } else {
- $this->error('访问异常,请重新进入...');
+ !empty($data) && DataService::save($this->table, $data, 'node');
+ $this->success('参数保存成功!', '');
}
+ $this->error('访问异常,请重新进入...');
}
}
diff --git a/application/admin/controller/Plugs.php b/application/admin/controller/Plugs.php
index 37b0c08b1..9a894d9b8 100644
--- a/application/admin/controller/Plugs.php
+++ b/application/admin/controller/Plugs.php
@@ -1,7 +1,7 @@
* @date 2017/02/21
*/
-class Plugs extends BasicAdmin {
-
- /**
- * 默认检查用户登录状态
- * @var bool
- */
- public $checkLogin = false;
-
- /**
- * 默认检查节点访问权限
- * @var bool
- */
- public $checkAuth = false;
+class Plugs extends BasicAdmin
+{
/**
* 文件上传
- * @return View
+ * @return mixed
+ * @throws \think\Exception
+ * @throws \think\exception\PDOException
*/
- public function upfile() {
- $types = $this->request->get('type', 'jpg,png');
- $mode = $this->request->get('mode', 'one');
- $this->assign('mode', $mode);
- $this->assign('types', $types);
- if (!in_array(($uptype = $this->request->get('uptype')), ['local', 'qiniu'])) {
+ public function upfile()
+ {
+ $uptype = $this->request->get('uptype');
+ if (!in_array($uptype, ['local', 'qiniu', 'oss'])) {
$uptype = sysconf('storage_type');
}
- $this->assign('uptype', $uptype);
+ $mode = $this->request->get('mode', 'one');
+ $types = $this->request->get('type', 'jpg,png');
$this->assign('mimes', FileService::getFileMine($types));
$this->assign('field', $this->request->get('field', 'file'));
- return view();
+ return $this->fetch('', ['mode' => $mode, 'types' => $types, 'uptype' => $uptype]);
}
/**
* 通用文件上传
- * @return string
+ * @return \think\response\Json
+ * @throws \think\Exception
+ * @throws \think\exception\PDOException
+ * @throws \OSS\Core\OssException
*/
- public function upload() {
- if ($this->request->isPost()) {
- $md5s = str_split($this->request->post('md5'), 16);
- if (($info = $this->request->file('file')->move('static' . DS . 'upload' . DS . $md5s[0], $md5s[1], true))) {
- $filename = join('/', $md5s) . '.' . $info->getExtension();
- $site_url = FileService::getFileUrl($filename, 'local');
- if ($site_url) {
- return json(['data' => ['site_url' => $site_url], 'code' => 'SUCCESS']);
- }
+ public function upload()
+ {
+ $file = $this->request->file('file');
+ if (!$file->checkExt(strtolower(sysconf('storage_local_exts')))) {
+ return json(['code' => 'ERROR', 'msg' => '文件上传类型受限']);
+ }
+ $names = str_split($this->request->post('md5'), 16);
+ $ext = strtolower(pathinfo($file->getInfo('name'), 4));
+ $ext = $ext ? $ext : 'tmp';
+ $filename = "{$names[0]}/{$names[1]}.{$ext}";
+ // 文件上传Token验证
+ if ($this->request->post('token') !== md5($filename . session_id())) {
+ return json(['code' => 'ERROR', 'msg' => '文件上传验证失败']);
+ }
+ // 文件上传处理
+ if (($info = $file->move("static/upload/{$names[0]}", "{$names[1]}.{$ext}", true))) {
+ if (($site_url = FileService::getFileUrl($filename, 'local'))) {
+ return json(['data' => ['site_url' => $site_url], 'code' => 'SUCCESS', 'msg' => '文件上传成功']);
}
}
- return json(['code' => 'ERROR']);
+ return json(['code' => 'ERROR', 'msg' => '文件上传失败']);
}
/**
* 文件状态检查
+ * @throws \OSS\Core\OssException
+ * @throws \think\Exception
+ * @throws \think\exception\PDOException
*/
- public function upstate() {
+ public function upstate()
+ {
$post = $this->request->post();
- $filename = join('/', str_split($post['md5'], 16)) . '.' . pathinfo($post['filename'], PATHINFO_EXTENSION);
+ $ext = strtolower(pathinfo($post['filename'], 4));
+ $filename = join('/', str_split($post['md5'], 16)) . '.' . ($ext ? $ext : 'tmp');
// 检查文件是否已上传
if (($site_url = FileService::getFileUrl($filename))) {
- $this->result(['site_url' => $site_url], 'IS_FOUND');
+ return json(['data' => ['site_url' => $site_url], 'code' => "IS_FOUND"]);
}
// 需要上传文件,生成上传配置参数
- $config = ['uptype' => $post['uptype'], 'file_url' => $filename];
+ $data = ['uptype' => $post['uptype'], 'file_url' => $filename];
switch (strtolower($post['uptype'])) {
- case 'qiniu':
- $config['server'] = FileService::getUploadQiniuUrl(true);
- $config['token'] = $this->_getQiniuToken($filename);
- break;
case 'local':
- $config['server'] = FileService::getUploadLocalUrl();
+ $data['token'] = md5($filename . session_id());
+ $data['server'] = FileService::getUploadLocalUrl();
+ break;
+ case 'qiniu':
+ $data['token'] = $this->_getQiniuToken($filename);
+ $data['server'] = FileService::getUploadQiniuUrl(true);
break;
case 'oss':
$time = time() + 3600;
$policyText = [
'expiration' => date('Y-m-d', $time) . 'T' . date('H:i:s', $time) . '.000Z',
- 'conditions' => [
- ['content-length-range', 0, 1048576000]
- ]
+ 'conditions' => [['content-length-range', 0, 1048576000]],
];
- $config['policy'] = base64_encode(json_encode($policyText));
- $config['server'] = FileService::getUploadOssUrl();
- $config['site_url'] = FileService::getBaseUriOss() . $filename;
- $config['signature'] = base64_encode(hash_hmac('sha1', $config['policy'], sysconf('storage_oss_secret'), true));
- $config['OSSAccessKeyId'] = sysconf('storage_oss_keyid');
+ $data['server'] = FileService::getUploadOssUrl();
+ $data['policy'] = base64_encode(json_encode($policyText));
+ $data['site_url'] = FileService::getBaseUriOss() . $filename;
+ $data['signature'] = base64_encode(hash_hmac('sha1', $data['policy'], sysconf('storage_oss_secret'), true));
+ $data['OSSAccessKeyId'] = sysconf('storage_oss_keyid');
+ break;
}
- $this->result($config, 'NOT_FOUND');
+ return json(['data' => $data, 'code' => "NOT_FOUND"]);
}
/**
* 生成七牛文件上传Token
* @param string $key
* @return string
+ * @throws \think\Exception
+ * @throws \think\exception\PDOException
*/
- protected function _getQiniuToken($key) {
+ protected function _getQiniuToken($key)
+ {
+ $baseUrl = FileService::getBaseUriQiniu();
+ $bucket = sysconf('storage_qiniu_bucket');
$accessKey = sysconf('storage_qiniu_access_key');
$secretKey = sysconf('storage_qiniu_secret_key');
- $bucket = sysconf('storage_qiniu_bucket');
- $host = sysconf('storage_qiniu_domain');
- $protocol = sysconf('storage_qiniu_is_https') ? 'https' : 'http';
$params = [
- "scope" => "{$bucket}:{$key}",
- "deadline" => 3600 + time(),
- "returnBody" => "{\"data\":{\"site_url\":\"{$protocol}://{$host}/$(key)\",\"file_url\":\"$(key)\"}, \"code\": \"SUCCESS\"}",
+ "scope" => "{$bucket}:{$key}", "deadline" => 3600 + time(),
+ "returnBody" => "{\"data\":{\"site_url\":\"{$baseUrl}/$(key)\",\"file_url\":\"$(key)\"}, \"code\": \"SUCCESS\"}",
];
$data = str_replace(['+', '/'], ['-', '_'], base64_encode(json_encode($params)));
return $accessKey . ':' . str_replace(['+', '/'], ['-', '_'], base64_encode(hash_hmac('sha1', $data, $secretKey, true))) . ':' . $data;
}
/**
- * 字体图标
+ * 字体图标选择器
+ * @return \think\response\View
*/
- public function icon() {
- $this->assign('field', $this->request->get('field', 'icon'));
- return view();
+ public function icon()
+ {
+ $field = $this->request->get('field', 'icon');
+ return $this->fetch('', ['field' => $field]);
}
}
diff --git a/application/admin/controller/User.php b/application/admin/controller/User.php
index a03f839d6..2510c4094 100644
--- a/application/admin/controller/User.php
+++ b/application/admin/controller/User.php
@@ -1,7 +1,7 @@
* @date 2017/02/15 18:12
*/
-class User extends BasicAdmin {
+class User extends BasicAdmin
+{
/**
* 指定当前数据表
@@ -35,62 +36,86 @@ class User extends BasicAdmin {
/**
* 用户列表
+ * @return array|string
+ * @throws \think\db\exception\DataNotFoundException
+ * @throws \think\db\exception\ModelNotFoundException
+ * @throws \think\exception\DbException
+ * @throws \think\Exception
*/
- public function index() {
- // 设置页面标题
+ public function index()
+ {
$this->title = '系统用户管理';
- // 获取到所有GET参数
- $get = $this->request->get();
- // 实例Query对象
- $db = Db::name($this->table)->where('is_deleted', '0');
- // 应用搜索条件
- foreach (['username', 'phone'] as $key) {
- if (isset($get[$key]) && $get[$key] !== '') {
- $db->where($key, 'like', "%{$get[$key]}%");
- }
+ list($get, $db) = [$this->request->get(), Db::name($this->table)];
+ foreach (['username', 'phone', 'mail'] as $key) {
+ (isset($get[$key]) && $get[$key] !== '') && $db->whereLike($key, "%{$get[$key]}%");
}
- // 实例化并显示
- return parent::_list($db);
+ if (isset($get['date']) && $get['date'] !== '') {
+ list($start, $end) = explode(' - ', $get['date']);
+ $db->whereBetween('login_at', ["{$start} 00:00:00", "{$end} 23:59:59"]);
+ }
+ return parent::_list($db->where(['is_deleted' => '0']));
}
/**
* 授权管理
* @return array|string
+ * @throws \think\db\exception\DataNotFoundException
+ * @throws \think\db\exception\ModelNotFoundException
+ * @throws \think\exception\DbException
+ * @throws \think\Exception
*/
- public function auth() {
+ public function auth()
+ {
return $this->_form($this->table, 'auth');
}
/**
* 用户添加
+ * @return array|string
+ * @throws \think\db\exception\DataNotFoundException
+ * @throws \think\db\exception\ModelNotFoundException
+ * @throws \think\exception\DbException
+ * @throws \think\Exception
*/
- public function add() {
+ public function add()
+ {
return $this->_form($this->table, 'form');
}
/**
* 用户编辑
+ * @return array|string
+ * @throws \think\db\exception\DataNotFoundException
+ * @throws \think\db\exception\ModelNotFoundException
+ * @throws \think\exception\DbException
+ * @throws \think\Exception
*/
- public function edit() {
+ public function edit()
+ {
return $this->_form($this->table, 'form');
}
/**
* 用户密码修改
+ * @return array|string
+ * @throws \think\Exception
+ * @throws \think\db\exception\DataNotFoundException
+ * @throws \think\db\exception\ModelNotFoundException
+ * @throws \think\exception\DbException
+ * @throws \think\exception\PDOException
*/
- public function pass() {
- if (in_array('10000', explode(',', $this->request->post('id')))) {
- $this->error('系统超级账号禁止操作!');
- }
+ public function pass()
+ {
if ($this->request->isGet()) {
$this->assign('verify', false);
return $this->_form($this->table, 'pass');
}
- $data = $this->request->post();
- if ($data['password'] !== $data['repassword']) {
+ $post = $this->request->post();
+ if ($post['password'] !== $post['repassword']) {
$this->error('两次输入的密码不一致!');
}
- if (DataService::save($this->table, ['id' => $data['id'], 'password' => md5($data['password'])], 'id')) {
+ $data = ['id' => $post['id'], 'password' => md5($post['password'])];
+ if (DataService::save($this->table, $data, 'id')) {
$this->success('密码修改成功,下次请使用新密码登录!', '');
}
$this->error('密码修改失败,请稍候再试!');
@@ -99,27 +124,36 @@ class User extends BasicAdmin {
/**
* 表单数据默认处理
* @param array $data
+ * @throws \think\db\exception\DataNotFoundException
+ * @throws \think\db\exception\ModelNotFoundException
+ * @throws \think\exception\DbException
*/
- public function _form_filter(&$data) {
+ public function _form_filter(&$data)
+ {
if ($this->request->isPost()) {
if (isset($data['authorize']) && is_array($data['authorize'])) {
$data['authorize'] = join(',', $data['authorize']);
+ } else {
+ $data['authorize'] = '';
}
if (isset($data['id'])) {
unset($data['username']);
- } elseif (Db::name($this->table)->where('username', $data['username'])->find()) {
+ } elseif (Db::name($this->table)->where(['username' => $data['username']])->count() > 0) {
$this->error('用户账号已经存在,请使用其它账号!');
}
} else {
$data['authorize'] = explode(',', isset($data['authorize']) ? $data['authorize'] : '');
- $this->assign('authorizes', Db::name('SystemAuth')->select());
+ $this->assign('authorizes', Db::name('SystemAuth')->where(['status' => '1'])->select());
}
}
/**
* 删除用户
+ * @throws \think\Exception
+ * @throws \think\exception\PDOException
*/
- public function del() {
+ public function del()
+ {
if (in_array('10000', explode(',', $this->request->post('id')))) {
$this->error('系统超级账号禁止删除!');
}
@@ -131,8 +165,11 @@ class User extends BasicAdmin {
/**
* 用户禁用
+ * @throws \think\Exception
+ * @throws \think\exception\PDOException
*/
- public function forbid() {
+ public function forbid()
+ {
if (in_array('10000', explode(',', $this->request->post('id')))) {
$this->error('系统超级账号禁止操作!');
}
@@ -144,8 +181,11 @@ class User extends BasicAdmin {
/**
* 用户禁用
+ * @throws \think\Exception
+ * @throws \think\exception\PDOException
*/
- public function resume() {
+ public function resume()
+ {
if (DataService::update($this->table)) {
$this->success("用户启用成功!", '');
}
diff --git a/application/admin/middleware/Auth.php b/application/admin/middleware/Auth.php
new file mode 100644
index 000000000..8dd0a3d1f
--- /dev/null
+++ b/application/admin/middleware/Auth.php
@@ -0,0 +1,71 @@
+module(), $request->controller(), $request->action()];
+ $access = $this->buildAuth($node = NodeService::parseNodeStr("{$module}/{$controller}/{$action}"));
+ // 登录状态检查
+ if (!empty($access['is_login']) && !session('user')) {
+ $msg = ['code' => 0, 'msg' => '抱歉,您还没有登录获取访问权限!', 'url' => url('@admin/login')];
+ return $request->isAjax() ? json($msg) : redirect($msg['url']);
+ }
+ // 访问权限检查
+ if (!empty($access['is_auth']) && !auth($node)) {
+ return json(['code' => 0, 'msg' => '抱歉,您没有访问该模块的权限!']);
+ }
+ // 模板常量声明
+ app('view')->init(config('template.'))->assign(['classuri' => NodeService::parseNodeStr("{$module}/{$controller}")]);
+ return $next($request);
+ }
+
+ /**
+ * 根据节点获取对应权限配置
+ * @param string $node 权限节点
+ * @return array
+ * @throws \think\db\exception\DataNotFoundException
+ * @throws \think\db\exception\ModelNotFoundException
+ * @throws \think\exception\DbException
+ */
+ private function buildAuth($node)
+ {
+ $info = Db::name('SystemNode')->cache(true, 30)->where(['node' => $node])->find();
+ return [
+ 'is_menu' => intval(!empty($info['is_menu'])),
+ 'is_auth' => intval(!empty($info['is_auth'])),
+ 'is_login' => empty($info['is_auth']) ? intval(!empty($info['is_login'])) : 1,
+ ];
+ }
+}
diff --git a/application/admin/view/auth.index.html b/application/admin/view/auth.index.html
deleted file mode 100644
index 561e473f5..000000000
--- a/application/admin/view/auth.index.html
+++ /dev/null
@@ -1,78 +0,0 @@
-{extend name='extra@admin/content'}
-
-{block name="button"}
-
-
-
-
-{/block}
-
-{block name="content"}
-
-{/block}
\ No newline at end of file
diff --git a/application/admin/view/auth.apply.html b/application/admin/view/auth/apply.html
similarity index 67%
rename from application/admin/view/auth.apply.html
rename to application/admin/view/auth/apply.html
index 30ae678ab..122881af6 100644
--- a/application/admin/view/auth.apply.html
+++ b/application/admin/view/auth/apply.html
@@ -1,36 +1,22 @@
-{extend name='extra@admin/content'}
+{extend name='admin@public/content'}
{block name="content"}
-
-
-
-
-
+{/block}
+{block name="script"}
+
+
+{/block}
+{block name="style"}
+
{/block}
\ No newline at end of file
diff --git a/application/admin/view/auth.form.html b/application/admin/view/auth/form.html
similarity index 87%
rename from application/admin/view/auth.form.html
rename to application/admin/view/auth/form.html
index ec94c8856..cc134f0fe 100644
--- a/application/admin/view/auth.form.html
+++ b/application/admin/view/auth/form.html
@@ -1,4 +1,4 @@
-
- *
- *
- *
- *
- *
- *
- *
- *
- * ```
- */
-
- /**
- * 遍历range内的节点。
- * 每当遍历一个节点时, 都会执行参数项 doFn 指定的函数, 该函数的接受当前遍历的节点
- * 作为其参数。
- * 可以通过参数项 filterFn 来指定一个过滤器, 只有符合该过滤器过滤规则的节点才会触
- * 发doFn函数的执行
- * @method traversal
- * @param { Function } doFn 对每个遍历的节点要执行的方法, 该方法接受当前遍历的节点作为其参数
- * @param { Function } filterFn 过滤器, 该函数接受当前遍历的节点作为参数, 如果该节点满足过滤
- * 规则, 请返回true, 该节点会触发doFn, 否则, 请返回false, 则该节点不
- * 会触发doFn。
- * @return { UE.dom.Range } 当前range对象
- * @see UE.dom.Range:traversal(Function)
- * @example
- * ```html
- *
- *
- *
- *
- * ```
- */
- traversal:function(doFn,filterFn){
- if (this.collapsed)
- return this;
- var bookmark = this.createBookmark(),
- end = bookmark.end,
- current = domUtils.getNextDomNode(bookmark.start, false, filterFn);
- while (current && current !== end && (domUtils.getPosition(current, end) & domUtils.POSITION_PRECEDING)) {
- var tmpNode = domUtils.getNextDomNode(current,false,filterFn);
- doFn(current);
- current = tmpNode;
- }
- return this.moveToBookmark(bookmark);
- }
- };
-})();
-
-// core/Selection.js
-/**
- * 选集
- * @file
- * @module UE.dom
- * @class Selection
- * @since 1.2.6.1
- */
-
-/**
- * 选区集合
- * @unfile
- * @module UE.dom
- * @class Selection
- */
-(function () {
-
- function getBoundaryInformation( range, start ) {
- var getIndex = domUtils.getNodeIndex;
- range = range.duplicate();
- range.collapse( start );
- var parent = range.parentElement();
- //如果节点里没有子节点,直接退出
- if ( !parent.hasChildNodes() ) {
- return {container:parent, offset:0};
- }
- var siblings = parent.children,
- child,
- testRange = range.duplicate(),
- startIndex = 0, endIndex = siblings.length - 1, index = -1,
- distance;
- while ( startIndex <= endIndex ) {
- index = Math.floor( (startIndex + endIndex) / 2 );
- child = siblings[index];
- testRange.moveToElementText( child );
- var position = testRange.compareEndPoints( 'StartToStart', range );
- if ( position > 0 ) {
- endIndex = index - 1;
- } else if ( position < 0 ) {
- startIndex = index + 1;
- } else {
- //trace:1043
- return {container:parent, offset:getIndex( child )};
- }
- }
- if ( index == -1 ) {
- testRange.moveToElementText( parent );
- testRange.setEndPoint( 'StartToStart', range );
- distance = testRange.text.replace( /(\r\n|\r)/g, '\n' ).length;
- siblings = parent.childNodes;
- if ( !distance ) {
- child = siblings[siblings.length - 1];
- return {container:child, offset:child.nodeValue.length};
- }
-
- var i = siblings.length;
- while ( distance > 0 ){
- distance -= siblings[ --i ].nodeValue.length;
- }
- return {container:siblings[i], offset:-distance};
- }
- testRange.collapse( position > 0 );
- testRange.setEndPoint( position > 0 ? 'StartToStart' : 'EndToStart', range );
- distance = testRange.text.replace( /(\r\n|\r)/g, '\n' ).length;
- if ( !distance ) {
- return dtd.$empty[child.tagName] || dtd.$nonChild[child.tagName] ?
- {container:parent, offset:getIndex( child ) + (position > 0 ? 0 : 1)} :
- {container:child, offset:position > 0 ? 0 : child.childNodes.length}
- }
- while ( distance > 0 ) {
- try {
- var pre = child;
- child = child[position > 0 ? 'previousSibling' : 'nextSibling'];
- distance -= child.nodeValue.length;
- } catch ( e ) {
- return {container:parent, offset:getIndex( pre )};
- }
- }
- return {container:child, offset:position > 0 ? -distance : child.nodeValue.length + distance}
- }
-
- /**
- * 将ieRange转换为Range对象
- * @param {Range} ieRange ieRange对象
- * @param {Range} range Range对象
- * @return {Range} range 返回转换后的Range对象
- */
- function transformIERangeToRange( ieRange, range ) {
- if ( ieRange.item ) {
- range.selectNode( ieRange.item( 0 ) );
- } else {
- var bi = getBoundaryInformation( ieRange, true );
- range.setStart( bi.container, bi.offset );
- if ( ieRange.compareEndPoints( 'StartToEnd', ieRange ) != 0 ) {
- bi = getBoundaryInformation( ieRange, false );
- range.setEnd( bi.container, bi.offset );
- }
- }
- return range;
- }
-
- /**
- * 获得ieRange
- * @param {Selection} sel Selection对象
- * @return {ieRange} 得到ieRange
- */
- function _getIERange( sel ) {
- var ieRange;
- //ie下有可能报错
- try {
- ieRange = sel.getNative().createRange();
- } catch ( e ) {
- return null;
- }
- var el = ieRange.item ? ieRange.item( 0 ) : ieRange.parentElement();
- if ( ( el.ownerDocument || el ) === sel.document ) {
- return ieRange;
- }
- return null;
- }
-
- var Selection = dom.Selection = function ( doc ) {
- var me = this, iframe;
- me.document = doc;
- if ( browser.ie9below ) {
- iframe = domUtils.getWindow( doc ).frameElement;
- domUtils.on( iframe, 'beforedeactivate', function () {
- me._bakIERange = me.getIERange();
- } );
- domUtils.on( iframe, 'activate', function () {
- try {
- if ( !_getIERange( me ) && me._bakIERange ) {
- me._bakIERange.select();
- }
- } catch ( ex ) {
- }
- me._bakIERange = null;
- } );
- }
- iframe = doc = null;
- };
-
- Selection.prototype = {
-
- rangeInBody : function(rng,txtRange){
- var node = browser.ie9below || txtRange ? rng.item ? rng.item() : rng.parentElement() : rng.startContainer;
-
- return node === this.document.body || domUtils.inDoc(node,this.document);
- },
-
- /**
- * 获取原生seleciton对象
- * @method getNative
- * @return { Object } 获得selection对象
- * @example
- * ```javascript
- * editor.selection.getNative();
- * ```
- */
- getNative:function () {
- var doc = this.document;
- try {
- return !doc ? null : browser.ie9below ? doc.selection : domUtils.getWindow( doc ).getSelection();
- } catch ( e ) {
- return null;
- }
- },
-
- /**
- * 获得ieRange
- * @method getIERange
- * @return { Object } 返回ie原生的Range
- * @example
- * ```javascript
- * editor.selection.getIERange();
- * ```
- */
- getIERange:function () {
- var ieRange = _getIERange( this );
- if ( !ieRange ) {
- if ( this._bakIERange ) {
- return this._bakIERange;
- }
- }
- return ieRange;
- },
-
- /**
- * 缓存当前选区的range和选区的开始节点
- * @method cache
- */
- cache:function () {
- this.clear();
- this._cachedRange = this.getRange();
- this._cachedStartElement = this.getStart();
- this._cachedStartElementPath = this.getStartElementPath();
- },
-
- /**
- * 获取选区开始位置的父节点到body
- * @method getStartElementPath
- * @return { Array } 返回父节点集合
- * @example
- * ```javascript
- * editor.selection.getStartElementPath();
- * ```
- */
- getStartElementPath:function () {
- if ( this._cachedStartElementPath ) {
- return this._cachedStartElementPath;
- }
- var start = this.getStart();
- if ( start ) {
- return domUtils.findParents( start, true, null, true )
- }
- return [];
- },
-
- /**
- * 清空缓存
- * @method clear
- */
- clear:function () {
- this._cachedStartElementPath = this._cachedRange = this._cachedStartElement = null;
- },
-
- /**
- * 编辑器是否得到了选区
- * @method isFocus
- */
- isFocus:function () {
- try {
- if(browser.ie9below){
-
- var nativeRange = _getIERange(this);
- return !!(nativeRange && this.rangeInBody(nativeRange));
- }else{
- return !!this.getNative().rangeCount;
- }
- } catch ( e ) {
- return false;
- }
-
- },
-
- /**
- * 获取选区对应的Range
- * @method getRange
- * @return { Object } 得到Range对象
- * @example
- * ```javascript
- * editor.selection.getRange();
- * ```
- */
- getRange:function () {
- var me = this;
- function optimze( range ) {
- var child = me.document.body.firstChild,
- collapsed = range.collapsed;
- while ( child && child.firstChild ) {
- range.setStart( child, 0 );
- child = child.firstChild;
- }
- if ( !range.startContainer ) {
- range.setStart( me.document.body, 0 )
- }
- if ( collapsed ) {
- range.collapse( true );
- }
- }
-
- if ( me._cachedRange != null ) {
- return this._cachedRange;
- }
- var range = new baidu.editor.dom.Range( me.document );
-
- if ( browser.ie9below ) {
- var nativeRange = me.getIERange();
- if ( nativeRange ) {
- //备份的_bakIERange可能已经实效了,dom树发生了变化比如从源码模式切回来,所以try一下,实效就放到body开始位置
- try{
- transformIERangeToRange( nativeRange, range );
- }catch(e){
- optimze( range );
- }
-
- } else {
- optimze( range );
- }
- } else {
- var sel = me.getNative();
- if ( sel && sel.rangeCount ) {
- var firstRange = sel.getRangeAt( 0 );
- var lastRange = sel.getRangeAt( sel.rangeCount - 1 );
- range.setStart( firstRange.startContainer, firstRange.startOffset ).setEnd( lastRange.endContainer, lastRange.endOffset );
- if ( range.collapsed && domUtils.isBody( range.startContainer ) && !range.startOffset ) {
- optimze( range );
- }
- } else {
- //trace:1734 有可能已经不在dom树上了,标识的节点
- if ( this._bakRange && domUtils.inDoc( this._bakRange.startContainer, this.document ) ){
- return this._bakRange;
- }
- optimze( range );
- }
- }
- return this._bakRange = range;
- },
-
- /**
- * 获取开始元素,用于状态反射
- * @method getStart
- * @return { Element } 获得开始元素
- * @example
- * ```javascript
- * editor.selection.getStart();
- * ```
- */
- getStart:function () {
- if ( this._cachedStartElement ) {
- return this._cachedStartElement;
- }
- var range = browser.ie9below ? this.getIERange() : this.getRange(),
- tmpRange,
- start, tmp, parent;
- if ( browser.ie9below ) {
- if ( !range ) {
- //todo 给第一个值可能会有问题
- return this.document.body.firstChild;
- }
- //control元素
- if ( range.item ){
- return range.item( 0 );
- }
- tmpRange = range.duplicate();
- //修正ie下x[xx] 闭合后 x|xx
- tmpRange.text.length > 0 && tmpRange.moveStart( 'character', 1 );
- tmpRange.collapse( 1 );
- start = tmpRange.parentElement();
- parent = tmp = range.parentElement();
- while ( tmp = tmp.parentNode ) {
- if ( tmp == start ) {
- start = parent;
- break;
- }
- }
- } else {
- range.shrinkBoundary();
- start = range.startContainer;
- if ( start.nodeType == 1 && start.hasChildNodes() ){
- start = start.childNodes[Math.min( start.childNodes.length - 1, range.startOffset )];
- }
- if ( start.nodeType == 3 ){
- return start.parentNode;
- }
- }
- return start;
- },
-
- /**
- * 得到选区中的文本
- * @method getText
- * @return { String } 选区中包含的文本
- * @example
- * ```javascript
- * editor.selection.getText();
- * ```
- */
- getText:function () {
- var nativeSel, nativeRange;
- if ( this.isFocus() && (nativeSel = this.getNative()) ) {
- nativeRange = browser.ie9below ? nativeSel.createRange() : nativeSel.getRangeAt( 0 );
- return browser.ie9below ? nativeRange.text : nativeRange.toString();
- }
- return '';
- },
-
- /**
- * 清除选区
- * @method clearRange
- * @example
- * ```javascript
- * editor.selection.clearRange();
- * ```
- */
- clearRange : function(){
- this.getNative()[browser.ie9below ? 'empty' : 'removeAllRanges']();
- }
- };
-})();
-
-// core/Editor.js
-/**
- * 编辑器主类,包含编辑器提供的大部分公用接口
- * @file
- * @module UE
- * @class Editor
- * @since 1.2.6.1
- */
-
-/**
- * UEditor公用空间,UEditor所有的功能都挂载在该空间下
- * @unfile
- * @module UE
- */
-
-/**
- * UEditor的核心类,为用户提供与编辑器交互的接口。
- * @unfile
- * @module UE
- * @class Editor
- */
-
-(function () {
- var uid = 0, _selectionChangeTimer;
-
- /**
- * 获取编辑器的html内容,赋值到编辑器所在表单的textarea文本域里面
- * @private
- * @method setValue
- * @param { UE.Editor } editor 编辑器事例
- */
- function setValue(form, editor) {
- var textarea;
- if (editor.textarea) {
- if (utils.isString(editor.textarea)) {
- for (var i = 0, ti, tis = domUtils.getElementsByTagName(form, 'textarea'); ti = tis[i++];) {
- if (ti.id == 'ueditor_textarea_' + editor.options.textarea) {
- textarea = ti;
- break;
- }
- }
- } else {
- textarea = editor.textarea;
- }
- }
- if (!textarea) {
- form.appendChild(textarea = domUtils.createElement(document, 'textarea', {
- 'name': editor.options.textarea,
- 'id': 'ueditor_textarea_' + editor.options.textarea,
- 'style': "display:none"
- }));
- //不要产生多个textarea
- editor.textarea = textarea;
- }
- !textarea.getAttribute('name') && textarea.setAttribute('name', editor.options.textarea );
- textarea.value = editor.hasContents() ?
- (editor.options.allHtmlEnabled ? editor.getAllHtml() : editor.getContent(null, null, true)) :
- ''
- }
- function loadPlugins(me){
- //初始化插件
- for (var pi in UE.plugins) {
- UE.plugins[pi].call(me);
- }
-
- }
- function checkCurLang(I18N){
- for(var lang in I18N){
- return lang
- }
- }
-
- function langReadied(me){
- me.langIsReady = true;
-
- me.fireEvent("langReady");
- }
-
- /**
- * 编辑器准备就绪后会触发该事件
- * @module UE
- * @class Editor
- * @event ready
- * @remind render方法执行完成之后,会触发该事件
- * @remind
- * @example
- * ```javascript
- * editor.addListener( 'ready', function( editor ) {
- * editor.execCommand( 'focus' ); //编辑器家在完成后,让编辑器拿到焦点
- * } );
- * ```
- */
- /**
- * 执行destroy方法,会触发该事件
- * @module UE
- * @class Editor
- * @event destroy
- * @see UE.Editor:destroy()
- */
- /**
- * 执行reset方法,会触发该事件
- * @module UE
- * @class Editor
- * @event reset
- * @see UE.Editor:reset()
- */
- /**
- * 执行focus方法,会触发该事件
- * @module UE
- * @class Editor
- * @event focus
- * @see UE.Editor:focus(Boolean)
- */
- /**
- * 语言加载完成会触发该事件
- * @module UE
- * @class Editor
- * @event langReady
- */
- /**
- * 运行命令之后会触发该命令
- * @module UE
- * @class Editor
- * @event beforeExecCommand
- */
- /**
- * 运行命令之后会触发该命令
- * @module UE
- * @class Editor
- * @event afterExecCommand
- */
- /**
- * 运行命令之前会触发该命令
- * @module UE
- * @class Editor
- * @event firstBeforeExecCommand
- */
- /**
- * 在getContent方法执行之前会触发该事件
- * @module UE
- * @class Editor
- * @event beforeGetContent
- * @see UE.Editor:getContent()
- */
- /**
- * 在getContent方法执行之后会触发该事件
- * @module UE
- * @class Editor
- * @event afterGetContent
- * @see UE.Editor:getContent()
- */
- /**
- * 在getAllHtml方法执行时会触发该事件
- * @module UE
- * @class Editor
- * @event getAllHtml
- * @see UE.Editor:getAllHtml()
- */
- /**
- * 在setContent方法执行之前会触发该事件
- * @module UE
- * @class Editor
- * @event beforeSetContent
- * @see UE.Editor:setContent(String)
- */
- /**
- * 在setContent方法执行之后会触发该事件
- * @module UE
- * @class Editor
- * @event afterSetContent
- * @see UE.Editor:setContent(String)
- */
- /**
- * 每当编辑器内部选区发生改变时,将触发该事件
- * @event selectionchange
- * @warning 该事件的触发非常频繁,不建议在该事件的处理过程中做重量级的处理
- * @example
- * ```javascript
- * editor.addListener( 'selectionchange', function( editor ) {
- * console.log('选区发生改变');
- * }
- */
- /**
- * 在所有selectionchange的监听函数执行之前,会触发该事件
- * @module UE
- * @class Editor
- * @event beforeSelectionChange
- * @see UE.Editor:selectionchange
- */
- /**
- * 在所有selectionchange的监听函数执行完之后,会触发该事件
- * @module UE
- * @class Editor
- * @event afterSelectionChange
- * @see UE.Editor:selectionchange
- */
- /**
- * 编辑器内容发生改变时会触发该事件
- * @module UE
- * @class Editor
- * @event contentChange
- */
-
-
- /**
- * 以默认参数构建一个编辑器实例
- * @constructor
- * @remind 通过 改构造方法实例化的编辑器,不带ui层.需要render到一个容器,编辑器实例才能正常渲染到页面
- * @example
- * ```javascript
- * var editor = new UE.Editor();
- * editor.execCommand('blod');
- * ```
- * @see UE.Config
- */
-
- /**
- * 以给定的参数集合创建一个编辑器实例,对于未指定的参数,将应用默认参数。
- * @constructor
- * @remind 通过 改构造方法实例化的编辑器,不带ui层.需要render到一个容器,编辑器实例才能正常渲染到页面
- * @param { Object } setting 创建编辑器的参数
- * @example
- * ```javascript
- * var editor = new UE.Editor();
- * editor.execCommand('blod');
- * ```
- * @see UE.Config
- */
- var Editor = UE.Editor = function (options) {
- var me = this;
- me.uid = uid++;
- EventBase.call(me);
- me.commands = {};
- me.options = utils.extend(utils.clone(options || {}), UEDITOR_CONFIG, true);
- me.shortcutkeys = {};
- me.inputRules = [];
- me.outputRules = [];
- //设置默认的常用属性
- me.setOpt(Editor.defaultOptions(me));
-
- /* 尝试异步加载后台配置 */
- me.loadServerConfig();
-
- if(!utils.isEmptyObject(UE.I18N)){
- //修改默认的语言类型
- me.options.lang = checkCurLang(UE.I18N);
- UE.plugin.load(me);
- langReadied(me);
-
- }else{
- utils.loadFile(document, {
- src: me.options.langPath + me.options.lang + "/" + me.options.lang + ".js",
- tag: "script",
- type: "text/javascript",
- defer: "defer"
- }, function () {
- UE.plugin.load(me);
- langReadied(me);
- });
- }
-
- UE.instants['ueditorInstant' + me.uid] = me;
- };
- Editor.prototype = {
- registerCommand : function(name,obj){
- this.commands[name] = obj;
- },
- /**
- * 编辑器对外提供的监听ready事件的接口, 通过调用该方法,达到的效果与监听ready事件是一致的
- * @method ready
- * @param { Function } fn 编辑器ready之后所执行的回调, 如果在注册事件之前编辑器已经ready,将会
- * 立即触发该回调。
- * @remind 需要等待编辑器加载完成后才能执行的代码,可以使用该方法传入
- * @example
- * ```javascript
- * editor.ready( function( editor ) {
- * editor.setContent('初始化完毕');
- * } );
- * ```
- * @see UE.Editor.event:ready
- */
- ready: function (fn) {
- var me = this;
- if (fn) {
- me.isReady ? fn.apply(me) : me.addListener('ready', fn);
- }
- },
-
- /**
- * 该方法是提供给插件里面使用,设置配置项默认值
- * @method setOpt
- * @warning 三处设置配置项的优先级: 实例化时传入参数 > setOpt()设置 > config文件里设置
- * @warning 该方法仅供编辑器插件内部和编辑器初始化时调用,其他地方不能调用。
- * @param { String } key 编辑器的可接受的选项名称
- * @param { * } val 该选项可接受的值
- * @example
- * ```javascript
- * editor.setOpt( 'initContent', '欢迎使用编辑器' );
- * ```
- */
-
- /**
- * 该方法是提供给插件里面使用,以{key:value}集合的方式设置插件内用到的配置项默认值
- * @method setOpt
- * @warning 三处设置配置项的优先级: 实例化时传入参数 > setOpt()设置 > config文件里设置
- * @warning 该方法仅供编辑器插件内部和编辑器初始化时调用,其他地方不能调用。
- * @param { Object } options 将要设置的选项的键值对对象
- * @example
- * ```javascript
- * editor.setOpt( {
- * 'initContent': '欢迎使用编辑器'
- * } );
- * ```
- */
- setOpt: function (key, val) {
- var obj = {};
- if (utils.isString(key)) {
- obj[key] = val
- } else {
- obj = key;
- }
- utils.extend(this.options, obj, true);
- },
- getOpt:function(key){
- return this.options[key]
- },
- /**
- * 销毁编辑器实例,使用textarea代替
- * @method destroy
- * @example
- * ```javascript
- * editor.destroy();
- * ```
- */
- destroy: function () {
-
- var me = this;
- me.fireEvent('destroy');
- var container = me.container.parentNode;
- var textarea = me.textarea;
- if (!textarea) {
- textarea = document.createElement('textarea');
- container.parentNode.insertBefore(textarea, container);
- } else {
- textarea.style.display = ''
- }
-
- textarea.style.width = me.iframe.offsetWidth + 'px';
- textarea.style.height = me.iframe.offsetHeight + 'px';
- textarea.value = me.getContent();
- textarea.id = me.key;
- container.innerHTML = '';
- domUtils.remove(container);
- var key = me.key;
- //trace:2004
- for (var p in me) {
- if (me.hasOwnProperty(p)) {
- delete this[p];
- }
- }
- UE.delEditor(key);
- },
-
- /**
- * 渲染编辑器的DOM到指定容器
- * @method render
- * @param { String } containerId 指定一个容器ID
- * @remind 执行该方法,会触发ready事件
- * @warning 必须且只能调用一次
- */
-
- /**
- * 渲染编辑器的DOM到指定容器
- * @method render
- * @param { Element } containerDom 直接指定容器对象
- * @remind 执行该方法,会触发ready事件
- * @warning 必须且只能调用一次
- */
- render: function (container) {
- var me = this,
- options = me.options,
- getStyleValue=function(attr){
- return parseInt(domUtils.getComputedStyle(container,attr));
- };
- if (utils.isString(container)) {
- container = document.getElementById(container);
- }
- if (container) {
- if(options.initialFrameWidth){
- options.minFrameWidth = options.initialFrameWidth
- }else{
- options.minFrameWidth = options.initialFrameWidth = container.offsetWidth;
- }
- if(options.initialFrameHeight){
- options.minFrameHeight = options.initialFrameHeight
- }else{
- options.initialFrameHeight = options.minFrameHeight = container.offsetHeight;
- }
-
- container.style.width = /%$/.test(options.initialFrameWidth) ? '100%' : options.initialFrameWidth-
- getStyleValue("padding-left")- getStyleValue("padding-right") +'px';
- container.style.height = /%$/.test(options.initialFrameHeight) ? '100%' : options.initialFrameHeight -
- getStyleValue("padding-top")- getStyleValue("padding-bottom") +'px';
-
- container.style.zIndex = options.zIndex;
-
- var html = ( ie && browser.version < 9 ? '' : '') +
- '