收藏
回答

【物流助手】调用addOrder后一直返回这样的寄件人信息异常的消息?

$sender   = [
   "name"      => "吴名",
   // "tel"       => "0371-86552563",
   "mobile"    => "18x9582089x",
   // "company"   => "黄金大路有限公司",
   // "post_code" => "450009",
   // "country"   => "中国",
   "province"  => "河南省",
   "city"      => "郑州市",
   "area"      => "新东新区",
   "address"   => "金水东路88号1栋1502",
];
$receiver = [
   "name"      => "王小蒙",
   // "tel"       => "0371-86551122",
   "mobile"    => "18x1718337x",
   // "company"   => "愉悦有乐科技公司",
   // "post_code" => "450005",
   // "country"   => "中国",
   "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(); //封装的curl方法
$result    = $action->curl_post($url, $addOrderDataJson);
$resultArr = json_decode($result, true);
print_r($resultArr);


//post方式请求接口
public function curl_post($url, $data=null,$headers = null)
{
    //$data 是一个 array() 数组;未编码
    $curl = curl_init();    // 启动一个CURL会话
    if(substr($url,0,5)=='https'){
        // 跳过证书检查
        curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
        //只有在CURL低于7.28.1时CURLOPT_SSL_VERIFYHOST才支持使用1表示true,高于这个版本就需要使用2表示了(true也不行)。
        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){
        //post请求中携带header参数
        curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
    }
    //返回api的json对象
    $response = curl_exec($curl);
    if ($response == false){
        echo 'Curl error: ' . curl_error($curl);
    }

    //关闭URL请求
    curl_error($curl);

    //返回json对象
    return $response;
}


返回信息是:
Array
(
    [errcode] => 9300501
    [errmsg] => delivery logic fail
    [delivery_resultcode] => 20002
    [delivery_resultmsg] => 寄件人信息异常
    [waybill_data] => Array
        (
        )
)



最后一次编辑于  2020-02-05
回答关注问题邀请回答
收藏

2 个回答

  • 灵芝
    灵芝
    2020-02-03

    你好,使用的是什么物流?请提供appid、完整的请求、具体返回、具体请求时间

    2020-02-03
    有用
    回复 17
    • 白开水
      白开水
      2020-02-03
      openid是:oxN_y5NoFwhy-Qq19OV8zVrS48cg
      快递选择的是:SF(顺丰)
      上面的信息完全准确
      2020-02-03
      回复
    • 白开水
      白开水
      2020-02-03
      请求时间就在20分钟内
      2020-02-03
      回复
    • 白开水
      白开水
      2020-02-03
      返回信息就是
      Array
      (
          [errcode] => 9300501
          [errmsg] => delivery logic fail
          [delivery_resultcode] => 20002
          [delivery_resultmsg] => 寄件人信息异常
          [waybill_data] => Array
              (
              )
      )
      2020-02-03
      回复
    • 灵芝
      灵芝
      2020-02-03回复白开水
      请贴一下完整的请求
      2020-02-03
      回复
    • 白开水
      白开水
      2020-02-03回复灵芝
      已帖
      2020-02-03
      回复
    查看更多(12)
  • 卡卡西特
    卡卡西特
    2020-02-03
    回公司可口可乐了
    2020-02-03
    有用
    回复
登录 后发表内容
问题标签