收藏
回答

【物流助手/即时配送】使用预下配送单接口返回错误代码2003签名错误,请问应该向谁咨询?

使用达达即时配送方案,在预下单(https://api.weixin.qq.com/cgi-bin/express/local/business/order/pre_add?access_token=ACCESS_TOKEN)时,出现2003错误,错误返回如下:

{"resultcode":2003,"resultmsg":"签名错误","fee":0,"deliverfee":0,"tips":0,"insurancefee":0,"distance":0,"delivery_token":"","dispatch_duration":0}

请求信息如下($data):

{

    "cargo": {

        "goods_value": "97.80",

        "goods_weight": "3",

        "goods_pickup_info": "",

        "goods_delivery_info": "",

        "cargo_first_class": "\u65e5\u7528\u767e\u8d27",

        "cargo_second_class": "\u5ba0\u7269\u7528\u54c1"

    },

    "delivery_sign": "a6967774e37d812ca9d887efce235ce5606540d3",

    "delivery_id": "DADA",

    "openid": "o7OLI5V-JEIH-5qwuonh-ThNCinA",

    "order_info": {

        "order_type": "0"

    },

    "receiver": {

        "name": "\u5f20\u4e09",

        "city": "\u5357\u4eac",

        "address": "\u5e7f\u5dde\u5e02\u6d77\u73e0\u533a\u65b0\u6e2f\u4e2d\u8def397\u53f7",

        "address_detail": "\u5e7f\u5dde\u5e02\u6d77\u73e0\u533a\u65b0\u6e2f\u4e2d\u8def397\u53f7",

        "phone": "020-81167888",

        "lng": "113.3237686157",

        "lat": "23.0964202881"

    },

    "shop_id": "dadae5e77242bf27905",

    "shop_order_id": "110",

    "shop_no": "39160-433264",

    "shop": {

        "wxa_path": "\/historyOrderDetail\/historyOrderDetail?order_id=110",

        "img_url": "https:\/\/cyanlake.cn\/crd\/shopImg\/1\/coverImg.jpg",

        "goods_name": "\u9752\u6e56\u6d4b\u8bd5\u5e97",

        "goods_count": "10"

    }

}

达达提供的appkey:$dada_shop_id="dadae5e77242bf27905";$dada_app_secret="如需要可提供";

加密算法:$delivery_sign=sha1($dada_shop_id.$shop_order_id.$dada_app_secret);

-------------------------------------------------

请求发送:

$data = array(//主参数构建

"cargo"=>$cargo,

"delivery_sign"=>$delivery_sign,

"delivery_id"=>$delivery_id,

"openid"=>$user_openid,

"order_info"=>$order_info,

"receiver"=>$receiver,

"shop_id" =>$dada_shop_id,

"shop_order_id"=>$shop_order_id,

"shop_no"=>$dadaID,

"shop"=>$shop

); 

$url="https://api.weixin.qq.com/cgi-bin/express/local/business/order/pre_add?access_token=".$accessToken;

$data=json_encode($data,JSON_UNESCAPED_UNICODE);

$options = array(

'http' => array(

'method' => 'POST',

'header'=>"Content-type: application/x-www-form-urlencoded;charset=gb2312\r\n".  

  "Content-length:".strlen($data)."\r\n",

'content' => $data,

)

);

$context = stream_context_create($options);

$codeinfo = file_get_contents($url,false,$context);


服务器使用php7.3


回答关注问题邀请回答
收藏

2 个回答

  • 卢屹峰
    卢屹峰
    02-07

    文档算法

    delivery_sign=SHA1(shopid + shop_order_id + AppSecret)

    我的算法

    $delivery_sign=sha1($dada_shop_id.$shop_order_id.$dada_app_secret);

    其中$dada_shop_id=达达APP_Key=dadae5e77242bf27905

    $dada_app_secret=达达APP_Secret

    以上两个值,从达达开放平台-我是商户入口进入并获得,且和immediateDelivery.getBindAccount接口查询结果一致

    $shop_order_id=自定义订单编号

    且我算出来的$delivery_sign和网上工具算出来的sha1结果相等

    所以。。。想请教一下这个$delivery_sign是不是还有什么我没考虑到的坑?

    02-07
    赞同
    回复
  • raylin
    raylin
    02-07

    签名错误指delivery_sign设置不对,请参考

    https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/immediate-delivery/read_first.html

    02-07
    赞同
    回复 3
    • 卢屹峰
      卢屹峰
      02-07
      文档算法
      delivery_sign=SHA1(shopid + shop_order_id + AppSecret)
      我的算法
      $delivery_sign=sha1($dada_shop_id.$shop_order_id.$dada_app_secret);
      其中$dada_shop_id=达达APP_Key=dadae5e77242bf27905
      $dada_app_secret=达达APP_Secret
      以上两个值,从达达开放平台-我是商户入口进入并获得,且和immediateDelivery.getBindAccount接口查询结果一致
      $shop_order_id=自定义订单编号
      且我算出来的$delivery_sign和网上工具算出来的sha1结果相等
      所以。。。想请教一下这个$delivery_sign是不是还有什么我没考虑到的坑?
      02-07
      回复
    • raylin
      raylin
      02-10回复卢屹峰
      方法是对的,是不是appsecret没取对?
      02-10
      回复
    • 卢屹峰
      卢屹峰
      02-10回复raylin
      也是对的,这个端口你们近期验证过是没有问题的对吧?
      02-10
      回复
登录 后发表内容
问题标签