diff --git a/access_control.sql b/access_control.sql new file mode 100644 index 00000000..359b0959 --- /dev/null +++ b/access_control.sql @@ -0,0 +1,323 @@ +-- phpMyAdmin SQL Dump +-- version 4.9.1 +-- https://www.phpmyadmin.net/ +-- +-- Host: 127.0.0.1 +-- Generation Time: Oct 08, 2020 at 12:11 PM +-- Server version: 10.4.8-MariaDB +-- PHP Version: 7.1.33 + +SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; +SET AUTOCOMMIT = 0; +START TRANSACTION; +SET time_zone = "+00:00"; + + +/*!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 utf8mb4 */; + +-- +-- Database: `access_control` +-- + +-- -------------------------------------------------------- + +-- +-- Table structure for table `area` +-- + +CREATE TABLE `area` ( + `id` int(11) NOT NULL, + `code` int(11) NOT NULL, + `pid` int(11) NOT NULL DEFAULT 0, + `name` varchar(100) NOT NULL, + `description` text DEFAULT NULL, + `created_at` int(11) NOT NULL DEFAULT 0, + `modified_at` int(11) NOT NULL DEFAULT 0 +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- +-- Dumping data for table `area` +-- + +INSERT INTO `area` (`id`, `code`, `pid`, `name`, `description`, `created_at`, `modified_at`) VALUES +(1, 1, 0, 'AreaName', NULL, 0, 0); + +-- -------------------------------------------------------- + +-- +-- Table structure for table `auth_assignment` +-- + +CREATE TABLE `auth_assignment` ( + `item_name` varchar(64) COLLATE utf8_unicode_ci NOT NULL, + `user_id` varchar(64) COLLATE utf8_unicode_ci NOT NULL, + `created_at` int(11) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Dumping data for table `auth_assignment` +-- + +INSERT INTO `auth_assignment` (`item_name`, `user_id`, `created_at`) VALUES +('administrator', '1', 1569900053); + +-- -------------------------------------------------------- + +-- +-- Table structure for table `auth_item` +-- + +CREATE TABLE `auth_item` ( + `name` varchar(64) COLLATE utf8_unicode_ci NOT NULL, + `type` smallint(6) NOT NULL, + `description` text COLLATE utf8_unicode_ci DEFAULT NULL, + `rule_name` varchar(64) COLLATE utf8_unicode_ci DEFAULT NULL, + `data` blob DEFAULT NULL, + `created_at` int(11) DEFAULT NULL, + `updated_at` int(11) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Dumping data for table `auth_item` +-- + +INSERT INTO `auth_item` (`name`, `type`, `description`, `rule_name`, `data`, `created_at`, `updated_at`) VALUES +('administrator', 1, 'Administrator', NULL, NULL, 1535011160, 1535011160); + +-- -------------------------------------------------------- + +-- +-- Table structure for table `auth_item_child` +-- + +CREATE TABLE `auth_item_child` ( + `parent` varchar(64) COLLATE utf8_unicode_ci NOT NULL, + `child` varchar(64) COLLATE utf8_unicode_ci NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `auth_rule` +-- + +CREATE TABLE `auth_rule` ( + `name` varchar(64) COLLATE utf8_unicode_ci NOT NULL, + `data` blob DEFAULT NULL, + `created_at` int(11) DEFAULT NULL, + `updated_at` int(11) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `department` +-- + +CREATE TABLE `department` ( + `id` int(11) NOT NULL, + `code` int(11) NOT NULL, + `pid` int(11) NOT NULL, + `name` varchar(100) NOT NULL, + `created_at` int(11) NOT NULL, + `modified_at` int(11) NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- +-- Dumping data for table `department` +-- + +INSERT INTO `department` (`id`, `code`, `pid`, `name`, `created_at`, `modified_at`) VALUES +(1, 1, 0, 'CompanyName', 0, 0), +(2, 2, 1, 'Phòng CNTT', 1602151686, 1602151686), +(3, 3, 2, 'Phòng AI', 1602151780, 1602151780), +(4, 4, 2, 'Phòng OP', 1602151789, 1602151828); + +-- -------------------------------------------------------- + +-- +-- Table structure for table `device` +-- + +CREATE TABLE `device` ( + `id` int(11) NOT NULL, + `name` varchar(100) NOT NULL, + `serial` varchar(50) DEFAULT NULL, + `ip_address` varchar(20) NOT NULL, + `status` int(11) NOT NULL, + `type` int(11) NOT NULL, + `area_id` int(11) NOT NULL, + `created_at` int(11) NOT NULL DEFAULT 0, + `modified_at` int(11) NOT NULL DEFAULT 0 +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `system_logs` +-- + +CREATE TABLE `system_logs` ( + `id` int(11) NOT NULL, + `user_id` int(11) NOT NULL, + `time` int(11) NOT NULL, + `action` varchar(10) NOT NULL, + `description` text NOT NULL, + `type` varchar(100) NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- +-- Dumping data for table `system_logs` +-- + +INSERT INTO `system_logs` (`id`, `user_id`, `time`, `action`, `description`, `type`) VALUES +(1, 1, 1602151686, 'insert', 'Thêm mới phòng ban: Phòng CNTT', 'department'), +(2, 1, 1602151780, 'insert', 'Thêm mới phòng ban: Phòng AI', 'department'), +(3, 1, 1602151789, 'insert', 'Thêm mới phòng ban: Phòng OP', 'department'), +(4, 1, 1602151794, 'update', 'Chỉnh sửa phòng ban: Phòng OP', 'department'), +(5, 1, 1602151810, 'insert', 'Thêm mới phòng ban: gffdg', 'department'), +(6, 1, 1602151813, 'delete', 'Xóa phòng ban: gffdg', 'department'), +(7, 1, 1602151828, 'update', 'Chỉnh sửa phòng ban: Phòng OP', 'department'); + +-- -------------------------------------------------------- + +-- +-- Table structure for table `user` +-- + +CREATE TABLE `user` ( + `id` int(11) NOT NULL, + `first_name` varchar(250) NOT NULL, + `last_name` varchar(250) DEFAULT NULL, + `phone_number` varchar(30) DEFAULT NULL, + `username` varchar(250) NOT NULL, + `email` varchar(500) DEFAULT NULL, + `password` varchar(250) NOT NULL, + `authKey` varchar(250) DEFAULT NULL, + `password_reset_token` varchar(250) DEFAULT NULL, + `user_image` varchar(500) DEFAULT NULL, + `quota` int(11) NOT NULL DEFAULT 2 +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- +-- Dumping data for table `user` +-- + +INSERT INTO `user` (`id`, `first_name`, `last_name`, `phone_number`, `username`, `email`, `password`, `authKey`, `password_reset_token`, `user_image`, `quota`) VALUES +(1, 'Administrator', '', '12313', 'admin', 'admin@bitraffic.vn', 'ceea23519f6f86ad67e9f798bf8002cb', NULL, NULL, '', 2); + +-- +-- Indexes for dumped tables +-- + +-- +-- Indexes for table `area` +-- +ALTER TABLE `area` + ADD PRIMARY KEY (`id`); + +-- +-- Indexes for table `auth_assignment` +-- +ALTER TABLE `auth_assignment` + ADD PRIMARY KEY (`item_name`,`user_id`), + ADD KEY `auth_assignment_user_id_idx` (`user_id`); + +-- +-- Indexes for table `auth_item` +-- +ALTER TABLE `auth_item` + ADD PRIMARY KEY (`name`), + ADD KEY `rule_name` (`rule_name`), + ADD KEY `idx-auth_item-type` (`type`); + +-- +-- Indexes for table `auth_item_child` +-- +ALTER TABLE `auth_item_child` + ADD PRIMARY KEY (`parent`,`child`), + ADD KEY `child` (`child`); + +-- +-- Indexes for table `auth_rule` +-- +ALTER TABLE `auth_rule` + ADD PRIMARY KEY (`name`); + +-- +-- Indexes for table `department` +-- +ALTER TABLE `department` + ADD PRIMARY KEY (`id`); + +-- +-- Indexes for table `device` +-- +ALTER TABLE `device` + ADD PRIMARY KEY (`id`); + +-- +-- Indexes for table `system_logs` +-- +ALTER TABLE `system_logs` + ADD PRIMARY KEY (`id`); + +-- +-- Indexes for table `user` +-- +ALTER TABLE `user` + ADD PRIMARY KEY (`id`), + ADD UNIQUE KEY `username` (`username`); + +-- +-- AUTO_INCREMENT for dumped tables +-- + +-- +-- AUTO_INCREMENT for table `area` +-- +ALTER TABLE `area` + MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2; + +-- +-- AUTO_INCREMENT for table `department` +-- +ALTER TABLE `department` + MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6; + +-- +-- AUTO_INCREMENT for table `device` +-- +ALTER TABLE `device` + MODIFY `id` int(11) NOT NULL AUTO_INCREMENT; + +-- +-- AUTO_INCREMENT for table `system_logs` +-- +ALTER TABLE `system_logs` + MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8; + +-- +-- AUTO_INCREMENT for table `user` +-- +ALTER TABLE `user` + MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=202; + +-- +-- Constraints for dumped tables +-- + +-- +-- Constraints for table `auth_item_child` +-- +ALTER TABLE `auth_item_child` + ADD CONSTRAINT `auth_item_child_ibfk_1` FOREIGN KEY (`parent`) REFERENCES `auth_item` (`name`) ON DELETE CASCADE ON UPDATE CASCADE, + ADD CONSTRAINT `auth_item_child_ibfk_2` FOREIGN KEY (`child`) REFERENCES `auth_item` (`name`) ON DELETE CASCADE ON UPDATE CASCADE; +COMMIT; + +/*!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 */; diff --git a/assets/AreaAsset.php b/assets/AreaAsset.php new file mode 100644 index 00000000..2a43d14f --- /dev/null +++ b/assets/AreaAsset.php @@ -0,0 +1,23 @@ +user->isGuest) + return $this->redirect(['/site/login']); + } + + /** + * {@inheritdoc} + */ + public function behaviors() { + return [ + 'verbs' => [ + 'class' => VerbFilter::className(), + 'actions' => [ + 'delete' => ['POST'], + ], + ], + ]; + } + + public function actionIndex() { + $this->view->title = 'Khu vực'; + $searchModel = new AreaSearch(); + $dataProvider = $searchModel->search(Yii::$app->request->queryParams); + + return $this->render('index', [ + 'searchModel' => $searchModel, + 'dataProvider' => $dataProvider, + ]); + } + + public function actionView($id) { + return $this->render('view', [ + 'model' => $this->findModel($id), + ]); + } + + public function actionCreate() { + $model = new Area(); + + if ($model->load(Yii::$app->request->post()) && $model->save()) { + return $this->redirect(['view', 'id' => $model->id]); + } + + return $this->render('create', [ + 'model' => $model, + ]); + } + + public function actionUpdate($id) { + $model = $this->findModel($id); + + if ($model->load(Yii::$app->request->post()) && $model->save()) { + return $this->redirect(['view', 'id' => $model->id]); + } + + return $this->render('update', [ + 'model' => $model, + ]); + } + + public function actionDelete($id) { + $this->findModel($id)->delete(); + + return $this->redirect(['index']); + } + + protected function findModel($id) { + if (($model = Area::findOne($id)) !== null) { + return $model; + } + + throw new NotFoundHttpException('The requested page does not exist.'); + } + +} diff --git a/controllers/DepartmentController.php b/controllers/DepartmentController.php index 0f0af742..5f2bb63b 100644 --- a/controllers/DepartmentController.php +++ b/controllers/DepartmentController.php @@ -5,7 +5,7 @@ namespace app\controllers; use Yii; use app\models\Department; use app\models\DepartmentSearch; -use app\models\LogsDepartment; +use app\models\SystemLogs; use app\models\common; use yii\web\Controller; use yii\web\NotFoundHttpException; @@ -60,7 +60,7 @@ class DepartmentController extends Controller { return ["status" => false, "type" => "code"]; if ($model->create($data)) { - Department::insertSystemLogs(["action" => "insert", "description" => "Thêm mới phòng ban: " . $data["Name"]]); + common::insertSystemLogs(["action" => "insert", "description" => "Thêm mới phòng ban: " . $data["Name"], "type" => Yii::$app->controller->id]); return ["status" => true]; } else return ["status" => false, "type" => "error"]; @@ -91,7 +91,7 @@ class DepartmentController extends Controller { $model->modified_at = time(); if ($model->save()) { Department::updateAll(["pid" => $data["Code"]], ["pid" => $oldCode]); - Department::insertSystemLogs(["action" => "update", "description" => "Chỉnh sửa phòng ban: " . $data["Name"]]); + common::insertSystemLogs(["action" => "update", "description" => "Chỉnh sửa phòng ban: " . $data["Name"], "type" => Yii::$app->controller->id]); return ["status" => true]; } else return ["status" => false, "type" => "error"]; @@ -181,7 +181,7 @@ class DepartmentController extends Controller { header('Content-type: application/vnd.ms-excel'); header('Content-Disposition: attachment; filename="department_' . date("YmdHis") . '.xlsx"'); header('Cache-Control: max-age=0'); - $objWriter->save('php://output'); + common::SaveViaTempFile($objWriter); exit(); } @@ -215,7 +215,7 @@ class DepartmentController extends Controller { } $model = new Department(); $model->multiCreate($datas); - Department::insertSystemLogs(["action" => "import", "description" => "Nhập dữ liệu: " . count($post) . " phòng ban mới"]); + common::insertSystemLogs(["action" => "import", "description" => "Nhập dữ liệu: " . count($post) . " phòng ban mới", "type" => Yii::$app->controller->id]); return; } } @@ -226,11 +226,34 @@ class DepartmentController extends Controller { return [ "title" => Html::tag("i", "", ["class" => "fa fa-file"]) . " Ghi nhận hệ thống", "form" => $this->renderPartial("logs", [ - "logs" => LogsDepartment::find()->orderBy(['time' => SORT_DESC])->limit(30)->all(), + "logs" => SystemLogs::find()->andWhere(["type" => Yii::$app->controller->id])->orderBy(['time' => SORT_DESC])->limit(30)->all(), "userArray" => \app\models\User::userArray() ]) ]; } } + public function actionTree() { + if (Yii::$app->request->isAjax) { + Yii::$app->response->format = "json"; + return [ + "title" => Html::tag("i", "", ["class" => "fa fa-sitemap"]) . " Cây thư mục", + "form" => $this->renderPartial("tree", [ + "root" => Department::findOne(1) + ]) + ]; + } + } + + public function actionTest() { + $test = file_get_contents("http://192.168.2.119:2001/TestConnection", false, stream_context_create([ + 'http' => [ + 'header' => "Content-Type: application/json", + 'method' => "POST", + 'content' => json_encode(["DeviceIP" => "192.168.1.201"]) + ] + ])); + return var_dump($test); + } + } diff --git a/controllers/DeviceController.php b/controllers/DeviceController.php new file mode 100644 index 00000000..9b9b9672 --- /dev/null +++ b/controllers/DeviceController.php @@ -0,0 +1,92 @@ +user->isGuest) + return $this->redirect(['/site/login']); + } + + /** + * {@inheritdoc} + */ + public function behaviors() { + return [ + 'verbs' => [ + 'class' => VerbFilter::className(), + 'actions' => [ + 'delete' => ['POST'], + ], + ], + ]; + } + + public function actionIndex() { + $this->view->title = 'Thiết bị'; + $searchModel = new DeviceSearch(); + $dataProvider = $searchModel->search(Yii::$app->request->queryParams); + + return $this->render('index', [ + 'searchModel' => $searchModel, + 'dataProvider' => $dataProvider, + ]); + } + + public function actionView($id) { + return $this->render('view', [ + 'model' => $this->findModel($id), + ]); + } + + public function actionCreate() { + $model = new Device(); + + if ($model->load(Yii::$app->request->post()) && $model->save()) { + return $this->redirect(['view', 'id' => $model->id]); + } + + return $this->render('create', [ + 'model' => $model, + ]); + } + + public function actionUpdate($id) { + $model = $this->findModel($id); + + if ($model->load(Yii::$app->request->post()) && $model->save()) { + return $this->redirect(['view', 'id' => $model->id]); + } + + return $this->render('update', [ + 'model' => $model, + ]); + } + + public function actionDelete($id) { + $this->findModel($id)->delete(); + + return $this->redirect(['index']); + } + + protected function findModel($id) { + if (($model = Device::findOne($id)) !== null) { + return $model; + } + + throw new NotFoundHttpException('The requested page does not exist.'); + } + +} diff --git a/models/Area.php b/models/Area.php new file mode 100644 index 00000000..40dfaeea --- /dev/null +++ b/models/Area.php @@ -0,0 +1,54 @@ + 100], + ]; + } + + /** + * {@inheritdoc} + */ + public function attributeLabels() { + return [ + 'id' => 'ID', + 'code' => 'Mã khu vực', + 'pid' => 'Khu vực cha', + 'name' => 'Tên khu vực', + 'description' => 'Chú thích', + 'created_at' => 'Thời gian tạo', + 'modified_at' => 'Thời gian sửa', + ]; + } + +} diff --git a/models/AreaSearch.php b/models/AreaSearch.php new file mode 100644 index 00000000..eee4990a --- /dev/null +++ b/models/AreaSearch.php @@ -0,0 +1,74 @@ + $query, + ]); + + $this->load($params); + + if (!$this->validate()) { + // uncomment the following line if you do not want to return any records when validation fails + // $query->where('0=1'); + return $dataProvider; + } + + // grid filtering conditions + $query->andFilterWhere([ + 'id' => $this->id, + 'code' => $this->code, + 'pid' => $this->pid, + 'created_at' => $this->created_at, + 'modified_at' => $this->modified_at, + ]); + + $query->andFilterWhere(['like', 'name', $this->name]) + ->andFilterWhere(['like', 'description', $this->description]); + + return $dataProvider; + } +} diff --git a/models/Department.php b/models/Department.php index 5c895df9..39fe5ba6 100644 --- a/models/Department.php +++ b/models/Department.php @@ -91,15 +91,10 @@ class Department extends \yii\db\ActiveRecord { self::deleteDepartment($value->id); } $model->delete(); - self::insertSystemLogs(["action" => "delete", "description" => "Xóa phòng ban: " . $model->name]); + common::insertSystemLogs(["action" => "delete", "description" => "Xóa phòng ban: " . $model->name, "type" => "department"]); } } - public static function insertSystemLogs($data) { - $model = new LogsDepartment(); - return $model->create($data); - } - public function checkStatusImport($data) { if ($this->findOne(["code" => $data["A"]])) return ["status" => false, "description" => "Mã phòng ban đã tồn tại"]; diff --git a/models/Device.php b/models/Device.php new file mode 100644 index 00000000..5e1e7eef --- /dev/null +++ b/models/Device.php @@ -0,0 +1,61 @@ + 100], + [['serial'], 'string', 'max' => 50], + [['ip_address'], 'string', 'max' => 20], + ]; + } + + /** + * {@inheritdoc} + */ + public function attributeLabels() + { + return [ + 'id' => 'ID', + 'name' => 'Name', + 'serial' => 'Serial', + 'ip_address' => 'Ip Address', + 'status' => 'Status', + 'type' => 'Type', + 'area_id' => 'Area ID', + 'created_at' => 'Created At', + 'modified_at' => 'Modified At', + ]; + } +} diff --git a/models/DeviceSearch.php b/models/DeviceSearch.php new file mode 100644 index 00000000..45aae1fb --- /dev/null +++ b/models/DeviceSearch.php @@ -0,0 +1,76 @@ + $query, + ]); + + $this->load($params); + + if (!$this->validate()) { + // uncomment the following line if you do not want to return any records when validation fails + // $query->where('0=1'); + return $dataProvider; + } + + // grid filtering conditions + $query->andFilterWhere([ + 'id' => $this->id, + 'status' => $this->status, + 'type' => $this->type, + 'area_id' => $this->area_id, + 'created_at' => $this->created_at, + 'modified_at' => $this->modified_at, + ]); + + $query->andFilterWhere(['like', 'name', $this->name]) + ->andFilterWhere(['like', 'serial', $this->serial]) + ->andFilterWhere(['like', 'ip_address', $this->ip_address]); + + return $dataProvider; + } +} diff --git a/models/LogsDepartment.php b/models/SystemLogs.php similarity index 74% rename from models/LogsDepartment.php rename to models/SystemLogs.php index 923da0c8..0c92505f 100644 --- a/models/LogsDepartment.php +++ b/models/SystemLogs.php @@ -5,21 +5,22 @@ namespace app\models; use Yii; /** - * This is the model class for table "logs_department". + * This is the model class for table "system_logs". * * @property int $id * @property int $user_id * @property int $time * @property string $action * @property string $description + * @property string $type */ -class LogsDepartment extends \yii\db\ActiveRecord { +class SystemLogs extends \yii\db\ActiveRecord { /** * {@inheritdoc} */ public static function tableName() { - return 'logs_department'; + return 'system_logs'; } /** @@ -27,10 +28,11 @@ class LogsDepartment extends \yii\db\ActiveRecord { */ public function rules() { return [ - [['user_id', 'time', 'action', 'description'], 'required'], + [['user_id', 'time', 'action', 'description', 'type'], 'required'], [['user_id', 'time'], 'integer'], [['description'], 'string'], [['action'], 'string', 'max' => 10], + [['type'], 'string', 'max' => 100], ]; } @@ -44,6 +46,7 @@ class LogsDepartment extends \yii\db\ActiveRecord { 'time' => 'Time', 'action' => 'Action', 'description' => 'Description', + 'type' => 'Type', ]; } @@ -52,7 +55,8 @@ class LogsDepartment extends \yii\db\ActiveRecord { 'user_id' => Yii::$app->user->id, 'time' => time(), 'action' => $data['action'], - 'description' => $data['description'] + 'description' => $data['description'], + 'type' => $data['type'] ], ''); if ($r) { try { diff --git a/models/common.php b/models/common.php index 1815bf2a..aa65eb0d 100644 --- a/models/common.php +++ b/models/common.php @@ -171,4 +171,16 @@ class common extends \yii\db\ActiveRecord { return $visible; } + public static function SaveViaTempFile($objWriter) { + $filePath = rand(0, getrandmax()) . rand(0, getrandmax()) . ".tmp"; + $objWriter->save($filePath); + readfile($filePath); + unlink($filePath); + } + + public static function insertSystemLogs($data) { + $model = new SystemLogs(); + return $model->create($data); + } + } diff --git a/traffic.sql b/traffic.sql deleted file mode 100644 index aaad1e62..00000000 --- a/traffic.sql +++ /dev/null @@ -1,509 +0,0 @@ --- phpMyAdmin SQL Dump --- version 4.9.1 --- https://www.phpmyadmin.net/ --- --- Host: 127.0.0.1 --- Generation Time: Oct 06, 2020 at 06:46 AM --- Server version: 10.4.8-MariaDB --- PHP Version: 7.1.33 - -SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; -SET AUTOCOMMIT = 0; -START TRANSACTION; -SET time_zone = "+00:00"; - - -/*!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 utf8mb4 */; - --- --- Database: `traffic` --- - --- -------------------------------------------------------- - --- --- Table structure for table `area` --- - -CREATE TABLE `area` ( - `id` int(11) NOT NULL, - `pid` int(11) NOT NULL DEFAULT 0, - `name` varchar(100) NOT NULL, - `description` text DEFAULT NULL, - `status` int(11) NOT NULL DEFAULT 1, - `created_at` int(11) NOT NULL, - `modified_at` int(11) NOT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - --- -------------------------------------------------------- - --- --- Table structure for table `auth_assignment` --- - -CREATE TABLE `auth_assignment` ( - `item_name` varchar(64) COLLATE utf8_unicode_ci NOT NULL, - `user_id` varchar(64) COLLATE utf8_unicode_ci NOT NULL, - `created_at` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; - --- --- Dumping data for table `auth_assignment` --- - -INSERT INTO `auth_assignment` (`item_name`, `user_id`, `created_at`) VALUES -('administrator', '1', 1569900053); - --- -------------------------------------------------------- - --- --- Table structure for table `auth_item` --- - -CREATE TABLE `auth_item` ( - `name` varchar(64) COLLATE utf8_unicode_ci NOT NULL, - `type` smallint(6) NOT NULL, - `description` text COLLATE utf8_unicode_ci DEFAULT NULL, - `rule_name` varchar(64) COLLATE utf8_unicode_ci DEFAULT NULL, - `data` blob DEFAULT NULL, - `created_at` int(11) DEFAULT NULL, - `updated_at` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; - --- --- Dumping data for table `auth_item` --- - -INSERT INTO `auth_item` (`name`, `type`, `description`, `rule_name`, `data`, `created_at`, `updated_at`) VALUES -('administrator', 1, 'Administrator', NULL, NULL, 1535011160, 1535011160); - --- -------------------------------------------------------- - --- --- Table structure for table `auth_item_child` --- - -CREATE TABLE `auth_item_child` ( - `parent` varchar(64) COLLATE utf8_unicode_ci NOT NULL, - `child` varchar(64) COLLATE utf8_unicode_ci NOT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; - --- -------------------------------------------------------- - --- --- Table structure for table `auth_rule` --- - -CREATE TABLE `auth_rule` ( - `name` varchar(64) COLLATE utf8_unicode_ci NOT NULL, - `data` blob DEFAULT NULL, - `created_at` int(11) DEFAULT NULL, - `updated_at` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; - --- -------------------------------------------------------- - --- --- Table structure for table `camera` --- - -CREATE TABLE `camera` ( - `id` int(11) NOT NULL, - `gate` int(11) NOT NULL, - `name` varchar(100) NOT NULL, - `type` varchar(5) NOT NULL, - `stream_url` text DEFAULT NULL, - `minWidth` int(11) NOT NULL DEFAULT 0, - `maxWidth` int(11) NOT NULL DEFAULT 0, - `minHeight` int(11) NOT NULL DEFAULT 0, - `maxHeight` int(11) NOT NULL DEFAULT 0, - `scaleFactor` float NOT NULL DEFAULT 0, - `minNeighbors` int(11) NOT NULL DEFAULT 0, - `status` int(11) NOT NULL DEFAULT 1, - `isRecognizeCamera` int(11) NOT NULL DEFAULT 1, - `isLongPlate` int(11) NOT NULL DEFAULT 0, - `stt` int(11) NOT NULL, - `roi_config` text DEFAULT NULL, - `created_at` int(11) NOT NULL, - `modified_at` int(11) NOT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - --- -------------------------------------------------------- - --- --- Table structure for table `card` --- - -CREATE TABLE `card` ( - `id` int(11) NOT NULL, - `card_id` int(11) NOT NULL DEFAULT 0, - `code` varchar(30) NOT NULL, - `card_group` int(11) NOT NULL, - `description` text DEFAULT NULL, - `name` varchar(100) DEFAULT NULL, - `department` varchar(100) DEFAULT NULL, - `phone` varchar(20) DEFAULT NULL, - `plate` varchar(20) DEFAULT NULL, - `brand` varchar(50) DEFAULT NULL, - `address` text DEFAULT NULL, - `ngay_dang_ky` int(11) NOT NULL DEFAULT 0, - `ngay_phat_the` int(11) NOT NULL DEFAULT 0, - `ngay_hoat_dong` int(11) NOT NULL DEFAULT 0, - `ngay_het_han` int(11) NOT NULL DEFAULT 0, - `status` int(11) NOT NULL DEFAULT 1, - `created_at` int(11) NOT NULL DEFAULT 0, - `modified_at` int(11) NOT NULL DEFAULT 0 -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - --- -------------------------------------------------------- - --- --- Table structure for table `card_group` --- - -CREATE TABLE `card_group` ( - `id` int(11) NOT NULL, - `name` varchar(100) NOT NULL, - `description` text DEFAULT NULL, - `card_type` int(11) NOT NULL DEFAULT 1, - `vehicle_type` int(11) NOT NULL DEFAULT 1, - `auto_open_door` int(11) NOT NULL DEFAULT 0, - `cost_config` text DEFAULT NULL, - `created_at` int(11) NOT NULL DEFAULT 0, - `modified_at` int(11) NOT NULL DEFAULT 0 -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - --- -------------------------------------------------------- - --- --- Table structure for table `config` --- - -CREATE TABLE `config` ( - `id` int(11) NOT NULL, - `mac_address` varchar(30) NOT NULL, - `active` int(11) NOT NULL DEFAULT 0 -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - --- -------------------------------------------------------- - --- --- Table structure for table `gate` --- - -CREATE TABLE `gate` ( - `id` int(11) NOT NULL, - `area` int(11) NOT NULL, - `name` varchar(100) NOT NULL, - `description` text DEFAULT NULL, - `status` int(11) NOT NULL DEFAULT 1, - `user_id` int(11) NOT NULL DEFAULT 0, - `api_config` text DEFAULT NULL, - `cascade_config` text DEFAULT NULL, - `lane_config` text DEFAULT NULL, - `created_at` int(11) NOT NULL, - `modified_at` int(11) NOT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - --- -------------------------------------------------------- - --- --- Table structure for table `logs` --- - -CREATE TABLE `logs` ( - `id` int(11) NOT NULL, - `card_id` int(11) NOT NULL, - `plate_in` varchar(20) DEFAULT NULL, - `plate_image_in` text DEFAULT NULL, - `frame_image_in` text DEFAULT NULL, - `face_image_in` text DEFAULT NULL, - `name_in` varchar(100) DEFAULT NULL, - `time_in` int(11) NOT NULL, - `camera_in` int(11) NOT NULL DEFAULT 0, - `mod_in` int(11) NOT NULL DEFAULT 0, - `plate_out` varchar(20) DEFAULT NULL, - `plate_image_out` text DEFAULT NULL, - `frame_image_out` text DEFAULT NULL, - `face_image_out` text NOT NULL, - `name_out` varchar(100) DEFAULT NULL, - `time_out` int(11) NOT NULL DEFAULT 0, - `camera_out` int(11) NOT NULL DEFAULT 0, - `mod_out` int(11) NOT NULL DEFAULT 0, - `logs_number` int(11) NOT NULL DEFAULT 0, - `soft_delete` int(11) NOT NULL DEFAULT 0 -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - --- -------------------------------------------------------- - --- --- Table structure for table `user` --- - -CREATE TABLE `user` ( - `id` int(11) NOT NULL, - `first_name` varchar(250) NOT NULL, - `last_name` varchar(250) DEFAULT NULL, - `phone_number` varchar(30) DEFAULT NULL, - `username` varchar(250) NOT NULL, - `email` varchar(500) DEFAULT NULL, - `password` varchar(250) NOT NULL, - `authKey` varchar(250) DEFAULT NULL, - `password_reset_token` varchar(250) DEFAULT NULL, - `user_image` varchar(500) DEFAULT NULL, - `quota` int(11) NOT NULL DEFAULT 2 -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - --- --- Dumping data for table `user` --- - -INSERT INTO `user` (`id`, `first_name`, `last_name`, `phone_number`, `username`, `email`, `password`, `authKey`, `password_reset_token`, `user_image`, `quota`) VALUES -(1, 'Administrator', '', '12313', 'admin', 'admin@bitraffic.vn', 'ceea23519f6f86ad67e9f798bf8002cb', NULL, NULL, '', 2); - --- -------------------------------------------------------- - --- --- Table structure for table `vip_logs` --- - -CREATE TABLE `vip_logs` ( - `id` int(11) NOT NULL, - `vehicle_id` int(11) NOT NULL, - `plate_in` varchar(20) DEFAULT NULL, - `plate_image_in` text DEFAULT NULL, - `vehicle_image_in` text DEFAULT NULL, - `time_in` int(11) NOT NULL DEFAULT 0, - `gate_in` int(11) NOT NULL DEFAULT 0, - `plate_out` varchar(20) DEFAULT NULL, - `plate_image_out` text DEFAULT NULL, - `vehicle_image_out` text DEFAULT NULL, - `time_out` int(11) NOT NULL DEFAULT 0, - `gate_out` int(11) NOT NULL DEFAULT 0 -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - --- -------------------------------------------------------- - --- --- Table structure for table `vip_logs_other` --- - -CREATE TABLE `vip_logs_other` ( - `id` int(11) NOT NULL, - `plate` varchar(20) DEFAULT NULL, - `plate_image_in` text DEFAULT NULL, - `vehicle_image_in` text DEFAULT NULL, - `time_in` int(11) NOT NULL DEFAULT 0, - `gate_in` int(11) NOT NULL DEFAULT 0, - `plate_image_out` text DEFAULT NULL, - `vehicle_image_out` text DEFAULT NULL, - `time_out` int(11) NOT NULL DEFAULT 0, - `gate_out` int(11) NOT NULL DEFAULT 0 -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - --- -------------------------------------------------------- - --- --- Table structure for table `vip_vehicle` --- - -CREATE TABLE `vip_vehicle` ( - `id` int(11) NOT NULL, - `plate` varchar(20) DEFAULT NULL, - `chuxe` varchar(100) DEFAULT NULL, - `loaixe` varchar(100) DEFAULT NULL, - `donvi` varchar(100) DEFAULT NULL, - `dienthoai` varchar(20) DEFAULT NULL, - `diachi` text DEFAULT NULL, - `status` int(11) NOT NULL DEFAULT 1, - `created_at` int(11) NOT NULL, - `modified_at` int(11) NOT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - --- --- Indexes for dumped tables --- - --- --- Indexes for table `area` --- -ALTER TABLE `area` - ADD PRIMARY KEY (`id`); - --- --- Indexes for table `auth_assignment` --- -ALTER TABLE `auth_assignment` - ADD PRIMARY KEY (`item_name`,`user_id`), - ADD KEY `auth_assignment_user_id_idx` (`user_id`); - --- --- Indexes for table `auth_item` --- -ALTER TABLE `auth_item` - ADD PRIMARY KEY (`name`), - ADD KEY `rule_name` (`rule_name`), - ADD KEY `idx-auth_item-type` (`type`); - --- --- Indexes for table `auth_item_child` --- -ALTER TABLE `auth_item_child` - ADD PRIMARY KEY (`parent`,`child`), - ADD KEY `child` (`child`); - --- --- Indexes for table `auth_rule` --- -ALTER TABLE `auth_rule` - ADD PRIMARY KEY (`name`); - --- --- Indexes for table `camera` --- -ALTER TABLE `camera` - ADD PRIMARY KEY (`id`); - --- --- Indexes for table `card` --- -ALTER TABLE `card` - ADD PRIMARY KEY (`id`); - --- --- Indexes for table `card_group` --- -ALTER TABLE `card_group` - ADD PRIMARY KEY (`id`); - --- --- Indexes for table `config` --- -ALTER TABLE `config` - ADD PRIMARY KEY (`id`); - --- --- Indexes for table `gate` --- -ALTER TABLE `gate` - ADD PRIMARY KEY (`id`); - --- --- Indexes for table `logs` --- -ALTER TABLE `logs` - ADD PRIMARY KEY (`id`); - --- --- Indexes for table `user` --- -ALTER TABLE `user` - ADD PRIMARY KEY (`id`), - ADD UNIQUE KEY `username` (`username`); - --- --- Indexes for table `vip_logs` --- -ALTER TABLE `vip_logs` - ADD PRIMARY KEY (`id`); - --- --- Indexes for table `vip_logs_other` --- -ALTER TABLE `vip_logs_other` - ADD PRIMARY KEY (`id`); - --- --- Indexes for table `vip_vehicle` --- -ALTER TABLE `vip_vehicle` - ADD PRIMARY KEY (`id`); - --- --- AUTO_INCREMENT for dumped tables --- - --- --- AUTO_INCREMENT for table `area` --- -ALTER TABLE `area` - MODIFY `id` int(11) NOT NULL AUTO_INCREMENT; - --- --- AUTO_INCREMENT for table `camera` --- -ALTER TABLE `camera` - MODIFY `id` int(11) NOT NULL AUTO_INCREMENT; - --- --- AUTO_INCREMENT for table `card` --- -ALTER TABLE `card` - MODIFY `id` int(11) NOT NULL AUTO_INCREMENT; - --- --- AUTO_INCREMENT for table `card_group` --- -ALTER TABLE `card_group` - MODIFY `id` int(11) NOT NULL AUTO_INCREMENT; - --- --- AUTO_INCREMENT for table `config` --- -ALTER TABLE `config` - MODIFY `id` int(11) NOT NULL AUTO_INCREMENT; - --- --- AUTO_INCREMENT for table `gate` --- -ALTER TABLE `gate` - MODIFY `id` int(11) NOT NULL AUTO_INCREMENT; - --- --- AUTO_INCREMENT for table `logs` --- -ALTER TABLE `logs` - MODIFY `id` int(11) NOT NULL AUTO_INCREMENT; - --- --- AUTO_INCREMENT for table `user` --- -ALTER TABLE `user` - MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=202; - --- --- AUTO_INCREMENT for table `vip_logs` --- -ALTER TABLE `vip_logs` - MODIFY `id` int(11) NOT NULL AUTO_INCREMENT; - --- --- AUTO_INCREMENT for table `vip_logs_other` --- -ALTER TABLE `vip_logs_other` - MODIFY `id` int(11) NOT NULL AUTO_INCREMENT; - --- --- AUTO_INCREMENT for table `vip_vehicle` --- -ALTER TABLE `vip_vehicle` - MODIFY `id` int(11) NOT NULL AUTO_INCREMENT; - --- --- Constraints for dumped tables --- - --- --- Constraints for table `auth_item_child` --- -ALTER TABLE `auth_item_child` - ADD CONSTRAINT `auth_item_child_ibfk_1` FOREIGN KEY (`parent`) REFERENCES `auth_item` (`name`) ON DELETE CASCADE ON UPDATE CASCADE, - ADD CONSTRAINT `auth_item_child_ibfk_2` FOREIGN KEY (`child`) REFERENCES `auth_item` (`name`) ON DELETE CASCADE ON UPDATE CASCADE; -COMMIT; - -/*!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 */; diff --git a/vendor/dmstr/yii2-adminlte-asset/example-views/yiisoft/yii2-app/layouts/header.php b/vendor/dmstr/yii2-adminlte-asset/example-views/yiisoft/yii2-app/layouts/header.php index 90229451..1d69f2d5 100644 --- a/vendor/dmstr/yii2-adminlte-asset/example-views/yiisoft/yii2-app/layouts/header.php +++ b/vendor/dmstr/yii2-adminlte-asset/example-views/yiisoft/yii2-app/layouts/header.php @@ -19,30 +19,30 @@ use yii\widgets\ActiveForm;