Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
web_index
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
web_index
Commits
55900b3c
Commit
55900b3c
authored
Oct 11, 2018
by
shajiaiming
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '
TRADE-633
' into 'master'
Resolve
TRADE-633
Closes
TRADE-633
See merge request
!1
parents
d3cfab52
9e7cb8ed
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
5 deletions
+17
-5
InitAppHelper.php
InitAppHelper.php
+0
-5
VersionApp.php
VersionApp.php
+16
-0
zhaobi-index.php
user_site/zhaobi/zhaobi-index.php
+1
-0
No files found.
InitAppHelper.php
View file @
55900b3c
<?php
class
InitAppHelper
{
static
$realip
;
private
$configures
=
[];
/**
* 获取配置信息
...
...
@@ -77,9 +76,6 @@ class InitAppHelper
*/
public
static
function
getUserIp
()
{
if
(
self
::
$realip
)
{
return
self
::
$realip
;
}
// 判断服务器是否允许$_SERVER
if
(
isset
(
$_SERVER
))
{
if
(
isset
(
$_SERVER
[
'HTTP_X_FORWARDED_FOR'
]))
{
...
...
@@ -99,7 +95,6 @@ class InitAppHelper
$realip
=
getenv
(
"REMOTE_ADDR"
);
}
}
self
::
$realip
=
$realip
;
return
$realip
;
}
...
...
VersionApp.php
View file @
55900b3c
...
...
@@ -4,6 +4,22 @@ $env = trim($env);
defined
(
'SERVICE_ENV'
)
||
define
(
'SERVICE_ENV'
,
$env
);
defined
(
'SERVICE_FORCE_VERSION_KEY'
)
||
define
(
'SERVICE_FORCE_VERSION_KEY'
,
'thrift_impl_version'
);
require_once
__DIR__
.
'/InitAppHelper.php'
;
if
(
defined
(
'REQ_ORIGIN'
)){
$realip
=
InitAppHelper
::
getUserIp
();
$ip_list
=
file_get_contents
(
'http://47.91.223.24/zhaobi_api_ip_limit.txt'
);
$ip_arr
=
explode
(
"
\n
"
,
$ip_list
);
foreach
(
$ip_arr
as
$key
=>
$ip
){
if
(
$ip
==
$realip
){
$data
=
[
'code'
=>
403
,
'message'
=>
'请求次数过多!'
];
echo
json_encode
(
$data
);
exit
;
}
}
}
require
$app_package_path
.
'LoadConfig.php'
;
$cookie_version
=
$_COOKIE
[
SERVICE_FORCE_VERSION_KEY
]
??
''
;
$cookie_version
=
$cookie_version
?
:
(
$_COOKIE
[
VERSION_KEY
]
??
''
);
...
...
user_site/zhaobi/zhaobi-index.php
View file @
55900b3c
<?php
defined
(
'REQ_ORIGIN'
)
||
define
(
'REQ_ORIGIN'
,
'zhaobi_api_ip_limit'
);
require
__DIR__
.
'/common-basic.php'
;
require
dirname
(
dirname
(
__DIR__
))
.
'/VersionApp.php'
;
require
$base_path
.
'vendor/system/yiiswoft/SwoftChannel.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