$sender = [
"name" => "吴名",
"mobile" => "18x9582089x",
"province" => "河南省",
"city" => "郑州市",
"area" => "新东新区",
"address" => "金水东路88号1栋1502",
];
$receiver = [
"name" => "王小蒙",
"mobile" => "18x1718337x",
"province" => "河南省",
"city" => "郑州市",
"area" => "管城回族区",
"address" => "金城街蓝海港湾玉兰湾2栋",
];
$shop = [
"wxa_path" => "pages/order/detail?from=waybill&order_id=2020013050561015",
"img_url" => "https://mmbiz.qpic.cn/mmbiz_png/OiaFLUqewuIDNQnTiaCInIG8ibdosYHhQHPbXJUrqYSNIcBL60vo4LIjlcoNG1QPkeH5GWWEB41Ny895CokeAah8A/640",
"goods_name" => "微信气泡狗抱枕&微信气泡狗钥匙扣",
"goods_count" => 2,
];
$cargo = [
"count" => 2,
"weight" => 5.5,
"space_x" => 30.5,
"space_y" => 20,
"space_z" => 20,
"detail_list" => [
[
"name" => "微信气泡狗抱枕",
"count" => 1,
],
[
"name" => "微信气泡狗钥匙扣",
"count" => 1,
],
],
];
$order_id = date("YmdHis").rand(111, 999);
$addOrderData = [
"add_source" => 0,
"order_id" => $order_id,
"openid" => "oxN_y5NoFwhy-Qq19OV8zVrS48cg",
"delivery_id" => "SF",
"biz_id" => "SF_CASH",
"custom_remark" => "易碎物品",
"sender" => $sender,
"receiver" => $receiver,
"shop" => $shop,
"cargo" => $cargo,
"insured" => [
"use_insured" => 1,
"insured_value" => 10000,
],
"service" => [
"service_type" => 1,
"service_name" => "标准快递",
],
];
$addOrderDataJson = json_encode($addOrderData);
$url = "https://api.weixin.qq.com/cgi-bin/express/business/order/add?access_token=" . $token;
$action = new Curl();
$result = $action->curl_post($url, $addOrderDataJson);
$resultArr = json_decode($result, true);
print_r($resultArr);
public function curl_post($url, $data=null,$headers = null)
{
$curl = curl_init();
if(substr($url,0,5)=='https'){
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 2);
}
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_HEADER, 0);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
if($headers != null){
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
}
$response = curl_exec($curl);
if ($response == false){
echo 'Curl error: ' . curl_error($curl);
}
curl_error($curl);
return $response;
}
返回信息是:
Array
(
[errcode] => 9300501
[errmsg] => delivery logic fail
[delivery_resultcode] => 20002
[delivery_resultmsg] => 寄件人信息异常
[waybill_data] => Array
(
)
)
你好,使用的是什么物流?请提供appid、完整的请求、具体返回、具体请求时间
快递选择的是:SF(顺丰)
上面的信息完全准确
Array
(
[errcode] => 9300501
[errmsg] => delivery logic fail
[delivery_resultcode] => 20002
[delivery_resultmsg] => 寄件人信息异常
[waybill_data] => Array
(
)
)