Files
xk-api-yii/admin/config/main.php

152 lines
5.4 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
$params = array_merge(
require(__DIR__ . '/../../common/config/params.php'),
require(__DIR__ . '/../../common/config/params-local.php'),
require(__DIR__ . '/params.php'),
require(__DIR__ . '/menu.php'),
require(__DIR__ . '/store_menu.php'),
require(__DIR__ . '/agent_menu.php'),
require(__DIR__ . '/supplier_menu.php'),
require(__DIR__ . '/params-local.php')
);
return [
'id' => 'app-backend',
'name'=>'萧康医院',
'basePath' => dirname(__DIR__),
/* 控制器默认命名空间 */
'controllerNamespace' => 'admin\controllers',
/**
* 比较重要的属性,系统启动阶段(一般new application()最后)加载的组件或模块。
* 如果该组件或模块实现BootstrapInterface接口那么就会执行bootstrap()方法yii/base/application类315行左右。
* 应用案例yii-debug扩展或者设想我有个需求在数据库中配置某些组件和模块的开启或关闭。这样可以不将这些组件或模块
* 配置在config.php中而写在数据库中通过bootstrap()方法将这些组件模块动态加载到系统中。
* 参考http://www.yiichina.com/doc/guide/2.0/structure-applications#bootstrap
*/
// 'bootstrap' => ['log'],
/**
* 模块
*/
'modules' => [
'v1' => [
'class' => 'admin\modules\v1\Module',
],
'doc'=>[
'class' => 'cfd\doc\Module',
// 'modelDescriptions'=>require __DIR__ . '/model_description.php',
'modelsMap'=>[
'\common\models\\',
'\common\modelsgii\\',
]
],
],
/* 默认路由 */
'defaultRoute' => 'index',
/* 默认布局文件 优先级 控制器>配置文件>系统默认 */
'layout' => 'main',
/**
* 组件
*/
'components' => [
// 身份认证类 默认yii\web\user
'user' => [
'class' => 'yii\web\User',
'identityClass' => 'admin\models\Admin',
'enableSession' => false, //关闭session
'enableAutoLogin' => true,
'loginUrl' => null, //默认登录url
'on afterLogin' => function ($event) {
$user = $event->identity;
$user->last_login_ip = ip2long(\Yii::$app->request->userIP);
$user->last_login_time = time();
$user->save();
}
],
// 修改默认的request组件
'request' => [
'parsers' => [
'application/json' =>\yii\web\JsonParser::class
]
],
// 数据库RBAC权限控制
'authManager' => [
'class' => 'common\core\rbac\DbManager',
],
// 日志
// 'log' => [
// 'traceLevel' => YII_DEBUG ? 3 : 0,
// 'targets' => [
// [
// 'class' => 'yii\log\FileTarget',
// 'levels' => ['error', 'warning'],//info会记录一些删除的信息放开一下
// ],
// ],
// ],
// 错误处理器
/*'errorHandler' => [
'errorAction' => 'public/404',
],*/
// 链接管理
'urlManager' => [
'class' => 'common\core\UrlManager',
'enablePrettyUrl' => 'BACKEND_PRETTY_URL', //开启url规则
'showScriptName' => false, //是否显示链接中的index.php
//'suffix' => '.html', //后缀
'rules' => [
//
],
],
// 响应组件
'response' => [
'class' => 'yii\web\Response',
'format' => \yii\web\Response::FORMAT_JSON,
'formatters' => [
\yii\web\Response::FORMAT_JSON => [
'class' => 'admin\foundation\JsonResponseFormatter',
'prettyPrint' => YII_DEBUG, // use "pretty" output in debug mode
'encodeOptions' => JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE,
],
],
],
/**
* 这里要注意了由于我使用的是模板自带的jQuery和bootstrap所以这里就先清空系统的jQuery和bootstrap
* 基本上所有的插件都是使用了yii\web\JqueryAsset
* 为了模板全局的js/css放在其他插件的前面这里我设置了yii\web\JqueryAsset依赖backend\assets\AppAsset
*/
//'assetManager' => [
// 'bundles' => [
// 'yii\web\JqueryAsset' => [
// 'sourcePath' => null,
// 'js' => [],
// 'depends' => [
// 'backend\assets\AppAsset'
// ]
// ],
// 'yii\bootstrap\BootstrapAsset' => [
// 'css' => []
// ],
// ],
//
//],
],
/**
* 该属性允许你用一个数组定义多个 别名 代替 Yii::setAlias()
*/
'aliases' => [
'@bower' => '@vendor/bower-asset'
],
/**
* 通过配置文件附加行为,全局
*/
//'as rbac' => [
// 'class' => 'admin\behaviors\RbacBehavior',
// 'allowActions' => [
// 'login/login', 'v1/admin/login','v1/admin/my-menu', 'login/logout', 'public*', 'debug/*', 'gii/*', 'order/settle-result' // 不需要权限检测
// ]
//],
'params' => $params,
];