| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495 |
- <?php
- $hostData = \common\components\httpUtil::getHttpHost();
- $http = $hostData['http'];
- $suffix = $hostData['suffix'];
- $miniUrl = $http . 'mini.' . $suffix;
- $adminUrl = $http . 'a.' . $suffix;
- $frontUrl = $http . 'm.' . $suffix;
- $mobileUrl = $http . 'm.' . $suffix;
- $openUrl = $http . 'o.' . $suffix;
- $picUrl = $http . 'pic.' . $suffix;
- $wwwUrl = $http . 'www.' . $suffix;
- $cssUrl = $http . 'css.' . $suffix;
- $jsUrl = $http . 'js.' . $suffix;
- $config = [
- //全站统一使用的秘钥
- 'secretKey' => 'CzWjvVY5F.dUqT65Knj81qh_eU2wI3SokO',
- 'adminUrl' => $adminUrl,
- 'frontUrl' => $frontUrl,
- 'openUrl' => $openUrl,
- 'picUrl' => $picUrl,
- 'wwwUrl' => $wwwUrl,
- 'mobileUrl' => $mobileUrl,
- 'miniUrl' => $miniUrl,
- //平台来源
- 'ptSource' => [
- //商城移动端
- 'mobile' => 1,
- //商城小程序
- 'mini' => 2,
- //商家后台PC端
- 'admin' => 3,
- //商家后台移动端
- 'back' => 4,
- //总后台
- 'saas' => 5,
- ],
- //永不过期时间
- 'neverExpireTime' => 4102416000,
- //永不过期日期
- 'neverExpireDate' => '2100-01-01 00:00:00',
- 'pageSize' => 20,
- ];
- $prefixHttp = 'http://';
- $userAgent = isset($_SERVER['HTTP_USER_AGENT']) ? strtolower($_SERVER['HTTP_USER_AGENT']) : '';
- if (strpos($userAgent, 'miniprogram') === true) {
- $prefixHttp = 'https://';
- }
- $referrer = isset($_SERVER["HTTP_REFERER"]) ? strtolower($_SERVER["HTTP_REFERER"]) : '';
- if (strpos($referrer, 'servicewechat.com') === true) {
- $prefixHttp = 'https://';
- }
- if (strpos($referrer, 'https') === true) {
- $prefixHttp = 'https://';
- }
- if (getenv('YII_ENV') == 'local') {
- $config['c'] = $prefixHttp . 'api.m.hhb.com';
- $config['b'] = $prefixHttp . 'api.b.hhb.com';
- if (strpos($referrer, $prefixHttp . 'h') === true || strpos($referrer, $prefixHttp . 'api.h') === true) {
- $config['b'] = $prefixHttp . 'api.h.hhb.com';
- }
- $config['s'] = $prefixHttp . 'api.s.hhb.com';
- $config['host'] = 'hhb.com';
- $config['imgUrl'] = $prefixHttp . 'img.hhb.com';
- }
- if (getenv('YII_ENV') == 'test') {
- $config['c'] = $prefixHttp . 'api.m.huaml.com';
- $config['b'] = $prefixHttp . 'api.b.huaml.com';
- if (strpos($referrer, $prefixHttp . 'h') === true || strpos($referrer, $prefixHttp . 'api.h') === true) {
- $config['b'] = $prefixHttp . 'api.h.huaml.com';
- }
- $config['s'] = $prefixHttp . 'api.s.huaml.com';
- $config['host'] = 'huaml.com';
- $config['imgUrl'] = $prefixHttp . 'img.huaml.com';
- }
- if (getenv('YII_ENV') == 'development') {
- $config['c'] = $prefixHttp . 'api.m.huaml.com';
- $config['b'] = $prefixHttp . 'api.b.huaml.com';
- if (strpos($referrer, $prefixHttp . 'h') === true || strpos($referrer, $prefixHttp . 'api.h') === true) {
- $config['b'] = $prefixHttp . 'api.h.huaml.com';
- }
- $config['s'] = $prefixHttp . 'api.s.huaml.com';
- $config['host'] = 'huaml.com';
- $config['imgUrl'] = $prefixHttp . 'img.huaml.com';
- }
- if (getenv('YII_ENV') == 'production') {
- $config['c'] = $prefixHttp . 'api.m.huahb.com';
- $config['b'] = $prefixHttp . 'api.b.huahb.com';
- $config['b'] = $prefixHttp . 'api.h.huahb.com';
- $config['s'] = $prefixHttp . 'api.s.huahb.com';
- $config['host'] = 'huahb.com';
- $config['imgUrl'] = $prefixHttp . 'img.huahb.com';
- }
- return $config;
|