This commit is contained in:
flucout
2023-12-07 14:45:15 +08:00
parent ef99d79f1a
commit 4c76ec2056
3 changed files with 26 additions and 0 deletions

View File

@@ -387,6 +387,7 @@ class Api extends BaseController
return json(['page'=>"<div><span class='Pcurrent'>1</span><span class='Pnumber'>1/0</span><span class='Pline'>从1-1000条</span><span class='Pcount'>共计0条数据</span></div>", 'data'=>[]]);
}
//获取所有蜘蛛IP列表
public function btwaf_getspiders(){
try{
$result = Plugins::btwaf_getspiders();
@@ -396,6 +397,14 @@ class Api extends BaseController
}
}
//分类获取蜘蛛IP列表
public function get_spider(){
$type = input('get.spider/d');
if(!$type) return json([]);
$result = Plugins::get_spider($type);
return json($result);
}
//检查黑白名单
private function checklist(){
if(config_get('whitelist') == 1){

View File

@@ -151,4 +151,18 @@ class Plugins
return $result;
}
//分类获取蜘蛛IP列表
public static function get_spider($type){
$result = cache('get_spider_'.$type);
if($result){
return $result;
}
$url = 'https://www.bt.cn/api/panel/get_spider?spider='.$type;
$data = get_curl($url);
$result = json_decode($data, true);
if(!$result) return [];
cache('get_spider_'.$type, $result, 3600 * 24);
return $result;
}
}