组件名称:传运单接口 follow_waybill
php处理后的参数:
$data=[
'openid'=>'oJ60A0dxK6-************',//用户openid
'sender_phone'=>'135******5',//寄件人手机号
'receiver_phone'=>'135**********95',//收件人手机号,部分运力需要用户手机号作为查单依据
'express_no'=>'YT632372***6766',
'goods_info'=>[
'goods_name' => '宽头软毛牙刷',
'goods_img_url' => 'https://www.******.com/20201027094735acaee0076.jpg',
'goods_desc' => '颜色:随机 款式:2支装'
],
'trans_id'=>'42000013472*********',//交易单号(微信支付生成的交易单号,一般以420开头)
'order_detail_path'=>''
];
然后提交的时候,使用json_encode处理,获得的参数
{
"openid":"oJ60A0dxK6-sUKLIDadZNL_aMhIU",
"sender_phone":"1350*****95",
"receiver_phone":"1350*****95",
"express_no":"YT632372***6766",
"goods_info":[
{
"goods_name":"宽头软毛牙刷",
"goods_img_url":"https://www.******.com/20201027094735acaee0076.jpg",
"goods_desc":"颜色:随机 款式:2支装 "
}
],
"trans_id":"420000134*****************",
"order_detail_path":""
}
curl提交的时候,增加header
curl_setopt($curl, CURLOPT_HTTPHEADER,array(
'Content-Type:application/json; charset=utf-8'
));
cur的时候使用post,提示openid错误,使用get提示47001:data format error detail: [json错误]
请教大家这个该如何处理?
data format error 数据格式错了
Array
(
[errcode] => 0
[errmsg] => ok
[request] => Array
(
[invoke_time] => 1645692049
[cost_in_ms] => 4
[request_url] => access_token=************
[request_body] => {"openid":"oJ60A0dxK6-sUKLID*******","sender_phone":"13506****5","receiver_phone":"13506****5","express_no":"YT63237242***6","goods_info":[{"goods_name":"宽头软毛牙刷","goods_img_url":"https:\/\/www.yanyuhuo.com\/uploads\/202010\/20201027094735acaee0076.jpg","goods_desc":"颜色:随机 款式:2支装 "}],"trans_id":"4200001347202202245017931228","order_detail_path":""}
[response_body] => {"errcode":47001,"errmsg":"data format error detail: [json错误] rid: 62174491-2713d272-24176c11"}
)
)
你传的参数和文档里面不一致,请确认一下。比如express_no 这个字段是我们都没有的,商品的字段也是不一样的。