main.php 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. $mainConfig = require_once __DIR__ . '/config.php';
  3. return [
  4. 'language' => 'zh-CN',
  5. 'timeZone' => 'PRC',
  6. 'aliases' => [
  7. '@bower' => '@vendor/bower-asset',
  8. '@npm' => '@vendor/npm-asset',
  9. // 'anlity/swooleAsyncTimer' => '@backend/runtime/tmp-extensions/yii2-swoole-async-timer',
  10. ],
  11. 'vendorPath' => dirname(dirname(__DIR__)) . '/vendor',
  12. 'components' => [
  13. 'db' => array_merge([
  14. 'class' => 'yii\db\Connection',
  15. 'enableSlaves' => false,
  16. // 'enableSavepoint' => false,
  17. ], $mainConfig['db'], $mainConfig['slavesDb']),
  18. // 'dbShop' => array_merge(['class' => 'yii\db\Connection', 'schemaMap' => ['oci' => 'common\helpers\Schema']], $mainConfig['dbShop']),
  19. 'dbLog' => array_merge(['class' => 'yii\mongodb\Connection',], $mainConfig['dbLog']),
  20. 'dbCalc' => array_merge(['class' => 'yii\db\Connection'], $mainConfig['dbCalc']),
  21. // 'dbShopCalc' => array_merge(['class' => 'yii\db\Connection', 'schemaMap' => ['oci' => 'common\helpers\Schema'],], $mainConfig['dbShopCalc']),
  22. 'dbNetPoint' => array_merge(['class' => 'yii\db\Connection'], $mainConfig['dbNetPoint']),
  23. 'cache' => [
  24. //'class' => 'yii\caching\FileCache',
  25. 'class' => 'dcb9\redis\Cache',
  26. 'redis' => $mainConfig['cacheRedis'],
  27. ],
  28. 'tokenRedis' => array_merge(['class' => 'common\components\Redis'], $mainConfig['tokenRedis']),
  29. 'redis' => array_merge(['class' => 'common\components\Redis'], $mainConfig['otherRedis']),
  30. 'mailer' => [
  31. 'class' => 'yii\swiftmailer\Mailer',
  32. 'viewPath' => '@common/mail',
  33. // send all mails to a file by default. You have to set
  34. // 'useFileTransport' to false and configure a transport
  35. // for the mailer to send real emails.
  36. 'useFileTransport' => true,
  37. ],
  38. 'swooleAsyncTimer' => [
  39. 'class' => 'common\components\SwooleAsyncTimer',
  40. ],
  41. ],
  42. 'controllerMap' => [
  43. 'swoole_server' => [
  44. 'class' => 'anlity\swooleAsyncTimer\SwooleAsyncTimerController',
  45. ],
  46. ],
  47. ];