test tools comany request

This commit is contained in:
2025-11-10 16:57:45 +08:00
parent 299c831e82
commit 9f1a26dbf0
2 changed files with 8 additions and 4 deletions
+4 -1
View File
@@ -7,6 +7,7 @@ namespace App\Command;
use Hyperf\Command\Command as HyperfCommand; use Hyperf\Command\Command as HyperfCommand;
use Hyperf\Command\Annotation\Command; use Hyperf\Command\Annotation\Command;
use Psr\Container\ContainerInterface; use Psr\Container\ContainerInterface;
use App\Platform\Tools\Request\CompanyRequest;
#[Command] #[Command]
class AppCompanySync extends HyperfCommand class AppCompanySync extends HyperfCommand
@@ -24,7 +25,9 @@ class AppCompanySync extends HyperfCommand
public function handle() public function handle()
{ {
$companies = $companies = CompanyRequest::all();
dump($$companies);
$this->line('Hello Hyperf!', 'info'); $this->line('Hello Hyperf!', 'info');
} }
+3 -2
View File
@@ -41,7 +41,7 @@ class HttpClient
'connect_timeout' => 10, 'connect_timeout' => 10,
'timeout' => 60, 'timeout' => 60,
'handler' => $stack, 'handler' => $stack,
'debug' => false 'debug' => true
]; ];
return new Client($config); return new Client($config);
@@ -193,10 +193,11 @@ class HttpClient
$http_code = $response->getStatusCode(); $http_code = $response->getStatusCode();
$body = $response->getBody(); $body = $response->getBody();
// dump($body->getContents());
// when deal with stream object, need to move to pointer to the ram head // when deal with stream object, need to move to pointer to the ram head
$body->rewind(); $body->rewind();
$content = $body->getContents(); $content = $body->getContents();
$payload = \json_decode($content); $payload = \json_decode($content, 1);
if ($http_code == 200) { if ($http_code == 200) {
return $payload; return $payload;
} }