后端php代码:
<?php
class cs_controller extends common{
function index_action(){
$_POST['openid']="osiO-4iA0eK9q_jPCpdop0TYUZxU";
$_POST['access_token']="31_2TmcbK0Nz1uD29bi78o4HtiB1nF3tcMA9EL3QPdROEFqUH3AYs5BhqcX7oRy_7muBPdoF1BKI1FkMM9lRy3oG-tGEoF99omIIQcQK5aFc-V59TwAaFTjg6vr7qC5NaV9pCzSe8v9FrQj0jNfLUAhAAAVEK";
$data['add_source']=0;
$data['order_id']=time();
$data['openid']=$_POST['openid'];
$data['delivery_id']="SF";
$data['biz_id']="SF_CASH";
$data['custom_remark']="易碎";
$sender['name']="张三";
$sender['tel']="0512-89990000";
$sender['mobile']="13815733350";
//$sender['company']="苏州金盟";
//$sender['post_code']="215000";
$sender['country']="中国";
$sender['province']="江苏省";
$sender['city']="苏州市";
$sender['area']="工业园区";
$sender['address']="若水路99号";
$data['sender']=$sender;
$receiver['name']="张三";
$receiver['tel']="0512-89990000";
$receiver['mobile']="13815733350";
$receiver['company']="苏州金盟";
$receiver['post_code']="215000";
$receiver['country']="中国";
$receiver['province']="江苏省";
$receiver['city']="苏州市";
$receiver['area']="工业园区";
$receiver['address']="若水路99号";
$data['receiver']=$receiver;
$shop['wxa_path']="/index/index?from=waybill&id=01234567890123456789";
$shop['img_url']="https://mmbiz.qpic.cn/mmbiz_png/OiaFLUqewuIDNQnTiaCInIG8ibdosYHhQHPbXJUrqYSNIcBL60vo4LIjlcoNG1QPkeH5GWWEB41Ny895CokeAah8A/640";
$shop['goods_name']="微信气泡狗抱枕&微信气泡狗钥匙扣";
$shop['goods_count']=2;
$data['shop']=$shop;
$cargo['count']=2;
$cargo['weight']=5;
$cargo['space_x']=30;
$cargo['space_y']=2;
$cargo['space_z']=2;
$detail_list[0]['name']="微信气泡狗抱枕";
$detail_list[0]['count']=2;
$cargo['detail_list']=$detail_list;
$data['cargo']=$cargo;
$insured['use_insured']=1;
$insured['insured_value']=10000;
$data['insured']=$insured;
$service['use_insured']=0;
$service['insured_value']="标准快递";
$data['service']=$service;
$access_token=$_POST['access_token'];
//print_r(json_encode($data));die;
$result=$this->CurlPost("https://api.weixin.qq.com/cgi-bin/express/business/order/add?access_token=$access_token",json_encode($data));
print_r($result);die;
}
function CurlPost($url,$data=''){
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
if($data!=''){
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
}
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
$Return=curl_exec ($ch);
if (curl_errno($url)) {
echo 'Errno'.curl_error($url);
}
curl_close($ch);
return $Return;
}
}
?>
返回结果:
{
"errcode": 9300501,
"errmsg": "delivery logic fail",
"delivery_resultcode": 20002,
"delivery_resultmsg": "寄件人信息异常",
"waybill_data": []
}
我刚刚用的是时间戳测试的,需要我下一个固定的订单号吗
订单号麻烦提供下