更新CF优选IP接口

This commit is contained in:
net909 2024-09-17 10:11:10 +08:00
parent 4145e282f9
commit 30427a9704
2 changed files with 12 additions and 8 deletions

View File

@ -28,7 +28,7 @@ class OptimizeService
}elseif($api == 1){ }elseif($api == 1){
$url = 'https://api.hostmonit.com/get_license?license='.$key; $url = 'https://api.hostmonit.com/get_license?license='.$key;
}else{ }else{
$url = 'https://monitor.gacjie.cn/api/client/get_account_integral?license='.$key; $url = 'https://www.182682.xyz/api/cf2dns/get_license?license='.$key;
} }
$response = get_curl($url); $response = get_curl($url);
$arr = json_decode($response, true); $arr = json_decode($response, true);
@ -43,20 +43,24 @@ class OptimizeService
public function get_ip_address($cdn_type = 1, $ip_type = 'v4'){ public function get_ip_address($cdn_type = 1, $ip_type = 'v4'){
$api = config_get('optimize_ip_api', 0); $api = config_get('optimize_ip_api', 0);
if($api == 1){ if($api == 2){
$url = 'https://api.345673.xyz/get_data'; $url = 'https://api.345673.xyz/get_data';
}elseif($api == 1){ }elseif($api == 1){
$url = 'https://api.hostmonit.com/get_optimization_ip'; $url = 'https://api.hostmonit.com/get_optimization_ip';
}else{ }else{
$url = 'https://monitor.gacjie.cn/api/client/get_ip_address'; $url = 'https://www.182682.xyz/api/cf2dns/';
if($cdn_type == 1){
$url .= 'get_cloudflare_ip';
}elseif($cdn_type == 2){
$url .= 'get_cloudfront_ip';
}elseif($cdn_type == 3){
$url .= 'get_gcore_ip';
}
} }
$params = [ $params = [
'key' => config_get('optimize_ip_key', 'o1zrmHAF'), 'key' => config_get('optimize_ip_key', 'o1zrmHAF'),
'type' => $ip_type, 'type' => $ip_type,
]; ];
if($api == 0){
$params['cdn_server'] = $cdn_type;
}
$response = get_curl($url, json_encode($params), 0, 0, 0, 0, 0, ['Content-Type: application/json; charset=UTF-8']); $response = get_curl($url, json_encode($params), 0, 0, 0, 0, 0, ['Content-Type: application/json; charset=UTF-8']);
$arr = json_decode($response, true); $arr = json_decode($response, true);
if(isset($arr['code']) && $arr['code'] == 200){ if(isset($arr['code']) && $arr['code'] == 200){

View File

@ -13,7 +13,7 @@
<div class="panel panel-warning"> <div class="panel panel-warning">
<div class="panel-heading"><h3 class="panel-title">使用说明</h3></div> <div class="panel-heading"><h3 class="panel-title">使用说明</h3></div>
<div class="panel-body"> <div class="panel-body">
<p><li>数据接口:<a href="https://monitor.gacjie.cn/" target="_blank" rel="noreferrer">GacJieMonitor</a> 数据接口支持CloudFlare、CloudFront、Gcore<a href="https://hostmonit.com/" target="_blank" rel="noreferrer">HostMonit</a> 只支持CloudFlare<a href="https://345673.xyz/" target="_blank" rel="noreferrer">345673.xyz</a> 只支持CloudFlare。</li></p> <p><li>数据接口:<a href="https://www.182682.xyz/" target="_blank" rel="noreferrer">182682.xyz</a> 数据接口支持CloudFlare、CloudFront、Gcore<a href="https://hostmonit.com/" target="_blank" rel="noreferrer">HostMonit</a> 只支持CloudFlare<a href="https://345673.xyz/" target="_blank" rel="noreferrer">345673.xyz</a> 只支持CloudFlare。</li></p>
<p><li>接口密钥默认o1zrmHAF为免费KEY可永久免费使用。</li></p> <p><li>接口密钥默认o1zrmHAF为免费KEY可永久免费使用。</li></p>
<p><li>计划任务将以下命令添加到计划任务周期设置为15分钟以上</li></p> <p><li>计划任务将以下命令添加到计划任务周期设置为15分钟以上</li></p>
<p><code>cd {:app()->getRootPath()} && php think opiptask</code></p> <p><code>cd {:app()->getRootPath()} && php think opiptask</code></p>
@ -27,7 +27,7 @@
<form onsubmit="return saveSetting(this)" method="post" class="form-horizontal" role="form"> <form onsubmit="return saveSetting(this)" method="post" class="form-horizontal" role="form">
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label">数据接口</label> <label class="col-sm-3 control-label">数据接口</label>
<div class="col-sm-9"><select class="form-control" name="optimize_ip_api" default="{:config_get('optimize_ip_api')}"><option value="0">GacJieMonitor</option><option value="1">HostMonit</option><option value="2">345673.xyz</option></select></div> <div class="col-sm-9"><select class="form-control" name="optimize_ip_api" default="{:config_get('optimize_ip_api')}"><option value="0">182682.xyz</option><option value="1">HostMonit</option><option value="2">345673.xyz</option></select></div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label">接口密钥</label> <label class="col-sm-3 control-label">接口密钥</label>