From 944317212fd18588515f63864e7514849318d3d1 Mon Sep 17 00:00:00 2001 From: XiaoLFeng Date: Mon, 24 Jul 2023 15:56:50 +0800 Subject: [PATCH] =?UTF-8?q?Modify:=20=E8=87=AA=E5=8A=A8=E5=8C=96=E6=B5=8B?= =?UTF-8?q?=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 新增: - Afadian.php - NeteaseCloud.php 修改: - .gitignore Signed-off-by: XiaoLFeng --- .gitignore | 1 - tests/Feature/Afadian.php | 55 ++++++++++++++++++++++++++++++++++ tests/Feature/NeteaseCloud.php | 40 +++++++++++++++++++++++++ 3 files changed, 95 insertions(+), 1 deletion(-) create mode 100644 tests/Feature/Afadian.php create mode 100644 tests/Feature/NeteaseCloud.php diff --git a/.gitignore b/.gitignore index 4250e71..7e97b19 100644 --- a/.gitignore +++ b/.gitignore @@ -13,5 +13,4 @@ npm-debug.log yarn-error.log /.idea /.vscode -/tests/ /public/ diff --git a/tests/Feature/Afadian.php b/tests/Feature/Afadian.php new file mode 100644 index 0000000..3742cc4 --- /dev/null +++ b/tests/Feature/Afadian.php @@ -0,0 +1,55 @@ +get() + ->toArray(); + $userID = $result[20]->data; + $token = $result[21]->data; + $time = time(); + $params = [ + 'page' => 1, + 'per_page' => 50, + ]; + $sign = md5($token . 'params' . json_encode($params) . 'ts' . $time . 'user_id' . $userID); + + $data = [ + 'query' => [ + 'user_id' => $userID, + 'params' => json_encode($params), + 'ts' => $time, + 'sign' => $sign, + ], + ]; + + $client = new Client(['verify' => false]); + try { + $response = $client->get('https://afdian.net/api/open/query-sponsor', $data); + + var_dump(json_decode($response->getBody()->getContents())); + + + $this->assertTrue(true, "可以访问"); + } catch (GuzzleException $e) { + echo $e; + $this->fail("发生错误"); + } + } +} diff --git a/tests/Feature/NeteaseCloud.php b/tests/Feature/NeteaseCloud.php new file mode 100644 index 0000000..3720d72 --- /dev/null +++ b/tests/Feature/NeteaseCloud.php @@ -0,0 +1,40 @@ + [ + 'id' => '32459197', + 'limit' => 20, + ], + ]; + + $client = new Client(['verify' => false]); + try { + $response = $client->get('https://netease.api.x-lf.cn/artist/songs', $data); + + print_r(json_decode($response->getBody()->getContents())); + + + $this->assertTrue(true, "可以访问"); + } catch (GuzzleException $e) { + echo $e; + $this->fail("发生错误"); + } + } +}