/// <summary> /// 操作步聚:获取验证码内容(从聚合API接口) /// </summary> /// <param name="base64"></param> /// <returns></returns> private string StepByGetCaptchaCodeByJUHE(QuestSourceModel model, string base64) { ShowStatusText(string.Format("{0}[登录],自动识别验证码", model.Name)); string captchaCodeValue = string.Empty; if (!VerifyHelper.IsEmpty(base64)) { var options = new HttpClientOptions(); var client = new HttpWebClientUtility(); options.URL = AppHelper.UrlCaptchaValJuHe; options.Method = "POST"; options.ContentType = "application/x-www-form-urlencoded"; options.PostData = string.Format("key={0}&codeType={1}&base64Str={2}", AppHelper.ValueJuHeKey1, AppHelper.ValueJuHeKey2, CodingHelper.UrlEncoding(base64)); var result = client.Request(options); if (!VerifyHelper.IsEmpty(result.Content)) { var obj = JsonHelper.Deserialize <JObject>(result.Content); if (obj != null && StringHelper.Get(obj["error_code"]) == "0") { captchaCodeValue = StringHelper.Get(obj["result"]); } } } ShowStatusText(string.Format("{0}[登录],验证码识别 {1}", model.Name, !VerifyHelper.IsEmpty(captchaCodeValue) ? "成功" : "失败")); return(captchaCodeValue); }
/// <summary> /// 操作步聚:报名申请 /// </summary> /// <param name="model"></param> private void StepByApply(QuestSourceModel model) { ShowStatusText(string.Format("{0}[申请],正在申请", model.Name)); var options = new HttpClientOptions(); var client = new HttpWebClientUtility(); options.URL = AppHelper.UrlApply; options.Method = "POST"; options.ContentType = "application/x-www-form-urlencoded"; options.CookieCollection = model.Cookies; List <KeyValueModel> datas = new List <KeyValueModel>(); var examValueArr = model.ExamValue.Split('|'); var examNameArr = model.ExamNameValue.Split('|'); var areaValueArr = model.AreaValue.Split('|'); var relationshipValueArr = model.RelationshipValue.Split('|'); var categoryValueArr = model.CategoryValue.Split('|'); var subjectValueArr = model.SubjectValue.Split('|'); var packageValueArr = model.PackageValue.Split('|'); datas.Add(new KeyValueModel("scoreId", "")); datas.Add(new KeyValueModel("uId", model.UserId)); datas.Add(new KeyValueModel("proId", AppHelper.ValueProId)); datas.Add(new KeyValueModel("nodeCode", AppHelper.ValueNodeCode)); datas.Add(new KeyValueModel("studentType", AppHelper.ValueStudentType)); datas.Add(new KeyValueModel("paymentType", AppHelper.ValuePaymentType)); datas.Add(new KeyValueModel("examId", examValueArr[0])); datas.Add(new KeyValueModel("orgGeo", areaValueArr[0])); datas.Add(new KeyValueModel("relationshipId", relationshipValueArr[0])); datas.Add(new KeyValueModel("packageId", string.Format("{0}#", categoryValueArr[0]))); for (var i = 0; i < model.PackageIdValue.Split('|').Length; i++) { datas.Add(new KeyValueModel("regList[0].examId", examValueArr[i])); datas.Add(new KeyValueModel("regList[0].examDate", examNameArr[i])); datas.Add(new KeyValueModel("regList[0].orgGeo", areaValueArr[i])); datas.Add(new KeyValueModel("regList[0].relationshipId", relationshipValueArr[i])); datas.Add(new KeyValueModel("regList[0].categoryId", categoryValueArr[i])); datas.Add(new KeyValueModel("regList[0].subjectId", subjectValueArr[i])); datas.Add(new KeyValueModel("regList[0].packageId", packageValueArr[i])); } options.PostData = StringHelper.GetFormStringByKeyValues(datas); var result = client.Request(options); if (!VerifyHelper.IsEmpty(result.Content)) { var resModel = JsonHelper.Deserialize <ApplyResultModel>(result.Content); if (resModel != null && resModel.success) { model.Message = "申请成功"; model.RetryTotal = 0; model.IsWork = true; } else { model.Message = resModel.msg; } } ShowStatusText(string.Format("{0}[申请]({1})", model.Name, model.IsWork ? "成功" : "失败"), loggerLev: model.IsWork?EnumLoggerLev.Info: EnumLoggerLev.Error); }