main.php 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  1. <?php
  2. $params = array_merge(
  3. require __DIR__ . '/../../common/config/params.php',
  4. require __DIR__ . '/../../common/config/params-local.php',
  5. require __DIR__ . '/params.php',
  6. require __DIR__ . '/params-local.php'
  7. );
  8. $emailConfig = json_decode(file_get_contents(Yii::getAlias('@backend').'/config/email.json'),true);
  9. return [
  10. 'id' => 'app-frontend',
  11. 'basePath' => dirname(__DIR__),
  12. 'bootstrap' => ['log'],
  13. 'controllerNamespace' => 'frontend\controllers',
  14. 'components' => [
  15. 'request' => [
  16. 'csrfParam' => 'csrf_token_f',
  17. ],
  18. 'user' => [
  19. 'identityClass' => 'common\models\User',
  20. 'enableAutoLogin' => true,
  21. 'identityCookie' => ['name' => '_identity-frontend', 'httpOnly' => true],
  22. ],
  23. 'hostserver' => [
  24. 'class' => 'common\api\HostServer',
  25. ],
  26. 'session' => [
  27. // this is the name of the session cookie used for login on the frontend
  28. 'name' => 'advanced-frontend',
  29. ],
  30. 'mailer' => [ //邮箱设置
  31. 'class' => 'yii\swiftmailer\Mailer',
  32. 'useFileTransport' => false,//这句一定有,false发送邮件,true只是生成邮件在runtime文件夹下,不发邮件
  33. 'transport' => $emailConfig,
  34. 'messageConfig'=>[
  35. 'charset'=>'UTF-8',
  36. 'from'=>[$emailConfig['username']=>'客户报名信息']
  37. ],
  38. ],
  39. 'log' => [
  40. 'traceLevel' => YII_DEBUG ? 3 : 0,
  41. 'targets' => [
  42. [
  43. 'class' => 'yii\log\FileTarget',
  44. 'levels' => ['error', 'warning'],
  45. ],
  46. // [
  47. // 'class' => 'yii\log\FileTarget',
  48. // 'levels' => ['error'],
  49. // 'logVars'=>[],
  50. // //表示以yii\db\或者app\models\开头的分类都会写入这个文件
  51. // 'categories'=>['yii\db\*','common\models\*'],
  52. // //表示写入到文件sql.log中年月日记录日志
  53. // 'logFile'=>'@runtime/../logs/sql/sql.log'.date('Ymd'),
  54. // ],
  55. // [
  56. // 'class' => 'yii\log\EmailTarget',
  57. // 'mailer' => 'mailer',
  58. // 'levels' => ['error', 'warning'],
  59. //// 'categories' => ['yii\db\*','common\models\*','backend\controllers\*'],
  60. // 'message' => [
  61. // 'from'=>[$emailConfig['username']=>'易购'],
  62. // 'to' => ['313298389@qq.com'],
  63. // 'subject' => '易购-错误信息',
  64. // ],
  65. // ],
  66. ],
  67. ],
  68. 'errorHandler' => [
  69. 'errorAction' => 'public/error',
  70. ],
  71. 'assetManager' => [
  72. // 'class' => 'yii\web\AssetManager',
  73. // 'appendTimestamp' => true,
  74. // 'forceCopy' => true,
  75. 'bundles' => [
  76. // 'linkAssets' => true,
  77. 'yii\web\YiiAsset' => [
  78. 'js' => [], // 去除 yii.js
  79. 'sourcePath' => null, // 防止在 frontend/web/asset 下生产文件
  80. ],
  81. 'yii\widgets\ActiveFormAsset' => [
  82. 'js' => [], // 去除 yii.activeForm.js
  83. 'sourcePath' => null, // 防止在 frontend/web/asset 下生产文件
  84. ],
  85. 'yii\validators\ValidationAsset' => [
  86. 'js' => [], // 去除 yii.validation.js
  87. 'sourcePath' => null, // 防止在 frontend/web/asset 下生产文件
  88. ],
  89. // 'yii\bootstrap\BootstrapAsset' => [
  90. // 'css' => [], // 去除 bootstrap.css
  91. // 'sourcePath' => null, // 防止在 frontend/web/asset 下生产文件
  92. // ],
  93. 'yii\bootstrap\BootstrapPluginAsset' => [
  94. 'js' => [], // 去除 bootstrap.js
  95. 'sourcePath' => null, // 防止在 frontend/web/asset 下生产文件
  96. ],
  97. 'yii\web\JqueryAsset' => [
  98. 'js' => [], // 去除 jquery.js
  99. 'sourcePath' => null, // 防止在 frontend/web/asset 下生产文件
  100. ],
  101. ],
  102. ],
  103. 'urlManager' => [
  104. 'enablePrettyUrl' => true,
  105. 'showScriptName' => false,
  106. // 'enableStrictParsing' => true,
  107. 'rules' => [
  108. '/house/search<t:(/|)>' =>'/house/search',
  109. '/house/vr<t:(/|)>' =>'/house/vr',
  110. '/house/search<t:(/|)>' =>'/house/search',
  111. '/house/abroad<t:(/|)>' =>'/house/abroad',
  112. '/'=>'index/index',
  113. '/json/cityprice'=>'/json/cityprice',
  114. '/json/houseprice'=>'/json/houseprice',
  115. '/house/remark/<hid:\w+><t:(/|)>' =>'/house/remark',//楼盘点评
  116. '/house/news/<hid:\w+><t:(/|)>' =>'/house/news',
  117. '/house/typedetails/<hid:\w+><t:(/|)>' => '/house/typedetails', //楼盘户型详情页
  118. '/house/type/<hid:\w+><t:(/|)>' =>'/house/type',
  119. '/house/details/<hid:\w+><t:(/|)>' =>'/house/details',
  120. '/house/periphery/<hid:\w+><t:(/|)>' =>'/house/periphery',
  121. '/house/album/<hid:\w+><t:(/|)>' =>'/house/album',
  122. '/house/remarkfrom' => "house/remarkfrom",
  123. '/house/houseremark/<hid:\w+><t:(/|)>' => "/house/houseremark",
  124. '/house/remarklikesfrom' => '/house/remarklikesfrom',
  125. '/house/dynamic' =>'/house/dynamic',
  126. '/house/housetype' =>'/house/housetype',
  127. '/house/housetypeall' =>'/house/housetypeall',
  128. '/house/albumlist' =>'/house/albumlist',
  129. '/house/getalbumlist' =>'/house/getalbumlist',
  130. '/house/checkcode' =>'/house/checkcode',
  131. '/house/sendcode' =>'/house/sendcode',
  132. '/house/tall' =>'/house/tall',
  133. '/house/zhongqu/<hid:\w+><t:(/|)>' =>'/house/zhongqu', //VR 详情
  134. //'/house/<hid:\w+><t:(/|)>' => '/house/home',
  135. //'/house/<hid:\w+><t:(/|)><city:(\w+|)><s:(/|)>' => '/house/home',
  136. '/house/<hid:><t:(/|)>' => '/house/home',
  137. '/knowledgebase/tools' =>'/knowledgebase/tools',
  138. '/knowledgebase/details/<nid:\w+><t:(/|)>'=>'/knowledgebase/details',
  139. '/knowledgebase/list/<cid:\w+><t:(/|)>'=>'/knowledgebase/list',
  140. '/news/details/<nid:\w+><t:(/|)>'=>'/news/details',
  141. '/news/newshouse'=>'/news/newshouse',
  142. '/news/<cid:(\w+|)><t:(/|)>'=>'/news/home',
  143. '/news/'=>'/news/home',
  144. '/fresh<t:(/|)>'=>'/fresh/home',
  145. '/city/<cid:\w+><t:(/|)>'=>'/city/index',
  146. '/map/home<t:(/|)>'=>'/map/home',
  147. '/pj/details/<pid:\w+><t:(/|)>'=>'/pj/details',
  148. '/pj<t:(/|)>'=>'/pj/home',
  149. '/weirdo/details<t:(/|)><qid:\w+><a:(/|)>'=>'/weirdo/details',
  150. '/weirdo<t:(/|)>'=>'/weirdo/home',
  151. '<controller:\w+>/<action:\w+>.html'=>'<controller>/<action>',
  152. '<controller:\w+>/<action:\w+>.php'=>'<controller>/<action>',
  153. // '/house/search.\w+/<data:\w+>/<page:\w+>' => '/house/search',
  154. // '/house/search.\w+/<city:\d+>/<price:\d>/<type:\d>/<zhuti:\d>/' => '/house/search',
  155. // '<controller:\w+>/<action:\w+>/'=>'<controller>/<action>',
  156. ],
  157. ],
  158. 'i18n' => [ //语言配置
  159. 'translations' => [
  160. 'app*' => [
  161. 'class' => 'yii\i18n\PhpMessageSource',
  162. 'basePath' => '@common/messages',
  163. // 'sourceLanguage' => 'en',
  164. 'fileMap' => [
  165. 'app' => 'app.php',
  166. // 'app/error' => 'error.php',
  167. ],
  168. ],
  169. // 'model*' => [
  170. // 'class' => 'yii\i18n\PhpMessageSource',
  171. // 'basePath' => '@common/messages',
  172. // 'fileMap' => [
  173. // 'model' => 'model.php'
  174. // ]
  175. // ]
  176. ],
  177. ],
  178. ],
  179. 'params' => $params,
  180. 'language' =>'zh-CN',
  181. ];