params.php 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  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. 'pt' => 5,
  36. ],
  37. //永不过期时间
  38. 'neverExpireTime' => 4102416000,
  39. //永不过期日期
  40. 'neverExpireDate' => '2100-01-01 00:00:00',
  41. 'pageSize' => 20,
  42. //aliyun oss ak
  43. 'accessKeyId'=>'LTAI4GCXNRgt87qnCB8JrGFt',
  44. 'accessKeySecret'=>'m5q7aU3wGcoid9wr0yFJ4JqzHMKfks',
  45. 'endpoint'=>'oss-cn-hangzhou.aliyuncs.com',
  46. ];
  47. $prefixHttp = 'http://';
  48. $userAgent = isset($_SERVER['HTTP_USER_AGENT']) ? strtolower($_SERVER['HTTP_USER_AGENT']) : '';
  49. if (strpos($userAgent, 'miniprogram') === true) {
  50. $prefixHttp = 'https://';
  51. }
  52. $referrer = isset($_SERVER["HTTP_REFERER"]) ? strtolower($_SERVER["HTTP_REFERER"]) : '';
  53. if (strpos($referrer, 'servicewechat.com') === true) {
  54. $prefixHttp = 'https://';
  55. }
  56. if (strpos($referrer, 'https') === true) {
  57. $prefixHttp = 'https://';
  58. }
  59. if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') {
  60. $prefixHttp = 'https://';
  61. }
  62. if (getenv('YII_ENV') == 'local') {
  63. $config['hdHost'] = $prefixHttp . 'api.shop.hhb.com';
  64. $config['hdDomain'] = $prefixHttp . 'shop.hhb.com';
  65. $config['hdPtHost'] = $prefixHttp . 'api.pt.hhb.com';
  66. $config['hdShortHost'] = 'hhb.com';
  67. $config['hdImgHost'] = $prefixHttp . 'img.hhb.com';
  68. $config['ghsHost'] = $prefixHttp . 'api.shop.xhb.com';
  69. $config['ghsDomain'] = $prefixHttp . 'shop.xhb.com';
  70. $config['ghsPtHost'] = $prefixHttp . 'api.pt.xhb.com';
  71. $config['ghsShortHost'] = 'xhb.com';
  72. $config['ghsImgHost'] = $prefixHttp . 'img.xhb.com';
  73. $config['ossBucket'] = 'pic-hhb-cs';
  74. }
  75. if (getenv('YII_ENV') == 'test') {
  76. $config['hdHost'] = $prefixHttp . 'api.shop.huaml.com';
  77. $config['hdDomain'] = $prefixHttp . 'shop.huaml.com';
  78. $config['hdPtHost'] = $prefixHttp . 'api.pt.huaml.com';
  79. $config['hdShortHost'] = 'huaml.com';
  80. $config['hdImgHost'] = $prefixHttp . 'img.huaml.com/';
  81. $config['ghsHost'] = $prefixHttp . 'api.shop.hzghd.com';
  82. $config['ghsDomain'] = $prefixHttp . 'shop.hzghd.com';
  83. $config['ghsPtHost'] = $prefixHttp . 'api.pt.hzghd.com';
  84. $config['ghsShortHost'] = 'hzghd.com';
  85. $config['ghsImgHost'] = $prefixHttp . 'img.hzghd.com/';
  86. $config['ossBucket'] = 'pic-hhb-cs';
  87. }
  88. if (getenv('YII_ENV') == 'dev') {
  89. $config['hdHost'] = $prefixHttp . 'api.shop.huaml.com';
  90. $config['hdDomain'] = $prefixHttp . 'shop.huaml.com';
  91. $config['hdPtHost'] = $prefixHttp . 'api.pt.huaml.com';
  92. $config['hdShortHost'] = 'huaml.com';
  93. $config['hdImgHost'] = $prefixHttp . 'img.huaml.com/';
  94. $config['ghsHost'] = $prefixHttp . 'api.shop.hzghd.com';
  95. $config['ghsDomain'] = $prefixHttp . 'shop.hzghd.com';
  96. $config['ghsPtHost'] = $prefixHttp . 'api.pt.hzghd.com';
  97. $config['ghsShortHost'] = 'hzghd.com';
  98. $config['ghsImgHost'] = $prefixHttp . 'img.hzghd.com/';
  99. $config['ossBucket'] = 'pic-hhb-cs';
  100. }
  101. if (getenv('YII_ENV') == 'production') {
  102. $config['hdHost'] = $prefixHttp . 'api.shop.huahb.com';
  103. $config['hdDomain'] = $prefixHttp . 'shop.huahb.com';
  104. $config['hdPtHost'] = $prefixHttp . 'api.pt.huahb.com';
  105. $config['hdShortHost'] = 'huahb.com';
  106. $config['hdImgHost'] = $prefixHttp . 'img.huahb.com/';
  107. $config['ghsHost'] = $prefixHttp . 'api.shop.huahb.cn';
  108. $config['ghsDomain'] = $prefixHttp . 'shop.huahb.cn';
  109. $config['ghsPtHost'] = $prefixHttp . 'api.pt.huahb.cn';
  110. $config['ghsShortHost'] = 'huahb.cn';
  111. $config['ghsImgHost'] = $prefixHttp . 'img.huahb.cn/';
  112. $config['ossBucket'] = 'pic-hhb';
  113. }
  114. return $config;