private void SetMac(string Signtype) { string[] src = new string[rc.Keys.Length]; for (int i = 0; i < rc.Keys.Length; i++) { src[i] = rc[i].Trim(); } var srcordered = src.OrderBy(s => s); string mac = ""; if (Signtype == "MD5") { mac = string.Join("", srcordered) + INITools.GetIniKeyValue("MobileCZ", "MD5_key").Trim(); rc.Set("mac", DESHelper.ComputeMD5Hash(mac)); } else { mac = string.Join("", srcordered); rc.Set("mac", RSAHelper.SignWithSHA1(INITools.GetIniKeyValue("MobileCZ", "RSA_private_key").Trim(), mac)); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { //{ reurl}?c_succmark ={ c_succmark} //&resultmsg ={ resultmsg} //&c_order ={ c_order} //&c_mid ={ c_mid} //&orderid ={ orderid} string merchantid = INITools.GetIniKeyValue("MobileCZ", "merchantid"); PaygateBLL paydll = new PaygateBLL(); string showstr = ""; //ResultPacket resultpackge = paydll.DoVerify(Request.Params); //if (!resultpackge.IsError) //{ if (Request.Params["c_order"] == null) { ShowResult = "<h2>无效的充值订单信息</h2>"; } else { OrderNo = Request.Params["c_order"]; if (Request.Params["c_succmark"] != "Y") { // ShowResult = "支付失败"; Response.Redirect("/Account/Recharge.html?tost=t", true); return; } else { Response.Redirect("/Order/RechargeSuccess.html?orderid=" + OrderNo, true); return; } } } }
public void ProcessRequest(HttpContext context) { string orderno = ""; string PageSize = "10"; EGO_Order_List order; OrderEgoBLL orderBLL = new OrderEgoBLL(); IndexMessageBLL IndexMessageBLL = new IndexMessageBLL(); Project_ShowOrder ShowOrder = null; Project_ShowOrderBLL ShowOrderBLL = new Project_ShowOrderBLL(); ResultPacket res = new ResultPacket(); context.Response.Buffer = true; context.Response.ExpiresAbsolute = DateTime.Now.AddDays(-1); context.Response.AddHeader("pragma", "no-cache"); context.Response.AddHeader("cache-control", ""); context.Response.CacheControl = "no-cache"; context.Response.ContentType = "application/x-www-form-urlencoded"; string jsonData = string.Empty; #region 页索引 int pageIndex = 0; try { if (!string.IsNullOrEmpty(context.Request["pi"])) { int.TryParse(context.Request["pi"], out pageIndex); } } catch (Exception ex) { } #endregion #region 页大小 int pageSize = int.Parse(ConfigurationManager.AppSettings["DefaultPageSize"]); try { if (!string.IsNullOrEmpty(context.Request["ps"])) { int.TryParse(context.Request["ps"], out pageSize); } } catch (Exception ex) { } #endregion #region 排序方式 string orderCol = "SortID"; string orderType = "desc"; try { switch (context.Request["ot"]) { case "0": //正序 orderType = "asc"; break; case "1": //倒序 orderType = "desc"; break; default: orderType = "desc"; break; } } catch (Exception ex) { } #endregion StringBuilder conditionList = new StringBuilder(); #region 条件查询 int succ = 0; switch (context.Request["action"]) { case "index": #region 排序类型 switch (context.Request["oc"]) { case "0": //人气 orderCol = "chipinnum"; break; case "1": //进度 orderCol = "progress"; break; case "2": //最新 orderCol = "salestarttime"; break; case "3": //总须人数 orderCol = "sellprice"; break; default: orderCol = "SortID"; break; } #endregion ProductEgoBLL productBll = new ProductEgoBLL(); jsonData = productBll.GetDataSetByPage(pageIndex, pageSize, orderCol, orderType, conditionList.ToString()); break; case "history": #region 排序类型 orderCol = "salestarttime"; #endregion PeriodEgoBLL periodBll = new PeriodEgoBLL(); jsonData = periodBll.GetDataSetByPage(pageIndex, pageSize, orderCol, orderType, conditionList.ToString()); break; case "award": #region 排序类型 //最新 orderCol = "salestarttime"; #endregion //PeriodEgoBLL periodBll = new PeriodEgoBLL(); //jsonData = periodBll.GetDataSetByPage(pageIndex, pageSize, orderCol, orderType, conditionList.ToString()); break; case "getBanner": jsonData = "[{\"picUrl\":\"/img/mpic1.jpg\"},{\"picUrl\":\"/img/mpic1.jpg\"}]"; //"[{\"picUrl\":\"\"},{\"picUrl\":\"\"}]"; break; //获取商品信息 case "getGoodsInfo": jsonData = new ProductEgoBLL().GetGoodsInfoBy(int.Parse(context.Request["pid"])); break; //获取我的中奖码 case "getMyCodes": jsonData = new OrderEgoBLL().GetMyCodes(int.Parse(context.Request["perid"]), int.Parse(context.Request["pid"]), context.Request["ono"]); break; //获取参与记录 case "getRecord": int pIndex = int.Parse(context.Request["pi"]); int pSize = int.Parse(context.Request["ps"]); jsonData = new OrderEgoBLL().GetRecord(context.Request["perid"], context.Request["pid"], pIndex, pSize); break; //获取参与次数 case "getRecordCount": jsonData = new OrderEgoBLL().GetRecordCount(context.Request["perid"], context.Request["pid"]); break; //获取期信息 case "getperiod": jsonData = new PeriodEgoBLL().GetPeriodBy(int.Parse(context.Request["perid"]), int.Parse(context.Request["pid"])); break; //获取我的订单列表 case "myorders": pIndex = int.Parse(context.Request["pi"]); pSize = int.Parse(context.Request["ps"]); jsonData = new OrderEgoBLL().GetMyOrders(pIndex, pSize); break; //获取我的中奖记录列表 case "myawards": pIndex = int.Parse(context.Request["pi"]); pSize = int.Parse(context.Request["ps"]); jsonData = new OrderEgoBLL().GetMyAwards(pIndex, pSize); break; //获取订单详情 case "getorderdetail": jsonData = new OrderEgoBLL().GetOrderDetail(context.Request["oid"]); break; //获取中奖信息 case "getwininfo": jsonData = new OrderEgoBLL().GetWinInfo(int.Parse(context.Request["perid"]), int.Parse(context.Request["pid"])); break; //获取往期揭露 case "getotherperiod": jsonData = new PeriodEgoBLL().GetOtherPeriodBy(int.Parse(context.Request["pid"])); break; //获取最新揭晓 case "getawardlist": pIndex = int.Parse(context.Request["pi"]); pSize = int.Parse(context.Request["ps"]); jsonData = new PeriodEgoBLL().GetAwardList(pIndex, pSize); break; //获取查看记录详情 case "getluckDetail": jsonData = new OrderEgoBLL().GetGetLuckDetail(context.Request["perid"], context.Request["pid"], int.Parse(context.Request["record"])); break; //获取最新一期的期号 case "getnewperiod": jsonData = new PeriodEgoBLL().GetNewPeriodBy(int.Parse(context.Request["pid"])); break; case "getnewperiodbysku": jsonData = new PeriodEgoBLL().GetNewPeriodBySku(context.Request["sku"]); break; //获取领奖成功的jyhOrderNo case "getjyhorder": jsonData = new PeriodEgoBLL().GetJYHOrderNoBy(context.Request["orderno"]); break; //获取用户信息 case "getmemberinfo": jsonData = new LoginBLL().GetMemberInfo(); break; //更新昵称 case "savenickname": var nickName = context.Request["nickname"]; jsonData = new FC_MembersBLL().SaveNickName(nickName); break; //获取优惠卷 case "getcoupons": jsonData = new CouponEgoBLL().GetCoupons(); break; //使用优惠卷 case "usecoupon": string counponNo = context.Request["counponno"]; jsonData = new CouponEgoBLL().UseCoupons(counponNo); break; //获取用户余额 case "getbalance": jsonData = new FC_MembersBLL().GetAllBalance(); break; //确认领奖 case "confirmAward": var addressId = context.Request["addressid"]; var buyerName = context.Request["bname"]; var buyerAddress = context.Request["baddress"]; var addressCode = context.Request["code"]; var pid = int.Parse(context.Request["pid"]); var perid = int.Parse(context.Request["perid"]); var orderNo = context.Request["oid"]; jsonData = new AwardEgoBLL().ConfirmAward(perid, pid, addressId, buyerName, buyerAddress, addressCode, orderNo); break; //通知开奖服务 case "NotifyPeriodAwardService": try { BaseUDPClient udpE = new BaseUDPClient(); udpE.Command = 6; udpE.EncryptKey = ConfigurationManager.AppSettings["UDPSecretKey_4"]; udpE.RemoteIP = ConfigurationManager.AppSettings["UDPServerIP_4"]; udpE.RemotePort = int.Parse(ConfigurationManager.AppSettings["UDPServerPort_4"]); udpE.Execute(); jsonData = "{\"resultCode\":\"1\",\"resultMessage\":\"已经通知开奖服务\"}"; } catch (Exception ex) { jsonData = "{\"resultCode\":\"99\",\"resultMessage\":\"通知开奖服务异常\"}"; } break; case "awardOrders": jsonData = new OrderEgoBLL().GetMyAwardOrders(); break; /*在线充值*/ case "recharge": if (HttpContext.Current.Session["UserToken"] == null) { jsonData = "{\"resultCode\":\"999\",\"resultMessage\":\"连接超时,请重新登录\"}"; } else { var mobelNo = HttpContext.Current.Session["UserName"].ToString(); var zmember = new FC_MembersBLL().GetMemberByMobileNo(mobelNo); if (zmember != null) { orderNo = ""; decimal rechargeMoney = decimal.Parse(context.Request["TotalMoney"]); int payGate = int.Parse(context.Request["PayGate"]); EnumPaygateType payGateType = (EnumPaygateType)int.Parse(context.Request["PayGateType"]); ResultPacket result = new CardChzBLL().doChzDeposit(payGate, rechargeMoney, zmember.ID, payGateType, out orderNo); if (result.IsError) { jsonData = "{\"resultCode\":\"99\",\"resultMessage\":\"创建订单失败,请稍候再试\"}"; } else { jsonData = "{\"OrderNo\":\"" + orderNo + "\"}"; } } else { jsonData = "{\"resultCode\":\"99\",\"resultMessage\":\"未查找到用户信息\"}"; } } break; /*获取充值记录*/ case "getrechargerecord": pIndex = int.Parse(context.Request["pi"]); pSize = int.Parse(context.Request["ps"]); jsonData = new CardChzBLL().GetRechargeRecord(pIndex, pSize); break; /*获取使用记录*/ case "getuserecord": pIndex = int.Parse(context.Request["pi"]); pSize = int.Parse(context.Request["ps"]); jsonData = new CardChzBLL().GetUseRecord(pIndex, pSize); break; /*获取使用记录*/ case "getrechargeorder": orderno = context.Request["OrderNo"] ?? ""; var rechargeOrderD = new CardChzBLL().GetRechargeOrder(orderno); if (rechargeOrderD == null) { jsonData = "{\"resultCode\":\"99\",\"resultMessage\":\"未查找到订单信息\"}"; } else { jsonData = "{\"RechargeMoney\":\"" + rechargeOrderD.OrderMoney + "\"}"; } break; /*创建订单*/ case "createorder": order = new EGO_Order_List(); order.ProductID = int.Parse(context.Request["ProductID"]); order.PeriodNum = int.Parse(context.Request["PeriodNum"]); order.OrderNo = com.hjy.ego.FrameWork.RunProcedure.Exec_CreateSerialNo(10001); order.OrderTime = DateTime.Now; order.BuyerPhone = HttpContext.Current.Session["UserName"].ToString(); /*context.Request["PhoneNo"];*/// order.ChipinNum = int.Parse(context.Request["ChipinNum"]); order.IPAddress = context.Request["IpAddress"]; order.Status = EGO_Order_List.EnumOrderStatus.Init; order.ChipinCodeList = ""; order.OpenID = ""; order.TotalMoney = decimal.Parse(context.Request["TotalMoney"]); order.PayGate = (EnumPaygate)int.Parse(context.Request["PayGate"]); order.PayGateType = (EnumPaygateType)int.Parse(context.Request["PayGateType"]); order.RebatMoney = 0; order.RebatCount = 0; order.AccountMoney = decimal.Parse(context.Request["Balance"]); var member = new FC_MembersBLL().GetMember(); if (order.AccountMoney != 0) { if (member == null) { jsonData = "{\"resultCode\":\"99\",\"resultMessage\":\"不存在的用户信息\"}"; break; } else { if (order.AccountMoney > member.AllBalance) { jsonData = "{\"resultCode\":\"99\",\"resultMessage\":\"使用金额超过账户余额\"}"; break; } } } order.CheckAwardKey = this.GetBaseNumByOrderTime(order.OrderTime); if (!string.IsNullOrEmpty(context.Request["ListId"]) && context.Request["ListId"] != "0") { List <decimal> priceResult = new CouponEgoBLL().GetCouponPrice(context.Request["ListId"]); DataTable couponList = new Coupon_ListDAL().GetCouponList(int.Parse(context.Request["ListId"])); if (couponList.Rows.Count < 0) { jsonData = "{\"resultCode\":\"99\",\"resultMessage\":\"无效的优惠卷\"}"; break; } else { var status = int.Parse(couponList.Rows[0]["coupon_status"].ToString()); if (status == 2 || status == 4) { jsonData = "{\"resultCode\":\"99\",\"resultMessage\":\"优惠卷已经使用或者被冻结\"}"; break; } var startDate = DateTime.Parse(couponList.Rows[0]["date_info_begin"].ToString()); var endDate = DateTime.Parse(couponList.Rows[0]["date_info_end"].ToString()); if ((status == 1 || status == 3) && (DateTime.Now < startDate || DateTime.Now > endDate)) { jsonData = "{\"resultCode\":\"99\",\"resultMessage\":\"优惠卷已过期或暂时不能使用\"}"; break; } } if (priceResult != null && priceResult.Count >= 2) { if (priceResult[1] != 0 && order.TotalMoney < priceResult[1]) { jsonData = "{\"resultCode\":\"99\",\"resultMessage\":\"创建订单失败,订单金额未达到优惠卷使用金额\"}"; break; } else { order.CouponMoney = priceResult[0]; } } else { order.CouponMoney = 0; } } else { order.CouponMoney = 0; } if (!string.IsNullOrEmpty(context.Request["ListId"]) && context.Request["ListId"] != "0") { order.CouponListID = int.Parse(context.Request["ListId"]); } else { order.CouponListID = 0; } if (order.ChipinNum >= 1 && order.ChipinNum == order.TotalMoney) { DataAccess da = new DataAccess(); da.BeginTransaction(); try { int tradeLogiD = 0; DateTime settleTime = DateTime.Now; string centerSerialNo = ""; if (order.AccountMoney > 0) { res = FC_Members_TradeLogDAL.Exec_SP_Chipin_DealMoney(member.ID, order.ProductID, order.PeriodNum, 0, 0, order.OrderNo, order.OrderTime.ToString("yyyyMMdd"), order.AccountMoney, "", "参与夺宝", ConfigurationManager.AppSettings["merchant_projectcode"], out tradeLogiD, out centerSerialNo, out settleTime); } if (res.IsError) { jsonData = "{\"resultCode\":\"99\",\"resultMessage\":\"扣款失败\"}"; break; } else { order.MemberTradeLogID = tradeLogiD; if (order.MemberTradeLogID > 0) { FC_Members_TradeLog tradeMod = new FC_Members_TradeLogDAL().GetObjectByID(tradeLogiD); order.CardBalance = tradeMod.CardBalanceChanged; order.AwardBalance = tradeMod.AwardBalanceChanged; } if (orderBLL.Insert(order, da)) { if (order.CouponListID != 0) { new CouponEgoBLL().SaveUseCouponInfo(order.CouponListID, order.ID, da); } jsonData = "{\"OrderNo\":\"" + order.OrderNo + "\"}"; } else { da.Rollback(); jsonData = "{\"resultCode\":\"99\",\"resultMessage\":\"创建订单失败,请稍候再试\"}"; } } da.Commit(); } catch (Exception ex) { da.Rollback(); } } else { jsonData = "{\"resultCode\":\"99\",\"resultMessage\":\"订单最小数量为1\"}"; } break; /*使用支付网关支付*/ case "gotopayment": //取得支付网关的参数 try { orderno = context.Request["OrderNo"] ?? ""; //更新再次支付的支付方式 if (!string.IsNullOrEmpty(context.Request["PayGate"]) && !string.IsNullOrEmpty(context.Request["PayGateType"])) { OrderBLL.UpdatePayGate(orderno, int.Parse(context.Request["PayGate"]), int.Parse(context.Request["PayGateType"])); } order = OrderBLL.GetOrderInfo(orderno); var realPayMoney = order.TotalMoney - order.CouponMoney - order.AccountMoney - order.RebatMoney; if (realPayMoney == 0) { DataAccess da = new DataAccess(); da.BeginTransaction(); try { //网关支付成功 order.Status = EGO_Order_List.EnumOrderStatus.Payed; order.Pay_ResponseTime = QueryBase.GetDataBaseDate(); order.PayGate_Pay_OrderNo = ""; int yy = new EGO_Order_ListDAL().UpdateForPayResult(order, da); if (yy == 1) { /*充值成功*/ try { da.Commit(); BaseUDPClient udp = new BaseUDPClient(); udp.Command = 5; udp.EncryptKey = ConfigurationManager.AppSettings["UDPSecretKey_5"]; udp.RemoteIP = ConfigurationManager.AppSettings["UDPServerIP_5"]; udp.RemotePort = int.Parse(ConfigurationManager.AppSettings["UDPServerPort_5"]); udp.Execute(); } catch (Exception exx) { } } } catch (Exception ex) { da.Rollback(); } jsonData = "{\"resultcode\":\"22\",\"resultmessage\":\"支付金额为0\"}"; } else { if (order.PayGate == EnumPaygate.WeiXin_JSAPI || order.PayGate == EnumPaygate.WeiXin_App) { if (order.PayGate == EnumPaygate.WeiXin_App) { order.OpenID = ""; } else { order.OpenID = context.Session["wxPayOpenid"].ToString(); } jsonData = PaygateBLL.GoToPayMent(order); } else { //支付宝 jsonData = PaygateBLL.GoToPayMent(order); } } } catch (Exception ex) { jsonData = "{\"resultcode\":\"99\",\"resultmessage\":\"支付失败" + ex.Message + "\"}"; } break; /*使用支付网关支付*/ case "gotoreachargepayment": //取得支付网关的参数 try { orderno = context.Request["OrderNo"] ?? ""; var rechargeOrder = new CardChzBLL().GetRechargeOrder(orderno); string openID = ""; if (rechargeOrder.PayGate == 762 || rechargeOrder.PayGate == 763) { if (rechargeOrder.PayGate == 763) { openID = ""; } else { openID = context.Session["wxPayOpenid"].ToString(); } jsonData = PaygateBLL.GoToRechargePayMent(rechargeOrder, openID); } else { //支付宝 jsonData = PaygateBLL.GoToRechargePayMent(rechargeOrder, openID); } } catch (Exception ex) { jsonData = "{\"resultcode\":\"99\",\"resultmessage\":\"支付失败" + ex.Message + "\"}"; } break; /*微信充值方式 1:本地jsapi 2、跳转网关*/ case "GetWxPayRetflag": string tempWxPayType = INITools.GetIniKeyValue("paygate", "wx_pay_retflag") == null ? "2" : INITools.GetIniKeyValue("paygate", "wx_pay_retflag"); jsonData = "{\"payretflag\":\"" + tempWxPayType + "\"}"; break; /*首页功公告*/ case "GetIndexMessage": jsonData = IndexMessageBLL.GetIndexMessage(ConfigurationManager.AppSettings["TopAwardNum"], ConfigurationManager.AppSettings["UploadIMG_YM"]); break; #region 晒单相关 /*按订单ID查询必要信息*/ case "GetOrderInfoByID": if (!string.IsNullOrEmpty(context.Request["id"].Trim())) { //SQL conditionList.Append("select BuyerPhone,isnull((select top 1 NickName from vw_JYH_Member_Info where ProjectCode='jyh_ego' and PhoneNo=a.BuyerPhone),'') as NickName"); conditionList.Append(",isnull((select top 1 Avatar from vw_JYH_Member_Info where ProjectCode='jyh_ego' and PhoneNo=a.BuyerPhone),'') as Avatar"); conditionList.AppendFormat(",isnull((select count(0) from vw_ShowOrder_all where order_list_id={0} and ProjectCode='jyh_ego'),0) as haveShowOrder"); conditionList.AppendFormat(" from vw_Order_List a where id={0}", context.Request["id"]); try { jsonData = orderBLL.GetDataByTJ(conditionList.ToString()); } catch (Exception exc) { jsonData = "{\"resultcode\":\"99\",\"resultmessage\":\"程序异常:" + exc.Message + "\"}"; } } else { jsonData = "{\"resultcode\":\"99\",\"resultmessage\":\"缺少参数\"}"; } break; /*获取敏感词放入缓存*/ case "Getsensitive_word": //SQL conditionList.Append("select sensitive_word from nc_sensitive_word"); try { jsonData = ShowOrderBLL.GetSensitiveWord(conditionList.ToString(), ConfigurationManager.AppSettings["ConnectString_mysql"]); } catch (Exception exc) { jsonData = "{\"resultcode\":\"99\",\"resultmessage\":\"程序异常:" + exc.Message + "\"}"; } break; /*保存晒单*/ case "SaveShowOrder": //SQL if (!string.IsNullOrEmpty(context.Request["orderid"].Trim()) && !string.IsNullOrEmpty(context.Request["title"].Trim()) && !string.IsNullOrEmpty(context.Request["memo"].Trim()) && !string.IsNullOrEmpty(context.Request["pic"].Trim()) && !string.IsNullOrEmpty(context.Request["Phone"].Trim()) && !string.IsNullOrEmpty(context.Request["NickName"].Trim()) && !string.IsNullOrEmpty(context.Request["Avatar"].Trim()) ) { ShowOrder = new Project_ShowOrder(); ShowOrder.order_list_id = int.Parse(context.Request["orderid"].Trim()); ShowOrder.title = context.Request["title"].Trim(); ShowOrder.memo = context.Request["memo"].Trim(); ShowOrder.pic = context.Request["pic"].Trim(); ShowOrder.BuyerPhone = context.Request["Phone"].Trim(); ShowOrder.BuyerNickName = context.Request["NickName"].Trim(); ShowOrder.BuyerNickNameAvatar = context.Request["Avatar"].Trim(); try { if (ShowOrderBLL.Insert(ShowOrder)) { jsonData = "{\"resultcode\":\"1\",\"resultmessage\":\"发布成功\"}"; } else { jsonData = "{\"resultcode\":\"99\",\"resultmessage\":\"发布失败\"}"; } } catch (Exception exc) { jsonData = "{\"resultcode\":\"99\",\"resultmessage\":\"程序异常:" + exc.Message + "\"}"; } } else { jsonData = "{\"resultcode\":\"99\",\"resultmessage\":\"缺少参数\"}"; } break; /*获取晒单详情*/ case "GetShowOrderByID": if (!string.IsNullOrEmpty(context.Request["id"].Trim())) { //SQL conditionList.Append("select title,memo,pic,BuyerPhone,BuyerNickName,BuyerNickNameAvatar,createtime,content_check"); conditionList.Append(",isnull((select top 1 PeriodNum from vw_Order_List where id=a.order_list_id),'') as PeriodNum"); conditionList.Append(",isnull((select top 1 ProductName from vw_Product_List where id=(select top 1 ProductID from vw_Order_List where id=a.order_list_id)),'') as ProductName"); conditionList.Append(",isnull((select top 1 AwardCode from vw_Award_List where OrderNo=(select top 1 OrderNo from vw_Order_List where id=a.order_list_id)),'') as AwardCode"); conditionList.Append(",isnull((select top 1 convert(varchar(19), Createtime,120) from vw_Award_List where OrderNo=(select top 1 OrderNo from vw_Order_List where id=a.order_list_id)),'') as AwardCreatetime"); // conditionList.Append(",isnull((select top 1 AwardOrderCount from vw_Award_List where OrderNo=(select top 1 OrderNo from vw_Order_List where id=a.order_list_id)),0) as AwardOrderCount"); conditionList.Append(",isnull((select top 1 ChipinNum from vw_Order_List where id=a.order_list_id),0) as ChipinNum"); conditionList.AppendFormat(" from VW_Project_ShowOrder a where id={0} and ProjectCode='jyh_ego'", context.Request["id"]); try { jsonData = ShowOrderBLL.GetDataByTJ(conditionList.ToString()); } catch (Exception exc) { jsonData = "{\"resultcode\":\"99\",\"resultmessage\":\"程序异常:" + exc.Message + "\"}"; } } else { jsonData = "{\"resultcode\":\"99\",\"resultmessage\":\"缺少参数\"}"; } break; /*按页码获取未审核和通过审核晒单列表*/ case "GetShowOrderListByPageNo": if (!string.IsNullOrEmpty(context.Request["PageNo"].Trim()) && ValidateHelper.IsInteger(context.Request["PageNo"].Trim())) { //自动以pagesize if (!string.IsNullOrEmpty(context.Request["PageSize"].Trim()) && ValidateHelper.IsInteger(context.Request["PageSize"].Trim())) { PageSize = context.Request["PageSize"].Trim(); } conditionList.Append(" and content_check<=10 and ProjectCode='jyh_ego'"); try { StringBuilder strAddField = new StringBuilder(); jsonData = ShowOrderBLL.GetDataSetByPage(int.Parse(context.Request["PageNo"].Trim()), int.Parse(PageSize), strAddField.ToString(), "createtime", "desc", conditionList.ToString()); } catch (Exception exc) { jsonData = "{\"resultcode\":\"99\",\"resultmessage\":\"程序异常:" + exc.Message + "\"}"; } } else { jsonData = "{\"resultcode\":\"99\",\"resultmessage\":\"缺少参数\"}"; } break; #endregion } #endregion context.Response.Write(jsonData); }
protected void Page_Load(object sender, EventArgs e) { string outString = ""; string yqStr = ""; string qst = ""; string phoneno = ""; bool isallok = false; double LoginMaxSecond = 120; double TotalSeconds = 0; string LoginMD5_key = ""; DateTime ddd = new DateTime(); bool wxdebug = false; EGO_Order_List order; OrderEgoBLL orderBLL = new OrderEgoBLL(); string orderno = ""; string fileName = ""; Json_Response_Base.UploadPic_resultPackage jrb = new Json_Response_Base.UploadPic_resultPackage(); if (!bool.TryParse(Request["debug"] ?? "", out wxdebug)) { wxdebug = false; } try { ResultPacket rp = new ResultPacket(); Json_Response_Base.resultPackage jrp = new Json_Response_Base.resultPackage(); switch (Request["action"]) { //收货地址验证码 case "addressvalidcode": rp = SMSBll.MakeSMSCodeAndSend(Request["mobileno"], JYH_SMSCode.EnumSMSTradeType.SaveAddress); jrp.resultcode = rp.ResultCode; jrp.resultmessage = rp.Description; outString = JsonHelper.ToJsonString(jrp); break; //收货地址验证码 case "loginvalidcode": rp = SMSBll.MakeSMSCodeAndSend(Request["mobileno"], (int)JYH_SMSCode.EnumSMSTradeType.PhoneLogin, Request["piccode"]); jrp.resultcode = rp.ResultCode; jrp.resultmessage = rp.Description; outString = JsonHelper.ToJsonString(jrp); break; //收货地址验证码 case "oauthvalidcode": rp = SMSBll.MakeSMSCodeAndSend(Request["mobileno"], JYH_SMSCode.EnumSMSTradeType.BindMobileAndMobileReg); jrp.resultcode = rp.ResultCode; jrp.resultmessage = rp.Description; outString = JsonHelper.ToJsonString(jrp); break; //手机注册验证码 case "registervalidcode": rp = SMSBll.MakeSMSCodeAndSend(Request["mobileno"], (int)JYH_SMSCode.EnumSMSTradeType.PhoneRegister, Request["piccode"]); jrp.resultcode = rp.ResultCode; jrp.resultmessage = rp.Description; outString = JsonHelper.ToJsonString(jrp); break; //重新设置密码 case "passwordreset": phoneno = Session["UserName"] == null ? (Request["phoneno"] ?? "") : Session["UserName"].ToString(); jrp = new LoginBLL().ResetPassWord(phoneno, Request["validcode"], Request["password"]); outString = JsonHelper.ToJsonString(jrp); break; //重置密码验证码 case "resetpasswordvalidcode": phoneno = Session["UserName"] == null ? (Request["mobileno"] ?? "") : Session["UserName"].ToString(); rp = SMSBll.MakeSMSCodeAndSend(phoneno, (int)JYH_SMSCode.EnumSMSTradeType.PasswordReset, Request["piccode"]); jrp.resultcode = rp.ResultCode; jrp.resultmessage = rp.Description; outString = JsonHelper.ToJsonString(jrp); break; //手机注册验证码 case "lqfxtqvalidcode": rp = SMSBll.MakeSMSCodeAndSend(Request["mobileno"], (int)JYH_SMSCode.EnumSMSTradeType.LQFXTQ, Request["piccode"]); jrp.resultcode = rp.ResultCode; jrp.resultmessage = rp.Description; outString = JsonHelper.ToJsonString(jrp); break; //用户登录 case "userlogin": try { jrp = new LoginBLL().CheckLogin(Request["username"], Request["password"]); outString = JsonHelper.ToJsonString(jrp); if (jrp.resultcode == "1") { try { //保存用户信息至本地 new LoginBLL().SyncJYHMemberInfo(Request["password"], "wap"); } catch (Exception exd) { //记录异常 ProjectLogBLL.NotifyProjectLog(string.Format("一元购-保存用户信息至本地--异常:{0}", exd.ToString()), "active:API.asp的" + Request["action"]); } } } catch (Exception ex) { jrp.resultcode = "98"; jrp.resultmessage = ex.ToString(); outString = JsonHelper.ToJsonString(jrp); } break; //手机登录 case "phonelogin": jrp = new LoginBLL().CheckPhoneLogin(Request["phoneno"], Request["validcode"]); if (jrp.resultcode == "1") { try { //保存用户信息至本地 new LoginBLL().SyncJYHMemberInfo("", "wap"); } catch (Exception exd) { //记录异常 ProjectLogBLL.NotifyProjectLog(string.Format("一元购-保存用户信息至本地--异常:{0}", exd.ToString()), "active:API.asp的" + Request["action"]); } } outString = JsonHelper.ToJsonString(jrp); break; //只使用手机号直接登录,from=web的需要验签,安卓和ios直接登录 case "phoneloginauto": if (Request["type"] == "web") { try { //测试 //jrp = new LoginBLL().CheckPhoneLoginApp(Request["phoneno"]); //outString = JsonHelper.ToJsonString(jrp); //验签 if (Request["phoneno"] != null && Request["tt"] != null && Request["mac"] != null) { //判断时间是否自有效期内 LoginMaxSecond = INITools.GetIniKeyValue("autologinurl", "LoginMaxSecond") == "" ? 0 : double.Parse(INITools.GetIniKeyValue("autologinurl", "LoginMaxSecond")); // ConfigurationManager.AppSettings["LoginMaxSecond"] == null ? 120 : double.Parse(ConfigurationManager.AppSettings["LoginMaxSecond"].ToString()); qst = Request["tt"]; if (qst == "") { jrp.resultcode = "99"; jrp.resultmessage = "缺少参数"; } else { TimeSpan ts = DateTime.Now - DateTime.Parse("1970-1-1"); TotalSeconds = ts.TotalSeconds; TotalSeconds = TotalSeconds - double.Parse(qst); if (TotalSeconds >= LoginMaxSecond || TotalSeconds < 0) { jrp.resultcode = "99"; jrp.resultmessage = "已失效"; } else { LoginMD5_key = INITools.GetIniKeyValue("autologinurl", "LoginMD5_key") == "" ? "" : INITools.GetIniKeyValue("autologinurl", "LoginMD5_key"); yqStr = Request["phoneno"] + qst + LoginMD5_key; //验签通过 if (DESHelper.Md5(yqStr) == Request["mac"].ToString()) { //判断是否有手机号 if (Request["phoneno"] != "") { } else { jrp.resultcode = "99"; jrp.resultmessage = "缺少手机号"; } } else { jrp.resultcode = "99"; jrp.resultmessage = "签名错误"; } } } } else { jrp.resultcode = "99"; jrp.resultmessage = "缺少参数"; } } catch (Exception edf) { jrp.resultcode = "99"; jrp.resultmessage = "程序异常"; } if (jrp.resultcode != "99") { //登录 jrp = new LoginBLL().CheckPhoneLoginApp(Request["phoneno"]); if (jrp.resultcode == "1") { try { //保存用户信息至本地 new LoginBLL().SyncJYHMemberInfo("", "wap"); } catch (Exception exd) { //记录异常 ProjectLogBLL.NotifyProjectLog(string.Format("一元购-保存用户信息至本地--web登录--异常:{0}", exd.ToString()), "active:API.asp的" + Request["action"]); } } outString = JsonHelper.ToJsonString(jrp); } else { //用户注销 try { new LoginBLL().UserLoginOut(); } catch (Exception sse) { } } } else { jrp = new LoginBLL().CheckPhoneLoginApp(Request["phoneno"]); if (jrp.resultcode == "1") { try { //保存用户信息至本地 new LoginBLL().SyncJYHMemberInfo("", "wap"); } catch (Exception exd) { //记录异常 ProjectLogBLL.NotifyProjectLog(string.Format("一元购-保存用户信息至本地--APP登录--异常:{0}", exd.ToString()), "active:API.asp的" + Request["action"]); } } } outString = JsonHelper.ToJsonString(jrp); break; //用户注销 case "userlogout": jrp = new LoginBLL().UserLoginOut(); outString = JsonHelper.ToJsonString(jrp); break; //手机注册 case "phonereg": jrp = new LoginBLL().CheckPhoneReg(Request["phoneno"], Request["validcode"], Request["password"]); outString = JsonHelper.ToJsonString(jrp); break; case "phonereg_lqfxtq": jrp = new LoginBLL().CheckPhoneReg(Request["phoneno"], Request["validcode"], Request["password"], JYH_SMSCode.EnumSMSTradeType.LQFXTQ, Request["sharephone"]); outString = JsonHelper.ToJsonString(jrp); break; //检测是否登录 case "checklogin": jrp = new LoginBLL().CheckLoginSession(); outString = JsonHelper.ToJsonString(jrp); break; //手机登录 case "phoneexist": if (LoginBLL.CheckPhoneExist(Request["phoneno"])) { jrp.resultcode = "99"; jrp.resultmessage = "已存在"; } else { jrp.resultcode = "1"; jrp.resultmessage = "不存在"; } outString = JsonHelper.ToJsonString(jrp); break; //获取地址列表 case "addresslist": string addressList = ""; rp = new OrderBLL().GetAddressList(out addressList); if (rp.IsError) { jrp.resultcode = rp.ResultCode; jrp.resultmessage = rp.Description; outString = JsonHelper.ToJsonString(jrp); } else { outString = addressList; } break; //新增收货地址 case "addressadd": rp = new OrderBLL().AddAddressForOrder(Request["api_input"], Request["validcode"]); jrp.resultcode = rp.ResultCode; jrp.resultmessage = rp.Description; outString = JsonHelper.ToJsonString(jrp); break; //修改收货地址 case "addressedit": rp = new OrderBLL().EditAddressForOrder(Request["api_input"], Request["validcode"]); jrp.resultcode = rp.ResultCode; jrp.resultmessage = rp.Description; outString = JsonHelper.ToJsonString(jrp); break; //根据id获得地址 case "getaddressbyid": string addressByID = ""; rp = new OrderBLL().GetAddressByID(Request["addressid"], out addressByID); if (rp.IsError) { jrp.resultcode = rp.ResultCode; jrp.resultmessage = rp.Description; outString = JsonHelper.ToJsonString(jrp); } else { outString = addressByID; if (outString == "") { jrp.resultcode = "1000"; jrp.resultmessage = "收货地址已删除,请重新设置收货地址"; outString = JsonHelper.ToJsonString(jrp); } } break; //获取默认收货地址 case "addressdefault": string addressDetail = ""; rp = new OrderBLL().GetAddressDefault(out addressDetail); if (rp.IsError) { jrp.resultcode = rp.ResultCode; jrp.resultmessage = rp.Description; outString = JsonHelper.ToJsonString(jrp); } else { outString = addressDetail; if (outString == "") { jrp.resultcode = "1000"; jrp.resultmessage = "收货地址已删除,请重新设置收货地址"; outString = JsonHelper.ToJsonString(jrp); } } break; case "merchant_check": Merchant_PageBLL checkBll = new Merchant_PageBLL(); foreach (string key in Request.Form.Keys) { checkBll._paramList.Add(key, HttpUtility.UrlDecode(Request.Form[key])); } string from = Request["merchantcode"].ToString(); if (!string.IsNullOrEmpty(from)) { outString = checkBll.NotifyMerchantApiData(); if (outString == "-1") { from = ""; } else { if (JsonHelper.JsonToObject <Json_Response_Base.resultPackage>(outString).resultcode != "1") { from = ""; } } } checkBll.CheckMerchantValid(Request["host"].ToString(), Request["refer"].ToString(), from); if (Session["MerchantID_HJY"] != null) { jrp.resultcode = "1"; jrp.resultmessage = from; } else { jrp.resultcode = "99"; jrp.resultmessage = "已失效"; } outString = JsonHelper.ToJsonString(jrp); break; //获取拼团信息 case "getpininfo": string pinInfo = ""; rp = new PinBLL().GetPinListByEventCode(Request["eid"].ToString(), out pinInfo); if (rp.IsError) { jrp.resultcode = rp.ResultCode; jrp.resultmessage = rp.Description; outString = JsonHelper.ToJsonString(jrp); } else { outString = pinInfo; } break; //获取我的团信息 case "mytuans": string myTuans = ""; rp = new PinBLL().GetMyTuans(out myTuans); if (rp.IsError) { jrp.resultcode = rp.ResultCode; jrp.resultmessage = rp.Description; outString = JsonHelper.ToJsonString(jrp); } else { outString = myTuans; } break; //获取我的订单 case "myorders": string myOrders = ""; rp = new PinBLL().GetMyOrders(out myOrders); if (rp.IsError) { jrp.resultcode = rp.ResultCode; jrp.resultmessage = rp.Description; outString = JsonHelper.ToJsonString(jrp); } else { outString = myOrders; } break; //获取我的订单详情 case "myorderdetail": string myOrderDetail = ""; rp = new PinBLL().GetMyOrderDetail(Request.Form["oid"], out myOrderDetail); if (rp.IsError) { jrp.resultcode = rp.ResultCode; jrp.resultmessage = rp.Description; outString = JsonHelper.ToJsonString(jrp); } else { outString = myOrderDetail; } break; //获取活动订单 case "eventorders": string eventOrders = ""; rp = new PinBLL().GetEventOrdersByEventCode(Request.Form["eid"], out eventOrders); if (rp.IsError) { jrp.resultcode = rp.ResultCode; jrp.resultmessage = rp.Description; outString = JsonHelper.ToJsonString(jrp); } else { outString = eventOrders; } break; //参加拼团 case "pin": var num = int.Parse(Request.Form["num"]); var endTime = DateTime.Parse(Request.Form["endTime"].ToString()); rp = new PinBLL().Pin(num, endTime, Request.Form["json"].ToString()); jrp.resultcode = rp.ResultCode; jrp.resultmessage = rp.Description; outString = JsonHelper.ToJsonString(jrp); break; //监测是否可以参加拼团 case "iscanpin": rp = new PinBLL().IsCanPin(int.Parse(Request.Form["Num"].ToString()), DateTime.Parse(Request.Form["endTime"].ToString()), Request.Form["eventCode"].ToString()); jrp.resultcode = rp.ResultCode; jrp.resultmessage = rp.Description; outString = JsonHelper.ToJsonString(jrp); break; //更新拼团状态 case "updatetuanstatus": rp = new PinBLL().UpdatePinTuanStatus(Request.Form["eventCode"].ToString(), (JYH_Pin_List.EnumTuanStatus)(int.Parse(Request.Form["status"]))); jrp.resultcode = rp.ResultCode; jrp.resultmessage = rp.Description; outString = JsonHelper.ToJsonString(jrp); break; //更新支付状态 case "updatepaystatus": rp = new PinBLL().UpdatePayStatus(Request.Form["order_code"].ToString(), (JYH_Pin_Detail.EnumPayStatus)(int.Parse(Request.Form["status"]))); jrp.resultcode = rp.ResultCode; jrp.resultmessage = rp.Description; outString = JsonHelper.ToJsonString(jrp); break; case "wxpay": //不经过支付网关 try { JsApiPay jsApiPay = new JsApiPay(this); jsApiPay.openid = Session["wxPayOpenid"].ToString(); //"oz1WBs_FPv5qbh1cyyoN9fzNZgUw"; jsApiPay.total_fee = (int)(decimal.Parse(Request["total_fee"].ToString()) * 100); jsApiPay.orderid = Request["orderid"]; WxPayData unifiedOrderResult = jsApiPay.GetUnifiedOrderResult(); outString = jsApiPay.GetJsApiParameters(); FileHelper.WriteLogFile(Server.MapPath("log"), "wxOpenid", jsApiPay.openid); } catch (Exception ex) { FileHelper.WriteLogFile(Server.MapPath("log"), "wxOpenid", ex.ToString()); } break; case "test": rp = new PinBLL().Request_ApiBySendList(0, 0); jrp.resultcode = rp.ResultCode; jrp.resultmessage = rp.Description; outString = JsonHelper.ToJsonString(jrp); break; ///*创建订单*/ //case "createorder": // order = new EGO_Order_List(); // order.ProductID = int.Parse(Request["ProductID"]); // order.PeriodNum = int.Parse(Request["PeriodNum"]); // order.OrderNo = RunProcedure.Exec_CreateSerialNo(10001); // order.OrderTime = DateTime.Now; // order.BuyerPhone = HttpContext.Current.Session["UserName"].ToString(); // order.ChipinNum =int.Parse(Request["ChipinNum"]);; // order.Status =EGO_Order_List.EnumOrderStatus.Init; // order.TotalMoney =decimal.Parse(Request["TotalMoney"]); // order.PayGate =(EnumPaygate)int.Parse(Request["PayGate"]); // order.PayGateType =(EnumPaygateType)int.Parse(Request["PayGateType"]); // if (orderBLL.Insert(order)) // { // outString = order.OrderNo; // } // else { // outString = ""; // } // break; ///*使用支付网关支付*/ //case "gotopayment": // //取得支付网关的参数 // orderno = Request["OrderNo"] ?? ""; // order = OrderBLL.GetOrderInfo(orderno); // if (order.PayGate == EnumPaygate.WeiXin_JSAPI) // { // //微信JSAPI // if (order.OpenID != "") // { // order.OpenID = Session["wxPayOpenid"].ToString(); // outString = PaygateBLL.GoToPayMent(order); // } // else { // outString = ""; // } // } // else // { // //支付宝 // outString = PaygateBLL.GoToPayMent(order); // } // break; case "wxshare": //微信内JSAPI分享 WX_JSAPI_Config jaapiconfig = new WX_JSAPI_Config(); jaapiconfig.resultcode = "0"; jaapiconfig.resultmessage = "操作成功"; string jsApiList = Request["jsApiList"] ?? ""; string url = Request["surl"] ?? ""; if (jsApiList == "") { jaapiconfig.resultcode = "1"; jaapiconfig.resultmessage = "要调用的接口不能为空"; } else if (url == "") { jaapiconfig.resultcode = "2"; jaapiconfig.resultmessage = "当前页面的url不能为空"; } else { WX_JSAPI_Ticket_Response ticket = WxJsApiData.GetJsApiTicket("jsapi"); if (ticket == null) { jaapiconfig.resultcode = "3"; jaapiconfig.resultmessage = "获取ticket失败."; } else { jaapiconfig.appId = WxPayConfig.APPID; jaapiconfig.debug = wxdebug; jaapiconfig.jsApiList = jsApiList.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); jaapiconfig.nonceStr = WxPayApi.GenerateNonceStr(); jaapiconfig.timestamp = WxPayApi.GenerateTimeStamp(); jaapiconfig.ticket = ticket.ticket; jaapiconfig.url = url; jaapiconfig.signature = WxJsApiData.getSign(jaapiconfig); } } outString = JsonHelper.ToJsonString(jaapiconfig); break; #region 图片* /*上传图片*/ case "uploadimg": //====使用服务器物理路径,可实现上传======================================== //获取图片控件 string file_ID = Request["fileid"]; //.Split('|'); //string return_img_path = ""; var file = Request.Files[file_ID]; //var file =Request.Files[0]; //上传图片文件路径【通过虚拟目录获得对应的物理地址,虚拟目录地址需指向文件服务器的共享路径】 string temp_filePath = ConfigurationManager.AppSettings["UploadIMG"]; //图片上传物理路径(当前服务器上) string filePath = new System.Web.UI.Page().Server.MapPath(temp_filePath); ////图片上传物理路径(相对于文件服务器的地址) //string filePath = ConfigurationManager.AppSettings["UploadIMG"]; int maxSize = 0; string path = ""; if (file == null) { outString = "{\"resultCode\":\"1\",\"resultMessage\":\"请上传图片信息!\"}"; } fileName = file.FileName; string aaa = Encoding.UTF8.GetString(Encoding.Default.GetBytes(file.FileName)); string exName = ""; if (Path.GetExtension(aaa) == "") { exName = fileName.Substring(fileName.LastIndexOf('?')).Replace("?", "."); } else { exName = fileName.Substring(fileName.LastIndexOf('.')); } if (exName == "") { exName = "." + fileName.Substring(fileName.Length - 3, 3); } //重命名 //int seed = Guid.NewGuid().GetHashCode(); //var random = new System.Random(seed); string newFileName = DateTime.Now.ToString("yyyyMMddHHmmssffff") + "" + RandHelper.Next(100000, 999999); if (Directory.Exists(filePath) == false) { Directory.CreateDirectory(filePath); } path = filePath + "\\" + newFileName + exName; file.SaveAs(path); //图片访问路径 string baseurl = ""; if (Request["saveFullPath"] != null) { baseurl = ConfigurationManager.AppSettings["UploadIMG_YM"]; //Request.Url.Scheme + "://" + Request.Url.Host + ":" + Request.Url.Port; } jrb.resultmessage = baseurl + ConfigurationManager.AppSettings["UploadIMG_Path"] + newFileName + exName; jrb.resultcode = "1"; outString = JsonHelper.ToJsonString(jrb); break; #endregion case "group_back": if (Session["group_back"] != null) { jrp.resultcode = "1"; jrp.resultmessage = "正常"; } else { jrp.resultcode = "99"; jrp.resultmessage = "已失效"; } outString = JsonHelper.ToJsonString(jrp); break; case "merchant_page": if (Session["MerchantID_HJY"] != null || (!string.IsNullOrEmpty(Request["recordact"]))) { Merchant_PageBLL pageBll = new Merchant_PageBLL(); foreach (string key in Request.Form.Keys) { pageBll._paramList.Add(key, HttpUtility.UrlDecode(Request.Form[key])); } outString = pageBll.NotifyMerchantApiData(); if (outString == "-1") { jrp.resultcode = "99"; jrp.resultmessage = "通知失败"; outString = JsonHelper.ToJsonString(jrp); } } else { if (Request["recordact"].ToString() != "") { } jrp.resultcode = "98"; jrp.resultmessage = "已失效"; outString = JsonHelper.ToJsonString(jrp); } break; } } catch (Exception ex) { ProjectLogBLL.NotifyProjectLog(string.Format("异常:{0}", ex.ToString()), "api-" + Request["action"]); } Response.Write(outString); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { //{ reurl}?c_succmark ={ c_succmark} //&resultmsg ={ resultmsg} //&c_order ={ c_order} //&c_mid ={ c_mid} //&orderid ={ orderid} string merchantid = INITools.GetIniKeyValue("MobileCZ", "merchantid"); PaygateBLL paydll = new PaygateBLL(); string showstr = ""; //ResultPacket resultpackge = paydll.DoVerify(Request.Params); //if (!resultpackge.IsError) //{ if (Request.Params["c_order"] == null) { ShowResult = "<h2>无效的充值订单信息</h2>"; } else { OrderNo = Request.Params["c_order"]; hid_orderno.Value = OrderNo; if (Request.Params["c_succmark"] != "Y") { ShowResult = "支付失败"; //Response.Redirect("/Order/OrderDetail.html?oid="+ OrderNo, true); return; } else { Response.Redirect("/Order/OrderSuccess.html?orderid=" + OrderNo, true); return; //EGO_Order_ListDAL Order_ListDAL = new EGO_Order_ListDAL(); //EGO_Order_List Order_List = Order_ListDAL.GetModel(Request["c_order"]); //if (Order_List == null) //{ // ShowResult = "<h2>无效的充值订单信息</h2>"; //} //else //{ // if (Order_List.TotalMoney != decimal.Parse(Request["c_orderamount"])) // { // ShowResult = "<h2>订单金额不一致</h2>"; // } // else // { // //获得商品信息 // EGO_Product_ListDAL DAL = new EGO_Product_ListDAL(); // EGO_Product_List Product_model = DAL.GetModel(Order_List.ProductID); // StringBuilder res = new StringBuilder(); // if (Order_List.Status == EGO_Order_List.EnumOrderStatus.Payed) // { // showstr = "支付成功,等待分配号码"; // res.AppendFormat("<h2>{3}</h2><p>订单号:{0},</p><p>选择商品:{1},</p><p>实际支付:{2}元</p><p></p>", Order_List.OrderNo, Product_model.ProductName, Order_List.TotalMoney.ToString("0.00"), showstr); // } // else if (Order_List.Status == EGO_Order_List.EnumOrderStatus.Paying) // { // //resultpackge.Description = "订单支付成功,充值进行中"; // showstr = "订单中"; // res.AppendFormat("<h2>{3}</h2><p>订单号:{0},</p><p>选择商品:{1},</p><p>支付金额:{2}元</p><p></p>", Order_List.OrderNo, Product_model.ProductName, Order_List.TotalMoney.ToString("0.00"), showstr); // } // else // { // //resultpackge.Description = "订单支付成功,充值进行中"; // showstr = EnumHelper.GetEnumCNNameFromEnum(typeof(EGO_Order_List.EnumOrderStatus), Order_List.Status); // res.AppendFormat("<h2>{3}</h2><p>订单号:{0},</p><p>选择商品:{1},</p><p>支付金额:{2}元</p><p></p>", Order_List.OrderNo, Product_model.ProductName, Order_List.TotalMoney.ToString("0.00"), showstr); // } // ShowResult = res.ToString(); // } //} } } } }
protected void Page_Load(object sender, EventArgs e) { string returl = ""; string errstr = ""; bool isok = false; EGO_Pay_ReceiveLogDAL ReceiveLogDAL = new EGO_Pay_ReceiveLogDAL(); EGO_Pay_ReceiveLog ReceiveLog = new EGO_Pay_ReceiveLog(); PaygateBLL paydll = new PaygateBLL(); ResultPacket resultpage = paydll.DoVerify(Request.Params); string ReceiveData = "c_mid=" + Request.Params["c_mid"] + "&c_order=" + Request.Params["c_order"] + "&c_orderamount=" + Request.Params["c_orderamount"] + "&c_ymd=" + Request.Params["c_ymd"] + "&c_transnum=" + Request.Params["c_transnum"] + "&c_succmark=" + Request.Params["c_succmark"] + "&c_cause=" + Request.Params["c_cause"] + "&c_moneytype=" + Request.Params["c_moneytype"] + "&dealtime=" + Request.Params["dealtime"] + "&c_memo1=" + Request.Params["c_memo1"] + "&c_memo2=" + Request.Params["c_memo2"] + "&c_signstr=" + Request.Params["c_signstr"] + "&c_paygate=" + Request.Params["c_paygate"] + "&c_version=" + Request.Params["c_version"]; ReceiveLog.TradeType = "pay"; ReceiveLog.TradeDesp = "支付网关通知"; ReceiveLog.ReceiveData = ReceiveData; //;Request.Params.ToString(); ReceiveLog.Receivetime = DateTime.Now; ReceiveLog.OrderNo = Request.Params["c_order"]; ReceiveLogDAL.Insert(ReceiveLog); if (resultpage.IsError) { #region 记录用户操作日志 //try //{ // memlog.Status = FC_Members_Log.EnumLogStatus.Fail; // memlog.MemID = 0;// Order_List.MemID; // memlog.MerchantID ="00"; // memlog.Memo = "支付网关返回失败失败,描述:" + resultpage.Description; // memlog.SessionID = ""; // memlog.IP = GetIP.GetRequestIP(); // memlog.RequestSerialNo = ""; // memlog.ResultMessage = "支付网关返回失败,描述:" + resultpage.Description; // memlog.TradeMerchantID = "00"; // System.Utils.Common.INI.IniReadvalue("System", "MerchantID", _inifile); // new FC_Members_LogDAL().Insert(memlog); //} //catch //{ //} #endregion returl = ReturnUrl(0, resultpage.Description); } else { EGO_Order_ListDAL Order_ListDAL = new EGO_Order_ListDAL(); EGO_Order_List Order_List = Order_ListDAL.GetModel(Request["c_order"]); if (Order_List == null) { returl = ReturnUrl(0, "充值订单信息未找到"); } else { decimal realPayMoney = Order_List.TotalMoney - Order_List.CouponMoney - Order_List.AccountMoney - Order_List.RebatMoney; if (!(Order_List.Status == EGO_Order_List.EnumOrderStatus.Paying || Order_List.Status == EGO_Order_List.EnumOrderStatus.UserCancel)) { returl = ReturnUrl(0, "支付订单状态错误"); } if (Order_List.ChipinCodeList != "") { returl = ReturnUrl(0, "支付订单已分配过号码了"); } else if (Order_List.BuyerPhone != Request["c_memo1"]) { returl = ReturnUrl(0, "订单信息与网关信息不符"); } else if (realPayMoney != decimal.Parse(Request["c_orderamount"])) { returl = ReturnUrl(0, "订单金额不一致,数据库:" + realPayMoney.ToString() + ",通知:" + Request["c_orderamount"]); } else { //页面输出,表示网关已通知成功 returl = ReturnUrl(1, INITools.GetIniKeyValue("paygate", "handleurl_ego")); DataAccess da = new DataAccess(); da.BeginTransaction(); try { //网关支付成功 Order_List.Status = EGO_Order_List.EnumOrderStatus.Payed; Order_List.Pay_ResponseTime = QueryBase.GetDataBaseDate(); Order_List.PayGate_Pay_OrderNo = Request["c_transnum"].ToString(); int yy = Order_ListDAL.UpdateForPayResult(Order_List, da); if (yy != 1) { returl = ReturnUrl(0, resultpage.Description); } else { /*充值成功,增加充值成功trade_log,等待服务分配chipinCode*/ try { EGO_Trade_LogDAL Trade_LogDAL = new EGO_Trade_LogDAL(); EGO_Trade_Log model = new EGO_Trade_Log(); model.OrderID = Order_List.ID; model.ProductID = Order_List.ProductID; model.PeriodNum = Order_List.PeriodNum; model.TradeType = EnumTradetype.Pay; model.BuyerPhone = Order_List.BuyerPhone; model.MoneyDirect = EnumMoneydirect.In; model.BalanceChanged = realPayMoney; model.TradeOrderNo = Request["c_transnum"].ToString(); model.CreateTime = DateTime.Now; model.PaygateType = Order_List.PayGateType; model.Paygate = Order_List.PayGate; Trade_LogDAL.Insert(model, da); isok = true; da.Commit(); BaseUDPClient udp = new BaseUDPClient(); udp.Command = 5; udp.EncryptKey = ConfigurationManager.AppSettings["UDPSecretKey_5"]; udp.RemoteIP = ConfigurationManager.AppSettings["UDPServerIP_5"]; udp.RemotePort = int.Parse(ConfigurationManager.AppSettings["UDPServerPort_5"]); udp.Execute(); } catch (Exception exx) { isok = false; errstr = exx.ToString(); } } } catch (Exception edd) { da.Rollback(); //向综合后台增加日志 errstr = "网关通知成功,执行后续操作异常,描述:" + edd.ToString(); } } } } ReceiveLog.ResponseData = returl; ReceiveLog.ResponseTime = DateTime.Now; if (resultpage.IsError) { ReceiveLog.ResultCode = "0"; } else { ReceiveLog.ResultCode = "1"; } if (isok) { ReceiveLog.ResultMessage = "通知成功,发起充值成功"; } else { ReceiveLog.ResultMessage = "通知成功,增加充值日志异常,描述:" + errstr; //向综合后台增加日志 ProjectLogBLL.NotifyProjectLog("通知成功,增加充值日志异常,描述:" + errstr, "pay_result_err"); } ReceiveLogDAL.Update(ReceiveLog); Response.Write(returl); }
protected void Page_Load(object sender, EventArgs e) { string returl = ""; string errstr = ""; bool isok = false; EGO_Pay_ReceiveLogDAL ReceiveLogDAL = new EGO_Pay_ReceiveLogDAL(); EGO_Pay_ReceiveLog ReceiveLog = new EGO_Pay_ReceiveLog(); PaygateBLL paydll = new PaygateBLL(); ResultPacket resultpage = paydll.DoVerify(Request.Params); string ReceiveData = "c_mid=" + Request.Params["c_mid"] + "&c_order=" + Request.Params["c_order"] + "&c_orderamount=" + Request.Params["c_orderamount"] + "&c_ymd=" + Request.Params["c_ymd"] + "&c_transnum=" + Request.Params["c_transnum"] + "&c_succmark=" + Request.Params["c_succmark"] + "&c_cause=" + Request.Params["c_cause"] + "&c_moneytype=" + Request.Params["c_moneytype"] + "&dealtime=" + Request.Params["dealtime"] + "&c_memo1=" + Request.Params["c_memo1"] + "&c_memo2=" + Request.Params["c_memo2"] + "&c_signstr=" + Request.Params["c_signstr"] + "&c_paygate=" + Request.Params["c_paygate"] + "&c_version=" + Request.Params["c_version"]; ReceiveLog.TradeType = "chz"; ReceiveLog.TradeDesp = "支付网关通知"; ReceiveLog.ReceiveData = ReceiveData; //;Request.Params.ToString(); ReceiveLog.Receivetime = DateTime.Now; ReceiveLog.OrderNo = Request.Params["c_order"]; ReceiveLogDAL.Insert(ReceiveLog); if (resultpage.IsError) { #region 记录用户操作日志 //try //{ // memlog.Status = FC_Members_Log.EnumLogStatus.Fail; // memlog.MemID = 0;// Order_List.MemID; // memlog.MerchantID ="00"; // memlog.Memo = "支付网关返回失败失败,描述:" + resultpage.Description; // memlog.SessionID = ""; // memlog.IP = GetIP.GetRequestIP(); // memlog.RequestSerialNo = ""; // memlog.ResultMessage = "支付网关返回失败,描述:" + resultpage.Description; // memlog.TradeMerchantID = "00"; // System.Utils.Common.INI.IniReadvalue("System", "MerchantID", _inifile); // new FC_Members_LogDAL().Insert(memlog); //} //catch //{ //} #endregion //Response.Redirect("/Account/Recharge.html?tost=t"); // returl = ReturnUrl(1, ""); // Response.Redirect("", true); returl = ReturnUrl(0, resultpage.Description); } else { resultpage = new CardChzBLL().doChzResult(Request["c_order"], decimal.Parse(Request["c_orderamount"])); if (resultpage.IsError) { // Response.Redirect("/Account/Recharge.html?tost=t"); returl = ReturnUrl(0, resultpage.Description); } else { returl = ReturnUrl(1, INITools.GetIniKeyValue("paygate", "handleurl_recharge_ego")); } } ReceiveLog.ResponseData = returl; ReceiveLog.ResponseTime = DateTime.Now; if (resultpage.IsError) { ReceiveLog.ResultCode = "0"; } else { ReceiveLog.ResultCode = "1"; } if (isok) { ReceiveLog.ResultMessage = "通知成功,发起充值成功"; } else { ReceiveLog.ResultMessage = "通知成功,增加充值日志异常,描述:" + errstr; //向综合后台增加日志 ProjectLogBLL.NotifyProjectLog("通知成功,增加充值日志异常,描述:" + errstr, "pay_result_err"); } ReceiveLogDAL.Update(ReceiveLog); Response.Write(returl); }