Exemplo n.º 1
0
        /// <summary>
        /// 修改订单信息
        /// </summary>
        /// <param name="data"></param>
        /// <returns></returns>
        public bool UpdateExpressOrder(ExpressOrderData data)
        {
            HttpHelper helper = new HttpHelper();
            HttpItem   item   = new HttpItem()
            {
                URL         = "http://b.kuaidi100.com/v2/open/api.do?method=update",
                Method      = "post",
                Accept      = "application/json;charset=UTF-8",
                ContentType = "application/x-www-form-urlencoded",
                Postdata    = baseParam + "&data=" + data
            };
            var result = helper.GetHtml(item);
            var m      = JObject.Parse(result.Html);

            return(Convert.ToBoolean(m["result"]));
        }
Exemplo n.º 2
0
        /// <summary>
        /// 订单信息导入接口
        /// </summary>
        /// <param name="data"></param>
        /// <returns></returns>
        public bool CreateExpressOrder(ExpressOrderData data)
        {
            var        parmStr = JsonConvert.SerializeObject(data);
            HttpHelper helper  = new HttpHelper();
            HttpItem   item    = new HttpItem()
            {
                URL         = "http://b.kuaidi100.com/v2/open/api.do?method=send",
                Method      = "post",
                UserAgent   = "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36",
                Accept      = "application/json;charset=UTF-8",
                ContentType = "application/x-www-form-urlencoded;charset=UTF-8",
                Postdata    = baseParam + "&data=" + HttpUtility.UrlEncode(parmStr)
            };
            var result = helper.GetHtml(item);
            var m      = JObject.Parse(result.Html);

            return(Convert.ToBoolean(m["result"]));
        }