client 调用 传递 app name
This commit is contained in:
parent
83c91ac7c0
commit
cb98bc4666
|
@ -10,11 +10,18 @@ class Client
|
||||||
protected $config;
|
protected $config;
|
||||||
|
|
||||||
protected $id;
|
protected $id;
|
||||||
|
/**
|
||||||
|
* @var \GuzzleHttp\Client
|
||||||
|
*/
|
||||||
protected $http;
|
protected $http;
|
||||||
|
|
||||||
public function __construct($config)
|
public function __construct($config)
|
||||||
{
|
{
|
||||||
$this->config = $config;
|
$default = [
|
||||||
|
'app' => '***',
|
||||||
|
];
|
||||||
|
|
||||||
|
$this->config = array_merge($default, $config);
|
||||||
$this->id = 0;
|
$this->id = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,7 +75,10 @@ class Client
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$resp = $this->http->request('POST', 'rpc/json-rpc-v2.json', [
|
$resp = $this->http->request('POST', 'rpc/json-rpc-v2.json', [
|
||||||
'json' => $payload
|
'headers' => [
|
||||||
|
'hwmc_app' => $this->config['app'],
|
||||||
|
],
|
||||||
|
'json' => $payload,
|
||||||
]);
|
]);
|
||||||
} catch (ServerException $e) {
|
} catch (ServerException $e) {
|
||||||
throw new RpcServerException($e->getMessage(), $e->getCode());
|
throw new RpcServerException($e->getMessage(), $e->getCode());
|
||||||
|
|
Loading…
Reference in New Issue
Block a user