/// <summary> /// 修改时时订单表数据 /// </summary> /// <param name="morder">根据订单查询后的mode实体类型</param> /// <param name="trade_no">第三方流水号</param> /// <param name="gmt_payment">支付时间</param> /// <param name="price">支付金额</param> /// <param name="payuser">付款账号</param> /// <param name="noticestr">传入的字符串</param> /// <param name="channelId">支付通道id</param> /// <returns></returns> private bool UpdateOrder(JMP.MDL.jmp_order morder, string trade_no, DateTime gmt_payment, decimal price, string payuser, string noticestr, int channelId) { try { JMP.BLL.jmp_order order = new JMP.BLL.jmp_order(); string TableName = "jmp_order"; morder.o_tradeno = trade_no; morder.o_ptime = gmt_payment; morder.o_payuser = payuser; morder.o_state = 1; morder.o_noticestate = 0; morder.o_price = price; if (morder.o_interface_id != channelId) { morder.o_interface_id = channelId; } if (order.Update(morder, TableName)) { return(true); } else { //AddLocLog.AddLog(1, 4, HttpContext.Current.Request.UserHostAddress, "通知接口错误", "修改订单失败!订单号:" + morder.o_code + ",传入参数:" + noticestr);//写入报错日志 PayNotifyGlobalErrorLogger.Log("修改订单失败!订单号:" + morder.o_code + ",传入参数:" + noticestr, summary: "通知接口错误"); return(false); } } catch (Exception ex) { // AddLocLog.AddLog(1, 4, HttpContext.Current.Request.UserHostAddress, "通知接口错误", "修改订单失败!订单号:" + morder.o_code + ",错误信息:" + ex.ToString() + ",传入参数:" + noticestr);//写入报错日志 PayNotifyGlobalErrorLogger.Log("修改订单失败!订单号:" + morder.o_code + ",错误信息:" + ex.ToString() + ",传入参数:" + noticestr, summary: "通知接口错误"); return(false); } }
protected void Page_Load(object sender, EventArgs e) { if (Request.Params["oid"] != null) { try { int oid = int.Parse(Request.QueryString["oid"].ToString()); JMP.BLL.jmp_order order = new JMP.BLL.jmp_order(); JMP.MDL.jmp_order morder = new JMP.MDL.jmp_order(); string TableName = "jmp_order"; morder = order.GetModelbyid(oid, TableName); if (morder != null) { if (string.IsNullOrEmpty(morder.o_showaddress)) { morder.o_showaddress = ConfigurationManager.AppSettings["succeed"].ToString(); } string url = morder.o_showaddress.Contains("?") ? morder.o_showaddress + "&trade_no=" + morder.o_bizcode + "&trade_status=TRADE_SUCCESS" : morder.o_showaddress + "?trade_no=" + morder.o_bizcode + "&trade_status=TRADE_SUCCESS"; Response.Redirect(url); } else { Response.Write("非法访问"); } } catch { Response.Write("非法访问"); } } else { Response.Write("非法访问"); } }
/// <summary> /// 当回传金额和支付金额不一致时调用此方法(把信息传入订单异常表) /// </summary> /// <param name="morder">订单实体类型</param> /// <param name="orderTableName">表名</param> /// <param name="trade_no">第三方流水号</param> /// <param name="gmt_payment">支付时间</param> /// <param name="price">支付金额</param> /// <param name="noticestr">传入的字符串</param> /// <returns></returns> private string AddAuditor(JMP.MDL.jmp_order morder, string orderTableName, string trade_no, DateTime gmt_payment, decimal price, string noticestr) { string message = ""; try { string TableName = "jmp_order"; if (JMP.TOOL.UpdateOrder.OrderState.UpdateOrderState(morder.o_code, TableName)) { string ddsm = "订单号:" + morder.o_code + ",支付信息异常请核实!";//短信说明 JMP.TOOL.Auditor.IAuditor audit = new JMP.TOOL.Auditor.OrderAbnormalAuditor(morder.o_code, orderTableName, morder.o_app_id, ddsm, trade_no, gmt_payment, price, "成功", morder.o_price); audit.Add(); message = "ok"; } else { message = "error"; } } catch (Exception ex) { //AddLocLog.AddLog(1, 4, HttpContext.Current.Request.UserHostAddress, "通知接口错误", "订单号:" + morder.o_code + "添加金额异常表出错,传入参数:" + noticestr + "!错误信息:" + ex.ToString());//写入报错日志 PayNotifyGlobalErrorLogger.Log("订单号:" + morder.o_code + "添加金额异常表出错,传入参数:" + noticestr + "!错误信息:" + ex.ToString(), summary: "通知接口错误"); message = "error"; } return(message); }
/// <summary> /// 添加订单表数据 /// </summary> /// <param name="model"></param> /// <returns></returns> public int AddOrder(JMP.MDL.jmp_order model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into jmp_order("); strSql.Append("o_code,o_bizcode,o_tradeno,o_paymode_id,o_app_id,o_goodsname,o_term_key,o_price,o_payuser,o_ctime,o_ptime,o_state,o_times,o_address,o_noticestate,o_noticetimes,o_privateinfo,o_interface_id,o_showaddress"); strSql.Append(") values ("); strSql.Append("@o_code,@o_bizcode,@o_tradeno,@o_paymode_id,@o_app_id,@o_goodsname,@o_term_key,@o_price,@o_payuser,@o_ctime,@o_ptime,@o_state,@o_times,@o_address,@o_noticestate,@o_noticetimes,@o_privateinfo,@o_interface_id,@o_showaddress"); strSql.Append(") "); strSql.Append(";select @@IDENTITY"); SqlParameter[] parameters = { new SqlParameter("@o_code", SqlDbType.NVarChar, -1), new SqlParameter("@o_bizcode", SqlDbType.NVarChar, -1), new SqlParameter("@o_tradeno", SqlDbType.NVarChar, -1), new SqlParameter("@o_paymode_id", SqlDbType.NVarChar, -1), new SqlParameter("@o_app_id", SqlDbType.Int, 4), new SqlParameter("@o_goodsname", SqlDbType.NVarChar, -1), new SqlParameter("@o_term_key", SqlDbType.NVarChar, -1), new SqlParameter("@o_price", SqlDbType.Money, 8), new SqlParameter("@o_payuser", SqlDbType.NVarChar, -1), new SqlParameter("@o_ctime", SqlDbType.DateTime), new SqlParameter("@o_ptime", SqlDbType.DateTime), new SqlParameter("@o_state", SqlDbType.Int, 4), new SqlParameter("@o_times", model.o_times), new SqlParameter("@o_address", model.o_address), new SqlParameter("@o_noticestate", model.o_noticestate), new SqlParameter("@o_noticetimes", model.o_noticetimes), new SqlParameter("@o_privateinfo", model.o_privateinfo), new SqlParameter("@o_interface_id", model.o_interface_id), new SqlParameter("@o_showaddress", model.o_showaddress) }; parameters[0].Value = model.o_code; parameters[1].Value = model.o_bizcode; parameters[2].Value = model.o_tradeno; parameters[3].Value = model.o_paymode_id; parameters[4].Value = model.o_app_id; parameters[5].Value = model.o_goodsname; parameters[6].Value = model.o_term_key; parameters[7].Value = model.o_price; parameters[8].Value = model.o_payuser; parameters[9].Value = model.o_ctime; parameters[10].Value = model.o_ptime; parameters[11].Value = model.o_state; object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters); if (obj == null) { return(0); } else { return(Convert.ToInt32(obj)); } }
/// <summary> /// 通知接口外部调用公共方式(主入口) /// </summary> /// <param name="code">订单编号</param> /// <param name="price">支付金额(单位:元)</param> /// <param name="gmt_payment">支付时间</param> /// <param name="trade_no">第三方流水号</param> /// <param name="payuser">付款账号</param> /// <param name="channelId">通道id</param> /// <param name="tname">接口名称</param> /// <param name="noticestr">传入参数字符串</param> /// <returns></returns> public string PubNotice(string code, decimal price, DateTime gmt_payment, string trade_no, string payuser, int channelId, string tname, string noticestr) { string message = ""; try { JMP.MDL.jmp_order morder = new JMP.MDL.jmp_order(); string orderTableName = JMP.TOOL.WeekDateTime.GetOrderTableName(gmt_payment.ToString()); //获取订单表名 morder = SelectOrder(code, noticestr); //获取订单信息 if (morder != null) { if (price == morder.o_price) { int payid = !string.IsNullOrEmpty(morder.o_paymode_id) ? Int32.Parse(morder.o_paymode_id) : 0; if (JMP.TOOL.OrderProportion.ddbl(morder.o_app_id, price, payid))//调单设置 { message = "ok"; } else { if (morder.o_interface_id != channelId) { PayApiDetailErrorLogger.UpstreamNotifyErrorLog("订单号:" + code + ",我们记录的通道id:" + morder.o_interface_id + ",上游获取回来的id:" + channelId + ",订单表id:" + morder.o_id, summary: tname + "通知接口错误,串单了", channelId: channelId); } if (morder.o_state != 1) { if (UpdateOrder(morder, trade_no, gmt_payment, price, payuser, noticestr, channelId)) { message = addqueuelist(morder, orderTableName, tname, noticestr); } } else { message = "ok"; } } } else { message = AddAuditor(morder, orderTableName, trade_no, gmt_payment, price, noticestr); } } else { PayApiDetailErrorLogger.UpstreamNotifyErrorLog("订单号:" + code + ",未查询到相关信息!,传入参数:" + noticestr, summary: tname + "通知接口错误", channelId: channelId); message = "error"; } } catch (Exception ex) { PayApiDetailErrorLogger.UpstreamNotifyErrorLog("通知接口主入口出错,订单号:" + code + ",传入参数:" + noticestr + ",错误信息:" + ex.ToString(), summary: tname + "通知接口错误", channelId: channelId); message = "error"; } return(message); }
/// <summary> /// 通知接口外部调用公共方法(主入口,不判断金额以上游通知的金额为准) /// </summary> /// <param name="code">订单编号</param> /// <param name="price">支付金额(单位:元)</param> /// <param name="gmt_payment">支付时间</param> /// <param name="trade_no">第三方流水号</param> /// <param name="payuser">付款账号</param> /// <param name="tname">接口名称</param> /// <param name="noticestr">传入参数字符串</param> /// <param name="channelId">通道id</param> /// <returns></returns> public string PubNoticeMoney(string code, decimal price, DateTime gmt_payment, string trade_no, string payuser, string tname, string noticestr, int channelId) { string message = ""; try { JMP.MDL.jmp_order morder = new JMP.MDL.jmp_order(); string orderTableName = JMP.TOOL.WeekDateTime.GetOrderTableName(gmt_payment.ToString()); //获取订单表名 morder = SelectOrder(code, noticestr); //获取订单信息 if (morder != null) { if (price < (morder.o_price - 2) || price > (morder.o_price + 2) || price <= 0) { return(message = AddAuditor(morder, orderTableName, trade_no, gmt_payment, price, noticestr)); } else { morder.o_price = price; //以上游通知的金额为准 int payid = !string.IsNullOrEmpty(morder.o_paymode_id) ? Int32.Parse(morder.o_paymode_id) : 0; if (JMP.TOOL.OrderProportion.ddbl(morder.o_app_id, price, payid)) //调单设置 { message = "ok"; } else { if (morder.o_state != 1) { if (UpdateOrder(morder, trade_no, gmt_payment, price, payuser, noticestr, channelId)) { message = addqueuelist(morder, orderTableName, tname, noticestr); } } else { message = "ok"; } } } } else { // AddLocLog.AddLog(1, 4, HttpContext.Current.Request.UserHostAddress, tname + "通知接口错误", "订单号:" + code + ",未查询到相关信息!,传入参数:" + noticestr);//写入报错日志 PayNotifyGlobalErrorLogger.Log("订单号:" + code + ",未查询到相关信息!,传入参数:" + noticestr, summary: tname + "通知接口错误"); message = "error"; } } catch (Exception ex) { //AddLocLog.AddLog(1, 4, HttpContext.Current.Request.UserHostAddress, tname + "通知接口错误", "通知接口主入口出错,订单号:" + code + ",传入参数:" + noticestr + ",错误信息:" + ex.ToString());//写入报错日志 PayNotifyGlobalErrorLogger.Log("通知接口主入口出错,订单号:" + code + ",传入参数:" + noticestr + ",错误信息:" + ex.ToString(), summary: tname + "通知接口错误"); message = "error"; } return(message); }
/// <summary> /// 添加到队列通知表 /// </summary> /// <param name="morder">根据订单查询后的moder实体类型</param> /// <param name="orderTableName">订单归档表表名</param> /// <param name="noticestr">传入的字符串</param> /// <returns></returns> private string addqueuelist(JMP.MDL.jmp_order morder, string orderTableName, string tname, string noticestr) { string message = ""; try { int appid = selectUserID(morder.o_app_id, tname, noticestr); if (appid > 0) { JMP.MDL.jmp_queuelist quli = new JMP.MDL.jmp_queuelist(); JMP.BLL.jmp_queuelist bllq = new JMP.BLL.jmp_queuelist(); quli.q_address = morder.o_address; quli.q_sign = new JMP.BLL.jmp_app().GetModel(morder.o_app_id).a_secretkey; quli.q_noticestate = 0; quli.q_times = 0; quli.q_noticetimes = DateTime.Now; quli.q_tablename = orderTableName; quli.q_o_id = morder.o_id; quli.trade_type = Int32.Parse(morder.o_paymode_id); quli.trade_time = morder.o_ptime; quli.trade_price = morder.o_price; quli.trade_paycode = morder.o_tradeno; quli.trade_code = morder.o_code; quli.trade_no = morder.o_bizcode; quli.q_privateinfo = morder.o_privateinfo; quli.q_uersid = appid; int cg = bllq.Add(quli); if (cg > 0) { message = "ok"; } else { //AddLocLog.AddLog(1, 4, HttpContext.Current.Request.UserHostAddress, tname + "通知接口错误", "订单号:" + morder.o_code + "添加到通知队列失败,传入参数:" + noticestr);//写入报错日志 PayNotifyGlobalErrorLogger.Log("订单号:" + morder.o_code + "添加到通知队列失败,传入参数:" + noticestr, summary: tname + "通知接口错误"); message = "error"; } } else { message = "error"; } } catch (Exception ex) { //AddLocLog.AddLog(1, 4, HttpContext.Current.Request.UserHostAddress, tname + "通知接口错误", "订单号:" + morder.o_code + "添加到通知队列失败,错误信息:" + ex.ToString() + ",传入参数:" + noticestr);//写入报错日志 PayNotifyGlobalErrorLogger.Log("订单号:" + morder.o_code + "添加到通知队列失败,错误信息:" + ex.ToString() + ",传入参数:" + noticestr, summary: tname + "通知接口错误"); message = "error"; throw; } return(message); }
/// <summary> /// 根据订单编号查询订单信息(支付接口专用,H5或收银台模式第二次请求时调用) /// </summary> /// <param name="o_code"></param> /// <param name="TableName"></param> /// <returns></returns> public JMP.MDL.jmp_order SelectCode(string o_code, string TableName) { StringBuilder strSql = new StringBuilder(); strSql.Append("select o_id, o_code, o_bizcode, o_tradeno, o_paymode_id, o_app_id, o_goodsname, o_term_key, o_price, o_payuser, o_ctime, o_ptime, o_state,o_times,o_address,o_noticestate,o_noticetimes,o_privateinfo,o_interface_id,o_showaddress "); strSql.Append(" from " + TableName); strSql.Append(" where o_code=@o_code and o_interface_id=0 "); SqlParameter parameters = new SqlParameter("@o_code", @o_code); JMP.MDL.jmp_order model = new JMP.MDL.jmp_order(); DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters); return(DbHelperSQL.ToModel <JMP.MDL.jmp_order>(ds.Tables[0])); }
/// <summary> /// 微信公众号第一次跳转 /// </summary> /// <param name="Oid">订单id</param> private void OnJump(int Oid) { try { string str = ""; JMP.MDL.jmp_app mo = new JMP.MDL.jmp_app(); JMP.BLL.jmp_app blls = new JMP.BLL.jmp_app(); mo = JMP.TOOL.MdlList.ToModel <JMP.MDL.jmp_app>(blls.GetList(" a_id=(SELECT o_app_id FROM jmp_order WHERE o_id=" + Oid + ") ").Tables[0]); if (mo != null) { SelectInterface SeIn = new SelectInterface(); string cache = "wxgfgzh" + Oid; SeIn = SelectInfo(cache, mo.a_rid, mo.a_id, int.Parse(ConfigurationManager.AppSettings["CacheTime"].ToString())); if (SeIn == null || SeIn.PayId <= 0 || string.IsNullOrEmpty(SeIn.UserId) || string.IsNullOrEmpty(SeIn.UserKey)) { str = "{\"Message\":\"支付通道未配置\",\"ErrorCode\":106}"; Response.Write(str); } JMP.BLL.jmp_order bll = new JMP.BLL.jmp_order(); JMP.MDL.jmp_order morder = bll.SelectOrderGoodsName(Oid, "jmp_order"); if (morder.o_price < SeIn.minmun) { str = "{\"Message\":\"订单金额不能小于单笔最小支付金额\",\"ErrorCode\":8990}"; Response.Write(str); } if (morder.o_price > SeIn.maximum) { str = "{\"Message\":\"订单金额不能大于单笔最大支付金额\",\"ErrorCode\":8989}"; Response.Write(str); } if (bll.UpdatePay(Oid, SeIn.PayId)) { string redirect_uri = ConfigurationManager.AppSettings["WxGzhRturnUrl"].ToString() + Oid + ".html"; PayApiDetailErrorLogger.UpstreamPaymentErrorLog("报错信息:" + "回调地址:" + redirect_uri, summary: "微信官方公众号第一次跳转支付接口错误信息", channelId: Oid); string url = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=" + SeIn.wxappid + "&redirect_uri=" + redirect_uri + "&response_type=code&scope=snsapi_base#wechat_redirect"; Response.Redirect(url, false); } } else { str = "{\"Message\":\"支付接口异常\",\"ErrorCode\":102}"; Response.Write(str); } } catch (Exception ex) { PayApiDetailErrorLogger.UpstreamPaymentErrorLog("报错信息:" + ex.Message, summary: "微信官方公众号第一次跳转支付接口错误信息", channelId: Oid); Response.Write("非法访问!"); } }
/// <summary> /// 根据订单号获取需要手动通知的信息 /// </summary> /// <param name="o_code">订单号</param> /// <param name="TableName">表名</param> /// <returns></returns> public JMP.MDL.jmp_order SelectOrder(string o_code, string TableName) { string sql = string.Format("select o_id, o_code, o_bizcode, o_tradeno, o_paymode_id, o_app_id, o_goodsname, o_term_key, o_price, o_payuser, o_ctime, o_ptime,o_state, o_times, o_address, o_noticestate, o_noticetimes, o_privateinfo, o_interface_id, o_showaddress FROM " + TableName + " WHERE o_state = 1 AND o_noticestate = -1 AND o_code=@o_code AND o_times>7 "); SqlParameter[] parameters = { new SqlParameter("@o_code", @o_code) }; JMP.MDL.jmp_order model = new JMP.MDL.jmp_order(); DataTable dt = new DataTable(); dt = DbHelperSQL.Query(sql.ToString(), parameters).Tables[0]; model = DbHelperSQL.ToModel <JMP.MDL.jmp_order>(dt); return(model); }
/// <summary> /// 根据订单编号获取订单信息 /// </summary> /// <param name="code">订单编号</param> /// <param name="noticestr">传入的字符串</param> /// <returns>返回一个实体类型</returns> private JMP.MDL.jmp_order SelectOrder(string code, string noticestr) { try { //订单支付完成执行 JMP.BLL.jmp_order order = new JMP.BLL.jmp_order(); JMP.MDL.jmp_order morder = new JMP.MDL.jmp_order(); string TableName = "jmp_order"; morder = order.GetModelbycode(code, TableName); return(morder); } catch (Exception ex) { //AddLocLog.AddLog(1, 4, HttpContext.Current.Request.UserHostAddress, "通知接口错误", "订单号:" + code + "根据订单号查询出错,传入参数:" + noticestr + "!错误信息:" + ex.ToString());//写入报错日志 PayNotifyGlobalErrorLogger.Log("订单号:" + code + "根据订单号查询出错,传入参数:" + noticestr + "!错误信息:" + ex.ToString(), summary: "通知接口错误"); return(null); } }
/// <summary> /// 根据商户订单号和应用id查询订单信息 /// </summary> /// <param name="appid">应用id</param> /// <param name="code">订单编号</param> /// <param name="bizcode">商户订单编号</param> /// <param name="TableName">表名</param> /// <returns></returns> public JMP.MDL.jmp_order SelectOrderbizcode(int appid, string code, string bizcode, string TableName) { StringBuilder strSqlcode = new StringBuilder(); StringBuilder strSqbizcode = new StringBuilder(); StringBuilder str = new StringBuilder(); if (!string.IsNullOrEmpty(code)) { strSqlcode.Append("select o_id, o_code, o_bizcode, o_tradeno, o_paymode_id, o_app_id, o_goodsname, o_term_key, o_price, o_payuser, o_ctime, o_ptime, o_state,o_times,o_address,o_noticestate,o_noticetimes,o_privateinfo,o_interface_id,o_showaddress "); strSqlcode.Append(" from " + TableName); strSqlcode.Append(" where o_app_id=@appid and o_code=@o_code and o_ptime>='" + DateTime.Now.AddHours(-1) + "' and o_ptime<='" + DateTime.Now + "' "); } if (!string.IsNullOrEmpty(bizcode)) { strSqbizcode.Append("select o_id, o_code, o_bizcode, o_tradeno, o_paymode_id, o_app_id, o_goodsname, o_term_key, o_price, o_payuser, o_ctime, o_ptime, o_state,o_times,o_address,o_noticestate,o_noticetimes,o_privateinfo,o_interface_id,o_showaddress "); strSqbizcode.Append(" from " + TableName); strSqbizcode.Append(" where o_app_id=@appid and o_bizcode=@bizcode and o_ptime>='" + DateTime.Now.AddHours(-1) + "' and o_ptime<='" + DateTime.Now + "' "); } if (!string.IsNullOrEmpty(code) && !string.IsNullOrEmpty(bizcode)) { str.Append(strSqlcode); str.Append(" union "); str.Append(strSqbizcode); } else { str.Append(strSqlcode); str.Append(strSqbizcode); } SqlParameter[] parameters = { new SqlParameter("@bizcode", bizcode), new SqlParameter("@appid", appid), new SqlParameter("@o_code", code) }; JMP.MDL.jmp_order model = new JMP.MDL.jmp_order(); DataSet ds = DbHelperSQL.Query(str.ToString(), parameters); return(DbHelperSQL.ToModel <JMP.MDL.jmp_order>(ds.Tables[0])); }
/// <summary> /// 根据订单编号查询订单信息并调取支付当时 /// </summary> /// <param name="od">参数实体</param> /// <returns></returns> public static string SelectCode(OrderCode od, string json) { string StrJson = "{\"message\":\"参数code有误\",\"result\":8997}"; try { JMP.MDL.jmp_order mode = new JMP.MDL.jmp_order(); JMP.BLL.jmp_order bll = new JMP.BLL.jmp_order(); mode = bll.GetModelbycode(od.code, "jmp_order"); if (mode != null && mode.o_state == 0) { if (mode.o_price == od.price) { if (bll.UpdatePayMode(mode.o_id, od.paymode)) { StrJson = PayType.PaySelect(od.paymode.ToString(), mode.o_app_id, od.tid, od.paytype, mode.o_code, od.goodsname, mode.o_price, mode.o_id, mode.o_privateinfo);//直接调取支付方式 } } else { StrJson = "{\"message\":\"请求金额不一致\",\"result\":8994}"; } } else { StrJson = "{\"message\":\"参数code有误\",\"result\":8997}"; } } catch (Exception e) { string bcxx = "报错提示" + e.Message + "报错对象:" + e.Source + "报错方法:" + e.TargetSite + "报错信息:" + e.ToString() + "报错位置:" + e.StackTrace.ToString(); //报错信息 StrJson = "{\"message\":\"参数异常\",\"result\":8990}"; AddLocLog.AddLog(1, 4, HttpContext.Current.Request.UserHostAddress, "收银台调取支付接口错误信息", "报错信息:" + bcxx + ",支付接口请求数据" + json); //写入报错日志 throw; } return(StrJson); }
/// <summary> /// 根据订单编码唯一得到实体类 /// </summary> public JMP.MDL.jmp_order GetModelCode(string o_code, string TableName) { StringBuilder strSql = new StringBuilder(); strSql.Append("select o_id, o_code, o_bizcode, o_tradeno, o_paymode_id, o_app_id, o_goodsname, o_term_key, o_price, o_payuser, o_ctime, o_ptime, o_state,o_times,o_address,o_noticestate,o_noticetimes,o_privateinfo,o_interface_id,o_showaddress "); strSql.Append(" from " + TableName); strSql.Append(" where o_code=@o_code"); //SqlParameter[] parameters = { // new SqlParameter("@o_code", @o_code) //}; SqlParameter parameters = new SqlParameter("@o_code", @o_code); JMP.MDL.jmp_order model = new JMP.MDL.jmp_order(); DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters); return(DbHelperSQL.ToModel <JMP.MDL.jmp_order>(ds.Tables[0])); //if (ds.Tables[0].Rows.Count > 0) //{ // if (ds.Tables[0].Rows[0]["o_id"].ToString() != "") // { // model.o_id = int.Parse(ds.Tables[0].Rows[0]["o_id"].ToString()); // } // model.o_code = ds.Tables[0].Rows[0]["o_code"].ToString(); // model.o_bizcode = ds.Tables[0].Rows[0]["o_bizcode"].ToString(); // model.o_tradeno = ds.Tables[0].Rows[0]["o_tradeno"].ToString(); // model.o_paymode_id = ds.Tables[0].Rows[0]["o_paymode_id"].ToString(); // model.o_privateinfo = ds.Tables[0].Rows[0]["o_privateinfo"].ToString(); // if (ds.Tables[0].Rows[0]["o_app_id"].ToString() != "") // { // model.o_app_id = int.Parse(ds.Tables[0].Rows[0]["o_app_id"].ToString()); // } // model.o_goodsname = ds.Tables[0].Rows[0]["o_goodsname"].ToString(); // model.o_term_key = ds.Tables[0].Rows[0]["o_term_key"].ToString(); // if (ds.Tables[0].Rows[0]["o_price"].ToString() != "") // { // model.o_price = decimal.Parse(ds.Tables[0].Rows[0]["o_price"].ToString()); // } // model.o_payuser = ds.Tables[0].Rows[0]["o_payuser"].ToString(); // if (ds.Tables[0].Rows[0]["o_ctime"].ToString() != "") // { // model.o_ctime = DateTime.Parse(ds.Tables[0].Rows[0]["o_ctime"].ToString()); // } // if (ds.Tables[0].Rows[0]["o_ptime"].ToString() != "") // { // model.o_ptime = DateTime.Parse(ds.Tables[0].Rows[0]["o_ptime"].ToString()); // } // if (ds.Tables[0].Rows[0]["o_state"].ToString() != "") // { // model.o_state = int.Parse(ds.Tables[0].Rows[0]["o_state"].ToString()); // } // if (ds.Tables[0].Rows[0]["o_times"].ToString() != "") // { // model.o_times = int.Parse(ds.Tables[0].Rows[0]["o_times"].ToString()); // } // model.o_address = ds.Tables[0].Rows[0]["o_address"].ToString(); // if (ds.Tables[0].Rows[0]["o_noticestate"].ToString() != "") // { // model.o_noticestate = int.Parse(ds.Tables[0].Rows[0]["o_noticestate"].ToString()); // } // if (ds.Tables[0].Rows[0]["o_noticetimes"].ToString() != "") // { // model.o_noticetimes = DateTime.Parse(ds.Tables[0].Rows[0]["o_noticetimes"].ToString()); // } // if (ds.Tables[0].Rows[0]["o_interface_id"].ToString() != "") // { // model.o_interface_id = Int32.Parse(ds.Tables[0].Rows[0]["o_interface_id"].ToString()); // } // model.o_showaddress = ds.Tables[0].Rows[0]["o_showaddress"].ToString(); // return model; //} //else //{ // return null; //} }
/// <summary> /// 获得数据列表 /// </summary> public List <JMP.MDL.jmp_order> DataTableToList(DataTable dt) { List <JMP.MDL.jmp_order> modelList = new List <JMP.MDL.jmp_order>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { JMP.MDL.jmp_order model; for (int n = 0; n < rowsCount; n++) { model = new JMP.MDL.jmp_order(); if (dt.Rows[n]["o_id"].ToString() != "") { model.o_id = int.Parse(dt.Rows[n]["o_id"].ToString()); } model.o_code = dt.Rows[n]["o_code"].ToString(); model.o_bizcode = dt.Rows[n]["o_bizcode"].ToString(); model.o_tradeno = dt.Rows[n]["o_tradeno"].ToString(); model.o_paymode_id = dt.Rows[n]["o_paymode_id"].ToString(); if (dt.Rows[n]["o_app_id"].ToString() != "") { model.o_app_id = int.Parse(dt.Rows[n]["o_app_id"].ToString()); } model.o_goodsname = dt.Rows[n]["o_goodsname"].ToString(); model.o_term_key = dt.Rows[n]["o_term_key"].ToString(); if (dt.Rows[n]["o_price"].ToString() != "") { model.o_price = decimal.Parse(dt.Rows[n]["o_price"].ToString()); } model.o_payuser = dt.Rows[n]["o_payuser"].ToString(); if (dt.Rows[n]["o_ctime"].ToString() != "") { model.o_ctime = DateTime.Parse(dt.Rows[n]["o_ctime"].ToString()); } if (dt.Rows[n]["o_ptime"].ToString() != "") { model.o_ptime = DateTime.Parse(dt.Rows[n]["o_ptime"].ToString()); } if (dt.Rows[n]["o_state"].ToString() != "") { model.o_state = int.Parse(dt.Rows[n]["o_state"].ToString()); } if (dt.Rows[n]["o_times"].ToString() != "") { model.o_times = int.Parse(dt.Rows[n]["o_times"].ToString()); } model.o_address = dt.Rows[n]["o_address"].ToString(); if (dt.Rows[n]["o_noticestate"].ToString() != "") { model.o_noticestate = int.Parse(dt.Rows[n]["o_noticestate"].ToString()); } if (dt.Rows[n]["o_noticetimes"].ToString() != "") { model.o_noticetimes = DateTime.Parse(dt.Rows[n]["o_noticetimes"].ToString()); } model.o_privateinfo = dt.Rows[n]["o_privateinfo"].ToString(); modelList.Add(model); } } return(modelList); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(JMP.MDL.jmp_order model, string TableName) { return(dal.Add(model, TableName)); }
/// <summary> /// 添加订单表数据 /// </summary> /// <param name="model"></param> /// <returns></returns> public int AddOrder(JMP.MDL.jmp_order model) { return(dal.AddOrder(model)); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(JMP.MDL.jmp_order model, string TableName) { return(dal.Update(model, TableName)); }
/// <summary> /// 根据订单ID唯一得到实体类 /// </summary> public JMP.MDL.jmp_order GetModelid(int id, string TableName) { StringBuilder strSql = new StringBuilder(); strSql.Append("select o_id, o_code, o_bizcode, o_tradeno, o_paymode_id, o_app_id, o_goodsname, o_term_key, o_price, o_payuser, o_ctime, o_ptime, o_state,o_times,o_address,o_noticestate,o_noticetimes,o_privateinfo,o_interface_id,o_showaddress "); strSql.Append(" from " + TableName); strSql.Append(" where o_id=@o_id"); SqlParameter[] parameters = { new SqlParameter("@o_id", @id) }; JMP.MDL.jmp_order model = new JMP.MDL.jmp_order(); DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { if (ds.Tables[0].Rows[0]["o_id"].ToString() != "") { model.o_id = int.Parse(ds.Tables[0].Rows[0]["o_id"].ToString()); } model.o_code = ds.Tables[0].Rows[0]["o_code"].ToString(); model.o_bizcode = ds.Tables[0].Rows[0]["o_bizcode"].ToString(); model.o_tradeno = ds.Tables[0].Rows[0]["o_tradeno"].ToString(); model.o_paymode_id = ds.Tables[0].Rows[0]["o_paymode_id"].ToString(); model.o_privateinfo = ds.Tables[0].Rows[0]["o_privateinfo"].ToString(); if (ds.Tables[0].Rows[0]["o_app_id"].ToString() != "") { model.o_app_id = int.Parse(ds.Tables[0].Rows[0]["o_app_id"].ToString()); } model.o_goodsname = ds.Tables[0].Rows[0]["o_goodsname"].ToString(); model.o_term_key = ds.Tables[0].Rows[0]["o_term_key"].ToString(); if (ds.Tables[0].Rows[0]["o_price"].ToString() != "") { model.o_price = decimal.Parse(ds.Tables[0].Rows[0]["o_price"].ToString()); } model.o_payuser = ds.Tables[0].Rows[0]["o_payuser"].ToString(); if (ds.Tables[0].Rows[0]["o_ctime"].ToString() != "") { model.o_ctime = DateTime.Parse(ds.Tables[0].Rows[0]["o_ctime"].ToString()); } if (ds.Tables[0].Rows[0]["o_ptime"].ToString() != "") { model.o_ptime = DateTime.Parse(ds.Tables[0].Rows[0]["o_ptime"].ToString()); } if (ds.Tables[0].Rows[0]["o_state"].ToString() != "") { model.o_state = int.Parse(ds.Tables[0].Rows[0]["o_state"].ToString()); } if (ds.Tables[0].Rows[0]["o_times"].ToString() != "") { model.o_times = int.Parse(ds.Tables[0].Rows[0]["o_times"].ToString()); } model.o_address = ds.Tables[0].Rows[0]["o_address"].ToString(); if (ds.Tables[0].Rows[0]["o_noticestate"].ToString() != "") { model.o_noticestate = int.Parse(ds.Tables[0].Rows[0]["o_noticestate"].ToString()); } if (ds.Tables[0].Rows[0]["o_noticetimes"].ToString() != "") { model.o_noticetimes = DateTime.Parse(ds.Tables[0].Rows[0]["o_noticetimes"].ToString()); } if (ds.Tables[0].Rows[0]["o_interface_id"].ToString() != "") { model.o_interface_id = Int32.Parse(ds.Tables[0].Rows[0]["o_interface_id"].ToString()); } model.o_showaddress = ds.Tables[0].Rows[0]["o_showaddress"].ToString(); return(model); } else { return(null); } }
public override void ProcessNotify(int tid) { WxPayData notifyData = GetNotifyData(tid); //检查支付结果中transaction_id是否存在 if (!notifyData.IsSet("transaction_id")) { //若transaction_id不存在,则立即返回结果给微信支付后台 WxPayData res = new WxPayData(); res.SetValue("return_code", "FAIL"); res.SetValue("return_msg", "支付结果中微信订单号不存在"); page.Response.Write(res.ToXml()); page.Response.End(); } string transaction_id = notifyData.GetValue("transaction_id").ToString(); //查询订单,判断订单真实性 string ordertime = notifyData.GetValue("time_end").ToString(); if (ordertime == "null") { //若订单查询失败,则立即返回结果给微信支付后台 WxPayData res = new WxPayData(); res.SetValue("return_code", "FAIL"); res.SetValue("return_msg", "订单查询失败"); page.Response.Write(res.ToXml()); page.Response.End(); } //查询订单成功 else { //商户订单号 string out_trade_no = notifyData.GetValue("out_trade_no").ToString(); //交易号 string trade_no = notifyData.GetValue("transaction_id").ToString(); //交易状态 string trade_status = notifyData.GetValue("result_code").ToString(); //买家账号 string buyer_email = notifyData.GetValue("transaction_id").ToString(); //买家付款时间 string gmt_payment = ordertime; //交易金额(单位:分转换成元) decimal o_price = decimal.Parse((decimal.Parse(notifyData.GetValue("total_fee").ToString()) / 100).ToString("f2")); if (trade_status == "SUCCESS") { try { JMP.BLL.jmp_order order = new JMP.BLL.jmp_order(); JMP.MDL.jmp_order morder = new JMP.MDL.jmp_order(); string TableName = "jmp_order"; string orderTableName = JMP.TOOL.WeekDateTime.GetOrderTableName(DateTime.ParseExact(gmt_payment, "yyyyMMddHHmmss", System.Globalization.CultureInfo.CurrentCulture).ToString("yyyy-MM-dd"));//获取订单表名 morder = order.GetModelbycode(out_trade_no, TableName); if (morder != null) { if (morder.o_price == o_price) { int payid = !string.IsNullOrEmpty(morder.o_paymode_id) ? Int32.Parse(morder.o_paymode_id) : 0; if (JMP.TOOL.OrderProportion.ddbl(morder.o_app_id, o_price, payid)) { WxPayData res = new WxPayData(); res.SetValue("return_code", "SUCCESS"); res.SetValue("return_msg", "OK"); page.Response.Write(res.ToXml()); page.Response.End(); } else { if (morder.o_state != 1) { morder.o_tradeno = trade_no; morder.o_ptime = DateTime.ParseExact(gmt_payment, "yyyyMMddHHmmss", System.Globalization.CultureInfo.CurrentCulture); morder.o_payuser = buyer_email; morder.o_state = 1; morder.o_noticestate = 0; morder.o_price = o_price; order.Update(morder, TableName); JMP.MDL.jmp_app app = new JMP.MDL.jmp_app(); JMP.BLL.jmp_app appbll = new JMP.BLL.jmp_app(); app = appbll.SelectId(morder.o_app_id); if (app != null) { JMP.MDL.jmp_queuelist quli = new JMP.MDL.jmp_queuelist(); JMP.BLL.jmp_queuelist bllq = new JMP.BLL.jmp_queuelist(); quli.q_address = morder.o_address; quli.q_sign = new JMP.BLL.jmp_app().GetModel(morder.o_app_id).a_secretkey; quli.q_noticestate = 0; quli.q_times = 0; quli.q_noticetimes = DateTime.Now; quli.q_tablename = orderTableName; quli.q_o_id = morder.o_id; quli.trade_type = Int32.Parse(morder.o_paymode_id); quli.trade_time = morder.o_ptime; quli.trade_price = morder.o_price; quli.trade_paycode = morder.o_tradeno; quli.trade_code = morder.o_code; quli.trade_no = morder.o_bizcode; quli.q_privateinfo = morder.o_privateinfo; quli.q_uersid = app.u_id; int cg = bllq.Add(quli); if (cg > 0) { WxPayData res = new WxPayData(); res.SetValue("return_code", "SUCCESS"); res.SetValue("return_msg", "OK"); page.Response.Write(res.ToXml()); page.Response.End(); } else { //AddLocLog.AddLog(1, 4, HttpContext.Current.Request.UserHostAddress, "微信官网通知错误", "订单号:" + morder.o_code + "添加到通知队列失败");//写入报错日志 PayApiGlobalErrorLogger.Log("订单号:" + morder.o_code + "添加到通知队列失败", summary: "微信官网通知错误"); WxPayData res = new WxPayData(); res.SetValue("return_code", "FAIL"); res.SetValue("return_msg", "FAIL"); page.Response.Write(res.ToXml()); page.Response.End(); } } else { //AddLocLog.AddLog(1, 4, HttpContext.Current.Request.UserHostAddress, "微信官网通知错误", "应用id:" + morder.o_app_id + ",获取用户id失败!");//写入报错日志 PayApiGlobalErrorLogger.Log("应用id:" + morder.o_app_id + ",获取用户id失败!", summary: "微信官网通知错误"); WxPayData res = new WxPayData(); res.SetValue("return_code", "FAIL"); res.SetValue("return_msg", "FAIL"); page.Response.Write(res.ToXml()); page.Response.End(); } } else { //AddLocLog.AddLog(1, 4, HttpContext.Current.Request.UserHostAddress, "微信官网通知接口错误", "订单号:" + out_trade_no + ",未查询到相关信息!");//写入报错日志 PayApiGlobalErrorLogger.Log("订单号:" + out_trade_no + ",未查询到相关信息!", summary: "微信官网通知接口错误"); WxPayData res = new WxPayData(); res.SetValue("return_code", "SUCCESS"); res.SetValue("return_msg", "OK"); page.Response.Write(res.ToXml()); page.Response.End(); } } } else { if (JMP.TOOL.UpdateOrder.OrderState.UpdateOrderState(morder.o_code, TableName)) { string ddsm = "订单号:" + morder.o_code + ",支付信息异常请核实!";//短信说明 JMP.TOOL.Auditor.IAuditor audit = new JMP.TOOL.Auditor.OrderAbnormalAuditor(morder.o_code, orderTableName, morder.o_app_id, ddsm, trade_no, DateTime.ParseExact(gmt_payment, "yyyyMMddHHmmss", System.Globalization.CultureInfo.CurrentCulture), o_price, "成功", morder.o_price); audit.Add(); WxPayData res = new WxPayData(); res.SetValue("return_code", "SUCCESS"); res.SetValue("return_msg", "OK"); page.Response.Write(res.ToXml()); page.Response.End(); } else { WxPayData res = new WxPayData(); res.SetValue("return_code", "FAIL"); res.SetValue("return_msg", "FAIL"); page.Response.Write(res.ToXml()); page.Response.End(); } } } else { WxPayData res = new WxPayData(); res.SetValue("return_code", "FAIL"); res.SetValue("return_msg", "FAIL"); page.Response.Write(res.ToXml()); page.Response.End(); } } catch { WxPayData res = new WxPayData(); res.SetValue("return_code", "FAIL"); res.SetValue("return_msg", "FAIL"); page.Response.Write(res.ToXml()); page.Response.End(); } } } }
public JsonResult Orderrewire() { object retJson = new { success = 0, msg = "操作失败" }; string ordercode = string.IsNullOrEmpty(Request["code"]) ? "" : Request["code"]; string ptime = string.IsNullOrEmpty(Request["ptime"]) ? "" : Request["ptime"]; bool sess = Convert.ToDateTime(Session["sendtime_" + ordercode]) > System.DateTime.Now.AddMinutes(-1) ? true : false; if (!string.IsNullOrEmpty(ordercode) && !string.IsNullOrEmpty(ptime)) { if (DateTime.Parse(DateTime.Parse(ptime).ToString("yyyy-MM-dd")) > DateTime.Parse(DateTime.Now.AddDays(-3).ToString("yyyy-MM-dd"))) { if (sess) { retJson = new { success = 0, msg = "请间隔一分钟,再次发送!" }; return(Json(retJson)); } else { JMP.BLL.jmp_order bll = new JMP.BLL.jmp_order(); JMP.MDL.jmp_order morder = new JMP.MDL.jmp_order(); string tabalename = "dbo.jmp_order_" + JMP.TOOL.WeekDateTime.GetWeekFirstDayMon(DateTime.Parse(ptime)).ToString("yyyyMMdd"); morder = bll.SelectOrder(ordercode, tabalename); if (morder != null) { if (morder.o_times > 8 && morder.o_times < 12) { JMP.MDL.jmp_queuelist quli = new JMP.MDL.jmp_queuelist(); JMP.BLL.jmp_queuelist bllq = new JMP.BLL.jmp_queuelist(); quli.q_address = morder.o_address; quli.q_sign = new JMP.BLL.jmp_app().GetModel(morder.o_app_id).a_secretkey; quli.q_noticestate = 0; quli.q_times = morder.o_times; quli.q_noticetimes = DateTime.Now; quli.q_tablename = tabalename; quli.q_o_id = morder.o_id; quli.trade_type = Int32.Parse(morder.o_paymode_id); quli.trade_time = morder.o_ptime; quli.trade_price = morder.o_price; quli.trade_paycode = morder.o_tradeno; quli.trade_code = morder.o_code; quli.trade_no = morder.o_bizcode; quli.q_privateinfo = morder.o_privateinfo; quli.q_uersid = UserInfo.UserId; int cg = bllq.Add(quli); if (cg > 0) { Session["sendtime_" + morder.o_code] = System.DateTime.Now; retJson = new { success = 1, msg = "已重发通知!手动通知次数剩余:" + (11 - morder.o_times) + "次" }; } else { AddLocLog.AddLog(1, 4, Request.UserHostAddress, "管理平台手动重发通知失败", "订单号:" + morder.o_code + ",表名:" + tabalename);//写入报错日 retJson = new { success = 0, msg = "操作失败!" }; } } else { retJson = new { success = 0, msg = "手动通知无效!" }; } } } } else { retJson = new { success = 0, msg = "只能重发三天以内的数据!" }; } } else { retJson = new { success = 0, msg = "数据异常!" }; } return(Json(retJson)); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(JMP.MDL.jmp_order model, string TableName) { StringBuilder strSql = new StringBuilder(); strSql.Append("update " + TableName + " set "); strSql.Append(" o_code = @o_code , "); strSql.Append(" o_bizcode = @o_bizcode , "); strSql.Append(" o_tradeno = @o_tradeno , "); strSql.Append(" o_paymode_id = @o_paymode_id , "); strSql.Append(" o_app_id = @o_app_id , "); strSql.Append(" o_goodsname = @o_goodsname , "); strSql.Append(" o_term_key = @o_term_key , "); strSql.Append(" o_price = @o_price , "); strSql.Append(" o_payuser = @o_payuser , "); strSql.Append(" o_ctime = @o_ctime , "); strSql.Append(" o_ptime = @o_ptime , "); strSql.Append(" o_state = @o_state, "); strSql.Append(" o_times = @o_times , "); strSql.Append(" o_address = @o_address , "); strSql.Append(" o_noticestate = @o_noticestate, "); strSql.Append(" o_noticetimes = @o_noticetimes, "); strSql.Append(" o_privateinfo = @o_privateinfo, "); strSql.Append(" o_interface_id = @o_interface_id, "); strSql.Append(" o_showaddress = @o_showaddress "); strSql.Append(" where o_id=@o_id "); SqlParameter[] parameters = { new SqlParameter("@o_id", SqlDbType.Int, 4), new SqlParameter("@o_code", SqlDbType.NVarChar, -1), new SqlParameter("@o_bizcode", SqlDbType.NVarChar, -1), new SqlParameter("@o_tradeno", SqlDbType.NVarChar, -1), new SqlParameter("@o_paymode_id", SqlDbType.NVarChar, -1), new SqlParameter("@o_app_id", SqlDbType.Int, 4), new SqlParameter("@o_goodsname", SqlDbType.NVarChar, -1), new SqlParameter("@o_term_key", SqlDbType.NVarChar, -1), new SqlParameter("@o_price", SqlDbType.Money, 8), new SqlParameter("@o_payuser", SqlDbType.NVarChar, -1), new SqlParameter("@o_ctime", SqlDbType.DateTime), new SqlParameter("@o_ptime", SqlDbType.DateTime), new SqlParameter("@o_state", SqlDbType.Int, 4), new SqlParameter("@o_times", model.o_times), new SqlParameter("@o_address", model.o_address), new SqlParameter("@o_noticestate", model.o_noticestate), new SqlParameter("@o_noticetimes", model.o_noticetimes), new SqlParameter("@o_privateinfo", model.o_privateinfo), new SqlParameter("@o_interface_id", model.o_interface_id), new SqlParameter("@o_showaddress", model.o_showaddress) }; parameters[0].Value = model.o_id; parameters[1].Value = model.o_code; parameters[2].Value = model.o_bizcode; parameters[3].Value = model.o_tradeno; parameters[4].Value = model.o_paymode_id; parameters[5].Value = model.o_app_id; parameters[6].Value = model.o_goodsname; parameters[7].Value = model.o_term_key; parameters[8].Value = model.o_price; parameters[9].Value = model.o_payuser; parameters[10].Value = model.o_ctime; parameters[11].Value = model.o_ptime; parameters[12].Value = model.o_state; int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 根据订单号查询订单信息 /// </summary> /// <param name="code">订单编号</param> /// <returns></returns> public static string SelectOrder(string code) { string str = ""; try { JMP.MDL.jmp_order mode = new JMP.MDL.jmp_order(); JMP.BLL.jmp_order bll = new JMP.BLL.jmp_order(); mode = bll.GetModelbycode(code, "jmp_order"); if (mode != null) { #region 查询时时表信息 if (mode.o_state == 1) { str = "{\"message\":\"success\",\"price\":\"" + mode.o_price.ToString("f2") + "\"}"; } else { str = "{\"message\":\"fail\"}"; } #endregion } else { #region 根据指定时间查询归档表 string orderTableName = JMP.TOOL.WeekDateTime.GetOrderTableName(DateTime.Now.ToString("yyyy-MM-dd")); //获取订单表名 mode = bll.GetModelbycode(code, orderTableName); //查询本周归档表 if (mode != null) { if (mode.o_state == 1) { str = "{\"message\":\"success\",\"price\":\"" + mode.o_price.ToString("f2") + "\"}"; } else { str = "{\"message\":\"fail\"}"; } } else { string TableName = JMP.TOOL.WeekDateTime.GetOrderTableName(DateTime.Now.AddDays(-7).ToString("yyyy-MM-dd")); //获取订单表名 mode = bll.GetModelbycode(code, TableName); //查询上周归档表 if (mode != null) { if (mode.o_state == 1) { str = "{\"message\":\"success\",\"price\":\"" + mode.o_price.ToString("f2") + "\"}"; } else { str = "{\"message\":\"fail\"}"; } } else { str = "{\"message\":\"fail\"}"; } } #endregion } } catch (Exception ex) { AddLocLog.AddLog(1, 4, HttpContext.Current.Request.UserHostAddress, "查询接口查询订单出错", "报错信息:" + ex.ToString() + ",查询参数:" + code);//写入报错日志 return(str = "{\"message\":\"fail\"}"); } return(str); }