bool CheckValidateCode() { //获取选中图片坐标 foreach (Control c in picValidate.Controls) { if (c.Controls.Count > 0) { answer += (c.Location.X + 25).ToString() + "," + (c.Location.Y + 25).ToString() + ","; } } string json = _requestHelper.GetData("get", Api12306.getCaptchaCheck() + "&answer=" + answer); if (json != null && Common.IsJson(json)) { if (JObject.Parse(json)["result_code"].ToString() == "4") { return(true); } else { MessageBox.Show(JObject.Parse(json)["result_message"].ToString(), "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); GetValidateCode(); return(false); } } else { MessageBox.Show("网络异常!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); GetValidateCode(); return(false); } }
bool CheckValidateCode() { string json = _requestHelper.GetData("get", Api12306.getCaptchaCheck() + "&answer=" + answer); if (json != null && Common.IsJson(json)) { if (JObject.Parse(json)["result_code"].ToString() == "4") { return(true); } else { MessageBox.Show(JObject.Parse(json)["result_message"].ToString(), "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); GetValidateCode(); return(false); } } else { MessageBox.Show("网络异常!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); GetValidateCode(); return(false); } }