From 2a97375418ac9136cd339ed920afe3f4e07e9c3c Mon Sep 17 00:00:00 2001 From: augushong Date: Sun, 3 Apr 2022 15:29:06 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E6=88=90=E5=86=85=E7=BD=AE=E7=9A=84?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=BA=93=E6=97=A5=E5=BF=97=E9=A9=B1=E5=8A=A8?= =?UTF-8?q?=EF=BC=9B=E5=86=85=E7=BD=AE=E6=95=B0=E6=8D=AE=E5=BA=93=E6=97=A5?= =?UTF-8?q?=E5=BF=97=E7=9A=84=E5=AE=9A=E6=97=B6=E6=B8=85=E9=99=A4=EF=BC=9B?= =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=96=B0=E7=9A=84=E6=95=B0=E6=8D=AE=E5=BA=93?= =?UTF-8?q?sql=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .example.env | 3 + app/BaseController.php | 10 +- app/admin/middleware/SystemLog.php | 14 +- app/admin/service/SystemLogService.php | 136 ------- app/common/command/Install.php | 10 + app/common/command/timer/config.php | 18 +- app/common/controller/TimerController.php | 5 +- app/tools/controller/timer/ClearLog.php | 24 ++ config/install/sql/install.sql | 453 +++++++++++----------- config/log.php | 32 +- extend/.gitignore | 1 + extend/think/log/driver/DebugMysql.php | 171 ++++++++ 12 files changed, 487 insertions(+), 390 deletions(-) delete mode 100644 app/admin/service/SystemLogService.php create mode 100644 app/tools/controller/timer/ClearLog.php create mode 100644 extend/.gitignore create mode 100644 extend/think/log/driver/DebugMysql.php diff --git a/.example.env b/.example.env index 8ac9d27..dbe9294 100644 --- a/.example.env +++ b/.example.env @@ -15,6 +15,9 @@ DEBUG=true PREFIX=ul_ FIELDS_CACHE=false +[LOG] +CHANNEL=file + [LANG] default_lang=zh-cn diff --git a/app/BaseController.php b/app/BaseController.php index b3bd7d3..951f66f 100644 --- a/app/BaseController.php +++ b/app/BaseController.php @@ -1,10 +1,12 @@ request->url()); + } /** * 验证数据 @@ -90,5 +95,4 @@ abstract class BaseController return $v->failException(true)->check($data); } - } diff --git a/app/admin/middleware/SystemLog.php b/app/admin/middleware/SystemLog.php index 512a80e..25e48e7 100644 --- a/app/admin/middleware/SystemLog.php +++ b/app/admin/middleware/SystemLog.php @@ -12,7 +12,6 @@ namespace app\admin\middleware; -use app\admin\service\SystemLogService; use app\Request; use EasyAdmin\tool\CommonTool; use think\facade\Log; @@ -48,14 +47,6 @@ class SystemLog $method = strtolower($request->method()); $url = $request->url(); - trace([ - 'url' => $url, - 'method' => $method, - 'params' => $params, - ], - 'requestDebugInfo' - ); - if ($request->isAjax()) { if (in_array($method, ['post', 'put', 'delete'])) { $ip = CommonTool::getRealIp(); @@ -68,10 +59,9 @@ class SystemLog 'useragent' => $_SERVER['HTTP_USER_AGENT'], 'create_time' => time(), ]; - SystemLogService::instance()->save($data); + Log::debug($data); } } return $next($request); } - -} \ No newline at end of file +} diff --git a/app/admin/service/SystemLogService.php b/app/admin/service/SystemLogService.php deleted file mode 100644 index 1ff5432..0000000 --- a/app/admin/service/SystemLogService.php +++ /dev/null @@ -1,136 +0,0 @@ -tablePrefix = Config::get('database.connections.mysql.prefix'); - $this->tableSuffix = date('Ym', time()); - $this->tableName = "{$this->tablePrefix}system_log_{$this->tableSuffix}"; - return $this; - } - - /** - * 获取实例对象 - * @return SystemLogService|object - */ - public static function instance() - { - if (is_null(self::$instance)) { - self::$instance = new static(); - } - return self::$instance; - } - - - /** - * 保存数据 - * @param $data - * @return bool|string - */ - public function save($data) - { - Db::startTrans(); - try { - $this->detectTable(); - Db::table($this->tableName)->insert($data); - Db::commit(); - } catch (\Exception $e) { - Db::rollback(); - return $e->getMessage(); - } - return true; - } - - /** - * 检测数据表 - * @return bool - */ - protected function detectTable() - { - $check = Db::query("show tables like '{$this->tableName}'"); - if (empty($check)) { - $sql = $this->getCreateSql(); - Db::execute($sql); - } - return true; - } - - public function getAllTableList() - { - - } - - /** - * 根据后缀获取创建表的sql - * @return string - */ - protected function getCreateSql() - { - return <<tableName}` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'ID', - `admin_id` int(10) unsigned DEFAULT '0' COMMENT '管理员ID', - `url` varchar(1500) NOT NULL DEFAULT '' COMMENT '操作页面', - `method` varchar(50) NOT NULL COMMENT '请求方法', - `title` varchar(100) DEFAULT '' COMMENT '日志标题', - `content` text NOT NULL COMMENT '内容', - `ip` varchar(50) NOT NULL DEFAULT '' COMMENT 'IP', - `useragent` varchar(255) DEFAULT '' COMMENT 'User-Agent', - `create_time` int(10) DEFAULT NULL COMMENT '操作时间', - PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=630 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='后台操作日志表 - {$this->tableSuffix}'; -EOT; - } - -} diff --git a/app/common/command/Install.php b/app/common/command/Install.php index 68f415f..2b7da4f 100644 --- a/app/common/command/Install.php +++ b/app/common/command/Install.php @@ -5,6 +5,8 @@ declare(strict_types=1); namespace app\common\command; use app\common\tools\PathTools; +use PDO; +use think\Config as ThinkConfig; use think\console\Command; use think\console\Input; use think\console\input\Option; @@ -34,6 +36,8 @@ class Install extends Command protected function execute(Input $input, Output $output) { + + // 指令输出 $force = $input->getOption('force'); @@ -76,6 +80,12 @@ class Install extends Command Db::startTrans(); try { foreach ($sqlArray as $vo) { + if (strpos($vo, 'LOCK TABLES') === 0) { + continue; + } + if (strpos($vo, 'UNLOCK') === 0) { + continue; + } Db::execute($vo); } Db::name('system_admin') diff --git a/app/common/command/timer/config.php b/app/common/command/timer/config.php index ae5d2dd..32202e4 100644 --- a/app/common/command/timer/config.php +++ b/app/common/command/timer/config.php @@ -2,9 +2,15 @@ return [ [ - 'name'=>'http_demo', // 定时任务的名称,不能重複 - 'type'=>'site', // 定时任务的类型,默认只支持site,你也可以重写定时器命令行以支持其他命令 - 'target'=>'/tools/timer.ResetPassword/do', // 要访问的地址,如果不是以https开头,那么以后台的系统配置中读取相关配置,如果没有配置则不执行 - 'frequency'=>600 // 执行频率,单位:秒,填写10,则每10秒过后执行一次 - ] -]; \ No newline at end of file + 'name' => 'http_demo', // 定时任务的名称,不能重复 + 'type' => 'site', // 定时任务的类型,默认只支持site,你也可以重写定时器命令行以支持其他命令 + 'target' => '/tools/timer.ResetPassword/do', // 要访问的地址,如果不是以https开头,那么以后台的系统配置中读取相关配置,如果没有配置则不执行 + 'frequency' => 600 // 执行频率,单位:秒,填写10,则每10秒过后执行一次 + ], + [ + 'name' => 'clear_log', // 定时任务的名称,不能重复 + 'type' => 'site', // 定时任务的类型,默认只支持site,你也可以重写定时器命令行以支持其他命令 + 'target' => '/tools/timer.ClearLog/do', // 要访问的地址,如果不是以https开头,那么以后台的系统配置中读取相关配置,如果没有配置则不执行 + 'frequency' => 600 // 执行频率,单位:秒,填写10,则每10秒过后执行一次 + ], +]; diff --git a/app/common/controller/TimerController.php b/app/common/controller/TimerController.php index 40bed2f..9c05f06 100644 --- a/app/common/controller/TimerController.php +++ b/app/common/controller/TimerController.php @@ -11,6 +11,9 @@ class TimerController extends ToolsController public function initialize() { + + parent::initialize(); + if (is_integer($this->frequency)) { $this->protectVisit($this->frequency); } @@ -21,7 +24,7 @@ class TimerController extends ToolsController $cache_tag = 'timer_protect'; - $cache_key = 'timer_protect_' . $this->request->url(); + $cache_key = 'timer_protect_' . md5($this->request->url()); $last_exec_time = Cache::get($cache_key, 0); diff --git a/app/tools/controller/timer/ClearLog.php b/app/tools/controller/timer/ClearLog.php new file mode 100644 index 0000000..b2184cf --- /dev/null +++ b/app/tools/controller/timer/ClearLog.php @@ -0,0 +1,24 @@ +where('create_time', '<', time() - 60 * 60 * 24 * 3)->delete(); + + return 'success'; + } +} diff --git a/config/install/sql/install.sql b/config/install/sql/install.sql index 400630f..ff0a62d 100644 --- a/config/install/sql/install.sql +++ b/config/install/sql/install.sql @@ -1,24 +1,59 @@ -/* -Navicat MySQL Data Transfer +-- MySQL dump 10.13 Distrib 5.5.62, for Win64 (AMD64) +-- +-- Host: 47.96.111.169 Database: admin_demo_ultho +-- ------------------------------------------------------ +-- Server version 5.6.46-log -Source Server : localhost -Source Server Version : 50727 -Source Host : localhost:3306 -Source Database : ulthon_admin +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; -Target Server Type : MYSQL -Target Server Version : 50727 -File Encoding : 65001 +-- +-- Table structure for table `ul_debug_log` +-- -Date: 2020-05-17 23:24:06 -*/ +DROP TABLE IF EXISTS `ul_debug_log`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `ul_debug_log` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `uid` varchar(30) NOT NULL DEFAULT '', + `level` varchar(30) NOT NULL DEFAULT '', + `create_time` int(10) unsigned NOT NULL DEFAULT '0', + `create_time_title` varchar(30) NOT NULL DEFAULT '', + `content` text NOT NULL, + `app_name` varchar(30) NOT NULL DEFAULT '', + `controller_name` varchar(30) NOT NULL DEFAULT '', + `action_name` varchar(30) NOT NULL DEFAULT '', + PRIMARY KEY (`id`), + KEY `ul_debug_log_create_time_IDX` (`create_time`) USING BTREE, + KEY `ul_debug_log_uid_IDX` (`uid`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='日志表'; +/*!40101 SET character_set_client = @saved_cs_client */; -SET FOREIGN_KEY_CHECKS=0; +-- +-- Dumping data for table `ul_debug_log` +-- + +LOCK TABLES `ul_debug_log` WRITE; +/*!40000 ALTER TABLE `ul_debug_log` DISABLE KEYS */; +/*!40000 ALTER TABLE `ul_debug_log` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `ul_mall_cate` +-- --- ---------------------------- --- Table structure for ea_mall_cate --- ---------------------------- DROP TABLE IF EXISTS `ul_mall_cate`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `ul_mall_cate` ( `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `title` varchar(20) NOT NULL COMMENT '分类名', @@ -32,16 +67,25 @@ CREATE TABLE `ul_mall_cate` ( PRIMARY KEY (`id`), UNIQUE KEY `title` (`title`) USING BTREE ) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='商品分类'; +/*!40101 SET character_set_client = @saved_cs_client */; --- ---------------------------- --- Records of ea_mall_cate --- ---------------------------- -INSERT INTO `ul_mall_cate` VALUES ('9', '手机', 'http://admin.host/upload/20200514/98fc09b0c4ad4d793a6f04bef79a0edc.jpg', '0', '1', '', '1589440437', '1589440437', null); +-- +-- Dumping data for table `ul_mall_cate` +-- + +LOCK TABLES `ul_mall_cate` WRITE; +/*!40000 ALTER TABLE `ul_mall_cate` DISABLE KEYS */; +INSERT INTO `ul_mall_cate` VALUES (9,'手机','http://admin.host/upload/20200514/98fc09b0c4ad4d793a6f04bef79a0edc.jpg',0,1,'',1589440437,1589440437,NULL); +/*!40000 ALTER TABLE `ul_mall_cate` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `ul_mall_goods` +-- --- ---------------------------- --- Table structure for ea_mall_goods --- ---------------------------- DROP TABLE IF EXISTS `ul_mall_goods`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `ul_mall_goods` ( `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `cate_id` int(11) DEFAULT NULL COMMENT '分类ID', @@ -64,17 +108,25 @@ CREATE TABLE `ul_mall_goods` ( PRIMARY KEY (`id`), KEY `cate_id` (`cate_id`) ) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='商品列表'; +/*!40101 SET character_set_client = @saved_cs_client */; --- ---------------------------- --- Records of ea_mall_goods --- ---------------------------- -INSERT INTO `ul_mall_goods` VALUES ('8', '10', '落地-风扇', 'http://admin.host/upload/20200514/a0f7fe9637abd219f7e93ceb2820df9b.jpg', 'http://admin.host/upload/20200514/95496713918290f6315ea3f87efa6bf2.jpg|http://admin.host/upload/20200514/ae29fa9cba4fc02defb7daed41cb2b13.jpg|http://admin.host/upload/20200514/f0a104d88ec7dc6fb42d2f87cbc71b76.jpg|http://admin.host/upload/20200514/3b88be4b1934690e5c1bd6b54b9ab5c8.jpg', '

76654757

\n\n

\"\"

\n\n

\"\"

\n', '599.00', '368.00', '0', '594', '0', '0', '675', '1', '', '1589454309', '1589567016', null); -INSERT INTO `ul_mall_goods` VALUES ('9', '9', '电脑', 'http://admin.host/upload/20200514/bbf858d469dec2e12a89460110068d3d.jpg', 'http://admin.host/upload/20200514/f0a104d88ec7dc6fb42d2f87cbc71b76.jpg', '

477

\n', '0.00', '0.00', '0', '0', '115', '320', '0', '1', '', '1589465215', '1589476345', null); +-- +-- Dumping data for table `ul_mall_goods` +-- + +LOCK TABLES `ul_mall_goods` WRITE; +/*!40000 ALTER TABLE `ul_mall_goods` DISABLE KEYS */; +INSERT INTO `ul_mall_goods` VALUES (8,10,'落地-风扇','http://admin.host/upload/20200514/a0f7fe9637abd219f7e93ceb2820df9b.jpg','http://admin.host/upload/20200514/95496713918290f6315ea3f87efa6bf2.jpg|http://admin.host/upload/20200514/ae29fa9cba4fc02defb7daed41cb2b13.jpg|http://admin.host/upload/20200514/f0a104d88ec7dc6fb42d2f87cbc71b76.jpg|http://admin.host/upload/20200514/3b88be4b1934690e5c1bd6b54b9ab5c8.jpg','

76654757

\n\n

\"\"

\n\n

\"\"

\n',599.00,368.00,0,594,0,0,675,1,'',1589454309,1589567016,NULL),(9,9,'电脑','http://admin.host/upload/20200514/bbf858d469dec2e12a89460110068d3d.jpg','http://admin.host/upload/20200514/f0a104d88ec7dc6fb42d2f87cbc71b76.jpg','

477

\n',0.00,0.00,0,0,115,320,0,1,'',1589465215,1589476345,NULL); +/*!40000 ALTER TABLE `ul_mall_goods` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `ul_system_admin` +-- --- ---------------------------- --- Table structure for ea_system_admin --- ---------------------------- DROP TABLE IF EXISTS `ul_system_admin`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `ul_system_admin` ( `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `auth_ids` varchar(255) DEFAULT NULL COMMENT '角色权限ID', @@ -93,16 +145,25 @@ CREATE TABLE `ul_system_admin` ( UNIQUE KEY `username` (`username`) USING BTREE, KEY `phone` (`phone`) ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='系统用户表'; +/*!40101 SET character_set_client = @saved_cs_client */; --- ---------------------------- --- Records of ea_system_admin --- ---------------------------- -INSERT INTO `ul_system_admin` VALUES ('1', null, '/static/admin/images/head.jpg', 'admin', 'a33b679d5581a8692988ec9f92ad2d6a2259eaa7', 'admin', 'admin', '0', '0', '1', '1589454169', '1589476815', null); +-- +-- Dumping data for table `ul_system_admin` +-- + +LOCK TABLES `ul_system_admin` WRITE; +/*!40000 ALTER TABLE `ul_system_admin` DISABLE KEYS */; +INSERT INTO `ul_system_admin` VALUES (1,NULL,'/static/admin/images/head.jpg','admin','a33b679d5581a8692988ec9f92ad2d6a2259eaa7',NULL,'',0,0,1,1648970786,NULL,NULL); +/*!40000 ALTER TABLE `ul_system_admin` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `ul_system_auth` +-- --- ---------------------------- --- Table structure for ea_system_auth --- ---------------------------- DROP TABLE IF EXISTS `ul_system_auth`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `ul_system_auth` ( `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `title` varchar(20) NOT NULL COMMENT '权限名称', @@ -115,17 +176,25 @@ CREATE TABLE `ul_system_auth` ( PRIMARY KEY (`id`), UNIQUE KEY `title` (`title`) USING BTREE ) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='系统权限表'; +/*!40101 SET character_set_client = @saved_cs_client */; --- ---------------------------- --- Records of ea_system_auth --- ---------------------------- -INSERT INTO `ul_system_auth` VALUES ('1', '管理员', '1', '1', '测试管理员', '1588921753', '1589614331', null); -INSERT INTO `ul_system_auth` VALUES ('6', '游客权限', '0', '1', '', '1588227513', '1589591751', '1589591751'); +-- +-- Dumping data for table `ul_system_auth` +-- + +LOCK TABLES `ul_system_auth` WRITE; +/*!40000 ALTER TABLE `ul_system_auth` DISABLE KEYS */; +INSERT INTO `ul_system_auth` VALUES (1,'管理员',1,1,'测试管理员',1588921753,1589614331,NULL),(6,'游客权限',0,1,'',1588227513,1589591751,1589591751); +/*!40000 ALTER TABLE `ul_system_auth` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `ul_system_auth_node` +-- --- ---------------------------- --- Table structure for ea_system_auth_node --- ---------------------------- DROP TABLE IF EXISTS `ul_system_auth_node`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `ul_system_auth_node` ( `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `auth_id` bigint(20) unsigned DEFAULT NULL COMMENT '角色ID', @@ -134,31 +203,25 @@ CREATE TABLE `ul_system_auth_node` ( KEY `index_system_auth_auth` (`auth_id`) USING BTREE, KEY `index_system_auth_node` (`node_id`) USING BTREE ) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='角色与节点关系表'; +/*!40101 SET character_set_client = @saved_cs_client */; --- ---------------------------- --- Records of ea_system_auth_node --- ---------------------------- -INSERT INTO `ul_system_auth_node` VALUES ('1', '6', '1'); -INSERT INTO `ul_system_auth_node` VALUES ('2', '6', '2'); -INSERT INTO `ul_system_auth_node` VALUES ('3', '6', '9'); -INSERT INTO `ul_system_auth_node` VALUES ('4', '6', '12'); -INSERT INTO `ul_system_auth_node` VALUES ('5', '6', '18'); -INSERT INTO `ul_system_auth_node` VALUES ('6', '6', '19'); -INSERT INTO `ul_system_auth_node` VALUES ('7', '6', '21'); -INSERT INTO `ul_system_auth_node` VALUES ('8', '6', '22'); -INSERT INTO `ul_system_auth_node` VALUES ('9', '6', '29'); -INSERT INTO `ul_system_auth_node` VALUES ('10', '6', '30'); -INSERT INTO `ul_system_auth_node` VALUES ('11', '6', '38'); -INSERT INTO `ul_system_auth_node` VALUES ('12', '6', '39'); -INSERT INTO `ul_system_auth_node` VALUES ('13', '6', '45'); -INSERT INTO `ul_system_auth_node` VALUES ('14', '6', '46'); -INSERT INTO `ul_system_auth_node` VALUES ('15', '6', '52'); -INSERT INTO `ul_system_auth_node` VALUES ('16', '6', '53'); +-- +-- Dumping data for table `ul_system_auth_node` +-- + +LOCK TABLES `ul_system_auth_node` WRITE; +/*!40000 ALTER TABLE `ul_system_auth_node` DISABLE KEYS */; +INSERT INTO `ul_system_auth_node` VALUES (1,6,1),(2,6,2),(3,6,9),(4,6,12),(5,6,18),(6,6,19),(7,6,21),(8,6,22),(9,6,29),(10,6,30),(11,6,38),(12,6,39),(13,6,45),(14,6,46),(15,6,52),(16,6,53); +/*!40000 ALTER TABLE `ul_system_auth_node` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `ul_system_config` +-- --- ---------------------------- --- Table structure for ea_system_config --- ---------------------------- DROP TABLE IF EXISTS `ul_system_config`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `ul_system_config` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(30) NOT NULL DEFAULT '' COMMENT '变量名', @@ -171,48 +234,26 @@ CREATE TABLE `ul_system_config` ( PRIMARY KEY (`id`), UNIQUE KEY `name` (`name`), KEY `group` (`group`) -) ENGINE=InnoDB AUTO_INCREMENT=88 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='系统配置表'; +) ENGINE=InnoDB AUTO_INCREMENT=90 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='系统配置表'; +/*!40101 SET character_set_client = @saved_cs_client */; --- ---------------------------- --- Records of ea_system_config --- ---------------------------- -INSERT INTO `ul_system_config` VALUES ('41', 'alisms_access_key_id', 'sms', '填你的', '阿里大于公钥', '0', null, null); -INSERT INTO `ul_system_config` VALUES ('42', 'alisms_access_key_secret', 'sms', '填你的', '阿里大鱼私钥', '0', null, null); -INSERT INTO `ul_system_config` VALUES ('55', 'upload_type', 'upload', 'local', '当前上传方式 (local,alioss,qnoss,txoss)', '0', null, null); -INSERT INTO `ul_system_config` VALUES ('56', 'upload_allow_ext', 'upload', 'doc,gif,ico,icon,jpg,mp3,mp4,p12,pem,png,rar,jpeg', '允许上传的文件类型', '0', null, null); -INSERT INTO `ul_system_config` VALUES ('57', 'upload_allow_size', 'upload', '1024000', '允许上传的大小', '0', null, null); -INSERT INTO `ul_system_config` VALUES ('58', 'upload_allow_mime', 'upload', 'image/gif,image/jpeg,video/x-msvideo,text/plain,image/png', '允许上传的文件mime', '0', null, null); -INSERT INTO `ul_system_config` VALUES ('59', 'upload_allow_type', 'upload', 'local,alioss,qnoss,txcos', '可用的上传文件方式', '0', null, null); -INSERT INTO `ul_system_config` VALUES ('60', 'alioss_access_key_id', 'upload', '填你的', '阿里云oss公钥', '0', null, null); -INSERT INTO `ul_system_config` VALUES ('61', 'alioss_access_key_secret', 'upload', '填你的', '阿里云oss私钥', '0', null, null); -INSERT INTO `ul_system_config` VALUES ('62', 'alioss_endpoint', 'upload', '填你的', '阿里云oss数据中心', '0', null, null); -INSERT INTO `ul_system_config` VALUES ('63', 'alioss_bucket', 'upload', '填你的', '阿里云oss空间名称', '0', null, null); -INSERT INTO `ul_system_config` VALUES ('64', 'alioss_domain', 'upload', '填你的', '阿里云oss访问域名', '0', null, null); -INSERT INTO `ul_system_config` VALUES ('65', 'logo_title', 'site', 'ulthon_admin', 'LOGO标题', '0', null, null); -INSERT INTO `ul_system_config` VALUES ('66', 'logo_image', 'site', '/favicon.ico', 'logo图片', '0', null, null); -INSERT INTO `ul_system_config` VALUES ('68', 'site_name', 'site', 'ulthon_admin后台系统', '站点名称', '0', null, null); -INSERT INTO `ul_system_config` VALUES ('69', 'site_ico', 'site', '填你的', '浏览器图标', '0', null, null); -INSERT INTO `ul_system_config` VALUES ('70', 'site_copyright', 'site', '填你的', '版权信息', '0', null, null); -INSERT INTO `ul_system_config` VALUES ('71', 'site_beian', 'site', '填你的', '备案信息', '0', null, null); -INSERT INTO `ul_system_config` VALUES ('72', 'site_version', 'site', '2.0.0', '版本信息', '0', null, null); -INSERT INTO `ul_system_config` VALUES ('75', 'sms_type', 'sms', 'alisms', '短信类型', '0', null, null); -INSERT INTO `ul_system_config` VALUES ('76', 'miniapp_appid', 'wechat', '填你的', '小程序公钥', '0', null, null); -INSERT INTO `ul_system_config` VALUES ('77', 'miniapp_appsecret', 'wechat', '填你的', '小程序私钥', '0', null, null); -INSERT INTO `ul_system_config` VALUES ('78', 'web_appid', 'wechat', '填你的', '公众号公钥', '0', null, null); -INSERT INTO `ul_system_config` VALUES ('79', 'web_appsecret', 'wechat', '填你的', '公众号私钥', '0', null, null); -INSERT INTO `ul_system_config` VALUES ('80', 'txcos_secret_id', 'upload', '填你的', '腾讯云cos密钥', '0', null, null); -INSERT INTO `ul_system_config` VALUES ('81', 'txcos_secret_key', 'upload', '填你的', '腾讯云cos私钥', '0', null, null); -INSERT INTO `ul_system_config` VALUES ('82', 'txcos_region', 'upload', '填你的', '存储桶地域', '0', null, null); -INSERT INTO `ul_system_config` VALUES ('83', 'tecos_bucket', 'upload', '填你的', '存储桶名称', '0', null, null); -INSERT INTO `ul_system_config` VALUES ('84', 'qnoss_access_key', 'upload', '填你的', '访问密钥', '0', null, null); -INSERT INTO `ul_system_config` VALUES ('85', 'qnoss_secret_key', 'upload', '填你的', '安全密钥', '0', null, null); -INSERT INTO `ul_system_config` VALUES ('86', 'qnoss_bucket', 'upload', '填你的', '存储空间', '0', null, null); -INSERT INTO `ul_system_config` VALUES ('87', 'qnoss_domain', 'upload', '填你的', '访问域名', '0', null, null); +-- +-- Dumping data for table `ul_system_config` +-- + +LOCK TABLES `ul_system_config` WRITE; +/*!40000 ALTER TABLE `ul_system_config` DISABLE KEYS */; +INSERT INTO `ul_system_config` VALUES (41,'alisms_access_key_id','sms','填你的','阿里大于公钥',0,NULL,NULL),(42,'alisms_access_key_secret','sms','填你的','阿里大鱼私钥',0,NULL,NULL),(55,'upload_type','upload','local','当前上传方式 (local,alioss,qnoss,txoss)',0,NULL,NULL),(56,'upload_allow_ext','upload','doc,gif,ico,icon,jpg,mp3,mp4,p12,pem,png,rar,jpeg','允许上传的文件类型',0,NULL,NULL),(57,'upload_allow_size','upload','1024000','允许上传的大小',0,NULL,NULL),(58,'upload_allow_mime','upload','image/gif,image/jpeg,video/x-msvideo,text/plain,image/png','允许上传的文件mime',0,NULL,NULL),(59,'upload_allow_type','upload','local,alioss,qnoss,txcos','可用的上传文件方式',0,NULL,NULL),(60,'alioss_access_key_id','upload','填你的','阿里云oss公钥',0,NULL,NULL),(61,'alioss_access_key_secret','upload','填你的','阿里云oss私钥',0,NULL,NULL),(62,'alioss_endpoint','upload','填你的','阿里云oss数据中心',0,NULL,NULL),(63,'alioss_bucket','upload','填你的','阿里云oss空间名称',0,NULL,NULL),(64,'alioss_domain','upload','填你的','阿里云oss访问域名',0,NULL,NULL),(65,'logo_title','site','ulthon_admin','LOGO标题',0,NULL,NULL),(66,'logo_image','site','/favicon.ico','logo图片',0,NULL,NULL),(68,'site_name','site','ulthon_admin后台系统','站点名称',0,NULL,NULL),(69,'site_ico','site','填你的','浏览器图标',0,NULL,NULL),(70,'site_copyright','site','填你的','版权信息',0,NULL,NULL),(71,'site_beian','site','填你的','备案信息',0,NULL,NULL),(72,'site_version','site','2.0.0','版本信息',0,NULL,NULL),(75,'sms_type','sms','alisms','短信类型',0,NULL,NULL),(76,'miniapp_appid','wechat','填你的','小程序公钥',0,NULL,NULL),(77,'miniapp_appsecret','wechat','填你的','小程序私钥',0,NULL,NULL),(78,'web_appid','wechat','填你的','公众号公钥',0,NULL,NULL),(79,'web_appsecret','wechat','填你的','公众号私钥',0,NULL,NULL),(80,'txcos_secret_id','upload','填你的','腾讯云cos密钥',0,NULL,NULL),(81,'txcos_secret_key','upload','填你的','腾讯云cos私钥',0,NULL,NULL),(82,'txcos_region','upload','填你的','存储桶地域',0,NULL,NULL),(83,'tecos_bucket','upload','填你的','存储桶名称',0,NULL,NULL),(84,'qnoss_access_key','upload','填你的','访问密钥',0,NULL,NULL),(85,'qnoss_secret_key','upload','填你的','安全密钥',0,NULL,NULL),(86,'qnoss_bucket','upload','填你的','存储空间',0,NULL,NULL),(87,'qnoss_domain','upload','填你的','访问域名',0,NULL,NULL),(88,'file','site','','',0,1646053882,1646053882),(89,'site_domain','site','http://admin.demo.ulthon.com','',0,1646053882,1646053882); +/*!40000 ALTER TABLE `ul_system_config` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `ul_system_menu` +-- --- ---------------------------- --- Table structure for ea_system_menu --- ---------------------------- DROP TABLE IF EXISTS `ul_system_menu`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `ul_system_menu` ( `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `pid` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT '父id', @@ -230,29 +271,26 @@ CREATE TABLE `ul_system_menu` ( PRIMARY KEY (`id`), KEY `title` (`title`), KEY `href` (`href`) -) ENGINE=InnoDB AUTO_INCREMENT=253 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='系统菜单表'; +) ENGINE=InnoDB AUTO_INCREMENT=254 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='系统菜单表'; +/*!40101 SET character_set_client = @saved_cs_client */; --- ---------------------------- --- Records of ea_system_menu --- ---------------------------- -INSERT INTO `ul_system_menu` VALUES ('227', '99999999', '后台首页', 'fa fa-home', 'index/welcome', '', '_self', '0', '1', null, null, '1573120497', null); -INSERT INTO `ul_system_menu` VALUES ('228', '0', '系统管理', 'fa fa-cog', '', '', '_self', '0', '1', '', null, '1588999529', null); -INSERT INTO `ul_system_menu` VALUES ('234', '228', '菜单管理', 'fa fa-tree', 'system.menu/index', '', '_self', '10', '1', '', null, '1588228555', null); -INSERT INTO `ul_system_menu` VALUES ('244', '228', '管理员管理', 'fa fa-user', 'system.admin/index', '', '_self', '12', '1', '', '1573185011', '1588228573', null); -INSERT INTO `ul_system_menu` VALUES ('245', '228', '角色管理', 'fa fa-bitbucket-square', 'system.auth/index', '', '_self', '11', '1', '', '1573435877', '1588228634', null); -INSERT INTO `ul_system_menu` VALUES ('246', '228', '节点管理', 'fa fa-list', 'system.node/index', '', '_self', '9', '1', '', '1573435919', '1588228648', null); -INSERT INTO `ul_system_menu` VALUES ('247', '228', '配置管理', 'fa fa-asterisk', 'system.config/index', '', '_self', '8', '1', '', '1573457448', '1588228566', null); -INSERT INTO `ul_system_menu` VALUES ('248', '228', '上传管理', 'fa fa-arrow-up', 'system.uploadfile/index', '', '_self', '0', '1', '', '1573542953', '1588228043', null); -INSERT INTO `ul_system_menu` VALUES ('249', '0', '商城管理', 'fa fa-list', '', '', '_self', '0', '1', '', '1589439884', '1589439884', null); -INSERT INTO `ul_system_menu` VALUES ('250', '249', '商品分类', 'fa fa-calendar-check-o', 'mall.cate/index', '', '_self', '0', '1', '', '1589439910', '1589439966', null); -INSERT INTO `ul_system_menu` VALUES ('251', '249', '商品管理', 'fa fa-list', 'mall.goods/index', '', '_self', '0', '1', '', '1589439931', '1589439942', null); -INSERT INTO `ul_system_menu` VALUES ('252', '228', '快捷入口', 'fa fa-list', 'system.quick/index', '', '_self', '0', '1', '', '1589623683', '1589623683', null); -INSERT INTO `ul_system_menu` VALUES ('253', '228', '日志管理', 'fa fa-connectdevelop', 'system.log/index', '', '_self', '0', '1', '', '1589623684', '1589623684', null); +-- +-- Dumping data for table `ul_system_menu` +-- + +LOCK TABLES `ul_system_menu` WRITE; +/*!40000 ALTER TABLE `ul_system_menu` DISABLE KEYS */; +INSERT INTO `ul_system_menu` VALUES (227,99999999,'后台首页','fa fa-home','index/welcome','','_self',0,1,NULL,NULL,1573120497,NULL),(228,0,'系统管理','fa fa-cog','','','_self',0,1,'',NULL,1588999529,NULL),(234,228,'菜单管理','fa fa-tree','system.menu/index','','_self',10,1,'',NULL,1588228555,NULL),(244,228,'管理员管理','fa fa-user','system.admin/index','','_self',12,1,'',1573185011,1588228573,NULL),(245,228,'角色管理','fa fa-bitbucket-square','system.auth/index','','_self',11,1,'',1573435877,1588228634,NULL),(246,228,'节点管理','fa fa-list','system.node/index','','_self',9,1,'',1573435919,1588228648,NULL),(247,228,'配置管理','fa fa-asterisk','system.config/index','','_self',8,1,'',1573457448,1588228566,NULL),(248,228,'上传管理','fa fa-arrow-up','system.uploadfile/index','','_self',0,1,'',1573542953,1588228043,NULL),(249,0,'商城管理','fa fa-list','','','_self',0,1,'',1589439884,1589439884,NULL),(250,249,'商品分类','fa fa-calendar-check-o','mall.cate/index','','_self',0,1,'',1589439910,1589439966,NULL),(251,249,'商品管理','fa fa-list','mall.goods/index','','_self',0,1,'',1589439931,1589439942,NULL),(252,228,'快捷入口','fa fa-list','system.quick/index','','_self',0,1,'',1589623683,1589623683,NULL),(253,228,'日志管理','fa fa-connectdevelop','system.log/index','','_self',0,1,'',1589623684,1589623684,NULL); +/*!40000 ALTER TABLE `ul_system_menu` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `ul_system_node` +-- --- ---------------------------- --- Table structure for ea_system_node --- ---------------------------- DROP TABLE IF EXISTS `ul_system_node`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `ul_system_node` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `node` varchar(100) DEFAULT NULL COMMENT '节点代码', @@ -263,84 +301,26 @@ CREATE TABLE `ul_system_node` ( `update_time` int(10) DEFAULT NULL COMMENT '更新时间', PRIMARY KEY (`id`), KEY `node` (`node`) USING BTREE -) ENGINE=InnoDB AUTO_INCREMENT=67 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='系统节点表'; +) ENGINE=InnoDB AUTO_INCREMENT=69 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='系统节点表'; +/*!40101 SET character_set_client = @saved_cs_client */; --- ---------------------------- --- Records of ea_system_node --- ---------------------------- -INSERT INTO `ul_system_node` VALUES ('1', 'system.admin', '管理员管理', '1', '1', '1589580432', '1589580432'); -INSERT INTO `ul_system_node` VALUES ('2', 'system.admin/index', '列表', '2', '1', '1589580432', '1589580432'); -INSERT INTO `ul_system_node` VALUES ('3', 'system.admin/add', '添加', '2', '1', '1589580432', '1589580432'); -INSERT INTO `ul_system_node` VALUES ('4', 'system.admin/edit', '编辑', '2', '1', '1589580432', '1589580432'); -INSERT INTO `ul_system_node` VALUES ('5', 'system.admin/password', '编辑', '2', '1', '1589580432', '1589580432'); -INSERT INTO `ul_system_node` VALUES ('6', 'system.admin/delete', '删除', '2', '1', '1589580432', '1589580432'); -INSERT INTO `ul_system_node` VALUES ('7', 'system.admin/modify', '属性修改', '2', '1', '1589580432', '1589580432'); -INSERT INTO `ul_system_node` VALUES ('8', 'system.admin/export', '导出', '2', '1', '1589580432', '1589580432'); -INSERT INTO `ul_system_node` VALUES ('9', 'system.auth', '角色权限管理', '1', '1', '1589580432', '1589580432'); -INSERT INTO `ul_system_node` VALUES ('10', 'system.auth/authorize', '授权', '2', '1', '1589580432', '1589580432'); -INSERT INTO `ul_system_node` VALUES ('11', 'system.auth/saveAuthorize', '授权保存', '2', '1', '1589580432', '1589580432'); -INSERT INTO `ul_system_node` VALUES ('12', 'system.auth/index', '列表', '2', '1', '1589580432', '1589580432'); -INSERT INTO `ul_system_node` VALUES ('13', 'system.auth/add', '添加', '2', '1', '1589580432', '1589580432'); -INSERT INTO `ul_system_node` VALUES ('14', 'system.auth/edit', '编辑', '2', '1', '1589580432', '1589580432'); -INSERT INTO `ul_system_node` VALUES ('15', 'system.auth/delete', '删除', '2', '1', '1589580432', '1589580432'); -INSERT INTO `ul_system_node` VALUES ('16', 'system.auth/export', '导出', '2', '1', '1589580432', '1589580432'); -INSERT INTO `ul_system_node` VALUES ('17', 'system.auth/modify', '属性修改', '2', '1', '1589580432', '1589580432'); -INSERT INTO `ul_system_node` VALUES ('18', 'system.config', '系统配置管理', '1', '1', '1589580432', '1589580432'); -INSERT INTO `ul_system_node` VALUES ('19', 'system.config/index', '列表', '2', '1', '1589580432', '1589580432'); -INSERT INTO `ul_system_node` VALUES ('20', 'system.config/save', '保存', '2', '1', '1589580432', '1589580432'); -INSERT INTO `ul_system_node` VALUES ('21', 'system.menu', '菜单管理', '1', '1', '1589580432', '1589580432'); -INSERT INTO `ul_system_node` VALUES ('22', 'system.menu/index', '列表', '2', '1', '1589580432', '1589580432'); -INSERT INTO `ul_system_node` VALUES ('23', 'system.menu/add', '添加', '2', '1', '1589580432', '1589580432'); -INSERT INTO `ul_system_node` VALUES ('24', 'system.menu/edit', '编辑', '2', '1', '1589580432', '1589580432'); -INSERT INTO `ul_system_node` VALUES ('25', 'system.menu/delete', '删除', '2', '1', '1589580432', '1589580432'); -INSERT INTO `ul_system_node` VALUES ('26', 'system.menu/modify', '属性修改', '2', '1', '1589580432', '1589580432'); -INSERT INTO `ul_system_node` VALUES ('27', 'system.menu/getMenuTips', '添加菜单提示', '2', '1', '1589580432', '1589580432'); -INSERT INTO `ul_system_node` VALUES ('28', 'system.menu/export', '导出', '2', '1', '1589580432', '1589580432'); -INSERT INTO `ul_system_node` VALUES ('29', 'system.node', '系统节点管理', '1', '1', '1589580432', '1589580432'); -INSERT INTO `ul_system_node` VALUES ('30', 'system.node/index', '列表', '2', '1', '1589580432', '1589580432'); -INSERT INTO `ul_system_node` VALUES ('31', 'system.node/refreshNode', '系统节点更新', '2', '1', '1589580432', '1589580432'); -INSERT INTO `ul_system_node` VALUES ('32', 'system.node/clearNode', '清除失效节点', '2', '1', '1589580432', '1589580432'); -INSERT INTO `ul_system_node` VALUES ('33', 'system.node/add', '添加', '2', '1', '1589580432', '1589580432'); -INSERT INTO `ul_system_node` VALUES ('34', 'system.node/edit', '编辑', '2', '1', '1589580432', '1589580432'); -INSERT INTO `ul_system_node` VALUES ('35', 'system.node/delete', '删除', '2', '1', '1589580432', '1589580432'); -INSERT INTO `ul_system_node` VALUES ('36', 'system.node/export', '导出', '2', '1', '1589580432', '1589580432'); -INSERT INTO `ul_system_node` VALUES ('37', 'system.node/modify', '属性修改', '2', '1', '1589580432', '1589580432'); -INSERT INTO `ul_system_node` VALUES ('38', 'system.uploadfile', '上传文件管理', '1', '1', '1589580432', '1589580432'); -INSERT INTO `ul_system_node` VALUES ('39', 'system.uploadfile/index', '列表', '2', '1', '1589580432', '1589580432'); -INSERT INTO `ul_system_node` VALUES ('40', 'system.uploadfile/add', '添加', '2', '1', '1589580432', '1589580432'); -INSERT INTO `ul_system_node` VALUES ('41', 'system.uploadfile/edit', '编辑', '2', '1', '1589580432', '1589580432'); -INSERT INTO `ul_system_node` VALUES ('42', 'system.uploadfile/delete', '删除', '2', '1', '1589580432', '1589580432'); -INSERT INTO `ul_system_node` VALUES ('43', 'system.uploadfile/export', '导出', '2', '1', '1589580432', '1589580432'); -INSERT INTO `ul_system_node` VALUES ('44', 'system.uploadfile/modify', '属性修改', '2', '1', '1589580432', '1589580432'); -INSERT INTO `ul_system_node` VALUES ('45', 'mall.cate', '商品分类管理', '1', '1', '1589580432', '1589580432'); -INSERT INTO `ul_system_node` VALUES ('46', 'mall.cate/index', '列表', '2', '1', '1589580432', '1589580432'); -INSERT INTO `ul_system_node` VALUES ('47', 'mall.cate/add', '添加', '2', '1', '1589580432', '1589580432'); -INSERT INTO `ul_system_node` VALUES ('48', 'mall.cate/edit', '编辑', '2', '1', '1589580432', '1589580432'); -INSERT INTO `ul_system_node` VALUES ('49', 'mall.cate/delete', '删除', '2', '1', '1589580432', '1589580432'); -INSERT INTO `ul_system_node` VALUES ('50', 'mall.cate/export', '导出', '2', '1', '1589580432', '1589580432'); -INSERT INTO `ul_system_node` VALUES ('51', 'mall.cate/modify', '属性修改', '2', '1', '1589580432', '1589580432'); -INSERT INTO `ul_system_node` VALUES ('52', 'mall.goods', '商城商品管理', '1', '1', '1589580432', '1589580432'); -INSERT INTO `ul_system_node` VALUES ('53', 'mall.goods/index', '列表', '2', '1', '1589580432', '1589580432'); -INSERT INTO `ul_system_node` VALUES ('54', 'mall.goods/stock', '入库', '2', '1', '1589580432', '1589580432'); -INSERT INTO `ul_system_node` VALUES ('55', 'mall.goods/add', '添加', '2', '1', '1589580432', '1589580432'); -INSERT INTO `ul_system_node` VALUES ('56', 'mall.goods/edit', '编辑', '2', '1', '1589580432', '1589580432'); -INSERT INTO `ul_system_node` VALUES ('57', 'mall.goods/delete', '删除', '2', '1', '1589580432', '1589580432'); -INSERT INTO `ul_system_node` VALUES ('58', 'mall.goods/export', '导出', '2', '1', '1589580432', '1589580432'); -INSERT INTO `ul_system_node` VALUES ('59', 'mall.goods/modify', '属性修改', '2', '1', '1589580432', '1589580432'); -INSERT INTO `ul_system_node` VALUES ('60', 'system.quick', '快捷入口管理', '1', '1', '1589623188', '1589623188'); -INSERT INTO `ul_system_node` VALUES ('61', 'system.quick/index', '列表', '2', '1', '1589623188', '1589623188'); -INSERT INTO `ul_system_node` VALUES ('62', 'system.quick/add', '添加', '2', '1', '1589623188', '1589623188'); -INSERT INTO `ul_system_node` VALUES ('63', 'system.quick/edit', '编辑', '2', '1', '1589623188', '1589623188'); -INSERT INTO `ul_system_node` VALUES ('64', 'system.quick/delete', '删除', '2', '1', '1589623188', '1589623188'); -INSERT INTO `ul_system_node` VALUES ('65', 'system.quick/export', '导出', '2', '1', '1589623188', '1589623188'); -INSERT INTO `ul_system_node` VALUES ('66', 'system.quick/modify', '属性修改', '2', '1', '1589623188', '1589623188'); -INSERT INTO `ul_system_node` VALUES ('67', 'system.log', '操作日志管理', '1', '1', '1589623188', '1589623188'); -INSERT INTO `ul_system_node` VALUES ('68', 'system.log/index', '列表', '2', '1', '1589623188', '1589623188'); +-- +-- Dumping data for table `ul_system_node` +-- + +LOCK TABLES `ul_system_node` WRITE; +/*!40000 ALTER TABLE `ul_system_node` DISABLE KEYS */; +INSERT INTO `ul_system_node` VALUES (1,'system.admin','管理员管理',1,1,1589580432,1589580432),(2,'system.admin/index','列表',2,1,1589580432,1589580432),(3,'system.admin/add','添加',2,1,1589580432,1589580432),(4,'system.admin/edit','编辑',2,1,1589580432,1589580432),(5,'system.admin/password','编辑',2,1,1589580432,1589580432),(6,'system.admin/delete','删除',2,1,1589580432,1589580432),(7,'system.admin/modify','属性修改',2,1,1589580432,1589580432),(8,'system.admin/export','导出',2,1,1589580432,1589580432),(9,'system.auth','角色权限管理',1,1,1589580432,1589580432),(10,'system.auth/authorize','授权',2,1,1589580432,1589580432),(11,'system.auth/saveAuthorize','授权保存',2,1,1589580432,1589580432),(12,'system.auth/index','列表',2,1,1589580432,1589580432),(13,'system.auth/add','添加',2,1,1589580432,1589580432),(14,'system.auth/edit','编辑',2,1,1589580432,1589580432),(15,'system.auth/delete','删除',2,1,1589580432,1589580432),(16,'system.auth/export','导出',2,1,1589580432,1589580432),(17,'system.auth/modify','属性修改',2,1,1589580432,1589580432),(18,'system.config','系统配置管理',1,1,1589580432,1589580432),(19,'system.config/index','列表',2,1,1589580432,1589580432),(20,'system.config/save','保存',2,1,1589580432,1589580432),(21,'system.menu','菜单管理',1,1,1589580432,1589580432),(22,'system.menu/index','列表',2,1,1589580432,1589580432),(23,'system.menu/add','添加',2,1,1589580432,1589580432),(24,'system.menu/edit','编辑',2,1,1589580432,1589580432),(25,'system.menu/delete','删除',2,1,1589580432,1589580432),(26,'system.menu/modify','属性修改',2,1,1589580432,1589580432),(27,'system.menu/getMenuTips','添加菜单提示',2,1,1589580432,1589580432),(28,'system.menu/export','导出',2,1,1589580432,1589580432),(29,'system.node','系统节点管理',1,1,1589580432,1589580432),(30,'system.node/index','列表',2,1,1589580432,1589580432),(31,'system.node/refreshNode','系统节点更新',2,1,1589580432,1589580432),(32,'system.node/clearNode','清除失效节点',2,1,1589580432,1589580432),(33,'system.node/add','添加',2,1,1589580432,1589580432),(34,'system.node/edit','编辑',2,1,1589580432,1589580432),(35,'system.node/delete','删除',2,1,1589580432,1589580432),(36,'system.node/export','导出',2,1,1589580432,1589580432),(37,'system.node/modify','属性修改',2,1,1589580432,1589580432),(38,'system.uploadfile','上传文件管理',1,1,1589580432,1589580432),(39,'system.uploadfile/index','列表',2,1,1589580432,1589580432),(40,'system.uploadfile/add','添加',2,1,1589580432,1589580432),(41,'system.uploadfile/edit','编辑',2,1,1589580432,1589580432),(42,'system.uploadfile/delete','删除',2,1,1589580432,1589580432),(43,'system.uploadfile/export','导出',2,1,1589580432,1589580432),(44,'system.uploadfile/modify','属性修改',2,1,1589580432,1589580432),(45,'mall.cate','商品分类管理',1,1,1589580432,1589580432),(46,'mall.cate/index','列表',2,1,1589580432,1589580432),(47,'mall.cate/add','添加',2,1,1589580432,1589580432),(48,'mall.cate/edit','编辑',2,1,1589580432,1589580432),(49,'mall.cate/delete','删除',2,1,1589580432,1589580432),(50,'mall.cate/export','导出',2,1,1589580432,1589580432),(51,'mall.cate/modify','属性修改',2,1,1589580432,1589580432),(52,'mall.goods','商城商品管理',1,1,1589580432,1589580432),(53,'mall.goods/index','列表',2,1,1589580432,1589580432),(54,'mall.goods/stock','入库',2,1,1589580432,1589580432),(55,'mall.goods/add','添加',2,1,1589580432,1589580432),(56,'mall.goods/edit','编辑',2,1,1589580432,1589580432),(57,'mall.goods/delete','删除',2,1,1589580432,1589580432),(58,'mall.goods/export','导出',2,1,1589580432,1589580432),(59,'mall.goods/modify','属性修改',2,1,1589580432,1589580432),(60,'system.quick','快捷入口管理',1,1,1589623188,1589623188),(61,'system.quick/index','列表',2,1,1589623188,1589623188),(62,'system.quick/add','添加',2,1,1589623188,1589623188),(63,'system.quick/edit','编辑',2,1,1589623188,1589623188),(64,'system.quick/delete','删除',2,1,1589623188,1589623188),(65,'system.quick/export','导出',2,1,1589623188,1589623188),(66,'system.quick/modify','属性修改',2,1,1589623188,1589623188),(67,'system.log','操作日志管理',1,1,1589623188,1589623188),(68,'system.log/index','列表',2,1,1589623188,1589623188); +/*!40000 ALTER TABLE `ul_system_node` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `ul_system_quick` +-- --- ---------------------------- --- Table structure for ea_system_quick --- ---------------------------- DROP TABLE IF EXISTS `ul_system_quick`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `ul_system_quick` ( `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `title` varchar(20) NOT NULL COMMENT '快捷入口名称', @@ -354,23 +334,25 @@ CREATE TABLE `ul_system_quick` ( `delete_time` int(11) DEFAULT NULL COMMENT '删除时间', PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=24 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='系统快捷入口表'; +/*!40101 SET character_set_client = @saved_cs_client */; --- ---------------------------- --- Records of ea_system_quick --- ---------------------------- -INSERT INTO `ul_system_quick` VALUES ('1', '管理员管理', 'fa fa-user', 'system.admin/index', '0', '1', '', '1589624097', '1589624792', null); -INSERT INTO `ul_system_quick` VALUES ('2', '角色管理', 'fa fa-bitbucket-square', 'system.auth/index', '0', '1', '', '1589624772', '1589624781', null); -INSERT INTO `ul_system_quick` VALUES ('3', '菜单管理', 'fa fa-tree', 'system.menu/index', '0', '1', null, '1589624097', '1589624792', null); -INSERT INTO `ul_system_quick` VALUES ('6', '节点管理', 'fa fa-list', 'system.node/index', '0', '1', null, '1589624772', '1589624781', null); -INSERT INTO `ul_system_quick` VALUES ('7', '配置管理', 'fa fa-asterisk', 'system.config/index', '0', '1', null, '1589624097', '1589624792', null); -INSERT INTO `ul_system_quick` VALUES ('8', '上传管理', 'fa fa-arrow-up', 'system.uploadfile/index', '0', '1', null, '1589624772', '1589624781', null); -INSERT INTO `ul_system_quick` VALUES ('10', '商品分类', 'fa fa-calendar-check-o', 'mall.cate/index', '0', '1', null, '1589624097', '1589624792', null); -INSERT INTO `ul_system_quick` VALUES ('11', '商品管理', 'fa fa-list', 'mall.goods/index', '0', '1', null, '1589624772', '1589624781', null); +-- +-- Dumping data for table `ul_system_quick` +-- + +LOCK TABLES `ul_system_quick` WRITE; +/*!40000 ALTER TABLE `ul_system_quick` DISABLE KEYS */; +INSERT INTO `ul_system_quick` VALUES (1,'管理员管理','fa fa-user','system.admin/index',0,1,'',1589624097,1589624792,NULL),(2,'角色管理','fa fa-bitbucket-square','system.auth/index',0,1,'',1589624772,1589624781,NULL),(3,'菜单管理','fa fa-tree','system.menu/index',0,1,NULL,1589624097,1589624792,NULL),(6,'节点管理','fa fa-list','system.node/index',0,1,NULL,1589624772,1589624781,NULL),(7,'配置管理','fa fa-asterisk','system.config/index',0,1,NULL,1589624097,1589624792,NULL),(8,'上传管理','fa fa-arrow-up','system.uploadfile/index',0,1,NULL,1589624772,1589624781,NULL),(10,'商品分类','fa fa-calendar-check-o','mall.cate/index',0,1,NULL,1589624097,1589624792,NULL),(11,'商品管理','fa fa-list','mall.goods/index',0,1,NULL,1589624772,1589624781,NULL); +/*!40000 ALTER TABLE `ul_system_quick` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `ul_system_uploadfile` +-- --- ---------------------------- --- Table structure for ea_system_uploadfile --- ---------------------------- DROP TABLE IF EXISTS `ul_system_uploadfile`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; CREATE TABLE `ul_system_uploadfile` ( `id` int(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'ID', `upload_type` varchar(20) NOT NULL DEFAULT 'local' COMMENT '存储位置', @@ -391,20 +373,29 @@ CREATE TABLE `ul_system_uploadfile` ( KEY `upload_type` (`upload_type`), KEY `original_name` (`original_name`) ) ENGINE=InnoDB AUTO_INCREMENT=316 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='上传文件表'; +/*!40101 SET character_set_client = @saved_cs_client */; --- ---------------------------- --- Records of ea_system_uploadfile --- ---------------------------- -INSERT INTO `ul_system_uploadfile` VALUES ('286', 'alioss', 'image/jpeg', 'https://lxn-99php.oss-cn-shenzhen.aliyuncs.com/upload/20191111/0a6de1ac058ee134301501899b84ecb1.jpg', '', '', '', '0', 'image/jpeg', '0', 'jpg', '', null, null, null); -INSERT INTO `ul_system_uploadfile` VALUES ('287', 'alioss', 'image/jpeg', 'https://lxn-99php.oss-cn-shenzhen.aliyuncs.com/upload/20191111/46d7384f04a3bed331715e86a4095d15.jpg', '', '', '', '0', 'image/jpeg', '0', 'jpg', '', null, null, null); -INSERT INTO `ul_system_uploadfile` VALUES ('288', 'alioss', 'image/x-icon', 'https://lxn-99php.oss-cn-shenzhen.aliyuncs.com/upload/20191111/7d32671f4c1d1b01b0b28f45205763f9.ico', '', '', '', '0', 'image/x-icon', '0', 'ico', '', null, null, null); -INSERT INTO `ul_system_uploadfile` VALUES ('289', 'alioss', 'image/jpeg', 'https://lxn-99php.oss-cn-shenzhen.aliyuncs.com/upload/20191111/28cefa547f573a951bcdbbeb1396b06f.jpg', '', '', '', '0', 'image/jpeg', '0', 'jpg', '', null, null, null); -INSERT INTO `ul_system_uploadfile` VALUES ('290', 'alioss', 'image/jpeg', 'https://lxn-99php.oss-cn-shenzhen.aliyuncs.com/upload/20191111/2c412adf1b30c8be3a913e603c7b6e4a.jpg', '', '', '', '0', 'image/jpeg', '0', 'jpg', '', null, null, null); -INSERT INTO `ul_system_uploadfile` VALUES ('291', 'alioss', 'timg (1).jpg', 'http://ulthon_admin.oss-cn-shenzhen.aliyuncs.com/upload/20191113/ff793ced447febfa9ea2d86f9f88fa8e.jpg', '', '', '', '0', 'image/jpeg', '0', 'jpg', '', '1573612437', null, null); -INSERT INTO `ul_system_uploadfile` VALUES ('296', 'txcos', '22243.jpg', 'https://ulthon_admin-1251997243.cos.ap-guangzhou.myqcloud.com/upload/20191114/2381eaf81208ac188fa994b6f2579953.jpg', '', '', '', '0', 'image/jpeg', '0', 'jpg', '', '1573712153', null, null); -INSERT INTO `ul_system_uploadfile` VALUES ('297', 'local', 'timg.jpg', 'http://admin.host/upload/20200423/5055a273cf8e3f393d699d622b74f247.jpg', '', '', '', '0', 'image/jpeg', '0', 'jpg', '', '1587614155', null, null); -INSERT INTO `ul_system_uploadfile` VALUES ('298', 'local', 'timg.jpg', 'http://admin.host/upload/20200423/243f4e59f1b929951ef79c5f8be7468a.jpg', '', '', '', '0', 'image/jpeg', '0', 'jpg', '', '1587614269', null, null); -INSERT INTO `ul_system_uploadfile` VALUES ('299', 'local', 'head.jpg', 'http://admin.host/upload/20200512/a5ce9883379727324f5686ef61205ce2.jpg', '', '', '', '0', 'image/jpeg', '0', 'jpg', '', '1589255649', null, null); -INSERT INTO `ul_system_uploadfile` VALUES ('300', 'local', '896e5b87c9ca70e4.jpg', 'http://admin.host/upload/20200514/577c65f101639f53dbbc9e7aa346f81c.jpg', '', '', '', '0', 'image/jpeg', '0', 'jpg', '', '1589427798', null, null); -INSERT INTO `ul_system_uploadfile` VALUES ('301', 'local', '896e5b87c9ca70e4.jpg', 'http://admin.host/upload/20200514/98fc09b0c4ad4d793a6f04bef79a0edc.jpg', '', '', '', '0', 'image/jpeg', '0', 'jpg', '', '1589427840', null, null); -INSERT INTO `ul_system_uploadfile` VALUES ('302', 'local', '18811e7611c8f292.jpg', 'http://admin.host/upload/20200514/e1c6c9ef6a4b98b8f7d95a1a0191a2df.jpg', '', '', '', '0', 'image/jpeg', '0', 'jpg', '', '1589438645', null, null); +-- +-- Dumping data for table `ul_system_uploadfile` +-- + +LOCK TABLES `ul_system_uploadfile` WRITE; +/*!40000 ALTER TABLE `ul_system_uploadfile` DISABLE KEYS */; +INSERT INTO `ul_system_uploadfile` VALUES (286,'alioss','image/jpeg','https://lxn-99php.oss-cn-shenzhen.aliyuncs.com/upload/20191111/0a6de1ac058ee134301501899b84ecb1.jpg','','','',0,'image/jpeg',0,'jpg','',NULL,NULL,NULL),(287,'alioss','image/jpeg','https://lxn-99php.oss-cn-shenzhen.aliyuncs.com/upload/20191111/46d7384f04a3bed331715e86a4095d15.jpg','','','',0,'image/jpeg',0,'jpg','',NULL,NULL,NULL),(288,'alioss','image/x-icon','https://lxn-99php.oss-cn-shenzhen.aliyuncs.com/upload/20191111/7d32671f4c1d1b01b0b28f45205763f9.ico','','','',0,'image/x-icon',0,'ico','',NULL,NULL,NULL),(289,'alioss','image/jpeg','https://lxn-99php.oss-cn-shenzhen.aliyuncs.com/upload/20191111/28cefa547f573a951bcdbbeb1396b06f.jpg','','','',0,'image/jpeg',0,'jpg','',NULL,NULL,NULL),(290,'alioss','image/jpeg','https://lxn-99php.oss-cn-shenzhen.aliyuncs.com/upload/20191111/2c412adf1b30c8be3a913e603c7b6e4a.jpg','','','',0,'image/jpeg',0,'jpg','',NULL,NULL,NULL),(291,'alioss','timg (1).jpg','http://ulthon_admin.oss-cn-shenzhen.aliyuncs.com/upload/20191113/ff793ced447febfa9ea2d86f9f88fa8e.jpg','','','',0,'image/jpeg',0,'jpg','',1573612437,NULL,NULL),(296,'txcos','22243.jpg','https://ulthon_admin-1251997243.cos.ap-guangzhou.myqcloud.com/upload/20191114/2381eaf81208ac188fa994b6f2579953.jpg','','','',0,'image/jpeg',0,'jpg','',1573712153,NULL,NULL),(297,'local','timg.jpg','http://admin.host/upload/20200423/5055a273cf8e3f393d699d622b74f247.jpg','','','',0,'image/jpeg',0,'jpg','',1587614155,NULL,NULL),(298,'local','timg.jpg','http://admin.host/upload/20200423/243f4e59f1b929951ef79c5f8be7468a.jpg','','','',0,'image/jpeg',0,'jpg','',1587614269,NULL,NULL),(299,'local','head.jpg','http://admin.host/upload/20200512/a5ce9883379727324f5686ef61205ce2.jpg','','','',0,'image/jpeg',0,'jpg','',1589255649,NULL,NULL),(300,'local','896e5b87c9ca70e4.jpg','http://admin.host/upload/20200514/577c65f101639f53dbbc9e7aa346f81c.jpg','','','',0,'image/jpeg',0,'jpg','',1589427798,NULL,NULL),(301,'local','896e5b87c9ca70e4.jpg','http://admin.host/upload/20200514/98fc09b0c4ad4d793a6f04bef79a0edc.jpg','','','',0,'image/jpeg',0,'jpg','',1589427840,NULL,NULL),(302,'local','18811e7611c8f292.jpg','http://admin.host/upload/20200514/e1c6c9ef6a4b98b8f7d95a1a0191a2df.jpg','','','',0,'image/jpeg',0,'jpg','',1589438645,NULL,NULL); +/*!40000 ALTER TABLE `ul_system_uploadfile` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Dumping routines for database 'admin_demo_ultho' +-- +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +-- Dump completed on 2022-04-03 15:27:35 diff --git a/config/log.php b/config/log.php index ca45a0d..440bd78 100644 --- a/config/log.php +++ b/config/log.php @@ -1,14 +1,24 @@ Env::get('log.channel', 'file'), // 日志记录级别 - 'level' => [], + 'level' => $level, // 日志类型记录的通道 ['error'=>'email',...] 'type_channel' => [], // 关闭全局日志写入 @@ -43,6 +53,26 @@ return [ 'realtime_write' => false, ], // 其它日志通道配置 + // 其它日志通道配置 + 'debug_mysql' => [ + 'type' => 'DebugMysql', + // 服务器地址 + 'hostname' => Env::get('database.hostname', '127.0.0.1'), + // 数据库名 + 'database' => Env::get('database.database', 'pro_hairdressing_com'), + // 用户名 + 'username' => Env::get('database.username', 'pro_hairdressing_com'), + // 密码 + 'password' => Env::get('database.password', 'pro_hairdressing_com'), + // 端口 + 'hostport' => Env::get('database.hostport', '3306'), + // 数据库连接参数 + 'params' => [], + // 数据库编码默认采用utf8 + 'charset' => Env::get('database.charset', 'utf8'), + // 数据库表前缀 + 'prefix' => Env::get('database.prefix', 'ul_'), + ] ], ]; diff --git a/extend/.gitignore b/extend/.gitignore new file mode 100644 index 0000000..b722e9e --- /dev/null +++ b/extend/.gitignore @@ -0,0 +1 @@ +!.gitignore \ No newline at end of file diff --git a/extend/think/log/driver/DebugMysql.php b/extend/think/log/driver/DebugMysql.php new file mode 100644 index 0000000..2508d19 --- /dev/null +++ b/extend/think/log/driver/DebugMysql.php @@ -0,0 +1,171 @@ +config = array_merge($this->config, $config); + } + + $dsn = $this->parseDsn($config); + + try { + + $pdo = $this->createPdo($dsn, $config['username'], $config['password'], $config['params']); + + $this->pdo = $pdo; + } catch (\Throwable $th) { + $this->pdo = null; + + $log_path = App::getRuntimePath() . 'log/' . date('ymd') . '.csv'; + + $dirname = dirname($log_path); + + if (!is_dir($dirname)) { + mkdir($log_path, 0777, true); + } + + $first_line = false; + if (!file_exists($log_path)) { + $first_line = true; + } + + $this->fileRescource = fopen($log_path, 'a'); + + if ($first_line) { + $fields = [ + 'level', + 'content', + 'create_time', + 'create_time_title', + 'uid', + 'app_name', + 'controller_name', + 'action_name', + ]; + fputcsv($this->fileRescource, $fields); + } + } + + + $this->tableName = $config['prefix'] . 'debug_log'; + } + + public function save(array $log): bool + { + + + $app_name = app('http')->getName() ?: ''; + + $controller_name = request()->controller(); + $action_name = request()->action(); + + if (App::runningInConsole()) { + $app_name = 'cli'; + } + + $create_time = time(); + + + $create_time_title = date('Y-m-d H:i:s', $create_time); + + $log_key = uniqid(); + + foreach ($log as $log_level => $log_list) { + foreach ($log_list as $key => $log_item) { + + if (!is_string($log_item)) { + $log_item = json_encode($log_item, JSON_UNESCAPED_UNICODE); + } + $log_data = [ + 'level' => $log_level, + 'content' => $log_item, + 'create_time' => $create_time, + 'create_time_title' => $create_time_title, + 'uid' => $log_key, + 'app_name' => $app_name, + 'controller_name' => $controller_name, + 'action_name' => $action_name, + ]; + + if (!is_null($this->pdo)) { + + foreach ($log_data as $key => &$value) { + $value = str_replace('\'', '\\\'', $value); + } + + $data_keys = array_keys($log_data); + + $data_keys_in_sql = join(',', $data_keys); + + $data_values_in_sql = join('\',\'', $log_data); + + $sql = "INSERT INTO {$this->tableName} ($data_keys_in_sql) VALUES ('$data_values_in_sql');"; + + $this->pdo->exec($sql); + } else { + + fputcsv($this->fileRescource, $log_data); + } + } + } + + return true; + } + + /** + * 解析pdo连接的dsn信息 + * @access protected + * @param array $config 连接信息 + * @return string + */ + protected function parseDsn(array $config): string + { + if (!empty($config['socket'])) { + $dsn = 'mysql:unix_socket=' . $config['socket']; + } elseif (!empty($config['hostport'])) { + $dsn = 'mysql:host=' . $config['hostname'] . ';port=' . $config['hostport']; + } else { + $dsn = 'mysql:host=' . $config['hostname']; + } + $dsn .= ';dbname=' . $config['database']; + + if (!empty($config['charset'])) { + $dsn .= ';charset=' . $config['charset']; + } + + return $dsn; + } + + protected function createPdo($dsn, $username, $password, $params) + { + return new PDO($dsn, $username, $password, $params); + } + + public function __destruct() + { + $this->pdo = null; + + if (!is_null($this->fileRescource)) { + fclose($this->fileRescource); + } + } +}