@@ -106,7 +106,7 @@ class Prescription
|
||||
),
|
||||
];
|
||||
|
||||
Log::getInstance()->info("处方平台获取药品请求数据:" . json_encode($option,JSON_UNESCAPED_UNICODE));
|
||||
// Log::getInstance()->info("处方平台获取药品请求数据:" . json_encode($option,JSON_UNESCAPED_UNICODE));
|
||||
try {
|
||||
$response = $this->httpRequest($this->api_url . $this->version . '/drug/syncDrugCatalogue', $option);
|
||||
if (empty($response['data'])){
|
||||
@@ -121,11 +121,11 @@ class Prescription
|
||||
|
||||
if (empty($response['data']['result'])){
|
||||
// 返回值为空
|
||||
Log::getInstance()->error("处方平台获取药品返回result为空:" . json_encode($response,JSON_UNESCAPED_UNICODE));
|
||||
// Log::getInstance()->error("处方平台获取药品返回result为空:" . json_encode($response,JSON_UNESCAPED_UNICODE));
|
||||
throw new BusinessException(HttpEnumCode::getMessage(HttpEnumCode::SERVER_ERROR));
|
||||
}
|
||||
|
||||
Log::getInstance()->info("处方平台获取药品返回数据:" . json_encode($response,JSON_UNESCAPED_UNICODE));
|
||||
// Log::getInstance()->info("处方平台获取药品返回数据:" . json_encode($response,JSON_UNESCAPED_UNICODE));
|
||||
return $response['data']['result'];
|
||||
} catch (GuzzleException $e) {
|
||||
Log::getInstance()->error("处方平台获取药品请求异常:" . $e->getMessage());
|
||||
@@ -204,14 +204,14 @@ class Prescription
|
||||
"json" => $arg
|
||||
];
|
||||
|
||||
Log::getInstance()->info("处方平台上报数据:" . json_encode($option,JSON_UNESCAPED_UNICODE));
|
||||
// Log::getInstance()->info("处方平台上报数据:" . json_encode($option,JSON_UNESCAPED_UNICODE));
|
||||
try {
|
||||
$response = $this->httpRequest($this->api_url . $this->version . '/preOrder/receivePreOrder', $option);
|
||||
if (empty($response)){
|
||||
// 返回值错误为空
|
||||
throw new BusinessException(HttpEnumCode::getMessage(HttpEnumCode::SERVER_ERROR));
|
||||
}
|
||||
Log::getInstance()->info("处方平台返回数据:" . json_encode($response,JSON_UNESCAPED_UNICODE));
|
||||
// Log::getInstance()->info("处方平台返回数据:" . json_encode($response,JSON_UNESCAPED_UNICODE));
|
||||
return $response;
|
||||
} catch (GuzzleException $e) {
|
||||
throw new BusinessException($e->getMessage());
|
||||
@@ -293,25 +293,25 @@ class Prescription
|
||||
// 记录请求日志(隐藏敏感信息)
|
||||
$logArg = $arg;
|
||||
|
||||
Log::getInstance()->info("处方平台HTTP请求:" . $path . ",请求参数:" . json_encode($logArg,JSON_UNESCAPED_UNICODE));
|
||||
// Log::getInstance()->info("处方平台HTTP请求:" . $path . ",请求参数:" . json_encode($logArg,JSON_UNESCAPED_UNICODE));
|
||||
|
||||
$response = $this->client->post($path, $arg);
|
||||
|
||||
if ($response->getStatusCode() != '200'){
|
||||
// 请求失败
|
||||
$errorBody = $response->getBody()->getContents();
|
||||
Log::getInstance()->error("处方平台HTTP请求失败,状态码:" . $response->getStatusCode() . ",错误信息:" . $errorBody);
|
||||
// Log::getInstance()->error("处方平台HTTP请求失败,状态码:" . $response->getStatusCode() . ",错误信息:" . $errorBody);
|
||||
throw new BusinessException($errorBody);
|
||||
}
|
||||
|
||||
$body = json_decode($response->getBody(),true);
|
||||
if (empty($body)){
|
||||
// 返回值为空
|
||||
Log::getInstance()->error("处方平台HTTP请求返回值为空,路径:" . $path);
|
||||
// Log::getInstance()->error("处方平台HTTP请求返回值为空,路径:" . $path);
|
||||
throw new BusinessException(HttpEnumCode::getMessage(HttpEnumCode::SERVER_ERROR));
|
||||
}
|
||||
|
||||
Log::getInstance()->info("处方平台HTTP请求成功,路径:" . $path . ",返回数据:" . json_encode($body,JSON_UNESCAPED_UNICODE));
|
||||
// Log::getInstance()->info("处方平台HTTP请求成功,路径:" . $path . ",返回数据:" . json_encode($body,JSON_UNESCAPED_UNICODE));
|
||||
return $body;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user