add tools request libs, migrate for hyperf framework

This commit is contained in:
2025-11-10 16:48:19 +08:00
parent 5b3b0c70f2
commit 08bb2af2c3
11 changed files with 749 additions and 0 deletions
@@ -0,0 +1,32 @@
<?php
namespace App\Platform\Tools\Request;
use App\Platform\Tools\HttpClient;
use GuzzleHttp\Client;
use Hyperf\Collection\LazyCollection;
class KpiRequest extends HttpClient
{
const BATCH_SIZE = 20;
public static function find(int $store_id, string $date): mixed
{
$path = "/api/ext/kpi";
$response = static::get($path, ['store' => $store_id, 'from' => $date, 'to' => $date]);
return isset($response['data']) && !empty($response['data']) ? $response['data']['0'] : null;
}
public static function add(array $data): array
{
$path = "/api/ext/kpi";
return static::post($path, [], $data);
}
public static function update(array $data): array
{
$path = "/api/ext/kpi";
return static::put($path, [], $data);
}
}