You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

116 lines
4.2 KiB

  1. <?php
  2. $params = array_merge(
  3. require __DIR__ . '/../../common/config/params.php', require __DIR__ . '/../../common/config/params-local.php', require __DIR__ . '/params.php', require __DIR__ . '/params-local.php'
  4. );
  5. return [
  6. 'id' => 'api',
  7. 'basePath' => dirname(__DIR__),
  8. 'controllerNamespace' => 'api\controllers',
  9. 'bootstrap' => ['log'],
  10. 'modules' => [],
  11. 'components' => [
  12. 'request' => [
  13. 'parsers' => [
  14. 'application/json' => 'yii\web\JsonParser',
  15. ],
  16. 'csrfParam' => '_csrf-api',
  17. ],
  18. 'session' => [
  19. // this is the name of the session cookie used for login on the app
  20. 'name' => 'api',
  21. ],
  22. 'log' => [
  23. 'traceLevel' => YII_DEBUG ? 3 : 0,
  24. 'targets' => [
  25. [
  26. 'class' => 'yii\log\FileTarget',
  27. 'levels' => ['error', 'warning'],
  28. ],
  29. [
  30. 'class' => 'yii\log\FileTarget',
  31. 'levels' => ['error', 'warning'],
  32. 'categories' => ['notify'],
  33. 'logFile' => '@app/runtime/logs/notify.log',
  34. 'logVars' => [],
  35. 'exportInterval' => 1,
  36. 'prefix' => function ($message) {
  37. }
  38. ],
  39. [
  40. 'class' => 'yii\log\FileTarget',
  41. 'levels' => ['error', 'warning'],
  42. 'categories' => ['refund_log'],
  43. 'logFile' => '@app/runtime/logs/refund_log.log',
  44. 'logVars' => [],
  45. 'exportInterval' => 1,
  46. 'prefix' => function ($message) {
  47. }
  48. ],
  49. ],
  50. ],
  51. 'user' => [
  52. 'identityClass' => 'common\models\User',
  53. 'enableAutoLogin' => true,
  54. 'identityCookie' => ['name' => '_identity-api', 'httpOnly' => true],
  55. ],
  56. 'errorHandler' => [
  57. 'errorAction' => 'site/error',
  58. ],
  59. 'urlManager' => [
  60. 'enablePrettyUrl' => true,
  61. 'enableStrictParsing' => true,
  62. 'showScriptName' => false,
  63. 'rules' => [
  64. ['class' => 'yii\rest\UrlRule', 'controller' => 'goods', 'pluralize' => false],
  65. ['class' => 'yii\rest\UrlRule', 'controller' => 'address', 'pluralize' => false],
  66. ['class' => 'yii\rest\UrlRule', 'controller' => 'taking-site'],
  67. ['class' => 'yii\rest\UrlRule', 'controller' => 'cart'],
  68. ['class' => 'yii\rest\UrlRule', 'controller' => 'comment',
  69. 'extraPatterns' => [
  70. 'DELETE ' => 'delete'
  71. ]],
  72. ['class' => 'yii\rest\UrlRule', 'controller' => 'order'],
  73. ['class' => 'yii\rest\UrlRule', 'controller' => 'collection',
  74. 'extraPatterns' => [
  75. 'DELETE ' => 'delete'
  76. ]
  77. ],
  78. ['class' => 'yii\rest\UrlRule',
  79. 'controller' => 'user',
  80. 'pluralize' => false,
  81. 'extraPatterns' => [
  82. 'GET token' => 'token'
  83. ]
  84. ],
  85. [
  86. 'class' => 'yii\rest\UrlRule',
  87. 'controller' => 'admin',
  88. 'extraPatterns' => [
  89. 'GET menu' => 'menu',
  90. 'GET create' => 'create'
  91. ]
  92. ],
  93. [
  94. 'class' => 'yii\rest\UrlRule',
  95. 'controller' => 'site',
  96. 'extraPatterns' => [
  97. 'GET index' => 'index',
  98. ]
  99. ],
  100. [
  101. 'class' => 'yii\rest\UrlRule',
  102. 'controller' => 'wx-payment',
  103. 'pluralize' => false,
  104. 'extraPatterns' => [
  105. 'GET web' => 'web',
  106. 'POST notify' => 'notify',
  107. 'POST apply-refund' => 'apply-refund',
  108. ]
  109. ],
  110. ],
  111. ],
  112. ],
  113. 'params' => $params,
  114. ];