/// <summary> /// 查询订单支付宝支付状态 /// </summary> /// <param name="sheet_no">单号</param> bool IPayBLL.QueryAliPrePay(string sheet_no, string mer_id, out string errMsg) { errMsg = ""; try { IBLL.ISysBLL bll = new BLL.SysBLL(); body.alipay acc = bll.GetMerAlipayById(mer_id); if (acc == null) { throw new Exception("未初始化支付宝商家帐户"); } Com.Alipay.AliPay alibll = new Com.Alipay.AliPay(); var res = alibll.Alipay_Query(acc.app_id, acc.rsa1_private, acc.rsa1, sheet_no, out errMsg); return(res); } catch (Exception ex) { LogHelper.writeLog("PayBLL.QueryAliPrePay()", ex.ToString(), sheet_no); throw ex; } }
string IPayBLL.Query(string mer_id, string sheet_no, string pay_type) { DB.IDB db = new DB.DBByAutoClose(Appsetting.conn); string status = "0"; try { //微信支付生成微信预支付订单 if (pay_type == "W") { try { Wxpay.MicroPay bll = new Wxpay.MicroPay(); int eid = 0; string emsg = ""; bll.WXMicroPayQuery(mer_id, sheet_no, out eid, out emsg); if (eid == 0) { status = "1"; } else if (eid == 1) { status = "2"; throw new Exception("微信扫码支付失败[" + eid.ToString() + "]:" + emsg); } else { status = "0"; } } catch (Exception ex2) { throw ex2; } } else if (pay_type == "Z") { try { IBLL.ISysBLL bll = new BLL.SysBLL(); body.alipay acc = bll.GetMerAlipayById(mer_id); if (acc == null) { throw new Exception("未初始化支付宝商家帐户"); } Com.Alipay.AliPay alibll = new Com.Alipay.AliPay(); var emsg = ""; var res = alibll.Alipay_Query(acc.app_id, acc.rsa1_private, acc.rsa1, sheet_no, out emsg); if (!res) { throw new Exception("支付宝扫码支付失败:" + emsg); } else { status = "1"; } } catch (Exception ex2) { throw ex2; } } // if (status != "1") { string sql = "update ot_pay_record set status=@status where sheet_no=@sheet_no "; var pars = new System.Data.SqlClient.SqlParameter[] { new System.Data.SqlClient.SqlParameter("@sheet_no", sheet_no), new System.Data.SqlClient.SqlParameter("@status", status) }; db.ExecuteScalar(sql, pars); } return(status); } catch (Exception ex) { LogHelper.writeLog("PayBLL.Query()", ex.ToString(), sheet_no, mer_id, pay_type); throw ex; } }