修改我的医生

This commit is contained in:
2023-04-13 14:39:36 +08:00
parent a5fb1d46e7
commit 81a47d72e0
10 changed files with 291 additions and 121 deletions
+19 -8
View File
@@ -44,7 +44,16 @@ class Kuaidi
}
public function subscribe(string $logistics_no,string $logistics_company_code,string $phone){
/**
* 订阅快递推送
* @param string $logistics_no
* @param string $logistics_company_code
* @param string $order_product_id
* @param string $phone
* @return mixed
* @throws GuzzleException
*/
public function subscribe(string $logistics_no,string $logistics_company_code,string $phone = ""){
$param = [
'company' => $logistics_company_code, // 快递公司编码
'number' => $logistics_no, // 快递单号
@@ -52,12 +61,13 @@ class Kuaidi
'parameters' => array (
'callbackurl' => 'http://dev.hospital.applets.igandanyiyuan.com/callback/logistics', // 回调地址
'resultv2' => '1', // 行政区域解析
'phone' => $phone // 手机号
'phone' => $phone, // 手机号
'salt' => config('kuaidi100.salt'), // 签名用字符串
)
];
$option = [
"json" => [
"form_params" => [
"schema" => "json",
"param" => json_encode($param, JSON_UNESCAPED_UNICODE),
],
@@ -73,21 +83,22 @@ class Kuaidi
throw new BusinessException($response->getBody()->getContents());
}
$body = json_decode($response->getBody(), true);
dump($body);
if (empty($body)) {
// 返回值为空
throw new BusinessException(HttpEnumCode::getMessage(HttpEnumCode::SERVER_ERROR));
}
if ($body['result_code'] != 0) {
if ($body['returnCode'] != 200) {
// 请求失败
if (!empty($body['result_msg'])) {
throw new BusinessException($body['result_msg']);
if (!empty($body['message'])) {
throw new BusinessException($body['message']);
}
throw new BusinessException(HttpEnumCode::getMessage(HttpEnumCode::SERVER_ERROR));
}
return $body['body'];
return $body;
}
}