コード例 #1
0
 public static string WebQueryJson(string type, string postid)
 {
     if (string.IsNullOrEmpty(type))
     {
         List <string> types = KuaiDi100Helper.WebAutoComNum(postid);
         if (types.Count == 0)
         {
             throw new KuaiDiException("快递类型必填");
         }
         type = types[0];
     }
     return(KuaiDi100Helper.GetResult(type, postid));
 }
コード例 #2
0
        public static string GetResult(string type, string postid)
        {
            StringBuilder param = new StringBuilder("{");

            param.Append("\"com\":\"").Append(type).Append("\"");
            param.Append(",\"num\":\"").Append(postid).Append("\"");
            param.Append(",\"from\":\"").Append("\"");
            param.Append(",\"phone\":\"").Append("\"");
            param.Append(",\"to\":\"").Append("\"");
            param.Append(",\"resultv2\":0");
            param.Append("}");
            string      sign        = KuaiDi100Helper.Md5Hex(param + SystemDefault.KuaiDI100Key + SystemDefault.KuaiDI100Customer).ToUpper();
            string      url         = string.Format(SystemDefault.KuaiDi100Url2, SystemDefault.KuaiDI100Customer, sign, param.ToString());
            HttpHandler httpHandler = new HttpHandler();
            string      jsonText    = httpHandler.Initialize().GetHttpResponse(url);

            return(jsonText);
        }