private void timer1_Tick(object sender, EventArgs e) { this.pay_time_out = this.pay_time_out - 1; this.label5.Text = $"缴费倒计时{this.pay_time_out}秒"; // 支付超时超时 if (this.pay_time_out == 0) { this.timer1.Stop(); this.timer1.Enabled = false; string queryResult = HeMaPay.Query(out_order_no.ToString(), create_time); if (string.IsNullOrWhiteSpace(queryResult)) { this.Close(); this.mainForm.Close(); } else { JObject retQueryObj = JObject.Parse(queryResult); JObject retQueryDetailObj = JObject.Parse(retQueryObj["data"].ToString()); if (retQueryObj["code"].ToString().Equals("200") && retQueryDetailObj["sub_code"].ToString().Equals("SUCCESS")) { this.Close(); this.mainForm.PaySucceed(queryResult, retQueryObj, retQueryDetailObj, out_order_no.ToString(), this.create_time); } else { CloseOrder(out_order_no.ToString(), queryResult, retQueryObj, retQueryDetailObj); this.Close(); this.mainForm.Close(); } } } else { if (this.pay_time_out % this.pay_poll_time == 0) { string queryResult = HeMaPay.Query(out_order_no.ToString(), create_time); JObject retQueryObj = JObject.Parse(queryResult); JObject retQueryDetailObj = JObject.Parse(retQueryObj["data"].ToString()); if (retQueryObj["code"].ToString().Equals("200") && retQueryDetailObj["sub_code"].ToString().Equals("SUCCESS")) { this.Close(); this.timer1.Stop(); this.timer1.Enabled = false; this.mainForm.PaySucceed(queryResult, retQueryObj, retQueryDetailObj, out_order_no.ToString(), this.create_time); return; } } } }
private void CloseForm() { string queryResult = HeMaPay.Query(out_order_no.ToString(), create_time); if (string.IsNullOrWhiteSpace(queryResult)) { this.Close(); this.mainForm.Close(); } else { JObject retQueryObj = JObject.Parse(queryResult); JObject retQueryDetailObj = JObject.Parse(retQueryObj["data"].ToString()); if (retQueryObj["code"].ToString().Equals("200") && retQueryDetailObj["sub_code"].ToString().Equals("SUCCESS")) { this.Close(); this.mainForm.PaySucceed(queryResult, retQueryObj, retQueryDetailObj, out_order_no.ToString(), this.create_time); } else { CloseOrder(out_order_no.ToString(), queryResult, retQueryObj, retQueryDetailObj); } } }