|
|
|
|
@ -166,6 +166,10 @@ class HFPayHttpClient implements IHttpClient |
|
|
|
|
case 'body': |
|
|
|
|
$options['body'] = array_filter($body, fn($v) => $v !== null); |
|
|
|
|
break; |
|
|
|
|
// 新增的分支 |
|
|
|
|
case 'multipart': |
|
|
|
|
$options['multipart'] = array_filter($body, fn($v) => $v !== null); |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
try { |
|
|
|
|
@ -273,4 +277,18 @@ class HFPayHttpClient implements IHttpClient |
|
|
|
|
{ |
|
|
|
|
return $this->request('POST', $uri, [], $data, 'json', $needToken); |
|
|
|
|
} |
|
|
|
|
/** |
|
|
|
|
* 上传文件 |
|
|
|
|
* @param string $uri |
|
|
|
|
* @param array|null $data |
|
|
|
|
* @return Response |
|
|
|
|
* @throws ApiException |
|
|
|
|
* @throws BizException |
|
|
|
|
* @throws SignException |
|
|
|
|
*/ |
|
|
|
|
function uploadPost(string $uri, ?array $data = []): Response |
|
|
|
|
{ |
|
|
|
|
// 调用 request,并指定格式为 'multipart' |
|
|
|
|
return $this->request('POST', $uri, [], $data, 'multipart'); |
|
|
|
|
} |
|
|
|
|
} |