You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

71 lines
1.9 KiB

<?php
namespace App\Admin\Controllers;
use App\Admin\Metrics\Examples;
use App\Http\Controllers\Controller;
use Dcat\Admin\Http\Controllers\Dashboard;
use Dcat\Admin\Layout\Column;
use Dcat\Admin\Layout\Content;
use Dcat\Admin\Layout\Row;
use GuzzleHttp\Client;
class TestController extends Controller
{
public function platformCacheList()
{
$query = http_build_query([
'imei' => '866472059915631',
'start' => '2016-08-05T08:00:00',
]);
$client = new Client([
'base_uri' => config('onenet.api_host'),
'headers' => [
'api-key' => "knxzLGDiojaDvbIOvhG3QXRtScc=",
]
]);
$response = $client->request('GET', '/nbiot/offline/history?' . $query);
dump($response->getBody()->getContents());
}
/**
* 取消设备所有未下发缓存命令
* @return void
*/
public function cancelAllCache()
{
$query = http_build_query([
'imei' => '866472059915631',
]);
$client = new Client([
'base_uri' => config('onenet.api_host'),
'headers' => [
'api-key' => "knxzLGDiojaDvbIOvhG3QXRtScc=",
]
]);
$response = $client->request('PUT', '/nbiot/offline/cancel/all?' . $query);
dump($response->getBody()->getContents());
}
public function getDatapoints()
{
$query = http_build_query([
'start' => '2015-01-10T08:00:35',
'end' => '2023-01-10T08:00:35',
]);
$client = new Client([
'base_uri' => config('onenet.api_host'),
'headers' => [
'api-key' => "l5KGPjSqQVuwSSjlUAuBohPNVrM=",
]
]);
$response = $client->request('GET', 'devices/984998613/datapoints?' . $query);
dump($response->getBody()->getContents());
}
}