系统更新顺丰查询物流状态(签收/拒收)

因为客户通过其他人发货没有API,只可以通过手动查询;

我一开始直接人工查询物流状态,因为量慢慢多了,只可以搞一个js查询物流状态

如果 对接系统

首先导出 运单号对应的系统ID

设置eIDJson (一般导出昨天之前的运单对应ID)不需要对接系统不用这个添加ID直接设运单号就可以

打开 顺丰查询物流状态网址

https://www.sf-express.com/cn/sc/dynamic_function/waybill

每次复制10个运单号查询,查询之前打开调试器点网络

 筛选 rou,全选复制响应

var kd=复制的响应代码
var endOp,expressTime, opCode,sKey,wKey,eIDJson={"SF运单号1":系统ID,"SF运单号2":系统ID},nullIDs = new Array(),okIDs = new Array(),errIDs = new Array();
console.log(eIDJson)
for(var i=0;i<kd.length;i++){
  sKey="";
  wKey="";  // (eStatus<3 or eStatus is null) and 
  endOp=kd[i].routes[kd[i].routes.length-1];
  expressTime=endOp.scanDateTime;
  //http://qiao.sf-express.com/pages/developDoc/index.html?level2=949000
  switch(Number(endOp.opCode)){
    case 99:
    errIDs.push(eIDJson[kd[i].id])
    break;
    case 33:
    case 70:
      if(endOp.remark.indexOf("拒收")>-1 || endOp.remark.indexOf("客户未支付")>-1){
        errIDs.push(eIDJson[kd[i].id])
      }else{
        nullIDs.push(eIDJson[kd[i].id])
      }
      break
    case 80:
      okIDs.push(eIDJson[kd[i].id])
      break;
    default:
      nullIDs.push(eIDJson[kd[i].id])
      break;
  }
}

console.log("未确定",nullIDs)
console.log("签收",okIDs)
console.log("拒收",nullIDs)

 

posted @ 2020-10-03 23:14  80arrow  阅读(1605)  评论(0)    收藏  举报