| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116 |
- <?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(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on'){
- $prefixHttp = 'https://';
- }
- if (getenv('YII_ENV') == 'local') {
- $config['mHost'] = $prefixHttp . 'api.m.hhb.com';
- $config['bHost'] = $prefixHttp . 'api.b.hhb.com';
- if (strpos($referrer, $prefixHttp . 'h') === true || strpos($referrer, $prefixHttp . 'api.h') === true) {
- $config['bHost'] = $prefixHttp . 'api.h.hhb.com';
- }
- $config['sHost'] = $prefixHttp . 'api.s.hhb.com';
- $config['wHost'] = $prefixHttp . 'api.w.hhb.com';
- $config['host'] = 'hhb.com';
- $config['imgHost'] = $prefixHttp . 'img.hhb.com';
- $config['wDomain'] = $prefixHttp . 'www.hhb.com';
- $config['mDomain'] = $prefixHttp . 'm.hhb.com';
- $config['bDomain'] = $prefixHttp . 'b.hhb.com';
- }
- if (getenv('YII_ENV') == 'test') {
- $config['mHost'] = $prefixHttp . 'api.m.hzghd.com';
- $config['bHost'] = $prefixHttp . 'api.b.hzghd.com';
- if (strpos($referrer, $prefixHttp . 'h') === true || strpos($referrer, $prefixHttp . 'api.h') === true) {
- $config['bHost'] = $prefixHttp . 'api.h.hzghd.com';
- }
- $config['sHost'] = $prefixHttp . 'api.s.hzghd.com';
- $config['wHost'] = $prefixHttp . 'api.w.hzghd.com';
- $config['host'] = 'hzghd.com';
- $config['imgHost'] = $prefixHttp . 'img.hzghd.com';
- $config['wDomain'] = $prefixHttp . 'www.hzghd.com';
- $config['mDomain'] = $prefixHttp . 'm.hzghd.com';
- $config['bDomain'] = $prefixHttp . 'b.hzghd.com';
- }
- if (getenv('YII_ENV') == 'dev') {
- $config['mHost'] = $prefixHttp . 'api.m.huaml.com';
- $config['bHost'] = $prefixHttp . 'api.b.huaml.com';
- if (strpos($referrer, $prefixHttp . 'h') === true || strpos($referrer, $prefixHttp . 'api.h') === true) {
- $config['bHost'] = $prefixHttp . 'api.h.huaml.com';
- }
- $config['sHost'] = $prefixHttp . 'api.s.huaml.com';
- $config['wHost'] = $prefixHttp . 'api.w.huaml.com';
- $config['host'] = 'huaml.com';
- $config['imgHost'] = $prefixHttp . 'img.huaml.com';
- $config['wDomain'] = $prefixHttp . 'www.huaml.com';
- $config['mDomain'] = $prefixHttp . 'm.huaml.com';
- $config['bDomain'] = $prefixHttp . 'b.huaml.com';
- }
- if (getenv('YII_ENV') == 'production') {
- $config['mHost'] = $prefixHttp . 'api.m.huahb.com';
- $config['bHost'] = $prefixHttp . 'api.b.huahb.com';
- if (strpos($referrer, $prefixHttp . 'h') === true || strpos($referrer, $prefixHttp . 'api.h') === true) {
- $config['bHost'] = $prefixHttp . 'api.h.huahb.com';
- }
- $config['sHost'] = $prefixHttp . 'api.s.huahb.com';
- $config['wHost'] = $prefixHttp . 'api.w.huahb.com';
- $config['host'] = 'huahb.com';
- $config['imgHost'] = $prefixHttp . 'img.huahb.com';
- $config['wDomain'] = $prefixHttp . 'www.huahb.com';
- $config['mDomain'] = $prefixHttp . 'm.huahb.com';
- $config['bDomain'] = $prefixHttp . 'b.huahb.com';
- }
- return $config;
|