新增快递100测试
This commit is contained in:
+24
-21
@@ -34,24 +34,39 @@ class Kuaidi
|
||||
}
|
||||
|
||||
/**
|
||||
* 封装公共请求
|
||||
* @param string $path
|
||||
* @param array $arg
|
||||
* @return mixed
|
||||
* @throws GuzzleException
|
||||
* 获取签名
|
||||
* @param string $params
|
||||
* @return string
|
||||
*/
|
||||
protected function httpRequest(string $path, string $arg = []): mixed
|
||||
protected function getSign(string $params): string
|
||||
{
|
||||
return md5($params . config("kuaidi100.key") . config("kuaidi100.customer"));
|
||||
}
|
||||
|
||||
|
||||
public function subscribe(string $logistics_no,string $logistics_company_code,string $phone){
|
||||
$param = [
|
||||
'company' => $logistics_company_code, // 快递公司编码
|
||||
'number' => $logistics_no, // 快递单号
|
||||
'key' => config("kuaidi100.key"), // 客户授权key
|
||||
'parameters' => array (
|
||||
'callbackurl' => 'http://dev.hospital.applets.igandanyiyuan.com/callback/logistics', // 回调地址
|
||||
'resultv2' => '1', // 行政区域解析
|
||||
'phone' => $phone // 手机号
|
||||
)
|
||||
];
|
||||
|
||||
$option = [
|
||||
"json" => [
|
||||
"schema" => "json",
|
||||
"param" => json_encode($params, JSON_UNESCAPED_UNICODE),
|
||||
"param" => json_encode($param, JSON_UNESCAPED_UNICODE),
|
||||
],
|
||||
"verify" => false
|
||||
];
|
||||
|
||||
$arg = array_merge($arg, $option);
|
||||
$path = "https://poll.kuaidi100.com/poll";
|
||||
|
||||
$response = $this->client->post($path, $arg);
|
||||
$response = $this->client->post($path, $option);
|
||||
|
||||
if ($response->getStatusCode() != '200') {
|
||||
// 请求失败
|
||||
@@ -75,16 +90,4 @@ class Kuaidi
|
||||
return $body['body'];
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取签名
|
||||
* @param string $params
|
||||
* @return string
|
||||
*/
|
||||
protected function getSign(string $params): string
|
||||
{
|
||||
return md5($params . config("kuaidi100.key") . config("kuaidi100.customer"));
|
||||
}
|
||||
|
||||
public function
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user