main.php 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. <?php
  2. // 根据运行环境加载不同的配置文件
  3. $mainConfig = require_once __DIR__ . '/config-product.php';
  4. //if (YII_ENV == YII_ENV_DEV) {
  5. // $mainConfig = require_once __DIR__ . '/config-development.php';
  6. //} else if (YII_ENV == YII_ENV_TEST) {
  7. // $mainConfig = require_once __DIR__ . '/config-test.php';
  8. //} else if (YII_ENV == YII_ENV_PROD) {
  9. // $mainConfig = require_once __DIR__ . '/config-product.php';
  10. //} else {
  11. // $mainConfig = require_once __DIR__ . '/config-development.php';
  12. //}
  13. return [
  14. 'language' => 'zh-CN', // zh-CN 目标语言
  15. 'sourceLanguage' => 'en-US',
  16. 'timeZone' => 'Africa/Lagos',
  17. 'aliases' => [
  18. '@bower' => '@vendor/bower-asset',
  19. '@npm' => '@vendor/npm-asset',
  20. // 'anlity/swooleAsyncTimer' => '@backend/runtime/tmp-extensions/yii2-swoole-async-timer',
  21. ],
  22. 'vendorPath' => dirname(dirname(__DIR__)) . '/vendor',
  23. 'components' => [
  24. 'db' => array_merge([
  25. 'class' => 'yii\db\Connection',
  26. 'enableSlaves' => false,
  27. // 'enableSavepoint' => false,
  28. ], $mainConfig['db'], $mainConfig['slavesDb']),
  29. // 'dbShop' => array_merge(['class' => 'yii\db\Connection', 'schemaMap' => ['oci' => 'common\helpers\Schema']], $mainConfig['dbShop']),
  30. 'dbLog' => array_merge(['class' => 'yii\mongodb\Connection',], $mainConfig['dbLog']),
  31. 'dbCalc' => array_merge(['class' => 'yii\db\Connection'], $mainConfig['dbCalc']),
  32. 'dbCalcServer' => array_merge(['class' => 'yii\db\Connection'], $mainConfig['dbCalcServer']),
  33. // 'dbShopCalc' => array_merge(['class' => 'yii\db\Connection', 'schemaMap' => ['oci' => 'common\helpers\Schema'],], $mainConfig['dbShopCalc']),
  34. 'dbNetPoint' => array_merge(['class' => 'yii\db\Connection'], $mainConfig['dbNetPoint']),
  35. // 'cache' => [
  36. // //'class' => 'yii\caching\FileCache',
  37. // 'class' => 'dcb9\redis\Cache',
  38. // 'redis' => $mainConfig['cacheRedis'],
  39. // ],
  40. 'cache' => [
  41. 'class' => 'yii\redis\Cache',
  42. 'redis' => $mainConfig['cacheRedis'],
  43. // 'redis' => [
  44. // 'hostname' => '127.0.0.1',
  45. // 'port' => 6379,
  46. // 'database' => 0,
  47. // ]
  48. ],
  49. 'tokenRedis' => array_merge(['class' => 'yii\redis\Connection'], $mainConfig['tokenRedis']),
  50. 'redis' => array_merge(['class' => 'yii\redis\Connection'], $mainConfig['otherRedis']),
  51. // 'tokenRedis' => array_merge(['class' => 'common\components\Redis'], $mainConfig['tokenRedis']),
  52. // 'redis' => array_merge(['class' => 'common\components\Redis'], $mainConfig['otherRedis']),
  53. 'mailer' => [
  54. 'class' => 'yii\swiftmailer\Mailer',
  55. 'viewPath' => '@common/mail',
  56. 'useFileTransport' => false,
  57. 'enableSwiftMailerLogging' => true,
  58. 'transport' => [
  59. 'class' => 'Swift_SmtpTransport',
  60. 'host' => 'mail.authsmtp.com',
  61. 'port' => 325,
  62. 'username' => 'ac71555',
  63. 'password' => 'I1j-MKi-fJ8-nHb',
  64. 'encryption' => 'TLS',
  65. ],
  66. ],
  67. 'swooleAsyncTimer' => [
  68. 'class' => 'common\components\SwooleAsyncTimer',
  69. ],
  70. // payStack配置
  71. 'Paystack' => [
  72. 'class' => 'smladeoye\paystack\Paystack',
  73. 'environment' => YII_ENV,
  74. 'testPublicKey' => 'pk_test_2eed10135c4a958c5073795b22854ded9d1a6c55',
  75. 'testSecretKey' => 'sk_test_5ece72377432376f5cf6bb5c468395a650220309',
  76. 'livePublicKey' => 'pk_live_fae524f9d073d877beeb661fd825a37a9bc91f0a',
  77. 'liveSecretKey' => 'sk_live_b93c6bbee2cc0e9c594547bf4779ec9852b9d055',
  78. ],
  79. // 配置SQL语句输出
  80. 'log' => [
  81. 'traceLevel' => YII_DEBUG ? 3 : 0,
  82. 'targets' => [
  83. [
  84. 'class' => 'yii\log\FileTarget',
  85. 'levels' => ['error', 'warning', 'info'],
  86. 'categories' => ['yii\db\*', 'app\models\*'],
  87. 'logFile' => '@runtime/logs/sql.log',
  88. ],
  89. 'db' => [ 'class' => 'yii\log\FileTarget'],
  90. ],
  91. ],
  92. // 多语言
  93. 'i18n' => [
  94. 'translations' => [
  95. 'app*' => [
  96. 'class' => 'yii\i18n\PhpMessageSource',
  97. 'basePath' => '@common/messages',
  98. 'sourceLanguage' => 'en-US',
  99. 'fileMap' => [
  100. 'app' => 'app.php',
  101. 'app/error' => 'error.php',
  102. ],
  103. 'forceTranslation' => true,
  104. ],
  105. 'ctx*' => [
  106. 'class' => 'yii\i18n\PhpMessageSource',
  107. 'basePath' => '@common/messages',
  108. 'sourceLanguage' => 'en-US',
  109. 'fileMap' => [
  110. 'ctx' => 'ctx.php',
  111. 'ctx/error' => 'error.php',
  112. ],
  113. 'forceTranslation' => true,
  114. ],
  115. ],
  116. ],
  117. ],
  118. 'controllerMap' => [
  119. 'swoole_server' => [
  120. 'class' => 'anlity\swooleAsyncTimer\SwooleAsyncTimerController',
  121. ],
  122. ],
  123. ];