Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
console
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
tufengqi
console
Commits
e25bdc29
Commit
e25bdc29
authored
Sep 17, 2018
by
tufengqi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix
parent
47e518fe
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
64 deletions
+7
-64
VersionApp.php
VersionApp.php
+7
-64
No files found.
VersionApp.php
View file @
e25bdc29
...
...
@@ -7,75 +7,18 @@ require $app_package_path . 'LoadConfig.php';
$cookie_version
=
$_COOKIE
[
VERSION_KEY
]
??
''
;
$cookie_version
=
trim
(
$cookie_version
);
$version_val
=
$version_val_no_prefix
=
''
;
if
(
defined
(
'IS_FORCE_ONLINE'
)
&&
true
===
IS_FORCE_ONLINE
)
{
$is_real_outer_access
=
true
;
}
else
{
$is_real_outer_access
=
ConsoleInitAppHelper
::
isRealOuterAccess
();
}
$cookie_flag
=
false
;
if
(
$is_real_outer_access
||
(
!
$is_real_outer_access
&&
'ga'
===
$cookie_version
))
{
// 外部用户或者内部设置cookie为ga,只允许访问文件定义的ga版本
$file_tag
=
'ga'
;
$file_version
=
file_get_contents
(
$version_path
.
VERSION_KEY
.
'_ga'
);
}
elseif
(
!
$is_real_outer_access
&&
'beta'
===
$cookie_version
)
{
// 内部设置cookie为beta,只允许访问文件定义的beta版本
if
(
defined
(
'IS_FORCE_BATE'
)
&&
true
===
IS_FORCE_BATE
)
{
$file_tag
=
'beta'
;
$file_version
=
file_get_contents
(
$version_path
.
VERSION_KEY
.
'_beta'
);
}
else
{
$is_online_host
=
ConsoleInitAppHelper
::
isOnlineHost
();
if
(
true
===
$is_online_host
)
{
// 线上域名默认指向ga环境 即使设置cookie也无效
$file_tag
=
'ga'
;
$file_version
=
file_get_contents
(
$version_path
.
VERSION_KEY
.
'_ga'
);
}
else
{
// 其他来源查找cookie
if
(
$cookie_version
&&
is_dir
(
$base_path
.
$cookie_version
))
{
$base_path
=
$base_path
.
$cookie_version
.
'/'
;
$version_val
=
'cookie-'
.
$cookie_version
;
$version_val_no_prefix
=
$cookie_version
;
// header("fpf-version: " . $version_val);
}
}
$cookie_flag
=
true
;
}
if
(
false
===
$cookie_flag
)
{
$file_version
=
trim
(
$file_version
);
if
(
$file_version
&&
is_dir
(
$base_path
.
$file_version
))
{
$base_path
=
$base_path
.
$file_version
.
'/'
;
$version_val
=
$file_tag
.
'-'
.
$file_version
;
$version_val_no_prefix
=
$file_version
;
// header("fpf-version: " . $version_val);
}
}
$location_default_version
=
false
;
if
(
$origin_base_path
===
$base_path
)
{
if
(
$is_real_outer_access
||
ConsoleInitAppHelper
::
isFromCompanyAccessOuterHost
())
{
// 如果是外网用户或者公司访问公网域名且未定位到任何有效的代码目录,重新指向ga版本
$location_default_version
=
true
;
}
else
{
// 没有读取任何版本目录
if
(
'test'
===
SERVICE_ENV
)
{
// 提测环境
$location_default_version
=
true
;
}
else
{
// 本地开发环境
// header("fpf-version: local");
}
}
}
if
(
true
===
$location_default_version
)
{
// 如果是外网用户且未定位到任何有效的代码目录,重新指向ga版本
$file_tag
=
'ga'
;
$file_version
=
file_get_contents
(
$version_path
.
VERSION_KEY
.
'_ga'
);
$file_version
=
trim
(
$file_version
);
if
(
$file_version
&&
is_dir
(
$base_path
.
$file_version
))
{
$base_path
=
$base_path
.
$file_version
.
'/'
;
$version_val
=
$file_tag
.
'-'
.
$file_version
;
$version_val_no_prefix
=
$file_version
;
// header("fpf-version: " . $version_val);
}
else
{
throw
new
Exception
(
'服务器代码定位错误'
);
}
}
$file_version
=
trim
(
$file_version
);
if
(
$file_version
&&
is_dir
(
$base_path
.
$file_version
))
{
$base_path
=
$base_path
.
$file_version
.
'/'
;
$version_val
=
$file_tag
.
'-'
.
$file_version
;
$version_val_no_prefix
=
$file_version
;
}
// 重载外层配置路径
require
$app_package_path
.
'LoadConfig.php'
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment