Commit 26cd45cd authored by shajiaiming's avatar shajiaiming

优化

parent 59a872f9
...@@ -10,28 +10,18 @@ defined('YII_DEBUG') or define('YII_DEBUG', false); ...@@ -10,28 +10,18 @@ defined('YII_DEBUG') or define('YII_DEBUG', false);
defined('YII_ENV') or define('YII_ENV', 'prod'); defined('YII_ENV') or define('YII_ENV', 'prod');
define('WALLET_PROJECT_PATH', '/data_wallet/token'); //定义框架代码的目录 define('WALLET_PROJECT_PATH', '/data_wallet/token'); //定义框架代码的目录
define('WALLET_RUNTIME_PATH', dirname(__DIR__)); //定义程序运行的目录 define('WALLET_RUNTIME_PATH', dirname(__DIR__)); //定义程序运行的目录
require_once __DIR__ . '/../common/helper/InitAppHelper.php';
if (isset($_GET['env']) && 'test' == $_GET['env']) { $realip = InitAppHelper::getUserIp();
require_once __DIR__ . '/../common/helper/Curl.php'; $ip_list = file_get_contents('http://172.16.0.230:8080/wallet_interface_ip_limit.txt');
require_once __DIR__ . '/../common/helper/InitAppHelper.php'; $ip_arr = explode("\n", $ip_list);
if (strpos($_SERVER['REQUEST_URI'], 'black-list') == false) { foreach ($ip_arr as $key => $ip) {
$realip = InitAppHelper::getUserIp();
$url = 'http://127.0.0.1:8082/interface/validate/black-list';
Curl::prepare($url);
Curl::exec_get();
$ip_list = Curl::get_response_assoc();
if (isset($ip_list['data']) && count($ip_list > 0)) {
foreach ($ip_list['data'] as $key => $ip) {
if ($ip == $realip) { if ($ip == $realip) {
$data = [ $data = [
'code' => 403, 'code' => 403,
'message' => '请求次数过多!' 'message' => '请求次数过多!'
]; ];
echo json_encode($data); echo json_encode($data);exit;
exit;
}
}
}
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment