Compare commits
2 Commits
ca364fc3d5
...
cae91857d1
Author | SHA1 | Date |
---|---|---|
|
cae91857d1 | |
|
62ccfb43d0 |
|
@ -209,7 +209,7 @@ class Rocketgo
|
|||
self::login('h102067452', 'yBQnfuBShGl1MTBN');
|
||||
}
|
||||
} else {
|
||||
Log::info("登录没有过期可以继续使用token");
|
||||
// Log::info("登录没有过期可以继续使用token");
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
Log::error("检测登录是否过期失败: " . $e->getMessage());
|
||||
|
@ -375,14 +375,14 @@ class Rocketgo
|
|||
}
|
||||
|
||||
/**
|
||||
*查询指定手机号状态
|
||||
*查询指定手机号 是否在账户列表
|
||||
* @param mixed $phone
|
||||
* @return int
|
||||
* @return int 0在1不在
|
||||
*/
|
||||
public static function get_ws_status($phone)
|
||||
{
|
||||
$client = self::get_client(); // 创建 Guzzle 客户端
|
||||
$response = $client->get(self::$baseurl . "/prod-api3/biz/account/list", [
|
||||
$response = $client->get("https://dx1.rocketgo.vip/prod-api3/biz/account/list", [
|
||||
'query' => [
|
||||
'pageNum' => 1,
|
||||
'pageSize' => 10,
|
||||
|
@ -399,6 +399,7 @@ class Rocketgo
|
|||
// 获取响应体内容
|
||||
$body = $response->getBody();
|
||||
$responseData = json_decode($body, true);
|
||||
// var_dump($responseData);
|
||||
|
||||
// 检查响应是否成功
|
||||
if ($responseData['code'] == 200) {
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
namespace Tests;
|
||||
|
||||
use App\Utils\API\Rocketgo;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class TestConfig extends TestCase
|
||||
|
@ -31,4 +33,11 @@ class TestConfig extends TestCase
|
|||
'one plus one' => [1, 1, 2], // 1 + 1 = 2 pass
|
||||
];
|
||||
}
|
||||
|
||||
public function testPhone()
|
||||
{
|
||||
$res=Rocketgo::get_ws_status(8801831892829);
|
||||
// $this->assertSame($expected, $a + $b);
|
||||
$this->assertEquals(0,0);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
|
||||
namespace Tests;
|
||||
|
||||
use App\Utils\API\Rocketgo;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
/**
|
||||
* 用户手机号测试类
|
||||
*/
|
||||
class TestPhone extends TestCase
|
||||
{
|
||||
/**
|
||||
* @dataProvider additionPhone
|
||||
*/
|
||||
public function testPhone($phone, $expected)
|
||||
{
|
||||
Rocketgo::test_login();
|
||||
$res = Rocketgo::get_ws_status($phone);
|
||||
$this->assertEquals($expected, $res);
|
||||
}
|
||||
public function additionPhone()
|
||||
{
|
||||
$phone_array = [];
|
||||
$phone = 8801837967987;
|
||||
$phone_array["在列表ws号"] = [$phone, 0];
|
||||
$phone_array["不在列表ws号"] = [8801837967986, 1];
|
||||
for ($i = 1; $i <= 20; $i++) {
|
||||
$phone_array["查询第 $i 次在列表ws号 $phone"] = [$phone, 0];
|
||||
}
|
||||
return $phone_array;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue