webman/app/Utils/API/Rocketgo.php

76 lines
2.4 KiB
PHP

<?php
namespace App\Utils\API;
use GuzzleHttp\Client;
use support\Log;
/**
* 第三方 小火箭api
* 网址
* https://dx1.rocketgo.vip/setting/account/account
*/
class Rocketgo
{
/**
* TOKEN
*/
protected static $token="eyJhbGciOiJIUzUxMiJ9.eyJsb2dpbl91c2VyX2tleSI6IjFlMTRlZWQ3LTEyODUtNGFjNi1hMzFhLTFlNWQ5OTEzMTJhYSJ9.BJgOhw1VKX1i9VfYKLIzF1zXUZMi4idO9Sb-p6p_rMKJanmt4is9slky7SqvSEXqhJ6USMGs2wqMY3tYJrH-hw";
protected static $baseurl="https://dx1.rocketgo.vip";
/**
* 获取base64图形验证码
*
* @return void
*/
public static function get_captchaImage()
{
$client = new Client(); // 创建 Guzzle 客户端
// 请求数据
// 发送 POST 请求
$response = $client->get("self::1baseurl/prod-api1/captchaImage");
// 获取响应体内容
$body = $response->getBody();
$responseData = json_decode($body, true); // 如果返回的是 JSON 格式,解析它
return $responseData;
}
//login发送参数
// {
// "username": "h102067452",
// "password": "yBQnfuBShGl1MTBN",
// "code": "23",
// "uuid": "9cbe6a9037dc47cf80c9f2a23c0672a5"
// }
public static function login($username,$password,$code,$uuid)
{
$client = new Client(); // 创建 Guzzle 客户端
// 请求数据
$data = [
"username" => $username,
"password" => $password,
"code" => $code,
"uuid" => $uuid,
];
// 发送 POST 请求
$response = $client->post("self::1baseurl/prod-api1/login", [
'json' => $data, // 以 JSON 格式发送数据
]);
// 获取响应体内容
$body = $response->getBody();
$responseData = json_decode($body, true); // 如果返回的是 JSON 格式,解析它
return $responseData;
}
public static function account_list()
{
$client = new Client(); // 创建 Guzzle 客户端
// 请求数据
// 发送 POST 请求
$response = $client->get("self::1baseurl/prod-api1/biz/account/list?pageNum=1&pageSize=1000&accountStatus=1&sendCount=0");
// 获取响应体内容
$body = $response->getBody();
$responseData = json_decode($body, true); // 如果返回的是 JSON 格式,解析它
return $responseData;
}
}