From 33f068537b5397415ae53aaaa332971ab7081e35 Mon Sep 17 00:00:00 2001 From: XiaoLFeng Date: Fri, 12 May 2023 23:43:57 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=8B=E9=93=BE=E6=9F=A5=E6=89=BE=E6=A8=A1?= =?UTF-8?q?=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/api/blog/friends_link/select/index.php | 57 +++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 public/api/blog/friends_link/select/index.php diff --git a/public/api/blog/friends_link/select/index.php b/public/api/blog/friends_link/select/index.php new file mode 100644 index 0000000..f1ad21a --- /dev/null +++ b/public/api/blog/friends_link/select/index.php @@ -0,0 +1,57 @@ + urldecode(htmlspecialchars($_GET['type'])), + 'search' => urldecode(htmlspecialchars($_GET['search'])), + 'link' => urldecode(htmlspecialchars($_GET['link'])), + 'user' => urldecode(htmlspecialchars($_GET['user'])), +]; + +// 逻辑构建 +if ($Array_ConfigData['Session'] == $_SERVER['HTTP_SESSION']) { + // 判断赋值 + $GetData['user'] == 1 ? $Data_UserSee = 'AND `location`!=0 AND `deleted`=0' : $Data_UserSee = ''; + + // 检查类型是否合法 + if ($GetData['type'] == 0) { // 广泛查询 + // 查询数据库 + $AResult_Blog = Sql::SELECT("SELECT * FROM `index`.xf_blog_link"); + if ($AResult_Blog['output'] == 'Success') { + Normal::CustomOutput('Success', 200, '操作成功', $AResult_Blog['data']); + } else if ($AResult_Blog['output'] == 'EmptyResult') { + Normal::CustomOutput('EmptyResult', 200, '没有数据'); + } else Normal::Output(301); + } else if ($GetData['type'] == 1) { // 特定数据查询(一定查询) + if (empty($GetData['search']) && empty($GetData['link'])) { // 查找数据库 + $AResult_Blog = Sql::SELECT("SELECT * FROM `index`.xf_blog_link WHERE `name` = '{$GetData['search']}' OR `url` = '{$GetData['link']}' $Data_UserSee"); + if ($AResult_Blog['output'] == 'Success') { + Normal::CustomOutput('Success', 200, '操作成功', $AResult_Blog['data']); + } else Normal::Output(301); + } else Normal::Output(501); + } else if ($GetData['type'] == 2) { // 模糊查询 + if (!empty($GetData['search'])) {// 查询数据库 + $AResult_Blog = Sql::SELECT("SELECT * FROM `index`.xf_blog_link WHERE `owner_email` LIKE '%{$GetData['search']}%' OR `name` LIKE '%{$GetData['search']}%' OR `url` LIKE '%{$GetData['search']}%' $Data_UserSee"); + if ($AResult_Blog['output'] == 'Success') { + Normal::CustomOutput('Success', 200, '操作成功', $AResult_Blog['data']); + } else Normal::Output(301); + } else Normal::Output(501); + } else Normal::Output(404); +} else Normal::Output(100); \ No newline at end of file