Пример #1
0
        /// <summary>
        /// 验证身份证
        /// </summary>
        /// <param name="id"></param>
        /// <param name="name"></param>
        /// <param name="errmsg"></param>
        /// <returns></returns>
        public static bool IdCheck(string id, string name, ref string errmsg)
        {
            ReqIDCheck ric = new ReqIDCheck();

            ric.ywlx      = "open account";
            ric.sessionId = "";
            ric.gmsfhm    = id;
            ric.xm        = name;
            ric.fsd       = "不验证";
            ric.account   = USER;
            ric.xp        = "";
            ric.action    = "qsfz";
            ric.cid       = DateTime.Now.Ticks.ToString();
            string json  = JsonConvert.SerializeObject(ric);
            string param = "?action=qsfz&token=" + Token + "&mid=1&msg={\"" + ric.gmsfhm + "\":" + json + "}";

            log("2.验证用户请求:" + param);
            string res = req.SendRequest(CallBackUrl, param);

            log("2.验证返回信息:" + res);
            IDinfo  ri = null;
            JObject jo = JObject.Parse(res);

            if (jo != null)
            {
                JObject joc = JObject.Parse(jo["msg"].ToString());
                if (joc != null)
                {
                    ri = JsonConvert.DeserializeObject <IDinfo>(joc[ric.gmsfhm].ToString());
                }
            }
            bool isCheck = false;

            switch (ri.statcode)
            {
            case "1100":
                errmsg = "验证成功";
                log("2.验证结果:" + ric.gmsfhm + " 验证成功.");
                isCheck = true;
                break;

            case "1101":
                errmsg = "身份证号码不一致";
                log("2.验证结果:" + ric.gmsfhm + " 身份证号码不一致.");
                isCheck = false;
                break;

            case "1102":
                errmsg = "姓名不一致";
                log("2.验证结果:" + ric.gmsfhm + " 姓名不一致.");
                isCheck = false;
                break;

            default:
                errmsg = "异常错误";
                break;
            }

            return(isCheck);
        }
Пример #2
0
        /// <summary>
        /// 验证身份证
        /// </summary>
        /// <param name="id"></param>
        /// <param name="name"></param>
        /// <param name="errmsg"></param>
        /// <returns></returns>
        public static bool IdCheck(string id, string name, ref string errmsg)
        {
            ReqIDCheck ric = new ReqIDCheck();
            ric.ywlx = "open account";
            ric.sessionId = "";
            ric.gmsfhm = id;
            ric.xm = name;
            ric.fsd = "不验证";
            ric.account = USER;
            ric.xp = "";
            ric.action = "qsfz";
            ric.cid = DateTime.Now.Ticks.ToString();
            string json = JsonConvert.SerializeObject(ric);
            string param = "?action=qsfz&token=" + Token + "&mid=1&msg={\"" + ric.gmsfhm + "\":" + json + "}";
            log("2.验证用户请求:" + param);
            string res = req.SendRequest(CallBackUrl, param);
            log("2.验证返回信息:" + res);
            IDinfo ri = null;
            JObject jo = JObject.Parse(res);
            if (jo != null)
            {
                JObject joc = JObject.Parse(jo["msg"].ToString());
                if (joc != null){
                    ri = JsonConvert.DeserializeObject<IDinfo>(joc[ric.gmsfhm].ToString());
                }
            }
            bool isCheck = false;
            switch (ri.statcode)
            {
                case "1100":
                    errmsg = "验证成功";
                    log("2.验证结果:" + ric.gmsfhm+" 验证成功.");
                    isCheck = true;
                    break;

                case "1101":
                    errmsg = "身份证号码不一致";
                    log("2.验证结果:" + ric.gmsfhm+" 身份证号码不一致.");
                    isCheck = false;
                    break;

                case "1102":
                    errmsg = "姓名不一致";
                    log("2.验证结果:" + ric.gmsfhm+" 姓名不一致.");
                    isCheck = false;
                    break;

                default:
                    errmsg = "异常错误";
                    break;
            }

            return isCheck;
        }