params.php 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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 . 'mall.' . $suffix;
  8. $mobileUrl = $http . 'mall.' . $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['mallHost'] = $prefixHttp . 'api.mall.hhb.com';
  60. $config['shopHost'] = $prefixHttp . 'api.shop.hhb.com';
  61. $config['saasHost'] = $prefixHttp . 'api.saas.hhb.com';
  62. $config['host'] = 'hhb.com';
  63. $config['imgHost'] = $prefixHttp . 'img.hhb.com';
  64. $config['mallDomain'] = $prefixHttp . 'mall.hhb.com';
  65. $config['shopDomain'] = $prefixHttp . 'shop.hhb.com';
  66. }
  67. if (getenv('YII_ENV') == 'test') {
  68. $config['mallHost'] = $prefixHttp . 'api.mall.hzghd.com';
  69. $config['shopHost'] = $prefixHttp . 'api.shop.hzghd.com';
  70. $config['saasHost'] = $prefixHttp . 'api.saas.hzghd.com';
  71. $config['host'] = 'hzghd.com';
  72. $config['imgHost'] = $prefixHttp . 'img.hzghd.com';
  73. $config['mallDomain'] = $prefixHttp . 'mall.hzghd.com';
  74. $config['shopDomain'] = $prefixHttp . 'shop.hzghd.com';
  75. }
  76. if (getenv('YII_ENV') == 'dev') {
  77. $config['mallHost'] = $prefixHttp . 'api.mall.huaml.com';
  78. $config['shopHost'] = $prefixHttp . 'api.shop.huaml.com';
  79. $config['saasHost'] = $prefixHttp . 'api.saas.huaml.com';
  80. $config['host'] = 'huaml.com';
  81. $config['imgHost'] = $prefixHttp . 'img.huaml.com';
  82. $config['mallDomain'] = $prefixHttp . 'mall.huaml.com';
  83. $config['shopDomain'] = $prefixHttp . 'shop.huaml.com';
  84. }
  85. if (getenv('YII_ENV') == 'production') {
  86. $config['mallHost'] = $prefixHttp . 'api.mall.huahb.com';
  87. $config['shopHost'] = $prefixHttp . 'api.shop.huahb.com';
  88. $config['saasHost'] = $prefixHttp . 'api.saas.huahb.com';
  89. $config['host'] = 'huahb.com';
  90. $config['imgHost'] = $prefixHttp . 'img.huahb.com';
  91. $config['mallDomain'] = $prefixHttp . 'mall.huahb.com';
  92. $config['shopDomain'] = $prefixHttp . 'shop.huahb.com';
  93. }
  94. return $config;