|
|
|
@ -17,6 +17,7 @@ class YuanheRepository
|
|
|
|
public $customerId;
|
|
|
|
public $customerId;
|
|
|
|
public $authKey;
|
|
|
|
public $authKey;
|
|
|
|
public $lastRequestTimestamp;
|
|
|
|
public $lastRequestTimestamp;
|
|
|
|
|
|
|
|
public $lastRequest;
|
|
|
|
|
|
|
|
|
|
|
|
public function __construct()
|
|
|
|
public function __construct()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
@ -89,7 +90,14 @@ class YuanheRepository
|
|
|
|
public function enterpriseSearchProbe(array $params): array
|
|
|
|
public function enterpriseSearchProbe(array $params): array
|
|
|
|
{
|
|
|
|
{
|
|
|
|
$url = $this->baseUrl . '/master-service/openapi/businessCollege/enterprise/search';
|
|
|
|
$url = $this->baseUrl . '/master-service/openapi/businessCollege/enterprise/search';
|
|
|
|
$rawResponse = httpCurl($url, 'GET', $params, $this->getHeader());
|
|
|
|
$headers = $this->getHeader();
|
|
|
|
|
|
|
|
$this->lastRequest = [
|
|
|
|
|
|
|
|
'method' => 'GET',
|
|
|
|
|
|
|
|
'url' => $url,
|
|
|
|
|
|
|
|
'query' => $params,
|
|
|
|
|
|
|
|
'headers' => $this->headersToMap($headers),
|
|
|
|
|
|
|
|
];
|
|
|
|
|
|
|
|
$rawResponse = httpCurl($url, 'GET', $params, $headers);
|
|
|
|
$response = json_decode($rawResponse, true);
|
|
|
|
$response = json_decode($rawResponse, true);
|
|
|
|
|
|
|
|
|
|
|
|
return [
|
|
|
|
return [
|
|
|
|
@ -109,6 +117,13 @@ class YuanheRepository
|
|
|
|
{
|
|
|
|
{
|
|
|
|
$url = $this->baseUrl . '/master-service/openapi/businessCollege/enterprise/packInfo';
|
|
|
|
$url = $this->baseUrl . '/master-service/openapi/businessCollege/enterprise/packInfo';
|
|
|
|
$header = $this->getHeader();
|
|
|
|
$header = $this->getHeader();
|
|
|
|
|
|
|
|
$payload = json_encode($params, JSON_UNESCAPED_UNICODE);
|
|
|
|
|
|
|
|
$this->lastRequest = [
|
|
|
|
|
|
|
|
'method' => 'POST',
|
|
|
|
|
|
|
|
'url' => $url,
|
|
|
|
|
|
|
|
'json' => $params,
|
|
|
|
|
|
|
|
'headers' => $this->headersToMap($header),
|
|
|
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
|
|
$ch = curl_init();
|
|
|
|
$ch = curl_init();
|
|
|
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
|
|
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
|
|
|
@ -117,7 +132,7 @@ class YuanheRepository
|
|
|
|
curl_setopt($ch, CURLOPT_TIMEOUT, 3);
|
|
|
|
curl_setopt($ch, CURLOPT_TIMEOUT, 3);
|
|
|
|
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
|
|
|
|
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
|
|
|
|
curl_setopt($ch, CURLOPT_POST, true);
|
|
|
|
curl_setopt($ch, CURLOPT_POST, true);
|
|
|
|
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($params, JSON_UNESCAPED_UNICODE));
|
|
|
|
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
|
|
|
|
if (stripos($url, 'https://') !== false) {
|
|
|
|
if (stripos($url, 'https://') !== false) {
|
|
|
|
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
|
|
|
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
|
|
|
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
|
|
|
|
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
|
|
|
|
@ -151,6 +166,17 @@ class YuanheRepository
|
|
|
|
return $result;
|
|
|
|
return $result;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected function headersToMap(array $headers): array
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
$mapped = [];
|
|
|
|
|
|
|
|
foreach ($headers as $header) {
|
|
|
|
|
|
|
|
[$name, $value] = array_pad(explode(':', $header, 2), 2, '');
|
|
|
|
|
|
|
|
$mapped[trim($name)] = trim($value);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return $mapped;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 数据推送
|
|
|
|
* 数据推送
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
|