예제 #1
0
        public static string QueryRoute(string trackingNumber)
        {
            string url = string.Format(domain + "/rest/v1.0/route/query/access_token/{0}/sf_appid/{1}/sf_appkey/{2}", QueryAccessToken(), SFAppId, SFAppKey);
            MessageReq <RouteReqDto> req = new MessageReq <RouteReqDto>();

            req.head.transType      = 501;
            req.head.transMessageId = DateTime.Now.ToLongTimeString();
            req.body = new RouteReqDto();
            req.body.trackingNumber = trackingNumber;
            req.body.trackingType   = 2;//2 订单号查询 1 运单号查询
            req.body.methodType     = 1;
            MessageResp <List <RouteRespDto> > res = HttpWebHelper.doPost <MessageReq <RouteReqDto>, MessageResp <List <RouteRespDto> > >(url, req);

            if (res.head.code == "EX_CODE_OPENAPI_0105")
            {
                GetAccessToken();
                QueryRoute(trackingNumber);
            }
            return(HttpWebHelper.ObjectToJson(res));
        }