main.php 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  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. // send all mails to a file by default. You have to set
  57. // 'useFileTransport' to false and configure a transport
  58. // for the mailer to send real emails.
  59. 'useFileTransport' => true, // true(缓存到文件中) false(发送邮件)
  60. 'transport' => [
  61. 'class' => 'Swift_SmtpTransport',
  62. 'host' => 'mail.authsmtp.com',
  63. 'port' => 325,
  64. 'username' => 'ac71555',
  65. 'password' => 'I1j-MKi-fJ8-nHb',
  66. 'encryption' => 'TLS',
  67. // 'host' => 'smtp.163.com',
  68. // 'port' => 465,
  69. // 'username' => '18511880790@163.com',
  70. // 'password' => 'YOUSSWQHISDSWPVB',
  71. // 'encryption' => 'SSL',
  72. ],
  73. ],
  74. 'swooleAsyncTimer' => [
  75. 'class' => 'common\components\SwooleAsyncTimer',
  76. ],
  77. // payStack配置
  78. 'Paystack' => [
  79. 'class' => 'smladeoye\paystack\Paystack',
  80. 'environment' => YII_ENV,
  81. 'testPublicKey' => 'pk_test_2eed10135c4a958c5073795b22854ded9d1a6c55',
  82. 'testSecretKey' => 'sk_test_5ece72377432376f5cf6bb5c468395a650220309',
  83. 'livePublicKey' => 'pk_live_fae524f9d073d877beeb661fd825a37a9bc91f0a',
  84. 'liveSecretKey' => 'sk_live_b93c6bbee2cc0e9c594547bf4779ec9852b9d055',
  85. ],
  86. // 配置SQL语句输出
  87. 'log' => [
  88. 'traceLevel' => YII_DEBUG ? 3 : 0,
  89. 'targets' => [
  90. [
  91. 'class' => 'yii\log\FileTarget',
  92. 'levels' => ['error', 'warning', 'info'],
  93. 'categories' => ['yii\db\*', 'app\models\*'],
  94. 'logFile' => '@runtime/logs/sql.log',
  95. ],
  96. 'db' => [ 'class' => 'yii\log\FileTarget'],
  97. ],
  98. ],
  99. // 多语言
  100. 'i18n' => [
  101. 'translations' => [
  102. 'app*' => [
  103. 'class' => 'yii\i18n\PhpMessageSource',
  104. 'basePath' => '@common/messages',
  105. 'sourceLanguage' => 'en-US',
  106. 'fileMap' => [
  107. 'app' => 'app.php',
  108. 'app/error' => 'error.php',
  109. ],
  110. 'forceTranslation' => true,
  111. ],
  112. 'ctx*' => [
  113. 'class' => 'yii\i18n\PhpMessageSource',
  114. 'basePath' => '@common/messages',
  115. 'sourceLanguage' => 'en-US',
  116. 'fileMap' => [
  117. 'ctx' => 'ctx.php',
  118. 'ctx/error' => 'error.php',
  119. ],
  120. 'forceTranslation' => true,
  121. ],
  122. ],
  123. ],
  124. ],
  125. 'controllerMap' => [
  126. 'swoole_server' => [
  127. 'class' => 'anlity\swooleAsyncTimer\SwooleAsyncTimerController',
  128. ],
  129. ],
  130. ];