Compare commits

..

No commits in common. "9c6893a67c627f75afc458c8b6c56a7297974e1f" and "1ad6db98b10218ef11adb0df49346696f0796afc" have entirely different histories.

4 changed files with 8 additions and 37 deletions

2
.gitignore vendored
View File

@ -1,2 +0,0 @@
runtime/*
*.log

View File

@ -36,6 +36,7 @@ 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)

View File

@ -26,10 +26,8 @@ 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){
@ -37,19 +35,13 @@ class Server
$owner=$icp->icp_org;
$webid=$icp->icp_no;
}else{
if(str_ends_with($domain_name, '.gov.cn')){
$icp='GOV';
$owner='政府机构';
$webid='GOVERNMENT_WEBSITE';
$icp=null;
if($user==null){
$owner='anonymous';
}else{
$icp=null;
if($user==null){
$owner='anonymous';
}else{
$owner=$realname;
}
$webid=null;
$owner=$realname;
}
$webid=null;
}
}else{
return json(['code' => 405, 'msg' => '备案查询接口响应异常,请稍后重试']);
@ -110,25 +102,6 @@ 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');
}
}

View File

@ -20,7 +20,6 @@ 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('/');