main.php 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. <?php
  2. $params = array_merge(
  3. require __DIR__ . '/../../common/config/params.php',
  4. require __DIR__ . '/../../common/config/params-local.php',
  5. require __DIR__ . '/params.php',
  6. require __DIR__ . '/params-local.php'
  7. );
  8. return [
  9. 'id' => 'merchant',
  10. 'basePath' => dirname(__DIR__),
  11. 'controllerNamespace' => 'merchant\controllers',
  12. 'defaultRoute' => 'main', // 默认控制器
  13. 'bootstrap' => ['log'],
  14. 'modules' => [
  15. ],
  16. 'components' => [
  17. 'request' => [
  18. 'csrfParam' => '_csrf-merchant',
  19. ],
  20. 'user' => [
  21. 'identityClass' => 'common\models\member\Member',
  22. 'enableAutoLogin' => true,
  23. 'identityCookie' => ['name' => '_identity-merchant', 'httpOnly' => true],
  24. 'idParam' => '__merchant',
  25. 'on afterLogin' => function ($event) {
  26. Yii::$app->services->member->lastLogin($event->identity);
  27. },
  28. ],
  29. 'session' => [
  30. // this is the name of the session cookie used for login on the merchant
  31. 'name' => 'advanced-merchant',
  32. 'timeout' => 86400,
  33. ],
  34. 'log' => [
  35. 'traceLevel' => YII_DEBUG ? 3 : 0,
  36. 'targets' => [
  37. [
  38. 'class' => 'yii\log\FileTarget',
  39. 'levels' => ['error', 'warning'],
  40. 'logFile' => '@runtime/logs/' . date('Y-m/d') . '.log',
  41. ],
  42. ],
  43. ],
  44. 'errorHandler' => [
  45. 'errorAction' => 'site/error',
  46. ],
  47. 'urlManager' => [
  48. 'enablePrettyUrl' => true,
  49. 'showScriptName' => false,
  50. 'rules' => [
  51. ],
  52. ],
  53. 'assetManager' => [
  54. // 'linkAssets' => true,
  55. 'bundles' => [
  56. 'yii\web\JqueryAsset' => [
  57. 'js' => [],
  58. 'sourcePath' => null,
  59. ],
  60. 'yii\bootstrap4\BootstrapAsset' => [
  61. 'css' => [], // 去除 bootstrap.css
  62. 'sourcePath' => null,
  63. ],
  64. 'yii\bootstrap4\BootstrapPluginAsset' => [
  65. 'js' => [], // 去除 bootstrap.js
  66. 'sourcePath' => null,
  67. ],
  68. ],
  69. ],
  70. 'response' => [
  71. 'class' => 'yii\web\Response',
  72. 'on beforeSend' => function($event) {
  73. Yii::$app->services->log->record($event->sender);
  74. },
  75. ],
  76. ],
  77. 'container' => [
  78. 'definitions' => [
  79. \yii\widgets\LinkPager::class => \yii\bootstrap4\LinkPager::class,
  80. 'yii\bootstrap4\LinkPager' => [
  81. 'options' => [
  82. 'class' => ['clearfix'],
  83. ],
  84. 'listOptions' => [
  85. 'class' => ['pagination float-right hide'],
  86. ],
  87. 'nextPageLabel' => '<i class="icon ion-ios-arrow-right"></i>',
  88. 'prevPageLabel' => '<i class="icon ion-ios-arrow-left"></i>',
  89. 'lastPageLabel' => '<i class="icon ion-ios-arrow-right"></i><i class="icon ion-ios-arrow-right"></i>',
  90. 'firstPageLabel' => '<i class="icon ion-ios-arrow-left"></i><i class="icon ion-ios-arrow-left"></i>',
  91. ]
  92. ],
  93. 'singletons' => [
  94. // 依赖注入容器单例配置
  95. ]
  96. ],
  97. 'controllerMap' => [
  98. 'files' => 'common\widgets\webuploader\FilesController', // 文件上传公共控制器
  99. 'ueditor' => 'common\widgets\ueditor\UEditorController', // 百度编辑器
  100. 'map' => 'common\widgets\map\MapController', // 经纬度选择
  101. 'map-overlay' => 'common\widgets\map\MapOverlayController', // 地图范围设置
  102. 'cropper' => 'common\widgets\cropper\CropperController', // 图片裁剪
  103. 'provinces' => 'common\controllers\ProvincesController', // 省市区
  104. 'notify' => 'common\widgets\notify\NotifyController', // 消息
  105. 'personal' => 'backend\controllers\PersonalController', // 个人信息
  106. ],
  107. 'params' => $params,
  108. ];
粤ICP备19079148号