main.php 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  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,
  60. ],
  61. 'swooleAsyncTimer' => [
  62. 'class' => 'common\components\SwooleAsyncTimer',
  63. ],
  64. // payStack配置
  65. 'Paystack' => [
  66. 'class' => 'smladeoye\paystack\Paystack',
  67. 'environment' => YII_ENV,
  68. 'testPublicKey' => 'pk_test_2eed10135c4a958c5073795b22854ded9d1a6c55',
  69. 'testSecretKey' => 'sk_test_5ece72377432376f5cf6bb5c468395a650220309',
  70. 'livePublicKey' => 'pk_live_fae524f9d073d877beeb661fd825a37a9bc91f0a',
  71. 'liveSecretKey' => 'sk_live_b93c6bbee2cc0e9c594547bf4779ec9852b9d055',
  72. ],
  73. // 配置SQL语句输出
  74. 'log' => [
  75. 'traceLevel' => YII_DEBUG ? 3 : 0,
  76. 'targets' => [
  77. [
  78. 'class' => 'yii\log\FileTarget',
  79. 'levels' => ['error', 'warning', 'info'],
  80. 'categories' => ['yii\db\*', 'app\models\*'],
  81. 'logFile' => '@runtime/logs/sql.log',
  82. ],
  83. 'db' => [ 'class' => 'yii\log\FileTarget'],
  84. ],
  85. ],
  86. // 多语言
  87. 'i18n' => [
  88. 'translations' => [
  89. 'app*' => [
  90. 'class' => 'yii\i18n\PhpMessageSource',
  91. 'basePath' => '@common/messages',
  92. // 'sourceLanguage' => 'en-US',
  93. 'fileMap' => [
  94. 'app' => 'app.php',
  95. 'app/error' => 'error.php',
  96. ],
  97. ],
  98. 'ctx*' => [
  99. 'class' => 'yii\i18n\PhpMessageSource',
  100. 'basePath' => '@common/messages',
  101. // 'sourceLanguage' => 'en-US',
  102. 'fileMap' => [
  103. 'ctx' => 'ctx.php',
  104. 'ctx/error' => 'error.php',
  105. ],
  106. ],
  107. ],
  108. ],
  109. ],
  110. 'controllerMap' => [
  111. 'swoole_server' => [
  112. 'class' => 'anlity\swooleAsyncTimer\SwooleAsyncTimerController',
  113. ],
  114. ],
  115. ];