params.php 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. <?php
  2. $hostData = \common\components\httpUtil::getHttpHost();
  3. $http = $hostData['http'];
  4. $suffix = $hostData['suffix'];
  5. $miniUrl = $http . 'mini.' . $suffix;
  6. $adminUrl = $http . 'a.' . $suffix;
  7. $frontUrl = $http . 'm.' . $suffix;
  8. $mobileUrl = $http . 'm.' . $suffix;
  9. $openUrl = $http . 'o.' . $suffix;
  10. $picUrl = $http . 'pic.' . $suffix;
  11. $wwwUrl = $http . 'www.' . $suffix;
  12. $cssUrl = $http . 'css.' . $suffix;
  13. $jsUrl = $http . 'js.' . $suffix;
  14. $config = [
  15. //全站统一使用的秘钥
  16. 'secretKey' => 'CzWjvVY5F.dUqT65Knj81qh_eU2wI3SokO',
  17. 'adminUrl' => $adminUrl,
  18. 'frontUrl' => $frontUrl,
  19. 'openUrl' => $openUrl,
  20. 'picUrl' => $picUrl,
  21. 'wwwUrl' => $wwwUrl,
  22. 'mobileUrl' => $mobileUrl,
  23. 'miniUrl' => $miniUrl,
  24. //平台来源
  25. 'ptSource' => [
  26. //商城移动端
  27. 'mobile' => 1,
  28. //商城小程序
  29. 'mini' => 2,
  30. //商家后台PC端
  31. 'admin' => 3,
  32. //商家后台移动端
  33. 'back' => 4,
  34. //总后台
  35. 'saas' => 5,
  36. ],
  37. //永不过期时间
  38. 'neverExpireTime' => 4102416000,
  39. //永不过期日期
  40. 'neverExpireDate' => '2100-01-01 00:00:00',
  41. 'pageSize' => 20,
  42. ];
  43. $prefixHttp = 'http://';
  44. $userAgent = isset($_SERVER['HTTP_USER_AGENT']) ? strtolower($_SERVER['HTTP_USER_AGENT']) : '';
  45. if (strpos($userAgent, 'miniprogram') === true) {
  46. $prefixHttp = 'https://';
  47. }
  48. $referrer = isset($_SERVER["HTTP_REFERER"]) ? strtolower($_SERVER["HTTP_REFERER"]) : '';
  49. if (strpos($referrer, 'servicewechat.com') === true) {
  50. $prefixHttp = 'https://';
  51. }
  52. if (strpos($referrer, 'https') === true) {
  53. $prefixHttp = 'https://';
  54. }
  55. if(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on'){
  56. $prefixHttp = 'https://';
  57. }
  58. if (getenv('YII_ENV') == 'local') {
  59. $config['mHost'] = $prefixHttp . 'api.m.hhb.com';
  60. $config['bHost'] = $prefixHttp . 'api.b.hhb.com';
  61. if (strpos($referrer, $prefixHttp . 'h') === true || strpos($referrer, $prefixHttp . 'api.h') === true) {
  62. $config['bHost'] = $prefixHttp . 'api.h.hhb.com';
  63. }
  64. $config['sHost'] = $prefixHttp . 'api.s.hhb.com';
  65. $config['wHost'] = $prefixHttp . 'api.w.hhb.com';
  66. $config['host'] = 'hhb.com';
  67. $config['imgHost'] = $prefixHttp . 'img.hhb.com';
  68. $config['wDomain'] = $prefixHttp . 'www.hhb.com';
  69. $config['mDomain'] = $prefixHttp . 'm.hhb.com';
  70. $config['bDomain'] = $prefixHttp . 'b.hhb.com';
  71. }
  72. if (getenv('YII_ENV') == 'test') {
  73. $config['mHost'] = $prefixHttp . 'api.m.hzghd.com';
  74. $config['bHost'] = $prefixHttp . 'api.b.hzghd.com';
  75. if (strpos($referrer, $prefixHttp . 'h') === true || strpos($referrer, $prefixHttp . 'api.h') === true) {
  76. $config['bHost'] = $prefixHttp . 'api.h.hzghd.com';
  77. }
  78. $config['sHost'] = $prefixHttp . 'api.s.hzghd.com';
  79. $config['wHost'] = $prefixHttp . 'api.w.hzghd.com';
  80. $config['host'] = 'hzghd.com';
  81. $config['imgHost'] = $prefixHttp . 'img.hzghd.com';
  82. $config['wDomain'] = $prefixHttp . 'www.hzghd.com';
  83. $config['mDomain'] = $prefixHttp . 'm.hzghd.com';
  84. $config['bDomain'] = $prefixHttp . 'b.hzghd.com';
  85. }
  86. if (getenv('YII_ENV') == 'dev') {
  87. $config['mHost'] = $prefixHttp . 'api.m.huaml.com';
  88. $config['bHost'] = $prefixHttp . 'api.b.huaml.com';
  89. if (strpos($referrer, $prefixHttp . 'h') === true || strpos($referrer, $prefixHttp . 'api.h') === true) {
  90. $config['bHost'] = $prefixHttp . 'api.h.huaml.com';
  91. }
  92. $config['sHost'] = $prefixHttp . 'api.s.huaml.com';
  93. $config['wHost'] = $prefixHttp . 'api.w.huaml.com';
  94. $config['host'] = 'huaml.com';
  95. $config['imgHost'] = $prefixHttp . 'img.huaml.com';
  96. $config['wDomain'] = $prefixHttp . 'www.huaml.com';
  97. $config['mDomain'] = $prefixHttp . 'm.huaml.com';
  98. $config['bDomain'] = $prefixHttp . 'b.huaml.com';
  99. }
  100. if (getenv('YII_ENV') == 'production') {
  101. $config['mHost'] = $prefixHttp . 'api.m.huahb.com';
  102. $config['bHost'] = $prefixHttp . 'api.b.huahb.com';
  103. if (strpos($referrer, $prefixHttp . 'h') === true || strpos($referrer, $prefixHttp . 'api.h') === true) {
  104. $config['bHost'] = $prefixHttp . 'api.h.huahb.com';
  105. }
  106. $config['sHost'] = $prefixHttp . 'api.s.huahb.com';
  107. $config['wHost'] = $prefixHttp . 'api.w.huahb.com';
  108. $config['host'] = 'huahb.com';
  109. $config['imgHost'] = $prefixHttp . 'img.huahb.com';
  110. $config['wDomain'] = $prefixHttp . 'www.huahb.com';
  111. $config['mDomain'] = $prefixHttp . 'm.huahb.com';
  112. $config['bDomain'] = $prefixHttp . 'b.huahb.com';
  113. }
  114. return $config;