123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131 |
- <?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'
- );
- $emailConfig = json_decode(file_get_contents(Yii::getAlias('@backend').'/config/email.json'),true);
- return [
- 'id' => 'app-backend',
- 'basePath' => dirname(__DIR__),
- 'controllerNamespace' => 'backend\controllers',
- 'bootstrap' => ['log'],
- 'modules' => [],
- 'on beforeRequest' => function($event) {
- \yii\base\Event::on(\yii\db\BaseActiveRecord::className(), \yii\db\BaseActiveRecord::EVENT_AFTER_UPDATE, ['common\models\AdminLog', 'afterUpdate']);
- \yii\base\Event::on(\yii\db\BaseActiveRecord::className(), \yii\db\BaseActiveRecord::EVENT_AFTER_INSERT, ['common\models\AdminLog', 'afterInsert']);
- \yii\base\Event::on(\yii\db\BaseActiveRecord::className(), \yii\db\BaseActiveRecord::EVENT_AFTER_DELETE, ['common\models\AdminLog', 'afterDels']);
- },
- 'components' => [
- 'request' => [
- 'csrfParam' => 'token',
- ],
- // 'cache'=>[
- // 'class'=>'yii\caching\FileCache',
- // 'cachePath'=>'@runtime/../cachefile/',
- //
- // ],
- // 'user' => [
- // 'identityClass' => 'common\models\User',
- // 'enableAutoLogin' => true,
- // 'identityCookie' => ['name' => '_identity-backend', 'httpOnly' => true],
- // ],
- // 'pfg'=>[
- // 'class' => 'backend\base\ToJson',
- // ],
- 'mailer' => [ //邮箱设置
- 'class' => 'yii\swiftmailer\Mailer',
- 'useFileTransport' =>false,//这句一定有,false发送邮件,true只是生成邮件在runtime文件夹下,不发邮件
- 'transport' => $emailConfig,
- 'messageConfig'=>[
- 'charset'=>'UTF-8',
- 'from'=>[$emailConfig['username']=>'报名资料'.time()]
- ],
- ],
- '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'],
- ],
- // [
- // 'class' => 'yii\log\FileTarget',
- // 'levels' => ['error', 'warning','info'],
- // 'logVars'=>[],
- // //表示以yii\db\或者app\models\开头的分类都会写入这个文件
- // 'categories'=>['yii\db\*','common\models\*'],
- // //表示写入到文件sql.log中年月日记录日志
- // 'logFile'=>'@runtime/../logs/sql/sql.log'.date('Ymd'),
- // ]
- ],
- ],
- 'errorHandler' => [
- 'errorAction' => 'site/error',
- ],
- 'urlManager' => [
- 'enablePrettyUrl' => true,
- 'showScriptName' => false,
- // 'suffix'=>'',
- 'rules' => [
- '/'=>'index/index',
- '<controller:\w+>/<action:\w+>.html'=>'<controller>/<action>',
- '<controller:\w+>/<action:\w+>.php'=>'<controller>/<action>',
- ],
- ],
- 'assetManager' => [
- // 'class' => 'yii\web\AssetManager',
- // 'appendTimestamp' => true,
- // 'forceCopy' => true,
- 'bundles' => [
- 'linkAssets' => true,
- 'yii\web\YiiAsset' => [
- 'js' => [], // 去除 yii.js
- 'sourcePath' => null, // 防止在 frontend/web/asset 下生产文件
- ],
- 'yii\widgets\ActiveFormAsset' => [
- 'js' => [], // 去除 yii.activeForm.js
- 'sourcePath' => null, // 防止在 frontend/web/asset 下生产文件
- ],
- 'yii\validators\ValidationAsset' => [
- 'js' => [], // 去除 yii.validation.js
- 'sourcePath' => null, // 防止在 frontend/web/asset 下生产文件
- ],
- ],
- ],
- 'i18n' => [
- 'translations' => [
- 'app*' => [
- 'class' => 'yii\i18n\PhpMessageSource',
- 'basePath' => '@common/messages',
- // 'sourceLanguage' => 'en',
- 'fileMap' => [
- 'app' => 'app.php',
- // 'app/error' => 'error.php',
- ],
- ],
- // 'model*' => [
- // 'class' => 'yii\i18n\PhpMessageSource',
- // 'basePath' => '@common/messages',
- // 'fileMap' => [
- // 'model' => 'model.php'
- // ]
- // ]
- ],
- ],
- ],
- 'params' => $params,
- 'language' =>'zh-CN',
- ];
|