更新:删除功能、Gov.cn的备案解决。
This commit is contained in:
parent
15d968f0c8
commit
3f2862d118
@ -36,7 +36,6 @@ class Account
|
||||
return redirect('/');
|
||||
}
|
||||
$record=Db::table('links')->where('user', "$user")->get();
|
||||
print_r($record);
|
||||
return view('my', ['user' => $user,'realname' => $realname,'record' => $record]);
|
||||
}
|
||||
public function captcha(Request $request)
|
||||
|
@ -26,14 +26,21 @@ class Server
|
||||
}
|
||||
$realname=$session->get('realname',null);
|
||||
|
||||
#$domain=parse_url($url)['host'];
|
||||
$domain=$url;
|
||||
$domain_name=parse_url($url)['host'];
|
||||
|
||||
|
||||
$response = Http::post('https://api.uutool.cn/beian/icp/', ['site' => "$domain"])->json();
|
||||
if(isset($response->data->is_icp)){
|
||||
if($response->data->is_icp==1){
|
||||
$icp=$response->data;
|
||||
$owner=$icp->icp_org;
|
||||
$webid=$icp->icp_no;
|
||||
}else{
|
||||
if(str_ends_with($domain_name, '.gov.cn')){
|
||||
$icp='GOV';
|
||||
$owner='政府机构';
|
||||
$webid='GOVERNMENT_WEBSITE';
|
||||
}else{
|
||||
$icp=null;
|
||||
if($user==null){
|
||||
@ -43,6 +50,7 @@ class Server
|
||||
}
|
||||
$webid=null;
|
||||
}
|
||||
}
|
||||
}else{
|
||||
return json(['code' => 405, 'msg' => '备案查询接口响应异常,请稍后重试']);
|
||||
}
|
||||
@ -102,6 +110,25 @@ class Server
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function delete(Request $request,$link)
|
||||
{
|
||||
$session = $request->session();
|
||||
$user=$session->get('user',null);
|
||||
if($user==null){
|
||||
return json(['code' => 505, 'msg' => '需要登陆后才可使用']);
|
||||
}
|
||||
if($link==null){
|
||||
return json(['code' => 404, 'msg' => '缺少参数']);
|
||||
}
|
||||
$source=Db::table('links')->where('link', "$link")->first();
|
||||
if($source==null){
|
||||
return json(['code' => 404, 'msg' => '链接不存在']);
|
||||
}
|
||||
if($source->user!=$user){
|
||||
return json(['code' => 403, 'msg' => '无权删除']);
|
||||
}
|
||||
Db::table('links')->where('link', "$link")->delete();
|
||||
return redirect('/!/my');
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -20,6 +20,7 @@ Route::any('/!/loginapi', [app\controller\Account::class, 'loginapi']);
|
||||
Route::any('/!/my', [app\controller\Account::class, 'my']);
|
||||
Route::any('/!/logout', [app\controller\Account::class, 'logout']);
|
||||
Route::any('/!/captcha', [app\controller\Account::class, 'captcha']);
|
||||
Route::any('/!/delete/{link}', [app\controller\Server::class, 'delete']);
|
||||
Route::any('/{link}', [app\controller\Server::class, 'view']);
|
||||
Route::fallback(function(){
|
||||
return redirect('/');
|
||||
|
Loading…
Reference in New Issue
Block a user