Parcourir la source

feat:初始化sz地铁

mickey135 il y a 1 mois
Parent
commit
9e3b5098e2
100 fichiers modifiés avec 3642 ajouts et 1 suppressions
  1. 3 0
      .bowerrc
  2. 39 0
      .gitignore
  3. 29 0
      LICENSE.md
  4. 4 1
      README.md
  5. 88 0
      Vagrantfile
  6. 4 0
      backend/Dockerfile
  7. 23 0
      backend/assets/AppAsset.php
  8. 15 0
      backend/codeception.yml
  9. 4 0
      backend/config/.gitignore
  10. 1 0
      backend/config/bootstrap.php
  11. 11 0
      backend/config/codeception-local.php
  12. 25 0
      backend/config/main-local.php
  13. 48 0
      backend/config/main.php
  14. 4 0
      backend/config/params-local.php
  15. 4 0
      backend/config/params.php
  16. 4 0
      backend/config/test-local.php
  17. 15 0
      backend/config/test.php
  18. 104 0
      backend/controllers/SiteController.php
  19. 1 0
      backend/models/.gitkeep
  20. 2 0
      backend/runtime/.gitignore
  21. 10 0
      backend/tests/_bootstrap.php
  22. 0 0
      backend/tests/_data/.gitignore
  23. 13 0
      backend/tests/_data/login_data.php
  24. 2 0
      backend/tests/_output/.gitignore
  25. 1 0
      backend/tests/_support/.gitignore
  26. 26 0
      backend/tests/_support/FunctionalTester.php
  27. 26 0
      backend/tests/_support/UnitTester.php
  28. 5 0
      backend/tests/functional.suite.yml
  29. 44 0
      backend/tests/functional/LoginCest.php
  30. 16 0
      backend/tests/functional/_bootstrap.php
  31. 2 0
      backend/tests/unit.suite.yml
  32. 16 0
      backend/tests/unit/_bootstrap.php
  33. 33 0
      backend/views/layouts/blank.php
  34. 80 0
      backend/views/layouts/main.php
  35. 27 0
      backend/views/site/error.php
  36. 53 0
      backend/views/site/index.php
  37. 32 0
      backend/views/site/login.php
  38. 2 0
      backend/web/assets/.gitignore
  39. 90 0
      backend/web/css/site.css
  40. BIN
      backend/web/favicon.ico
  41. 27 0
      backend/web/index-test.php
  42. 18 0
      backend/web/index.php
  43. 2 0
      backend/web/robots.txt
  44. 9 0
      codeception.yml
  45. 15 0
      common/codeception.yml
  46. 47 0
      common/components/AjaxErrorHandler.php
  47. 19 0
      common/components/AjaxException.php
  48. 278 0
      common/components/BaseAjaxController.php
  49. 10 0
      common/components/Exception.php
  50. 227 0
      common/components/Routes.php
  51. 42 0
      common/components/Yii.php
  52. 4 0
      common/config/.gitignore
  53. 33 0
      common/config/__autocomplete.php
  54. 6 0
      common/config/bootstrap.php
  55. 3 0
      common/config/env/currentEnv.php
  56. 20 0
      common/config/main.php
  57. 9 0
      common/config/params.php
  58. 11 0
      common/config/test.php
  59. 10 0
      common/fixtures/UserFixture.php
  60. 16 0
      common/mail/emailVerify-html.php
  61. 12 0
      common/mail/emailVerify-text.php
  62. 24 0
      common/mail/layouts/html.php
  63. 12 0
      common/mail/layouts/text.php
  64. 16 0
      common/mail/passwordResetToken-html.php
  65. 12 0
      common/mail/passwordResetToken-text.php
  66. 151 0
      common/models/AccidentCases.php
  67. 47 0
      common/models/AccidentCasesDimension.php
  68. 43 0
      common/models/AccidentCasesFocus.php
  69. 43 0
      common/models/AccidentCasesRelateToDictionary.php
  70. 53 0
      common/models/AccidentCasesScore.php
  71. 48 0
      common/models/AccidentCasesScoreComment.php
  72. 43 0
      common/models/AccidentCasesScoreConfig.php
  73. 49 0
      common/models/AccidentCasesStudy.php
  74. 56 0
      common/models/AccidentCasesUpdateHistory.php
  75. 55 0
      common/models/AdminLog.php
  76. 57 0
      common/models/BaseMenu.php
  77. 58 0
      common/models/BaseRole.php
  78. 42 0
      common/models/BaseRoleClientRules.php
  79. 46 0
      common/models/BaseRoleMenu.php
  80. 42 0
      common/models/BaseRoleServerRules.php
  81. 82 0
      common/models/BaseUser.php
  82. 46 0
      common/models/BaseUserRole.php
  83. 47 0
      common/models/Department.php
  84. 52 0
      common/models/Dictionary.php
  85. 45 0
      common/models/DictionaryRelationship.php
  86. 60 0
      common/models/EmergencyResponse.php
  87. 47 0
      common/models/EmergencyResponseDimension.php
  88. 43 0
      common/models/EmergencyResponseRelateToRulesPoints.php
  89. 43 0
      common/models/EmergencyResponseRelateToSourceData.php
  90. 54 0
      common/models/EventOverview.php
  91. 49 0
      common/models/EventSourceData.php
  92. 47 0
      common/models/Job.php
  93. 52 0
      common/models/Mail.php
  94. 65 0
      common/models/OperationalAdjustments.php
  95. 47 0
      common/models/OperationalAdjustmentsDimension.php
  96. 43 0
      common/models/OperationalAdjustmentsRelateToRulesPoints.php
  97. 43 0
      common/models/OperationalAdjustmentsRelateToSourceData.php
  98. 60 0
      common/models/Rules.php
  99. 53 0
      common/models/RulesPoints.php
  100. 43 0
      common/models/SearchConfig.php

+ 3 - 0
.bowerrc

@@ -0,0 +1,3 @@
+{
+    "directory" : "vendor/bower-asset"
+}

+ 39 - 0
.gitignore

@@ -0,0 +1,39 @@
+# phpstorm project files
+.idea
+
+# netbeans project files
+nbproject
+
+# zend studio for eclipse project files
+.buildpath
+.project
+.settings
+
+# windows thumbnail cache
+Thumbs.db
+
+# composer itself is not needed
+composer.phar
+
+# Mac DS_Store Files
+.DS_Store
+
+# phpunit itself is not needed
+phpunit.phar
+# local phpunit config
+/phpunit.xml
+
+# vagrant runtime
+/.vagrant
+
+# 自定义
+*.data
+*.bin
+*.log
+
+/frontend/runtime/logs
+/frontend/web/*.htaccess
+
+
+/frontend/runtime
+/frontend/runtime/.gitignore

+ 29 - 0
LICENSE.md

@@ -0,0 +1,29 @@
+Copyright © 2008 by Yii Software LLC (http://www.yiisoft.com)
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+ * Redistributions of source code must retain the above copyright
+   notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+   notice, this list of conditions and the following disclaimer in
+   the documentation and/or other materials provided with the
+   distribution.
+ * Neither the name of Yii Software LLC nor the names of its
+   contributors may be used to endorse or promote products derived
+   from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.

+ 4 - 1
README.md

@@ -1,2 +1,5 @@
-# case_class_server
+# demo-server
 
+./configure --prefix=/usr/local/ffmpeg/ --enable-gpl --enable-libx264 --enable-libmp3lame
+ffmpeg -i 111.wmv -c:v libx264 2.mp4
+ffmpeg -i input.file -codec:a libmp3lame output.mp3

+ 88 - 0
Vagrantfile

@@ -0,0 +1,88 @@
+require 'yaml'
+require 'fileutils'
+
+required_plugins_installed = nil
+required_plugins = %w( vagrant-hostmanager vagrant-vbguest )
+required_plugins.each do |plugin|
+  unless Vagrant.has_plugin? plugin
+    system "vagrant plugin install #{plugin}"
+    required_plugins_installed = true
+  end
+end
+
+# IF plugin[s] was just installed - restart required
+if required_plugins_installed
+  # Get CLI command[s] and call again
+  system 'vagrant' + ARGV.to_s.gsub(/\[\"|\", \"|\"\]/, ' ')
+  exit
+end
+
+domains = {
+  frontend: 'y2aa-frontend.test',
+  backend:  'y2aa-backend.test'
+}
+
+config = {
+  local: './vagrant/config/vagrant-local.yml',
+  example: './vagrant/config/vagrant-local.example.yml'
+}
+
+# copy config from example if local config not exists
+FileUtils.cp config[:example], config[:local] unless File.exist?(config[:local])
+# read config
+options = YAML.load_file config[:local]
+
+# check github token
+if options['github_token'].nil? || options['github_token'].to_s.length != 40
+  puts "You must place REAL GitHub token into configuration:\n/yii2-app-advanced/vagrant/config/vagrant-local.yml"
+  exit
+end
+
+# vagrant configurate
+Vagrant.configure(2) do |config|
+  # select the box
+  config.vm.box = 'bento/ubuntu-18.04'
+
+  # should we ask about box updates?
+  config.vm.box_check_update = options['box_check_update']
+
+  config.vm.provider 'virtualbox' do |vb|
+    # machine cpus count
+    vb.cpus = options['cpus']
+    # machine memory size
+    vb.memory = options['memory']
+    # machine name (for VirtualBox UI)
+    vb.name = options['machine_name']
+  end
+
+  # machine name (for vagrant console)
+  config.vm.define options['machine_name']
+
+  # machine name (for guest machine console)
+  config.vm.hostname = options['machine_name']
+
+  # network settings
+  config.vm.network 'private_network', ip: options['ip']
+
+  # sync: folder 'yii2-app-advanced' (host machine) -> folder '/app' (guest machine)
+  config.vm.synced_folder './', '/app', owner: 'vagrant', group: 'vagrant'
+
+  # disable folder '/vagrant' (guest machine)
+  config.vm.synced_folder '.', '/vagrant', disabled: true
+
+  # hosts settings (host machine)
+  config.vm.provision :hostmanager
+  config.hostmanager.enabled            = true
+  config.hostmanager.manage_host        = true
+  config.hostmanager.ignore_private_ip  = false
+  config.hostmanager.include_offline    = true
+  config.hostmanager.aliases            = domains.values
+
+  # provisioners
+  config.vm.provision 'shell', path: './vagrant/provision/once-as-root.sh', args: [options['timezone'], options['ip']]
+  config.vm.provision 'shell', path: './vagrant/provision/once-as-vagrant.sh', args: [options['github_token']], privileged: false
+  config.vm.provision 'shell', path: './vagrant/provision/always-as-root.sh', run: 'always'
+
+  # post-install message (vagrant console)
+  config.vm.post_up_message = "Frontend URL: http://#{domains[:frontend]}\nBackend URL: http://#{domains[:backend]}"
+end

+ 4 - 0
backend/Dockerfile

@@ -0,0 +1,4 @@
+FROM yiisoftware/yii2-php:7.4-apache
+
+# Change document root for Apache
+RUN sed -i -e 's|/app/web|/app/backend/web|g' /etc/apache2/sites-available/000-default.conf

+ 23 - 0
backend/assets/AppAsset.php

@@ -0,0 +1,23 @@
+<?php
+
+namespace backend\assets;
+
+use yii\web\AssetBundle;
+
+/**
+ * Main backend application asset bundle.
+ */
+class AppAsset extends AssetBundle
+{
+    public $basePath = '@webroot';
+    public $baseUrl = '@web';
+    public $css = [
+        'css/site.css',
+    ];
+    public $js = [
+    ];
+    public $depends = [
+        'yii\web\YiiAsset',
+        'yii\bootstrap4\BootstrapAsset',
+    ];
+}

+ 15 - 0
backend/codeception.yml

@@ -0,0 +1,15 @@
+namespace: backend\tests
+actor_suffix: Tester
+paths:
+    tests: tests
+    output: tests/_output
+    data: tests/_data
+    support: tests/_support
+bootstrap: _bootstrap.php
+settings:
+    colors: true
+    memory_limit: 1024M
+modules:
+    config:
+        Yii2:
+            configFile: 'config/codeception-local.php'

+ 4 - 0
backend/config/.gitignore

@@ -0,0 +1,4 @@
+#codeception-local.php
+#main-local.php
+#params-local.php
+#test-local.php

+ 1 - 0
backend/config/bootstrap.php

@@ -0,0 +1 @@
+<?php

+ 11 - 0
backend/config/codeception-local.php

@@ -0,0 +1,11 @@
+<?php
+
+return yii\helpers\ArrayHelper::merge(
+    require dirname(dirname(__DIR__)) . '/common/config/codeception-local.php',
+    require __DIR__ . '/main.php',
+    require __DIR__ . '/main-local.php',
+    require __DIR__ . '/test.php',
+    require __DIR__ . '/test-local.php',
+    [
+    ]
+);

+ 25 - 0
backend/config/main-local.php

@@ -0,0 +1,25 @@
+<?php
+
+$config = [
+    'components' => [
+        'request' => [
+            // !!! insert a secret key in the following (if it is empty) - this is required by cookie validation
+            'cookieValidationKey' => '-aHOCZmyDHLvTfIfhQTHYC5oC-G5_9gy',
+        ],
+    ],
+];
+
+if (!YII_ENV_TEST) {
+    // configuration adjustments for 'dev' environment
+    $config['bootstrap'][] = 'debug';
+    $config['modules']['debug'] = [
+        'class' => 'yii\debug\Module',
+    ];
+
+    $config['bootstrap'][] = 'gii';
+    $config['modules']['gii'] = [
+        'class' => 'yii\gii\Module',
+    ];
+}
+
+return $config;

+ 48 - 0
backend/config/main.php

@@ -0,0 +1,48 @@
+<?php
+$params = array_merge(
+    require __DIR__ . '/../../common/config/params.php',
+    require __DIR__ . '/../../common/config/params-local.php',
+    require __DIR__ . '/params.php',
+    require __DIR__ . '/params-local.php'
+);
+
+return [
+    'id' => 'app-backend',
+    'basePath' => dirname(__DIR__),
+    'controllerNamespace' => 'backend\controllers',
+    'bootstrap' => ['log'],
+    'modules' => [],
+    'components' => [
+        'request' => [
+            'csrfParam' => '_csrf-backend',
+        ],
+        'user' => [
+            'identityClass' => 'common\models\User',
+            'enableAutoLogin' => true,
+            'identityCookie' => ['name' => '_identity-backend', 'httpOnly' => true],
+        ],
+        'session' => [
+            // this is the name of the session cookie used for login on the backend
+            'name' => 'advanced-backend',
+        ],
+        'log' => [
+            'traceLevel' => YII_DEBUG ? 3 : 0,
+            'targets' => [
+                [
+                    'class' => 'yii\log\FileTarget',
+                    'levels' => ['error', 'warning'],
+                ],
+            ],
+        ],
+        'errorHandler' => [
+            'errorAction' => 'site/error',
+        ],
+        'urlManager' => [
+            'enablePrettyUrl' => true,
+            'showScriptName' => false,
+            'rules' => [
+            ],
+        ],
+    ],
+    'params' => $params,
+];

+ 4 - 0
backend/config/params-local.php

@@ -0,0 +1,4 @@
+<?php
+
+return [
+];

+ 4 - 0
backend/config/params.php

@@ -0,0 +1,4 @@
+<?php
+return [
+    'adminEmail' => 'admin@example.com',
+];

+ 4 - 0
backend/config/test-local.php

@@ -0,0 +1,4 @@
+<?php
+
+return [
+];

+ 15 - 0
backend/config/test.php

@@ -0,0 +1,15 @@
+<?php
+return [
+    'id' => 'app-backend-tests',
+    'components' => [
+        'assetManager' => [
+            'basePath' => __DIR__ . '/../web/assets',
+        ],
+        'urlManager' => [
+            'showScriptName' => true,
+        ],
+        'request' => [
+            'cookieValidationKey' => 'test',
+        ],
+    ],
+];

+ 104 - 0
backend/controllers/SiteController.php

@@ -0,0 +1,104 @@
+<?php
+
+namespace backend\controllers;
+
+use common\models\LoginForm;
+use Yii;
+use yii\filters\VerbFilter;
+use yii\filters\AccessControl;
+use yii\web\Controller;
+use yii\web\Response;
+
+/**
+ * Site controller
+ */
+class SiteController extends Controller
+{
+    /**
+     * {@inheritdoc}
+     */
+    public function behaviors()
+    {
+        return [
+            'access' => [
+                'class' => AccessControl::className(),
+                'rules' => [
+                    [
+                        'actions' => ['login', 'error'],
+                        'allow' => true,
+                    ],
+                    [
+                        'actions' => ['logout', 'index'],
+                        'allow' => true,
+                        'roles' => ['@'],
+                    ],
+                ],
+            ],
+            'verbs' => [
+                'class' => VerbFilter::className(),
+                'actions' => [
+                    'logout' => ['post'],
+                ],
+            ],
+        ];
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function actions()
+    {
+        return [
+            'error' => [
+                'class' => 'yii\web\ErrorAction',
+            ],
+        ];
+    }
+
+    /**
+     * Displays homepage.
+     *
+     * @return string
+     */
+    public function actionIndex()
+    {
+        return $this->render('index');
+    }
+
+    /**
+     * Login action.
+     *
+     * @return string|Response
+     */
+    public function actionLogin()
+    {
+        if (!Yii::$app->user->isGuest) {
+            return $this->goHome();
+        }
+
+        $this->layout = 'blank';
+
+        $model = new LoginForm();
+        if ($model->load(Yii::$app->request->post()) && $model->login()) {
+            return $this->goBack();
+        }
+
+        $model->password = '';
+
+        return $this->render('login', [
+            'model' => $model,
+        ]);
+    }
+
+    /**
+     * Logout action.
+     *
+     * @return Response
+     */
+    public function actionLogout()
+    {
+        Yii::$app->user->logout();
+
+        return $this->goHome();
+    }
+}

+ 1 - 0
backend/models/.gitkeep

@@ -0,0 +1 @@
+*

+ 2 - 0
backend/runtime/.gitignore

@@ -0,0 +1,2 @@
+*
+!.gitignore

+ 10 - 0
backend/tests/_bootstrap.php

@@ -0,0 +1,10 @@
+<?php
+
+defined('YII_DEBUG') or define('YII_DEBUG', true);
+defined('YII_ENV') or define('YII_ENV', 'test');
+defined('YII_APP_BASE_PATH') or define('YII_APP_BASE_PATH', __DIR__.'/../../');
+
+require_once YII_APP_BASE_PATH . '/vendor/autoload.php';
+require_once YII_APP_BASE_PATH . '/vendor/yiisoft/yii2/Yii.php';
+require_once YII_APP_BASE_PATH . '/common/config/bootstrap.php';
+require_once __DIR__ . '/../config/bootstrap.php';

+ 0 - 0
backend/tests/_data/.gitignore


+ 13 - 0
backend/tests/_data/login_data.php

@@ -0,0 +1,13 @@
+<?php
+return [
+    [
+        'username' => 'erau',
+        'auth_key' => 'tUu1qHcde0diwUol3xeI-18MuHkkprQI',
+        // password_0
+        'password_hash' => '$2y$13$nJ1WDlBaGcbCdbNC5.5l4.sgy.OMEKCqtDQOdQ2OWpgiKRWYyzzne',
+        'password_reset_token' => 'RkD_Jw0_8HEedzLk7MM-ZKEFfYR7VbMr_1392559490',
+        'created_at' => '1392559490',
+        'updated_at' => '1392559490',
+        'email' => 'sfriesen@jenkins.info',
+    ],
+];

+ 2 - 0
backend/tests/_output/.gitignore

@@ -0,0 +1,2 @@
+*
+!.gitignore

+ 1 - 0
backend/tests/_support/.gitignore

@@ -0,0 +1 @@
+_generated

+ 26 - 0
backend/tests/_support/FunctionalTester.php

@@ -0,0 +1,26 @@
+<?php
+
+namespace backend\tests;
+
+/**
+ * Inherited Methods
+ * @method void wantToTest($text)
+ * @method void wantTo($text)
+ * @method void execute($callable)
+ * @method void expectTo($prediction)
+ * @method void expect($prediction)
+ * @method void amGoingTo($argumentation)
+ * @method void am($role)
+ * @method void lookForwardTo($achieveValue)
+ * @method void comment($description)
+ * @method \Codeception\Lib\Friend haveFriend($name, $actorClass = NULL)
+ *
+ * @SuppressWarnings(PHPMD)
+ */
+class FunctionalTester extends \Codeception\Actor
+{
+    use _generated\FunctionalTesterActions;
+   /**
+    * Define custom actions here
+    */
+}

+ 26 - 0
backend/tests/_support/UnitTester.php

@@ -0,0 +1,26 @@
+<?php
+
+namespace backend\tests;
+
+/**
+ * Inherited Methods
+ * @method void wantToTest($text)
+ * @method void wantTo($text)
+ * @method void execute($callable)
+ * @method void expectTo($prediction)
+ * @method void expect($prediction)
+ * @method void amGoingTo($argumentation)
+ * @method void am($role)
+ * @method void lookForwardTo($achieveValue)
+ * @method void comment($description)
+ * @method \Codeception\Lib\Friend haveFriend($name, $actorClass = NULL)
+ *
+ * @SuppressWarnings(PHPMD)
+ */
+class UnitTester extends \Codeception\Actor
+{
+    use _generated\UnitTesterActions;
+   /**
+    * Define custom actions here
+    */
+}

+ 5 - 0
backend/tests/functional.suite.yml

@@ -0,0 +1,5 @@
+suite_namespace: backend\tests\functional
+actor: FunctionalTester
+modules:
+    enabled:
+        - Yii2

+ 44 - 0
backend/tests/functional/LoginCest.php

@@ -0,0 +1,44 @@
+<?php
+
+namespace backend\tests\functional;
+
+use backend\tests\FunctionalTester;
+use common\fixtures\UserFixture;
+
+/**
+ * Class LoginCest
+ */
+class LoginCest
+{
+    /**
+     * Load fixtures before db transaction begin
+     * Called in _before()
+     * @see \Codeception\Module\Yii2::_before()
+     * @see \Codeception\Module\Yii2::loadFixtures()
+     * @return array
+     */
+    public function _fixtures()
+    {
+        return [
+            'user' => [
+                'class' => UserFixture::className(),
+                'dataFile' => codecept_data_dir() . 'login_data.php'
+            ]
+        ];
+    }
+    
+    /**
+     * @param FunctionalTester $I
+     */
+    public function loginUser(FunctionalTester $I)
+    {
+        $I->amOnPage('/site/login');
+        $I->fillField('Username', 'erau');
+        $I->fillField('Password', 'password_0');
+        $I->click('login-button');
+
+        $I->see('Logout (erau)', 'form button[type=submit]');
+        $I->dontSeeLink('Login');
+        $I->dontSeeLink('Signup');
+    }
+}

+ 16 - 0
backend/tests/functional/_bootstrap.php

@@ -0,0 +1,16 @@
+<?php
+/**
+ * Here you can initialize variables via \Codeception\Util\Fixtures class
+ * to store data in global array and use it in Cests.
+ *
+ * ```php
+ * // Here _bootstrap.php
+ * \Codeception\Util\Fixtures::add('user1', ['name' => 'davert']);
+ * ```
+ *
+ * In Cests
+ *
+ * ```php
+ * \Codeception\Util\Fixtures::get('user1');
+ * ```
+ */

+ 2 - 0
backend/tests/unit.suite.yml

@@ -0,0 +1,2 @@
+suite_namespace: backend\tests\unit
+actor: UnitTester

+ 16 - 0
backend/tests/unit/_bootstrap.php

@@ -0,0 +1,16 @@
+<?php
+/**
+ * Here you can initialize variables via \Codeception\Util\Fixtures class
+ * to store data in global array and use it in Tests.
+ *
+ * ```php
+ * // Here _bootstrap.php
+ * \Codeception\Util\Fixtures::add('user1', ['name' => 'davert']);
+ * ```
+ *
+ * In Tests
+ *
+ * ```php
+ * \Codeception\Util\Fixtures::get('user1');
+ * ```
+ */

+ 33 - 0
backend/views/layouts/blank.php

@@ -0,0 +1,33 @@
+<?php
+
+/** @var yii\web\View $this */
+/** @var string $content */
+
+use backend\assets\AppAsset;
+use yii\helpers\Html;
+
+AppAsset::register($this);
+?>
+<?php $this->beginPage() ?>
+<!DOCTYPE html>
+<html lang="<?= Yii::$app->language ?>" class="h-100">
+<head>
+    <meta charset="<?= Yii::$app->charset ?>">
+    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
+    <?php $this->registerCsrfMetaTags() ?>
+    <title><?= Html::encode($this->title) ?></title>
+    <?php $this->head() ?>
+</head>
+<body class="d-flex flex-column h-100">
+<?php $this->beginBody() ?>
+
+<main role="main">
+    <div class="container">
+        <?= $content ?>
+    </div>
+</main>
+
+<?php $this->endBody() ?>
+</body>
+</html>
+<?php $this->endPage();

+ 80 - 0
backend/views/layouts/main.php

@@ -0,0 +1,80 @@
+<?php
+
+/** @var \yii\web\View $this */
+/** @var string $content */
+
+use backend\assets\AppAsset;
+use common\widgets\Alert;
+use yii\bootstrap4\Breadcrumbs;
+use yii\bootstrap4\Html;
+use yii\bootstrap4\Nav;
+use yii\bootstrap4\NavBar;
+
+AppAsset::register($this);
+?>
+<?php $this->beginPage() ?>
+<!DOCTYPE html>
+<html lang="<?= Yii::$app->language ?>" class="h-100">
+<head>
+    <meta charset="<?= Yii::$app->charset ?>">
+    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
+    <?php $this->registerCsrfMetaTags() ?>
+    <title><?= Html::encode($this->title) ?></title>
+    <?php $this->head() ?>
+</head>
+<body class="d-flex flex-column h-100">
+<?php $this->beginBody() ?>
+
+<header>
+    <?php
+    NavBar::begin([
+        'brandLabel' => Yii::$app->name,
+        'brandUrl' => Yii::$app->homeUrl,
+        'options' => [
+            'class' => 'navbar navbar-expand-md navbar-dark bg-dark fixed-top',
+        ],
+    ]);
+    $menuItems = [
+        ['label' => 'Home', 'url' => ['/site/index']],
+    ];
+    if (Yii::$app->user->isGuest) {
+        $menuItems[] = ['label' => 'Login', 'url' => ['/site/login']];
+    } else {
+        $menuItems[] = '<li>'
+            . Html::beginForm(['/site/logout'], 'post', ['class' => 'form-inline'])
+            . Html::submitButton(
+                'Logout (' . Yii::$app->user->identity->username . ')',
+                ['class' => 'btn btn-link logout']
+            )
+            . Html::endForm()
+            . '</li>';
+    }
+    echo Nav::widget([
+        'options' => ['class' => 'navbar-nav'],
+        'items' => $menuItems,
+    ]);
+    NavBar::end();
+    ?>
+</header>
+
+<main role="main" class="flex-shrink-0">
+    <div class="container">
+        <?= Breadcrumbs::widget([
+            'links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : [],
+        ]) ?>
+        <?= Alert::widget() ?>
+        <?= $content ?>
+    </div>
+</main>
+
+<footer class="footer mt-auto py-3 text-muted">
+    <div class="container">
+        <p class="float-left">&copy; <?= Html::encode(Yii::$app->name) ?> <?= date('Y') ?></p>
+        <p class="float-right"><?= Yii::powered() ?></p>
+    </div>
+</footer>
+
+<?php $this->endBody() ?>
+</body>
+</html>
+<?php $this->endPage();

+ 27 - 0
backend/views/site/error.php

@@ -0,0 +1,27 @@
+<?php
+
+/** @var yii\web\View $this */
+/** @var string $name */
+/** @var string $message */
+/** @var Exception $exception*/
+
+use yii\helpers\Html;
+
+$this->title = $name;
+?>
+<div class="site-error">
+
+    <h1><?= Html::encode($this->title) ?></h1>
+
+    <div class="alert alert-danger">
+        <?= nl2br(Html::encode($message)) ?>
+    </div>
+
+    <p>
+        The above error occurred while the Web server was processing your request.
+    </p>
+    <p>
+        Please contact us if you think this is a server error. Thank you.
+    </p>
+
+</div>

+ 53 - 0
backend/views/site/index.php

@@ -0,0 +1,53 @@
+<?php
+
+/** @var yii\web\View $this */
+
+$this->title = 'My Yii Application';
+?>
+<div class="site-index">
+
+    <div class="jumbotron text-center bg-transparent">
+        <h1 class="display-4">Congratulations!</h1>
+
+        <p class="lead">You have successfully created your Yii-powered application.</p>
+
+        <p><a class="btn btn-lg btn-success" href="http://www.yiiframework.com">Get started with Yii</a></p>
+    </div>
+
+    <div class="body-content">
+
+        <div class="row">
+            <div class="col-lg-4">
+                <h2>Heading</h2>
+
+                <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et
+                    dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip
+                    ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu
+                    fugiat nulla pariatur.</p>
+
+                <p><a class="btn btn-outline-secondary" href="http://www.yiiframework.com/doc/">Yii Documentation &raquo;</a></p>
+            </div>
+            <div class="col-lg-4">
+                <h2>Heading</h2>
+
+                <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et
+                    dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip
+                    ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu
+                    fugiat nulla pariatur.</p>
+
+                <p><a class="btn btn-outline-secondary" href="http://www.yiiframework.com/forum/">Yii Forum &raquo;</a></p>
+            </div>
+            <div class="col-lg-4">
+                <h2>Heading</h2>
+
+                <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et
+                    dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip
+                    ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu
+                    fugiat nulla pariatur.</p>
+
+                <p><a class="btn btn-outline-secondary" href="http://www.yiiframework.com/extensions/">Yii Extensions &raquo;</a></p>
+            </div>
+        </div>
+
+    </div>
+</div>

+ 32 - 0
backend/views/site/login.php

@@ -0,0 +1,32 @@
+<?php
+
+/** @var yii\web\View $this */
+/** @var yii\bootstrap4\ActiveForm $form */
+/** @var \common\models\LoginForm $model */
+
+use yii\bootstrap4\ActiveForm;
+use yii\bootstrap4\Html;
+
+$this->title = 'Login';
+?>
+<div class="site-login">
+    <div class="mt-5 offset-lg-3 col-lg-6">
+        <h1><?= Html::encode($this->title) ?></h1>
+
+        <p>Please fill out the following fields to login:</p>
+
+        <?php $form = ActiveForm::begin(['id' => 'login-form']); ?>
+
+            <?= $form->field($model, 'username')->textInput(['autofocus' => true]) ?>
+
+            <?= $form->field($model, 'password')->passwordInput() ?>
+
+            <?= $form->field($model, 'rememberMe')->checkbox() ?>
+
+            <div class="form-group">
+                <?= Html::submitButton('Login', ['class' => 'btn btn-primary btn-block', 'name' => 'login-button']) ?>
+            </div>
+
+        <?php ActiveForm::end(); ?>
+    </div>
+</div>

+ 2 - 0
backend/web/assets/.gitignore

@@ -0,0 +1,2 @@
+*
+!.gitignore

+ 90 - 0
backend/web/css/site.css

@@ -0,0 +1,90 @@
+main > .container {
+    padding: 70px 15px 20px;
+}
+
+.footer {
+    background-color: #f5f5f5;
+    font-size: .9em;
+    height: 60px;
+}
+
+.footer > .container {
+    padding-right: 15px;
+    padding-left: 15px;
+}
+
+.not-set {
+    color: #c55;
+    font-style: italic;
+}
+
+/* add sorting icons to gridview sort links */
+a.asc:after, a.desc:after {
+    content: '';
+    left: 3px;
+    display: inline-block;
+    width: 0;
+    height: 0;
+    border: solid 5px transparent;
+    margin: 4px 4px 2px 4px;
+    background: transparent;
+}
+
+a.asc:after {
+    border-bottom: solid 7px #212529;
+    border-top-width: 0;
+}
+
+a.desc:after {
+    border-top: solid 7px #212529;
+    border-bottom-width: 0;
+}
+
+.grid-view th,
+.grid-view td:last-child {
+    white-space: nowrap;
+}
+
+.grid-view .filters input,
+.grid-view .filters select {
+    min-width: 50px;
+}
+
+.hint-block {
+    display: block;
+    margin-top: 5px;
+    color: #999;
+}
+
+.error-summary {
+    color: #a94442;
+    background: #fdf7f7;
+    border-left: 3px solid #eed3d7;
+    padding: 10px 20px;
+    margin: 0 0 15px 0;
+}
+
+/* align the logout "link" (button in form) of the navbar */
+.nav li > form > button.logout {
+    padding-top: 7px;
+    color: rgba(255, 255, 255, 0.5);
+}
+
+@media(max-width:767px) {
+    .nav li > form > button.logout {
+        display:block;
+        text-align: left;
+        width: 100%;
+        padding: 10px 0;
+    }
+}
+
+.nav > li > form > button.logout:focus,
+.nav > li > form > button.logout:hover {
+    text-decoration: none;
+    color: rgba(255, 255, 255, 0.75);
+}
+
+.nav > li > form > button.logout:focus {
+    outline: none;
+}

BIN
backend/web/favicon.ico


+ 27 - 0
backend/web/index-test.php

@@ -0,0 +1,27 @@
+<?php
+
+// NOTE: Make sure this file is not accessible when deployed to production
+if (!in_array(@$_SERVER['REMOTE_ADDR'], ['127.0.0.1', '::1'])) {
+    die('You are not allowed to access this file.');
+}
+
+defined('YII_DEBUG') or define('YII_DEBUG', true);
+defined('YII_ENV') or define('YII_ENV', 'test');
+
+require __DIR__ . '/../../vendor/autoload.php';
+require __DIR__ . '/../../vendor/yiisoft/yii2/Yii.php';
+require __DIR__ . '/../../common/config/bootstrap.php';
+require __DIR__ . '/../config/bootstrap.php';
+
+$config = yii\helpers\ArrayHelper::merge(
+    require __DIR__ . '/../../common/config/main.php',
+    require __DIR__ . '/../../common/config/main-local.php',
+    require __DIR__ . '/../../common/config/test.php',
+    require __DIR__ . '/../../common/config/test-local.php',
+    require __DIR__ . '/../config/main.php',
+    require __DIR__ . '/../config/main-local.php',
+    require __DIR__ . '/../config/test.php',
+    require __DIR__ . '/../config/test-local.php'
+);
+
+(new yii\web\Application($config))->run();

+ 18 - 0
backend/web/index.php

@@ -0,0 +1,18 @@
+<?php
+
+defined('YII_DEBUG') or define('YII_DEBUG', true);
+defined('YII_ENV') or define('YII_ENV', 'dev');
+
+require __DIR__ . '/../../vendor/autoload.php';
+require __DIR__ . '/../../vendor/yiisoft/yii2/Yii.php';
+require __DIR__ . '/../../common/config/bootstrap.php';
+require __DIR__ . '/../config/bootstrap.php';
+
+$config = yii\helpers\ArrayHelper::merge(
+    require __DIR__ . '/../../common/config/main.php',
+    require __DIR__ . '/../../common/config/main-local.php',
+    require __DIR__ . '/../config/main.php',
+    require __DIR__ . '/../config/main-local.php'
+);
+
+(new yii\web\Application($config))->run();

+ 2 - 0
backend/web/robots.txt

@@ -0,0 +1,2 @@
+User-agent: *
+Disallow: /

+ 9 - 0
codeception.yml

@@ -0,0 +1,9 @@
+# global codeception file to run tests from all apps
+include:
+    - common
+    - frontend
+    - backend
+paths:
+    log: console/runtime/logs
+settings:
+    colors: true

+ 15 - 0
common/codeception.yml

@@ -0,0 +1,15 @@
+namespace: common\tests
+actor_suffix: Tester
+paths:
+    tests: tests
+    output: tests/_output
+    data: tests/_data
+    support: tests/_support
+bootstrap: _bootstrap.php
+settings:
+    colors: true
+    memory_limit: 1024M
+modules:
+    config:
+        Yii2:
+            configFile: 'config/codeception-local.php'

+ 47 - 0
common/components/AjaxErrorHandler.php

@@ -0,0 +1,47 @@
+<?php
+
+namespace common\components;
+
+use Yii;
+use yii\web\ErrorHandler;
+use yii\web\Response;
+
+class AjaxErrorHandler extends ErrorHandler
+{
+
+    /**
+     * @param $exception
+     * @return void
+     */
+    protected function renderException($exception)
+    {
+        if (Yii::$app->has('response')) {
+            $response = Yii::$app->getResponse();
+            $response->isSent = false;
+        } else {
+            $response = new Response();
+        }
+        $response->format = Response::FORMAT_JSON;
+        $error_code = $exception->getCode();
+        if ($exception->getCode() == 0) {
+            $error_code = 1;
+        }
+        if ($exception instanceof AjaxException) {
+            $msg = $exception->getMessage();
+        } else {
+            error_log($exception->getMessage());
+            error_log($exception->getTraceAsString());
+            $msg = "系统繁忙请稍后重试";
+            var_dump($exception->getMessage());
+            var_dump($exception->getTraceAsString());
+            exit;
+        }
+        $response->data = [
+            'r' => $error_code,
+            'msg' => $msg
+        ];
+        $response->setStatusCode(200);
+        $response->send();
+    }
+
+}

+ 19 - 0
common/components/AjaxException.php

@@ -0,0 +1,19 @@
+<?php
+namespace common\components;
+use Yii;
+
+class AjaxException extends Exception
+{
+
+    public function __construct($message = '', $code = 1)
+    {
+        Yii::error('code:' . $code . ',message:' . $message);
+        parent::__construct($code, $message);
+    }
+
+    public static function getInstance($code = 1, $message = '')
+    {
+        return new AjaxException($code, $message);
+    }
+
+}

+ 278 - 0
common/components/BaseAjaxController.php

@@ -0,0 +1,278 @@
+<?php
+
+namespace common\components;
+
+use common\services\AdminLogService;
+use common\util\ActiveRecordHelper;
+use frontend\modules\api\components\BaseAdminController;
+use Yii;
+use yii\base\InvalidConfigException;
+use yii\helpers\ArrayHelper;
+use yii\web\Controller;
+use yii\db\ActiveQuery;
+use yii\db\ActiveRecord;
+
+class BaseAjaxController extends Controller
+{
+    use ActiveRecordHelper;
+
+    public $enableCsrfValidation = false;
+
+    public function runAction($id, $params = [])
+    {
+        $params = ArrayHelper::merge(Yii::$app->request->post(), $params);
+        if ($this instanceof BaseAdminController) {
+            //update
+            $url = substr(Yii::$app->controller->getRoute() . "/" . $id, strlen($this->module->id));
+            $adminLog = AdminLogService::saveLog($this->userInfo, $url, $params);
+            if (in_array($url, AdminLogService::$staffTitle)) {
+                if ($adminLog) {
+                    $_GET['adminLogId'] = $adminLog->id;
+                    $_GET['adminLogModel'] = $adminLog;
+                }
+            }
+        }
+        return parent::runAction($id, $params);
+    }
+
+    public function asJson($data = [], $r = 0, $msg = "成功")
+    {
+        if ($r !== 0) {
+            $resultData['r'] = 1;
+        } else {
+            $resultData['r'] = 0;
+        }
+        if ($msg !== "成功") {
+            $resultData['msg'] = $msg;
+        } else {
+            $resultData['msg'] = "成功";
+        }
+        $resultData['data'] = $data;
+        return parent::asJson($resultData);
+    }
+
+    /**
+     * 从Get参数里增加检索条件
+     */
+    public function addJoinConditionToQuery($name, $getName, $notEqual, ActiveQuery $query, $isLike = true)
+    {
+        if (isset($_GET[$getName]) && $_GET[$getName] != $notEqual) {
+            if ($isLike) {
+                $query = $query->andWhere(["like", $name, $_GET[$getName]]);
+            } else {
+                $query = $query->andWhere([$name => $_GET[$getName]]);
+            }
+        }
+        return $query;
+    }
+
+    public function addArrayConditionToQuery($name, ActiveQuery $query, $unionArray = [])
+    {
+        if ($unionArray != []) {
+            $query = $query->andWhere([$name => $unionArray]);
+        }
+        return $query;
+    }
+
+    /**
+     * @param $name
+     * @param ActiveQuery $query
+     * @param bool $isLike
+     * @return ActiveQuery
+     */
+    public function addConditionToQuery($name, ActiveQuery $query, bool $isLike = false): ActiveQuery
+    {
+        $paramsValue = $this->getParams($name);
+        if ($paramsValue === null || $paramsValue === "") {
+            return $query;
+        }
+        if ($isLike) {
+            $query = $query->andWhere(["like", $name, $paramsValue]);
+        } else {
+            $query = $query->andWhere([$name => $paramsValue]);
+        }
+        return $query;
+    }
+
+    /**
+     * @param $name
+     * @param ActiveQuery $query
+     * @param bool $isLike
+     * @return ActiveQuery
+     * @throws InvalidConfigException
+     */
+    public function addConditionToQueryNew($name, $paramName, ActiveQuery $query, bool $isLike = false): ActiveQuery
+    {
+        $paramsValue = $this->getParams($paramName);
+        if ($paramsValue === null || $paramsValue === "") {
+            return $query;
+        }
+        if ($isLike) {
+            $query = $query->andWhere(["like", $name, $paramsValue]);
+        } else {
+            $query = $query->andWhere([$name => $paramsValue]);
+        }
+        return $query;
+    }
+
+    /**
+     * 从Get和Post参数里增加检索条件
+     * @param $name
+     * @param ActiveQuery $query
+     * @param bool $timestamp
+     * @param array $values
+     * @return ActiveQuery
+     * @throws InvalidConfigException
+     */
+    public function addStartEndConditionToQueryNew($name, $paramName, ActiveQuery $query, bool $timestamp = false, array $values = []): ActiveQuery
+    {
+        $exist = true;
+        $array = [];
+        if ($values === []) {
+            $values = $this->getParams($paramName);
+        }
+        if (isset($values[0]) && isset($values[1])) {
+            $array = $values;
+        } else {
+            $exist = false;
+        }
+        if ($exist) {
+            if ($timestamp === true) {
+                $array[0] = strtotime($array[0]);
+                $array[1] = strtotime($array[1]);//替换掉
+            }
+            $query = $query->andWhere([">=", $name, $array[0]])->andWhere(["<=", $name, $array[1]]);
+        }
+        return $query;
+    }
+
+    /**
+     * 从Get和Post参数里增加检索条件
+     * @param $name
+     * @param ActiveQuery $query
+     * @param bool $timestamp
+     * @param array $values
+     * @return ActiveQuery
+     */
+    public function addStartEndConditionToQuery($name, ActiveQuery $query, bool $timestamp = false, array $values = []): ActiveQuery
+    {
+        $exist = true;
+        $array = [];
+        if ($values === []) {
+            $values = $this->getParams($name);
+        }
+        if (isset($values[0]) && isset($values[1])) {
+            $array = $values;
+        } else {
+            $exist = false;
+        }
+        if ($exist) {
+            if ($timestamp === true) {
+                $array[0] = strtotime($array[0]);
+                $array[1] = strtotime($array[1]);//替换掉
+            }
+            $query = $query->andWhere([">=", $name, $array[0]])->andWhere(["<=", $name, $array[1]]);
+        }
+        return $query;
+    }
+
+    public function log($info)
+    {
+        Yii::info($info, get_class($this));
+    }
+
+    public function returnError($msg, $r = -1)
+    {
+        return parent::asJson(['r' => $r, 'msg' => $msg, 'data' => []]);
+    }
+
+    /**
+     * 生成唯一字符串
+     * @return string
+     */
+    function uniqueNum(): string
+    {
+        return strtoupper(dechex(date('m'))) . date(
+                'd'
+            ) . substr(time(), -5) . substr(microtime(), 2, 5) . sprintf(
+                '%02d',
+                rand(111, 999)
+            );
+    }
+
+    /**
+     * 从Get参数里增加更新内容(单一)
+     */
+    public function addUpdateToModel(ActiveRecord $model, $name): void
+    {
+        $value = $this->getParams($name);
+        if ($value && $model->hasAttribute($name)) {
+            $model->setAttribute($name, $value);
+        }
+    }
+
+    /**
+     * @return string
+     */
+    public function getImageBasePath()
+    {
+        $http = $this->is_ssl() ? 'https://' : 'http://';
+
+        if (YII_ENV_DEV) {
+            $host = $_SERVER['HTTP_HOST'];
+        } else {
+            //案例库存储服务器
+            $host = "172.20.41.109:8080";
+        }
+        return $http . $host;
+    }
+
+    /**
+     * 判断是否SSL协议
+     * @return bool
+     */
+    public function is_ssl()
+    {
+        if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] = "https") {
+            return true;
+        } else if (isset($_SERVER['HTTPS']) && ('1' == $_SERVER['HTTPS'] || 'on' == strtolower($_SERVER['HTTPS']))) {
+            return true;
+        } elseif (isset($_SERVER['SERVER_PORT']) && ('443' == $_SERVER['SERVER_PORT'])) {
+            return true;
+        }
+        return false;
+    }
+
+    /**
+     * @param ActiveQuery $query
+     * @param string $orderBy
+     * @param string $sequenceKey
+     * @return void
+     */
+    public function initSequence(ActiveQuery $query, string $orderBy = "id desc", string $sequenceKey = "sequence"): void
+    {
+        $sequenceRaw = $this->getParams($sequenceKey);
+        if (!$sequenceRaw) {
+            $query->orderBy($orderBy);
+            return;
+        }
+        $sequence = is_array($sequenceRaw) ? $sequenceRaw : json_decode($sequenceRaw, true);
+        if (!is_null($sequence['prop'])) {
+            if (isset($sequence['order']) && $sequence['order'] == 'descending') {
+                $sort = 'desc';
+            } else {
+                $sort = 'asc';
+            }
+            if ($sequence['prop'] === "start_time" && $sort === "desc") {
+                $query->orderBy("start_time desc,id desc");
+            } else {
+                $query->orderBy("{$sequence['prop']} {$sort}");
+            }
+        } else {
+            if ($orderBy === "start_time desc") {
+                $orderBy = "start_time desc,id desc";
+            }
+            $query->orderBy($orderBy);
+        }
+    }
+}

+ 10 - 0
common/components/Exception.php

@@ -0,0 +1,10 @@
+<?php
+namespace common\components;
+
+class Exception extends \yii\base\Exception {
+    
+    public function __construct($code = 0, $message = '') {
+        parent::__construct($message, $code, null);
+    }
+
+}

+ 227 - 0
common/components/Routes.php

@@ -0,0 +1,227 @@
+<?php
+/**
+ * 获取所有路由
+ * @author xinnianq 2017-10-11
+ */
+namespace common\components;
+
+use Yii;
+
+class Routes {
+
+
+    /**
+     * Get list of application routes [获取应用的所有路由]
+     * @return array
+     */
+    public static function getAppRoutes($module = null)
+    {
+        if ($module === null) {
+            $module = Yii::$app;
+        } elseif (is_string($module)) {
+            $module = Yii::$app->getModule($module);
+        }
+        $key = [__METHOD__, $module->getUniqueId()];
+        // $cache = Configs::instance()->cache;
+//        if ($cache === null || ($result = $cache->get($key)) === false) {
+        $result = [];
+        self::getRouteRecrusive($module, $result);
+//            if ($cache !== null) {
+//                $cache->set($key, $result, Configs::instance()->cacheDuration, new TagDependency([
+//                    'tags' => self::CACHE_TAG,
+//                ]));
+//            }
+        // }
+
+        return $result;
+    }
+
+    /**
+     * 递归Get route(s)
+     * @param \yii\base\Module $module
+     * @param array $result
+     */
+    protected static function getRouteRecrusive($module, &$result)
+    {
+        $token = "Get Route of '" . get_class($module) . "' with id '" . $module->uniqueId . "'";
+        Yii::beginProfile($token, __METHOD__);
+        try {
+//            foreach ($module->getModules() as $id => $child) {
+//                if (($child = $module->getModule($id)) !== null) {
+//                    self::getRouteRecrusive($child, $result);
+//                }
+//            }
+
+            foreach ($module->controllerMap as $id => $type) {
+                self::getControllerActions($type, $id, $module, $result);
+            }
+
+            $namespace = trim($module->controllerNamespace, '\\') . '\\';
+            self::getControllerFiles($module, $namespace, '', $result);
+            //$all = '/' . ltrim($module->uniqueId . '/*', '/');  //###############################
+            //$result[$all] = $all;
+        } catch (\Exception $exc) {
+            Yii::error($exc->getMessage(), __METHOD__);
+        }
+        Yii::endProfile($token, __METHOD__);
+    }
+
+    /**
+     * Get list controller under module
+     * @param \yii\base\Module $module
+     * @param string $namespace
+     * @param string $prefix
+     * @param mixed $result
+     * @return mixed
+     */
+    protected static function getControllerFiles($module, $namespace, $prefix, &$result)
+    {
+        $path = Yii::getAlias('@' . str_replace('\\', '/', $namespace), false);
+        $token = "Get controllers from '$path'";
+        Yii::beginProfile($token, __METHOD__);
+        try {
+            if (!is_dir($path)) {
+                return;
+            }
+            foreach (scandir($path) as $file) {
+                if ($file == '.' || $file == '..') {
+                    continue;
+                }
+                if (is_dir($path . '/' . $file) && preg_match('%^[a-z0-9_/]+$%i', $file . '/')) {
+                    self::getControllerFiles($module, $namespace . $file . '\\', $prefix . $file . '/', $result);
+                } elseif (strcmp(substr($file, -14), 'Controller.php') === 0) {
+                    $baseName = substr(basename($file), 0, -14);
+                    $name = strtolower(preg_replace('/(?<![A-Z])[A-Z]/', ' \0', $baseName));
+                    $id = ltrim(str_replace(' ', '-', $name), '-');
+                    $className = $namespace . $baseName . 'Controller';
+                    if (strpos($className, '-') === false && class_exists($className) && is_subclass_of($className, 'yii\base\Controller')) {
+                        self::getControllerActions($className, $prefix . $id, $module, $result);
+                    }
+                }
+            }
+        } catch (\Exception $exc) {
+            Yii::error($exc->getMessage(), __METHOD__);
+        }
+        Yii::endProfile($token, __METHOD__);
+    }
+
+
+    /**
+     * Get list action of controller 获取controller的action
+     * @param mixed $type
+     * @param string $id
+     * @param \yii\base\Module $module
+     * @param string $result
+     */
+    protected static function getControllerActions($type, $id, $module, &$result)
+    {
+        $token = "Create controller with cofig=" . \yii\helpers\VarDumper::dumpAsString($type) . " and id='$id'";
+        Yii::beginProfile($token, __METHOD__);
+        try {
+            /* @var $controller \yii\base\Controller */
+            $controller = Yii::createObject($type, [$id, $module]);
+            self::getActionRoutes($controller, $result);
+            //$all = "/{$controller->uniqueId}/*"; //#####################################################
+            //$result[$all] = $all;
+        } catch (\Exception $exc) {
+            Yii::error($exc->getMessage(), __METHOD__);
+        }
+        Yii::endProfile($token, __METHOD__);
+    }
+
+    /**
+     * Get route of action
+     * @param \yii\base\Controller $controller
+     * @param array $result all controller action.
+     */
+    protected static function getActionRoutes($controller, &$result)
+    {
+        $token = "Get actions of controller '" . $controller->uniqueId . "'";
+        Yii::beginProfile($token, __METHOD__);
+        try {
+            $prefix = '/' . $controller->uniqueId . '/';
+//            foreach ($controller->actions() as $id => $value) {
+//                //$result[$prefix . $id] = $prefix . $id; //###########################################
+//                $result[$controller->uniqueId][$prefix . $id][0] = $prefix . $id;
+//                $result[$controller->uniqueId][$prefix . $id][1] = '';
+//            }
+            $class = new \ReflectionClass($controller);
+
+            $result['/'.$controller->uniqueId.'/']['controllerDescription'] = self::getHelpSummary($controller); //控制器描述
+            foreach ($class->getMethods() as $method) {
+                $name = $method->getName();
+                if ($method->isPublic() && !$method->isStatic() && strpos($name, 'action') === 0 && $name !== 'actions') {
+                    $name = strtolower(preg_replace('/(?<![A-Z])[A-Z]/', ' \0', substr($name, 6)));
+                    $id = $prefix . ltrim(str_replace(' ', '-', $name), '-');
+                    //$result[$id] = $id; //####################################
+                    $result['/'.$controller->uniqueId.'/']['route'][$id][0] = $id;
+
+                    //获取方法描述开始#############
+                    $summary = self::getActionHelpSummary($controller,$controller->createAction(ltrim(str_replace(' ', '-', $name), '-')));
+                    $result['/'.$controller->uniqueId.'/']['route'][$id][1] = $summary;
+                    //获取方法描述结束#############
+                }
+            }
+        } catch (\Exception $exc) {
+            Yii::error($exc->getMessage().$exc->getLine().'##'.$exc->getCode().'@@', __METHOD__);
+        }
+        Yii::endProfile($token, __METHOD__);
+    }
+
+
+    /**
+     * 获取控制器描述
+     * Returns one-line short summary describing this controller.
+     *
+     * You may override this method to return customized summary.
+     * The default implementation returns first line from the PHPDoc comment.
+     *
+     * @return string
+     */
+    public static function getHelpSummary($controller)
+    {
+        return self::parseDocCommentSummary(new \ReflectionClass($controller));
+    }
+
+    //获取方法描述开始#############
+    /**
+     * Returns a one-line short summary describing the specified action.
+     * @param Action $action action to get summary for
+     * @return string a one-line short summary describing the specified action.
+     */
+    public static function getActionHelpSummary($controller,$action)
+    {
+        return self::parseDocCommentSummary(self::getActionMethodReflection($controller,$action));
+    }
+    /**
+     * @param Action $action
+     * @return \ReflectionMethod
+     */
+    protected static function getActionMethodReflection($controller,$action)
+    {
+        $_reflections = [];
+        if (!isset($_reflections[$action->id])) {
+            if ($action instanceof \yii\base\InlineAction) {
+                $_reflections[$action->id] = new \ReflectionMethod($controller, $action->actionMethod);
+            } else {
+                $_reflections[$action->id] = new \ReflectionMethod($action, 'run');
+            }
+        }
+        return $_reflections[$action->id];
+    }
+    /**
+     * Returns the first line of docblock.
+     *
+     * @param \Reflector $reflection
+     * @return string
+     */
+    protected static function parseDocCommentSummary($reflection)
+    {
+        $docLines = preg_split('~\R~u', $reflection->getDocComment());
+        if (isset($docLines[1])) {
+            return trim($docLines[1], "\t *");
+        }
+        return '';
+    }
+    //获取方法描述结束#############
+}

+ 42 - 0
common/components/Yii.php

@@ -0,0 +1,42 @@
+<?php
+
+/**
+ * Yii bootstrap file.
+ * Used for enhanced IDE code autocompletion.
+ */
+class Yii extends \yii\BaseYii
+{
+    /**
+     * @var BaseApplication|WebApplication|ConsoleApplication the application instance
+     */
+    public static $app;
+}
+
+/**
+ * Class BaseApplication
+ * Used for properties that are identical for both WebApplication and ConsoleApplication
+ *
+
+ * @property yii\redis\Connection $redis
+ */
+abstract class BaseApplication extends yii\base\Application
+{
+}
+
+/**
+ * Class WebApplication
+ * Include only Web application related components here
+ *
+ */
+class WebApplication extends yii\web\Application
+{
+}
+
+/**
+ * Class ConsoleApplication
+ * Include only Console application related components here
+ *
+ */
+class ConsoleApplication extends yii\console\Application
+{
+}

+ 4 - 0
common/config/.gitignore

@@ -0,0 +1,4 @@
+codeception-local.php
+main-local.php
+params-local.php
+test-local.php

+ 33 - 0
common/config/__autocomplete.php

@@ -0,0 +1,33 @@
+<?php
+
+/**
+ * This class only exists here for IDE (PHPStorm/Netbeans/...) autocompletion.
+ * This file is never included anywhere.
+ * Adjust this file to match classes configured in your application config, to enable IDE autocompletion for custom components.
+ * Example: A property phpdoc can be added in `__Application` class as `@property \vendor\package\Rollbar|__Rollbar $rollbar` and adding a class in this file
+ * ```php
+ * // @property of \vendor\package\Rollbar goes here
+ * class __Rollbar {
+ * }
+ * ```
+ */
+class Yii {
+    /**
+     * @var \yii\web\Application|\yii\console\Application|__Application
+     */
+    public static $app;
+}
+
+/**
+ * @property yii\rbac\DbManager $authManager 
+ * @property \yii\web\User|__WebUser $user
+ * 
+ */
+class __Application {
+}
+
+/**
+ * @property app\models\User $identity
+ */
+class __WebUser {
+}

+ 6 - 0
common/config/bootstrap.php

@@ -0,0 +1,6 @@
+<?php
+Yii::setAlias('@common', dirname(__DIR__));
+Yii::setAlias('@frontend', dirname(dirname(__DIR__)) . '/frontend');
+Yii::setAlias('@backend', dirname(dirname(__DIR__)) . '/backend');
+Yii::setAlias('@console', dirname(dirname(__DIR__)) . '/console');
+Yii::setAlias('@adminapi', dirname(dirname(__DIR__)) . '/adminapi');

+ 3 - 0
common/config/env/currentEnv.php

@@ -0,0 +1,3 @@
+<?php
+
+return "local";

+ 20 - 0
common/config/main.php

@@ -0,0 +1,20 @@
+<?php
+return [
+    'aliases' => [
+        '@bower' => '@vendor/bower-asset',
+        '@npm' => '@vendor/npm-asset',
+    ],
+    'vendorPath' => dirname(dirname(__DIR__)) . '/vendor',
+    'components' => [
+        'cache' => [
+            'class' => 'yii\caching\FileCache',
+        ],
+//        'request' => [
+//            'csrfParam' => '_csrf-frontend',
+//            'parsers' => [
+//                'application/json' => 'yii\web\JsonParser',
+//                'text/json' => 'yii\web\JsonParser',
+//            ],
+//        ],
+    ],
+];

+ 9 - 0
common/config/params.php

@@ -0,0 +1,9 @@
+<?php
+return [
+    'adminEmail' => 'admin@example.com',
+    'supportEmail' => 'support@example.com',
+    'senderEmail' => 'noreply@example.com',
+    'senderName' => 'Example.com mailer',
+    'user.passwordResetTokenExpire' => 3600,
+    'user.passwordMinLength' => 8,
+];

+ 11 - 0
common/config/test.php

@@ -0,0 +1,11 @@
+<?php
+return [
+    'id' => 'app-common-tests',
+    'basePath' => dirname(__DIR__),
+    'components' => [
+        'user' => [
+            'class' => 'yii\web\User',
+            'identityClass' => 'common\models\User',
+        ],
+    ],
+];

+ 10 - 0
common/fixtures/UserFixture.php

@@ -0,0 +1,10 @@
+<?php
+
+namespace common\fixtures;
+
+use yii\test\ActiveFixture;
+
+class UserFixture extends ActiveFixture
+{
+    public $modelClass = 'common\models\User';
+}

+ 16 - 0
common/mail/emailVerify-html.php

@@ -0,0 +1,16 @@
+<?php
+
+use yii\helpers\Html;
+
+/** @var yii\web\View $this */
+/** @var common\models\User $user */
+
+$verifyLink = Yii::$app->urlManager->createAbsoluteUrl(['site/verify-email', 'token' => $user->verification_token]);
+?>
+<div class="verify-email">
+    <p>Hello <?= Html::encode($user->username) ?>,</p>
+
+    <p>Follow the link below to verify your email:</p>
+
+    <p><?= Html::a(Html::encode($verifyLink), $verifyLink) ?></p>
+</div>

+ 12 - 0
common/mail/emailVerify-text.php

@@ -0,0 +1,12 @@
+<?php
+
+/** @var yii\web\View $this */
+/** @var common\models\User $user */
+
+$verifyLink = Yii::$app->urlManager->createAbsoluteUrl(['site/verify-email', 'token' => $user->verification_token]);
+?>
+Hello <?= $user->username ?>,
+
+Follow the link below to verify your email:
+
+<?= $verifyLink ?>

+ 24 - 0
common/mail/layouts/html.php

@@ -0,0 +1,24 @@
+<?php
+
+use yii\helpers\Html;
+
+/** @var \yii\web\View $this view component instance */
+/** @var \yii\mail\MessageInterface $message the message being composed */
+/** @var string $content main view render result */
+
+?>
+<?php $this->beginPage() ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+    <meta http-equiv="Content-Type" content="text/html; charset=<?= Yii::$app->charset ?>" />
+    <title><?= Html::encode($this->title) ?></title>
+    <?php $this->head() ?>
+</head>
+<body>
+    <?php $this->beginBody() ?>
+    <?= $content ?>
+    <?php $this->endBody() ?>
+</body>
+</html>
+<?php $this->endPage();

+ 12 - 0
common/mail/layouts/text.php

@@ -0,0 +1,12 @@
+<?php
+
+/** @var \yii\web\View $this view component instance */
+/** @var \yii\mail\MessageInterface $message the message being composed */
+/** @var string $content main view render result */
+
+?>
+<?php $this->beginPage() ?>
+<?php $this->beginBody() ?>
+<?= $content ?>
+<?php $this->endBody() ?>
+<?php $this->endPage() ?>

+ 16 - 0
common/mail/passwordResetToken-html.php

@@ -0,0 +1,16 @@
+<?php
+
+use yii\helpers\Html;
+
+/** @var yii\web\View $this */
+/** @var common\models\User $user */
+
+$resetLink = Yii::$app->urlManager->createAbsoluteUrl(['site/reset-password', 'token' => $user->password_reset_token]);
+?>
+<div class="password-reset">
+    <p>Hello <?= Html::encode($user->username) ?>,</p>
+
+    <p>Follow the link below to reset your password:</p>
+
+    <p><?= Html::a(Html::encode($resetLink), $resetLink) ?></p>
+</div>

+ 12 - 0
common/mail/passwordResetToken-text.php

@@ -0,0 +1,12 @@
+<?php
+
+/** @var yii\web\View $this */
+/** @var common\models\User $user */
+
+$resetLink = Yii::$app->urlManager->createAbsoluteUrl(['site/reset-password', 'token' => $user->password_reset_token]);
+?>
+Hello <?= $user->username ?>,
+
+Follow the link below to reset your password:
+
+<?= $resetLink ?>

+ 151 - 0
common/models/AccidentCases.php

@@ -0,0 +1,151 @@
+<?php
+
+namespace common\models;
+
+use Yii;
+
+/**
+ * This is the model class for table "accident_cases".
+ *
+ * @property int $id
+ * @property string|null $title 案例名称
+ * @property int|null $level 事件性质(等级)
+ * @property string $type_base 事件类型—基本选项
+ * @property string $type_first 事件类型-一级字段
+ * @property string $type_second 事件类型-二级字段
+ * @property string $type_third 事件类型-三级字段
+ * @property string $type_extra 事件类型—复合选项
+ * @property string $duty_category 责任专业—事件归因
+ * @property string $duty_reason 责任专业—原因
+ * @property int|null $start_time 发生时间(具体日期、时间)
+ * @property int|null $elimination_time 故障/外部影响消除时间
+ * @property int|null $recovery_time 运营基本恢复时间
+ * @property int|null $day_type 日期特征
+ * @property int|null $time_type 时间特征
+ * @property int|null $line 所属线路
+ * @property int|null $automation_level 自动化程度
+ * @property int|null $signal_supplier 信号供应商
+ * @property int|null $train_number 车号
+ * @property int|null $train_group 列车编组
+ * @property int|null $train_model 列车型号
+ * @property string|null $position_start 车站进站位置(起始位置)
+ * @property string|null $position_end 车站进站位置(终止位置)
+ * @property int|null $no_parking_area 车站进站位置(终止位置)
+ * @property string|null $position_no_parking_area 车站进站位置(终止位置)
+ * @property string|null $position 发生位置
+ * @property string $position_base_first 发生位置-基本分类
+ * @property int|null $position_base_second 发生位置-基本分类-二级字段
+ * @property int|null $position_extra_first 发生位置-派生
+ * @property int|null $position_extra_second 发生位置-派生-二级字段
+ * @property string|null $signal_concentration_station            信号集中站/区域站
+ * @property string|null $fault_switch_number                           故障道岔编号
+ * @property string|null $foreign_body_location                       异物位置
+ * @property string|null $power_supply_zoning                        供电分区
+ * @property string|null $substation_in_the_fault_section         故障区段内变电站
+ * @property string|null $substation_type 变电站类型
+ * @property int|null $headway 行车间隔
+ * @property int|null $online_trains_number 在线列车数
+ * @property int|null $incidence 影响范围
+ * @property int|null $affect_trains_number 直接影响列车数
+ * @property int|null $emergency_duration 故障持续时长
+ * @property int|null $operation_duration 运营事件持续时长(分钟)
+ * @property int|null $maximum_delay 最大晚点
+ * @property int|null $train_delayed_two_minutes 2分钟晚点列次
+ * @property int|null $train_delayed_five_minutes 5分钟晚点列次
+ * @property int|null $get_off_trains_number 清客列次
+ * @property int|null $skip_stop_trains_number 跳停列次
+ * @property int|null $handle_person_dispatch   路网调度
+ * @property int|null $handle_person_leader 班组长(1人)
+ * @property int|null $handle_person_principal 运营正职(1人)
+ * @property int|null $handle_person_principal_device 设备正职(1人)
+ * @property int|null $handle_person_deputy 运营副职(可多人)
+ * @property int|null $handle_person_deputy_device 设备副职(可多人)
+ * @property int|null $command_area 指挥区域
+ * @property int|null $team_serial_number 班组序号
+ * @property int|null $delete_time 数据删除时间
+ * @property string|null $images 事件图片(封面图片)
+ * @property string|null $images_add 事件图片(额外)
+ * @property string|null $images_duibi 事件图片(对比)
+ * @property object $totalScore 事件图片(额外)
+ * @property string|null $update_time 
+ * @property int $status 状态 0-待审核 1-已发布 2已提交 3已审核 4驳回
+ * @property String create_by 创建人工号
+ * @property String create_name 创建人姓名
+ * @property String create_remark 创建人备注
+ * @property String check_list 可审核人列表 默认为空则所有审核人都能看到,不为空则只有指定人可以审核
+ * @property String check_name_list  可审核人姓名列表
+ * @property String check_by  审核人
+ * @property String check_name  审核人姓名
+ * @property String check_remark  审核人备注
+ */
+class AccidentCases extends \yii\db\ActiveRecord
+{
+    public $totalScore;
+
+    /**
+     * {@inheritdoc}
+     */
+    public static function tableName()
+    {
+        return 'accident_cases';
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function rules()
+    {
+        return [
+//            [['level', 'type_base', 'type_first', 'duty_category', 'duty_reason', 'start_time', 'day_type', 'time_type', 'line', 'automation_level', 'signal_supplier', 'train_number', 'train_group', 'train_model', 'position_base_first', 'position_base_second', 'position_extra_first', 'position_extra_second', 'substation_type', 'headway', 'online_trains_number', 'incidence', 'affect_trains_number', 'get_off_trains_number', 'skip stop_trains_number'], 'integer'],
+//            [['emergency_duration', 'maximum_delay'], 'number'],
+//            [['title', 'images'], 'string', 'max' => 512],
+//            [['type_second', 'type_third', 'type_extra'], 'string', 'max' => 50],
+//            [['position', 'train_delayed_two_minutes', 'train_delayed_five_minutes'], 'string', 'max' => 128],
+        ];
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function attributeLabels()
+    {
+        return [
+            'id' => 'ID',
+            'title' => 'Title',
+            'level' => 'Level',
+            'type_base' => 'Type Base',
+            'type_first' => 'Type First',
+            'type_second' => 'Type Second',
+            'type_third' => 'Type Third',
+            'type_extra' => 'Type Extra',
+            'duty_category' => 'Duty Category',
+            'duty_reason' => 'Duty Reason',
+            'start_time' => 'Start Time',
+            'day_type' => 'Day Type',
+            'time_type' => 'Time Type',
+            'line' => 'Line',
+            'automation_level' => 'Automation Level',
+            'signal_supplier' => 'Signal Supplier',
+            'train_number' => 'Train Number',
+            'train_group' => 'Train Group',
+            'train_model' => 'Train Model',
+            'position' => 'Position',
+            'position_base_first' => 'Position Base First',
+            'position_base_second' => 'Position Base Second',
+            'position_extra_first' => 'Position Extra First',
+            'position_extra_second' => 'Position Extra Second',
+            'substation_type' => 'Substation Type',
+            'headway' => 'Headway',
+            'online_trains_number' => 'Online Trains Number',
+            'incidence' => 'Incidence',
+            'affect_trains_number' => 'Affect Trains Number',
+            'emergency_duration' => 'Emergency Duration',
+            'maximum_delay' => 'Maximum Delay',
+            'train_delayed_two_minutes' => 'Train Delayed Two Minutes',
+            'train_delayed_five_minutes' => 'Train Delayed Five Minutes',
+            'get_off_trains_number' => 'Get Off Trains Number',
+            'skip stop_trains_number' => 'Skip Stop Trains Number',
+            'images' => 'Images',
+        ];
+    }
+}

+ 47 - 0
common/models/AccidentCasesDimension.php

@@ -0,0 +1,47 @@
+<?php
+
+namespace common\models;
+
+use Yii;
+
+/**
+ * This is the model class for table "accident_cases_dimension".
+ *
+ * @property int $id
+ * @property int $accident_id
+ * @property int $dictionary_id
+ * @property int $type
+ * @property int $status
+ * @property string $content
+ * @property int $update_time
+ */
+class AccidentCasesDimension extends \yii\db\ActiveRecord
+{
+    /**
+     * {@inheritdoc}
+     */
+    public static function tableName()
+    {
+        return 'accident_cases_dimension';
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function rules()
+    {
+        return [
+
+        ];
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function attributeLabels()
+    {
+        return [
+
+        ];
+    }
+}

+ 43 - 0
common/models/AccidentCasesFocus.php

@@ -0,0 +1,43 @@
+<?php
+
+namespace common\models;
+
+use Yii;
+
+/**
+ * This is the model class for table "accident_cases_focus".
+ *
+ * @property int $id id
+ * @property int $uid 用户ID
+ * @property string $accident_cases_id_list
+ */
+class AccidentCasesFocus extends \yii\db\ActiveRecord
+{
+    /**
+     * {@inheritdoc}
+     */
+    public static function tableName()
+    {
+        return 'accident_cases_focus';
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function rules()
+    {
+        return [
+
+        ];
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function attributeLabels()
+    {
+        return [
+
+        ];
+    }
+}

+ 43 - 0
common/models/AccidentCasesRelateToDictionary.php

@@ -0,0 +1,43 @@
+<?php
+
+namespace common\models;
+
+use Yii;
+
+/**
+ * This is the model class for table "accident_cases_relate_to_dictionary".
+ *
+ * @property int $id
+ * @property int $accident_cases_id
+ * @property int $dictionary_id
+ */
+class AccidentCasesRelateToDictionary extends \yii\db\ActiveRecord
+{
+    /**
+     * {@inheritdoc}
+     */
+    public static function tableName()
+    {
+        return 'accident_cases_relate_to_dictionary';
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function rules()
+    {
+        return [
+
+        ];
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function attributeLabels()
+    {
+        return [
+
+        ];
+    }
+}

+ 53 - 0
common/models/AccidentCasesScore.php

@@ -0,0 +1,53 @@
+<?php
+
+namespace common\models;
+
+use Yii;
+
+/**
+ * This is the model class for table "accident_cases_score".
+ *
+ * @property int $id
+ * @property int $accident_id
+ * @property int $dictionary_id
+ * @property int $category
+ * @property int $type
+ * @property int $type_two
+ * @property string $content
+ * @property string $content_two
+ * @property int $update_time
+ * @property float $score
+ */
+class AccidentCasesScore extends \yii\db\ActiveRecord
+{
+
+    public array $dimension = [];
+
+    /**
+     * {@inheritdoc}
+     */
+    public static function tableName()
+    {
+        return 'accident_cases_score';
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function rules()
+    {
+        return [
+
+        ];
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function attributeLabels()
+    {
+        return [
+
+        ];
+    }
+}

+ 48 - 0
common/models/AccidentCasesScoreComment.php

@@ -0,0 +1,48 @@
+<?php
+
+namespace common\models;
+
+use Yii;
+
+/**
+ * This is the model class for table "accident_cases_score_comment".
+ *
+ * @property int $id
+ * @property int $type
+ * @property int $type_two
+ * @property int $content
+ * @property int $status
+ */
+class AccidentCasesScoreComment extends \yii\db\ActiveRecord
+{
+
+    public array $dimension = [];
+
+    /**
+     * {@inheritdoc}
+     */
+    public static function tableName()
+    {
+        return 'accident_cases_score_comment';
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function rules()
+    {
+        return [
+
+        ];
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function attributeLabels()
+    {
+        return [
+
+        ];
+    }
+}

+ 43 - 0
common/models/AccidentCasesScoreConfig.php

@@ -0,0 +1,43 @@
+<?php
+
+namespace common\models;
+
+use Yii;
+
+/**
+ * This is the model class for table "accident_cases_score_config".
+ *
+ * @property int $id id
+ * @property string|null $content 搜索内容
+ * @property int $update_time 搜索类型
+ */
+class AccidentCasesScoreConfig extends \yii\db\ActiveRecord
+{
+    /**
+     * {@inheritdoc}
+     */
+    public static function tableName()
+    {
+        return 'accident_cases_score_config';
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function rules()
+    {
+        return [
+
+        ];
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function attributeLabels()
+    {
+        return [
+
+        ];
+    }
+}

+ 49 - 0
common/models/AccidentCasesStudy.php

@@ -0,0 +1,49 @@
+<?php
+
+namespace common\models;
+
+use Yii;
+
+/**
+ * This is the model class for table "accident_cases_study".
+ *
+ * @property int $id id
+ * @property int $uid
+ * @property string $username
+ * @property string $name
+ * @property int $accident_id
+ * @property int $learning_duration
+ * @property string $last_learn_time
+ * @property string $start_time
+ * @property string $create_date
+ */
+class AccidentCasesStudy extends \yii\db\ActiveRecord
+{
+    /**
+     * {@inheritdoc}
+     */
+    public static function tableName()
+    {
+        return 'accident_cases_study';
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function rules()
+    {
+        return [
+
+        ];
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function attributeLabels()
+    {
+        return [
+
+        ];
+    }
+}

+ 56 - 0
common/models/AccidentCasesUpdateHistory.php

@@ -0,0 +1,56 @@
+<?php
+
+namespace common\models;
+
+use Yii;
+
+/**
+ * This is the model class for table "accident_cases_update_history".
+ *
+ * @property int $id id
+ * @property string $origin
+ * @property string $current
+ * @property int $admin_log_id
+ * @property int $uid
+ * @property string $role_name
+ * @property string $username
+ * @property string $name
+ * @property string $url
+ * @property string $title
+ * @property int $case_id
+ * @property string $case_title
+ * @property string $content
+ * @property string $ip
+ * @property string $useragent
+ * @property string $create_time
+ */
+class AccidentCasesUpdateHistory extends \yii\db\ActiveRecord
+{
+    /**
+     * {@inheritdoc}
+     */
+    public static function tableName()
+    {
+        return 'accident_cases_update_history';
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function rules()
+    {
+        return [
+
+        ];
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function attributeLabels()
+    {
+        return [
+
+        ];
+    }
+}

+ 55 - 0
common/models/AdminLog.php

@@ -0,0 +1,55 @@
+<?php
+
+namespace common\models;
+
+use Yii;
+
+/**
+ * This is the model class for table "admin_log".
+ *
+ * @property int $id id
+ * @property int $uid
+ * @property string $role_name
+ * @property string $username
+ * @property string $name
+ * @property string $url
+ * @property string $title
+ * @property string $content
+ * @property string $ip
+ * @property string $useragent
+ * @property string $create_time
+ * @property int $history_id
+ */
+class AdminLog extends \yii\db\ActiveRecord
+{
+    public $origin = "";
+
+    public $current = "";
+
+    /**
+     * {@inheritdoc}
+     */
+    public static function tableName()
+    {
+        return 'admin_log';
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function rules()
+    {
+        return [
+
+        ];
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function attributeLabels()
+    {
+        return [
+        ];
+    }
+}

+ 57 - 0
common/models/BaseMenu.php

@@ -0,0 +1,57 @@
+<?php
+
+namespace common\models;
+
+use Yii;
+
+/**
+ * This is the model class for table "base_menu".
+ *
+ * @property int $id id
+ * @property string|null $name 菜单名称
+ * @property int|null $type 类型 1菜单 2按钮
+ * @property int|null $parentid 父ID
+ * @property string|null $url 菜单url
+ * @property string|null $icon 菜单图标
+ * @property int|null $status 状态 0禁用 1启用
+ * @property int|null $sort 排序
+ */
+class BaseMenu extends \yii\db\ActiveRecord
+{
+    /**
+     * {@inheritdoc}
+     */
+    public static function tableName()
+    {
+        return 'base_menu';
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function rules()
+    {
+        return [
+            [['type', 'parentid', 'status', 'sort'], 'integer'],
+            [['name', 'icon'], 'string', 'max' => 50],
+            [['url'], 'string', 'max' => 200],
+        ];
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function attributeLabels()
+    {
+        return [
+            'id' => 'id',
+            'name' => '菜单名称',
+            'type' => '类型 1菜单 2按钮',
+            'parentid' => '父ID',
+            'url' => '菜单url',
+            'icon' => '菜单图标',
+            'status' => '状态 0禁用 1启用',
+            'sort' => '排序',
+        ];
+    }
+}

+ 58 - 0
common/models/BaseRole.php

@@ -0,0 +1,58 @@
+<?php
+
+namespace common\models;
+
+use Yii;
+
+/**
+ * This is the model class for table "base_role".
+ *
+ * @property int $id id
+ * @property int $code 角色编号
+ * @property string|null $name 角色名称
+ * @property string|null $create_time 创建时间
+ * @property int|null $create_userid 创建人
+ * @property string|null $create_username 创建人
+ * @property int|null $status 状态 0禁用 1启用
+ * @property string|null $update_time 修改时间
+ */
+class BaseRole extends \yii\db\ActiveRecord
+{
+    /**
+     * {@inheritdoc}
+     */
+    public static function tableName()
+    {
+        return 'base_role';
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function rules()
+    {
+        return [
+//            [['create_time', 'update_time'], 'safe'],
+//            [['create_userid', 'status','code'], 'integer'],
+//            [['name'], 'string', 'max' => 255],
+//            [['create_username'], 'string', 'max' => 200],
+        ];
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function attributeLabels()
+    {
+        return [
+            'id' => 'id',
+            'code' => '角色编号',
+            'name' => '角色名称',
+            'create_time' => '创建时间',
+            'create_userid' => '创建人',
+            'create_username' => '创建人',
+            'status' => '状态 0禁用 1启用',
+            'update_time' => '修改时间',
+        ];
+    }
+}

+ 42 - 0
common/models/BaseRoleClientRules.php

@@ -0,0 +1,42 @@
+<?php
+
+namespace common\models;
+
+use yii\db\ActiveRecord;
+
+/**
+ * This is the model class for table "base_role_client_rules".
+ *
+ * @property int $id
+ * @property int $role_id
+ * @property string $rules
+ */
+class BaseRoleClientRules extends ActiveRecord
+{
+    /**
+     * {@inheritdoc}
+     */
+    public static function tableName(): string
+    {
+        return 'base_role_client_rules';
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function rules(): array
+    {
+        return [
+
+        ];
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function attributeLabels(): array
+    {
+        return [
+        ];
+    }
+}

+ 46 - 0
common/models/BaseRoleMenu.php

@@ -0,0 +1,46 @@
+<?php
+
+namespace common\models;
+
+use Yii;
+
+/**
+ * This is the model class for table "base_role_menu".
+ *
+ * @property int $role_id
+ * @property int $menu_id
+ * @property int $id
+ */
+class BaseRoleMenu extends \yii\db\ActiveRecord
+{
+    /**
+     * {@inheritdoc}
+     */
+    public static function tableName()
+    {
+        return 'base_role_menu';
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function rules()
+    {
+        return [
+            [['role_id', 'menu_id'], 'required'],
+            [['role_id', 'menu_id'], 'integer'],
+        ];
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function attributeLabels()
+    {
+        return [
+            'role_id' => 'Role ID',
+            'menu_id' => 'Menu ID',
+            'id' => 'ID',
+        ];
+    }
+}

+ 42 - 0
common/models/BaseRoleServerRules.php

@@ -0,0 +1,42 @@
+<?php
+
+namespace common\models;
+
+use Yii;
+
+/**
+ * This is the model class for table "base_role_server_rules".
+ *
+ * @property int $id
+ * @property int $role_id
+ * @property string $rules
+ */
+class BaseRoleServerRules extends \yii\db\ActiveRecord
+{
+    /**
+     * {@inheritdoc}
+     */
+    public static function tableName()
+    {
+        return 'base_role_server_rules';
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function rules()
+    {
+        return [
+
+        ];
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function attributeLabels()
+    {
+        return [
+        ];
+    }
+}

+ 82 - 0
common/models/BaseUser.php

@@ -0,0 +1,82 @@
+<?php
+
+namespace common\models;
+
+use Yii;
+
+/**
+ * This is the model class for table "base_user".
+ *
+ * @property int $id 用户ID
+ * @property string|null $roles 角色
+ * @property int|null $department_id 部门ID
+ * @property int|null $job_id 岗位ID
+ * @property string|null $username 用户账号
+ * @property string|null $password 用户密码
+ * @property string|null $name 用户姓名
+ * @property string|null $phone 手机号
+ * @property string|null $email 电子邮箱
+ * @property string|null $create_time 创建时间
+ * @property string|null $update_time 修改时间
+ * @property string|null $last_login_time 上次登录时间
+ * @property int|null $count 登录次数
+ * @property int|null $status 帐号状态 0禁用 1启用
+ * @property string|null $path 用户头像
+ * @property bool $IsCommonUser 判断用户是否是普通客户
+ * @property string $roleName 角色名
+ * @property string $realName 用户姓名
+ * @property string $isSuperAdmin 是否是超管
+ * @property string $learning_duration 学习总时长
+ * @property string $learning_duration_month 最近30天学习时长
+ */
+class BaseUser extends \yii\db\ActiveRecord
+{
+    public bool $IsCommonUser = false;
+    public $roleName;
+    public $realName;
+    public $isSuperAdmin = false;
+
+    /**
+     * {@inheritdoc}
+     */
+    public static function tableName()
+    {
+        return 'base_user';
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function rules()
+    {
+        return [
+            [['department_id', 'job_id', 'count', 'status'], 'integer'],
+            [['create_time', 'update_time', 'last_login_time'], 'safe'],
+            [['name', 'password', 'username', 'phone', 'roles', 'email', 'path'], 'string', 'max' => 255],
+        ];
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function attributeLabels()
+    {
+        return [
+            'id' => '用户ID',
+            'roles' => '角色',
+            'department_id' => '部门ID',
+            'job_id' => '岗位ID',
+            'username' => '用户账号',
+            'password' => '用户密码',
+            'name' => '用户姓名',
+            'phone' => '手机号',
+            'email' => '电子邮箱',
+            'create_time' => '创建时间',
+            'update_time' => '修改时间',
+            'last_login_time' => '上次登录时间',
+            'count' => '登录次数',
+            'status' => '帐号状态 0禁用 1启用',
+            'path' => '用户头像',
+        ];
+    }
+}

+ 46 - 0
common/models/BaseUserRole.php

@@ -0,0 +1,46 @@
+<?php
+
+namespace common\models;
+
+use Yii;
+
+/**
+ * This is the model class for table "base_user_role".
+ *
+ * @property int $user_id
+ * @property int $role_id
+ * @property int $id
+ */
+class BaseUserRole extends \yii\db\ActiveRecord
+{
+    /**
+     * {@inheritdoc}
+     */
+    public static function tableName()
+    {
+        return 'base_user_role';
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function rules()
+    {
+        return [
+            [['user_id', 'role_id'], 'required'],
+            [['user_id', 'role_id'], 'integer'],
+        ];
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function attributeLabels()
+    {
+        return [
+            'user_id' => 'User ID',
+            'role_id' => 'Role ID',
+            'id' => 'ID',
+        ];
+    }
+}

+ 47 - 0
common/models/Department.php

@@ -0,0 +1,47 @@
+<?php
+
+namespace common\models;
+
+use Yii;
+
+/**
+ * This is the model class for table "department".
+ *
+ * @property int $id id
+ * @property string|null $department_name 部门名称
+ * @property int|null $department_status 部门状态 0关闭 1启用
+ * @property string|null $create_time 创建时间
+ */
+class Department extends \yii\db\ActiveRecord
+{
+    /**
+     * {@inheritdoc}
+     */
+    public static function tableName()
+    {
+        return 'base_department';
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function rules()
+    {
+        return [
+
+        ];
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function attributeLabels()
+    {
+        return [
+            'id' => 'ID',
+            'department_name' => '部门名称',
+            'department_status' => '部门状态',
+            'create_time' => '创建时间',
+        ];
+    }
+}

+ 52 - 0
common/models/Dictionary.php

@@ -0,0 +1,52 @@
+<?php
+
+namespace common\models;
+
+use Yii;
+
+/**
+ * This is the model class for table "dictionary".
+ *
+ * @property int $id id
+ * @property string|null $name 分类名称
+ * @property string|null $param_name 分类名称
+ * @property int|null $pid 父ID
+ * @property int|null $has_children
+ * @property int|null $status 状态 0禁用 1启用
+ * @property string|null $remark 描述
+ * @property int|null $sort 排序
+ * @property int|null $multiple
+ * @property int|null $can_change
+ * @property int|null $can_children
+ * @property int|null $can_multiple
+ */
+class Dictionary extends \yii\db\ActiveRecord
+{
+    /**
+     * {@inheritdoc}
+     */
+    public static function tableName()
+    {
+        return 'dictionary';
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function rules()
+    {
+        return [
+
+        ];
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function attributeLabels()
+    {
+        return [
+
+        ];
+    }
+}

+ 45 - 0
common/models/DictionaryRelationship.php

@@ -0,0 +1,45 @@
+<?php
+
+namespace common\models;
+
+use Yii;
+
+/**
+ * This is the model class for table "dictionary_relationship".
+ *
+ * @property int $id
+ * @property int|null $dictionary_id 字典ID
+ * @property int|null $relation_id 派生关系的字典ID
+ */
+class DictionaryRelationship extends \yii\db\ActiveRecord
+{
+    /**
+     * {@inheritdoc}
+     */
+    public static function tableName()
+    {
+        return 'dictionary_relationship';
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function rules()
+    {
+        return [
+            [['dictionary_id', 'relation_id'], 'integer'],
+        ];
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function attributeLabels()
+    {
+        return [
+            'id' => 'ID',
+            'dictionary_id' => 'Dictionary ID',
+            'relation_id' => 'Relation ID',
+        ];
+    }
+}

+ 60 - 0
common/models/EmergencyResponse.php

@@ -0,0 +1,60 @@
+<?php
+
+namespace common\models;
+
+use Yii;
+
+/**
+ * This is the model class for table "emergency_response".
+ *
+ * @property int $id
+ * @property int|null $accident_id
+ * @property int|null $type_first
+ * @property int|null $type_second
+ * @property int|null $type_third
+ * @property int|null $type_fourth
+ * @property int|null $start_time
+ * @property string|null $content 内容
+ * @property string|null $rules
+ * @property string|null $assess
+ * @property string|null $assess_two
+ * @property string|null $source_data
+ * @property string|null $delete_time
+ */
+class EmergencyResponse extends \yii\db\ActiveRecord
+{
+    public $dimension;
+
+    /**
+     * {@inheritdoc}
+     */
+    public static function tableName()
+    {
+        return 'emergency_response';
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function rules()
+    {
+        return [
+
+        ];
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function attributeLabels()
+    {
+        return [
+            'id' => 'ID',
+            'accident_id' => 'Accident ID',
+            'type' => 'Type',
+            'start_time' => 'Start Time',
+            'content' => 'Content',
+            'image' => 'Image',
+        ];
+    }
+}

+ 47 - 0
common/models/EmergencyResponseDimension.php

@@ -0,0 +1,47 @@
+<?php
+
+namespace common\models;
+
+use Yii;
+
+/**
+ * This is the model class for table "emergency_response_dimension".
+ *
+ * @property int $id
+ * @property int $accident_id
+ * @property int $emergency_response_id
+ * @property int $type
+ * @property int $status
+ * @property string $content
+ * @property int $update_time
+ */
+class EmergencyResponseDimension extends \yii\db\ActiveRecord
+{
+    /**
+     * {@inheritdoc}
+     */
+    public static function tableName()
+    {
+        return 'emergency_response_dimension';
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function rules()
+    {
+        return [
+
+        ];
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function attributeLabels()
+    {
+        return [
+
+        ];
+    }
+}

+ 43 - 0
common/models/EmergencyResponseRelateToRulesPoints.php

@@ -0,0 +1,43 @@
+<?php
+
+namespace common\models;
+
+use Yii;
+
+/**
+ * This is the model class for table "emergency_response_relate_to_rules_points".
+ *
+ * @property int $id
+ * @property int $emergency_response_id
+ * @property int $rules_point_id
+ */
+class EmergencyResponseRelateToRulesPoints extends \yii\db\ActiveRecord
+{
+    /**
+     * {@inheritdoc}
+     */
+    public static function tableName()
+    {
+        return 'emergency_response_relate_to_rules_points';
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function rules()
+    {
+        return [
+
+        ];
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function attributeLabels()
+    {
+        return [
+
+        ];
+    }
+}

+ 43 - 0
common/models/EmergencyResponseRelateToSourceData.php

@@ -0,0 +1,43 @@
+<?php
+
+namespace common\models;
+
+use Yii;
+
+/**
+ * This is the model class for table "emergency_response_relate_to_source_data".
+ *
+ * @property int $id
+ * @property int $emergency_response_id
+ * @property int $source_data_id
+ */
+class EmergencyResponseRelateToSourceData extends \yii\db\ActiveRecord
+{
+    /**
+     * {@inheritdoc}
+     */
+    public static function tableName()
+    {
+        return 'emergency_response_relate_to_source_data';
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function rules()
+    {
+        return [
+
+        ];
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function attributeLabels()
+    {
+        return [
+
+        ];
+    }
+}

+ 54 - 0
common/models/EventOverview.php

@@ -0,0 +1,54 @@
+<?php
+
+namespace common\models;
+
+use Yii;
+
+/**
+ * This is the model class for table "event_overview".
+ *
+ * @property int $id
+ * @property int|null $accident_id 案例ID
+ * @property int|null $start_time 发生时间
+ * @property int|null $is_important
+ * @property string|null $important_content
+ * @property string|null $content 事件概览
+ * @property int|null $delete_time 删除时间
+ * @property string|null $assess 评估
+ * @property string|null $assess_two 评估
+ * @property string|null|array $source_data
+ */
+class EventOverview extends \yii\db\ActiveRecord
+{
+    /**
+     * {@inheritdoc}
+     */
+    public static function tableName()
+    {
+        return 'event_overview';
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function rules()
+    {
+        return [
+//            [['accident_id', 'start_time'], 'integer'],
+//            [['content'], 'string', 'max' => 512],
+        ];
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function attributeLabels()
+    {
+        return [
+            'id' => 'ID',
+            'accident_id' => '案例ID',
+            'start_time' => 'Start Time',
+            'content' => 'Content',
+        ];
+    }
+}

+ 49 - 0
common/models/EventSourceData.php

@@ -0,0 +1,49 @@
+<?php
+
+namespace common\models;
+
+use Yii;
+
+/**
+ * This is the model class for table "event_source_data".
+ *
+ * @property int $id
+ * @property int|null $accident_id
+ * @property string|null $file_name
+ * @property string|null $url
+ * @property int|null $update_time
+ * @property int|null $delete_time
+ */
+class EventSourceData extends \yii\db\ActiveRecord
+{
+    /**
+     * {@inheritdoc}
+     */
+    public static function tableName()
+    {
+        return 'event_source_data';
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function rules()
+    {
+        return [
+//            [['accident_id'], 'integer'],
+//            [['content'], 'string', 'max' => 512],
+        ];
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function attributeLabels()
+    {
+        return [
+            'id' => 'ID',
+            'accident_id' => 'Accident ID',
+            'content' => 'Content',
+        ];
+    }
+}

+ 47 - 0
common/models/Job.php

@@ -0,0 +1,47 @@
+<?php
+
+namespace common\models;
+
+use Yii;
+
+/**
+ * This is the model class for table "job".
+ *
+ * @property int $id id
+ * @property string|null $job_name 岗位名称
+ * @property int|null $job_status 岗位状态 0关闭 1启用
+ * @property string|null $create_time 创建时间
+ */
+class Job extends \yii\db\ActiveRecord
+{
+    /**
+     * {@inheritdoc}
+     */
+    public static function tableName()
+    {
+        return 'base_job';
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function rules()
+    {
+        return [
+
+        ];
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function attributeLabels()
+    {
+        return [
+            'id' => 'ID',
+            'job_name' => '岗位名称',
+            'job_status' => '岗位状态',
+            'create_time' => '创建时间',
+        ];
+    }
+}

+ 52 - 0
common/models/Mail.php

@@ -0,0 +1,52 @@
+<?php
+
+namespace common\models;
+
+use Yii;
+
+/**
+ * This is the model class for table "mail".
+ *
+ * @property int $id
+ * @property int $accident_id
+ * @property string $title
+ * @property string $content
+ * @property int $start_time
+ * @property int $update_time
+ * @property int $status
+ * @property string $receiver
+ * @property string $receiver_name
+ * @property string $sender
+ * @property string $sender_name
+ * @property string $case_type
+ */
+class Mail extends \yii\db\ActiveRecord
+{
+    /**
+     * {@inheritdoc}
+     */
+    public static function tableName()
+    {
+        return 'mail';
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function rules()
+    {
+        return [
+
+        ];
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function attributeLabels()
+    {
+        return [
+
+        ];
+    }
+}

+ 65 - 0
common/models/OperationalAdjustments.php

@@ -0,0 +1,65 @@
+<?php
+
+namespace common\models;
+
+use Yii;
+
+/**
+ * This is the model class for table "operational_adjustments".
+ *
+ * @property int $id
+ * @property int|null $accident_id 案件ID
+ * @property int|null $type_first
+ * @property int|null $type_second
+ * @property int|null $type_third
+ * @property int|null $type_fourth
+ * @property int|null $start_time 发生时间
+ * @property int|null $is_important
+ * @property string|null $important_content
+ * @property string|null $content 内容
+ * @property string|null $rules 规章
+ * @property string|null $assess 评估
+ * @property string|null $assess_two 评估
+ * @property string $source_data 图片
+ * @property int|null $delete_time 删除时间
+ */
+class OperationalAdjustments extends \yii\db\ActiveRecord
+{
+    public $dimension;
+
+    /**
+     * {@inheritdoc}
+     */
+    public static function tableName()
+    {
+        return 'operational_adjustments';
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function rules()
+    {
+        return [
+//            [['accident_id', 'type', 'start_time'], 'integer'],
+//            [['content'], 'string'],
+//            [['image'], 'string', 'max' => 512],
+        ];
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function attributeLabels()
+    {
+        return [
+            'id' => 'ID',
+            'accident_id' => '案件ID',
+            'type' => '运营调整类型',
+            'start_time' => '发生时间',
+            'content' => '内容',
+            'assess' => '评估',
+            'image' => '图片',
+        ];
+    }
+}

+ 47 - 0
common/models/OperationalAdjustmentsDimension.php

@@ -0,0 +1,47 @@
+<?php
+
+namespace common\models;
+
+use Yii;
+
+/**
+ * This is the model class for table "operational_adjustments_dimension".
+ *
+ * @property int $id
+ * @property int $accident_id
+ * @property int $operational_adjustments_id
+ * @property int $type
+ * @property int $status
+ * @property string $content
+ * @property int $update_time
+ */
+class OperationalAdjustmentsDimension extends \yii\db\ActiveRecord
+{
+    /**
+     * {@inheritdoc}
+     */
+    public static function tableName()
+    {
+        return 'operational_adjustments_dimension';
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function rules()
+    {
+        return [
+
+        ];
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function attributeLabels()
+    {
+        return [
+
+        ];
+    }
+}

+ 43 - 0
common/models/OperationalAdjustmentsRelateToRulesPoints.php

@@ -0,0 +1,43 @@
+<?php
+
+namespace common\models;
+
+use Yii;
+
+/**
+ * This is the model class for table "operational_adjustments_relate_to_rules_points".
+ *
+ * @property int $id
+ * @property int $operational_adjustments_id
+ * @property int $rules_point_id
+ */
+class OperationalAdjustmentsRelateToRulesPoints extends \yii\db\ActiveRecord
+{
+    /**
+     * {@inheritdoc}
+     */
+    public static function tableName()
+    {
+        return 'operational_adjustments_relate_to_rules_points';
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function rules()
+    {
+        return [
+
+        ];
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function attributeLabels()
+    {
+        return [
+
+        ];
+    }
+}

+ 43 - 0
common/models/OperationalAdjustmentsRelateToSourceData.php

@@ -0,0 +1,43 @@
+<?php
+
+namespace common\models;
+
+use Yii;
+
+/**
+ * This is the model class for table "operational_adjustments_relate_to_source_data".
+ *
+ * @property int $id
+ * @property int $operational_adjustments_id
+ * @property int $source_data_id
+ */
+class OperationalAdjustmentsRelateToSourceData extends \yii\db\ActiveRecord
+{
+    /**
+     * {@inheritdoc}
+     */
+    public static function tableName()
+    {
+        return 'operational_adjustments_relate_to_source_data';
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function rules()
+    {
+        return [
+
+        ];
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function attributeLabels()
+    {
+        return [
+
+        ];
+    }
+}

+ 60 - 0
common/models/Rules.php

@@ -0,0 +1,60 @@
+<?php
+
+namespace common\models;
+
+use Yii;
+
+/**
+ * This is the model class for table "Rules".
+ *
+ * @property int $id id
+ * @property string|null $rule_name 规章名称
+ * @property string|null $rule_category 规章类别
+ * @property string|null $rule_content 规章类别
+ * @property int|null $rule_status 规章状态0冻结1使用
+ * @property int|null $create_time 创建日期
+ * @property int|null $end_time 废止时间
+ * @property string|null $update_time 更新时间
+ * @property string|null $delete_time 更新时间
+ * @property int|null $version 规章版本
+ * @property string|null $rule_name_version 规章名称+规章版本
+ */
+class Rules extends \yii\db\ActiveRecord
+{
+    public $rule_name_version;
+
+    /**
+     * {@inheritdoc}
+     */
+    public static function tableName()
+    {
+        return 'rules';
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function rules()
+    {
+        return [
+
+        ];
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function attributeLabels()
+    {
+        return [
+            'id' => 'ID',
+            'rule_name' => '规章名称',
+            'rule_content' => '规章要点',
+            'rule_category' => '规章类别',
+            'rule_status' => '规章状态0冻结1使用',
+            'create_time' => '创建日期',
+            'update_time' => '更新时间',
+            'version' => '规章版本',
+        ];
+    }
+}

+ 53 - 0
common/models/RulesPoints.php

@@ -0,0 +1,53 @@
+<?php
+
+namespace common\models;
+
+use Yii;
+
+/**
+ * This is the model class for table "Rules_points".
+ *
+ * @property int $id id
+ * @property int $delete_time
+ * @property string|null $rule_id 规章ID
+ * @property string|null $point 知识点编号
+ * @property string|null $name 知识点标题
+ * @property string|null $content 知识点内容
+ * @property string|null $rule_id_point 规章ID+知识点编号
+ * @property string|null $dic 固化字典
+ */
+class RulesPoints extends \yii\db\ActiveRecord
+{
+    public $rule_id_point;
+
+    /**
+     * {@inheritdoc}
+     */
+    public static function tableName()
+    {
+        return 'rules_points';
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function rules()
+    {
+        return [
+
+        ];
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function attributeLabels()
+    {
+        return [
+            'id' => 'ID',
+            'rule_id' => '规章ID',
+            'point' => '知识点编号',
+            'content' => '知识点内容',
+        ];
+    }
+}

+ 43 - 0
common/models/SearchConfig.php

@@ -0,0 +1,43 @@
+<?php
+
+namespace common\models;
+
+use Yii;
+
+/**
+ * This is the model class for table "search_history".
+ *
+ * @property int $id id
+ * @property string|null $content 搜索内容
+ * @property int $update_time 搜索类型
+ */
+class SearchConfig extends \yii\db\ActiveRecord
+{
+    /**
+     * {@inheritdoc}
+     */
+    public static function tableName()
+    {
+        return 'search_config';
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function rules()
+    {
+        return [
+
+        ];
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function attributeLabels()
+    {
+        return [
+
+        ];
+    }
+}

Certains fichiers n'ont pas été affichés car il y a eu trop de fichiers modifiés dans ce diff