修改我的医生
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user