private void button2_Click(object sender, EventArgs e) { //timer2.Interval = 3000; if (timer2.Enabled) { timer2.Stop(); return; } var obj = GetVerifyCode(); if (obj == null) { return; } obj.Code = ttshituAPI.GetCode(obj.verifyCode); verifyList = new List <VerifyCodeData> { obj }; var member = new MemberParam { Name = "韦大宏", Phone = "19654783325", IdNumber = "110101199003076931" }; var verify = GetVerifyCodeData(); if (verify != null) { Start(member, verify, DateTime.Now.AddDays(1).Date); } }
public void Start(MemberParam memberParam, VerifyCodeData verify, DateTime dt) { try { //var json = "{\"code\":1016,\"msg\":\"今日预约已达上限\",\"data\":null}"; //Log($"{memberParam.Name}--{json}"); //var msg2 = dt + $" {memberParam.Name}:{json}"; //SetOKtb(msg2, dt); //return; System.DateTime startTime = TimeZone.CurrentTimeZone.ToLocalTime(new System.DateTime(1970, 1, 1)); // 当地时区 long stamp = (long)(dt - startTime).TotalMilliseconds; // 相差毫秒数 var postParam = new PostParam { basReservationNumberDate = stamp, basReservationNumberIdcard = memberParam.IdNumber, basReservationNumberName = memberParam.Name, basReservationNumberPhone = memberParam.Phone, verifyCodeId = verify.id, verifyCode = verify.Code, }; var postStr = JsonHelper.Serializer(postParam); var dtStr = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss ffffff"); var resultJson = HttpHelper.Post("http://120.202.98.106:8990/ebsapi/organization/basreservation/public/updateSchedule", postStr); Log($"{dtStr}-{memberParam.Name}\r\n{resultJson}\r\n"); var result = JsonHelper.DeserializeObject <PostResult>(resultJson); if (result.code == 1018) { lock (lockObj) { okList.Add(memberParam.Name); Log(memberParam.Name + " -->已预约"); } } if (result.code != 1016 && result.code != 1018 && result.code != 1023) { var msg = dt.Date + $" {memberParam.Name} -->{result.msg}"; SetOKtb(msg, dt); } /* * {"code":1016,"msg":"今日预约已达上限","data":null} * {"code":1018,"msg":"已预约","data":null} * {"code":1023,"msg":"未到预约开始时间","data":null} */ } catch (Exception ex) { } }