53 lines
1.3 KiB
PHP
53 lines
1.3 KiB
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace App\Platform\Tools\Request;
|
||
|
|
|
||
|
|
use App\Platform\Tools\HttpClient;
|
||
|
|
use Hyperf\Collection\LazyCollection;
|
||
|
|
|
||
|
|
class RefundRequest extends HttpClient
|
||
|
|
{
|
||
|
|
|
||
|
|
const BATCH_SIZE = 50;
|
||
|
|
|
||
|
|
public static function find(int $id): array
|
||
|
|
{
|
||
|
|
$path = "/api/ext/refunds/$id";
|
||
|
|
return static::get($path);
|
||
|
|
}
|
||
|
|
|
||
|
|
public static function findByOrder(int $t_store_id, int $t_order_id): array|bool
|
||
|
|
{
|
||
|
|
$path = "/api/ext/refunds";
|
||
|
|
$query = [
|
||
|
|
'store' => $t_store_id,
|
||
|
|
'order' => $t_order_id,
|
||
|
|
];
|
||
|
|
$response = static::get($path, $query);
|
||
|
|
|
||
|
|
if(isset($response['data']) && is_array($response['data']) && count($response['data']) == 1) {
|
||
|
|
return $response['data']['0'];
|
||
|
|
}
|
||
|
|
|
||
|
|
return false;
|
||
|
|
}
|
||
|
|
|
||
|
|
public static function add(array $data): array
|
||
|
|
{
|
||
|
|
$path = "/api/ext/refunds";
|
||
|
|
return static::post($path, [], $data);
|
||
|
|
}
|
||
|
|
|
||
|
|
public static function update(array $data): array
|
||
|
|
{
|
||
|
|
$path = "/api/ext/refunds";
|
||
|
|
return static::put($path, [], $data);
|
||
|
|
}
|
||
|
|
|
||
|
|
public static function queryByStorePlatformOrderIds(int $t_store_id, array $ids) : array
|
||
|
|
{
|
||
|
|
$path = "/api/ext/refunds/batch-query-by-ref-order-ids";
|
||
|
|
return static::post($path, [], ['store' => $t_store_id, 'orderIds' => $ids]);
|
||
|
|
}
|
||
|
|
}
|