protected void Page_Load(object sender, EventArgs e) { string author = Request["p"]; if (author == null || author.Equals("")) { author = UserTool.GetAccount(Session); // 获取登录的用户名 } if (author != null && !author.Equals("")) { // 查询收益信息 string url = "http://" + Request.Params.Get("HTTP_HOST") + "/Pages/UserWithdraw.aspx" + "?" + "TYPE=Reward&author=" + author; string reward = ScTool.getWebData(url); LabelAccount.Text = author; LabelReward.Text = reward; DataBase DB_Ali = new DataBase(ScTool.DBName(ScTool.PayTypeAli), ScTool.UserName, ScTool.Password); showTable(DivTable.Controls, DB_Ali, ScTool.ORDER, author, "True"); showTable(DivTableHistory.Controls, DB_Ali, ScTool.ORDER, author, "TrueFinish"); } else { LabelAccount.Text = ""; LabelReward.Text = "0"; DivTable.InnerText = "示例:" + "http://" + Request.Params.Get("HTTP_HOST") + "/Pages/UserRewards.aspx" + "?" + "p=scimence"; } }
protected void Page_Load(object sender, EventArgs e) { DB = new DataBase(ScTool.DBName("pre"), ScTool.UserName, ScTool.Password); // 显示指定类型的订单信息 //ScTool.showTable(DivTable.Controls, DB, UserWithdraw.TAB); showTable(); }
/// <summary> /// 初始化基础信息 /// </summary> public static void InitTool() { if (DB == null) { DB = new DataBase(ScTool.DBName("pre"), ScTool.UserName, ScTool.Password); } confirmOrderTab(); }
/// <summary> /// 载入后执行参数对应的sql请求 /// </summary> public override void Load(object sender, EventArgs e) { DB = new DataBase(ScTool.DBName("pre"), ScTool.UserName, ScTool.Password); DB_Ali = new DataBase(ScTool.DBName(ScTool.PayTypeAli), ScTool.UserName, ScTool.Password); confirmTabExist(); TYPE = Request["TYPE"]; if (TYPE != null) { if (TYPE.Equals("Add")) { string result = Add(Request["author"], Request["reward"], Request["sum"]); Response.Write(result); return; } else if (TYPE.Equals("Update")) { Update(Request["ID"], Request["author"], Request["reward"], Request["sum"]); } else if (TYPE.Equals("Delet")) { Delet(Request["ID"]); } else if (TYPE.Equals("Select")) { string result = Select(Request["ID"], Request["key"]); // 查询ID数据项对应的key值 Response.Write(result); return; } else if (TYPE.Equals("DeletThisTab")) { DB.DeletTable(TAB); } else if (TYPE.Equals("Reward")) { string result = CountReward(Request["author"]); Response.Write(result); return; } else if (TYPE.Equals("RewardClear")) { RewardClear(Request["author"]); } } //-------------------------------------------------------- // 显示接口使用说明 NoteInfo(); // 显示指定类型的订单信息 ScTool.showTable(this.Controls, DB, TAB); }
/// <summary> /// 设置对应的订单号为支付成功 /// </summary> /// <param name="DB"></param> /// <param name="orderId"></param> /// <returns></returns> public static string OrderSuccess(DataBase DB, string orderId, String Author = "") { Dictionary <string, string> Dic = DB.SelectValue(ScTool.ORDER, orderId, "ID").RowDic(); if (!Dic.ContainsKey("ext")) { return("fail"); } string isSuccess = Dic["isSuccess"]; // 是否已支付成功 if (isSuccess != null && isSuccess.Contains("True")) { return("success"); // 已成功则不再操作 } if (!Author.Equals("")) { string ext = Dic["ext"]; // ext if (!ext.Contains("author(" + Author + ")")) { return("fail"); } } // 设置当前订单为支付成功 Dictionary <string, string> datas = new Dictionary <string, string>(); datas.Add("isSuccess", "True"); string result = DB.UpdateValue(ScTool.ORDER, orderId, datas, "ID"); // 记录preDB中的Order表信息为支付成功 if (result.Equals("success")) { if (Dic.Count > 0 && Dic.ContainsKey("preOrderId")) { string preOrderId = Dic["preOrderId"]; // 预下单订单号 string machinCode = Dic["machinCode"]; // 机器码 string soft = Dic["soft"]; // 软件名称 DataBase preDB = new DataBase(ScTool.DBName("pre"), ScTool.UserName, ScTool.Password); result = OnlineSerial.GenOnlineSerial(machinCode, soft, preDB); OnlineCode.Add(preDB, OnlineCode.TAB, machinCode, soft, Dic["ext"]); // 记录支付成功的软件信息至数据表中 result = Pay.OrderSuccess(preDB, preOrderId); } } return(result); }
string TYPE = ""; // 自定义操作类型 /// <summary> /// 载入后执行参数对应的sql请求 /// </summary> public override void Load(object sender, EventArgs e) { TYPE = Request["TYPE"]; // 连接指定的数据库,若不存在则创建 DB = new DataBase(ScTool.DBName(PayType), ScTool.UserName, ScTool.Password); //DB.DeletTable(ScTool.ORDER); confirmOrderTab(); if (TYPE != null) { string result = ""; if (TYPE.Equals("Add")) { result = AddIteam(Request["QrUrl"], Request["HbUrl"], Request["Tittle"], Request["ext"]); } else if (TYPE.Equals("_Delet")) { result = DeletIteam(Request["ID"]).ToString(); } else if (TYPE.Equals("_Update")) { long count = -1; try { count = long.Parse(Request["count"]); } catch (Exception) { } result = UpdateIteam(Request["ID"], Request["QrUrl"], Request["HbUrl"], Request["Tittle"], Request["ext"], count); } else if (TYPE.Equals("Get")) { result = GetIteam(Request["ID"], Request["KeyName"]); } else if (TYPE.Equals("CountAdd")) { result = CountAdd(Request["ID"]); } Response.Write(result); } else { NoteInfo(); ScTool.showTable(this.Controls, DB, TAB); } }
/// <summary> /// 载入后执行参数对应的sql请求 /// </summary> public override void Load(object sender, EventArgs e) { DB = new DataBase(ScTool.DBName("pre"), ScTool.UserName, ScTool.Password); confirmOrderTab(DB); TYPE = Request["TYPE"]; if (TYPE != null) { string result = ""; if (TYPE.Equals("Add")) { result = Add(DB, Request["softName"], Request["price"], Request["linkUrl"], Request["recomondUrl"], Request["ext"]); } else if (TYPE.Equals("Update")) { result = Update(DB, Request["ID"], Request["softName"], Request["price"], Request["linkUrl"], Request["recomondUrl"], Request["ext"]); } else if (TYPE.Equals("Delet")) { result = Delet(DB, Request["ID"]).ToString(); } else if (TYPE.Equals("Select")) { result = Select(DB, Request["softName"], Request["key"]); if (Request["key"].Equals("price") || Request["key"].Equals("ext")) // 若查询金额信息,则进行加密 { result = Request["key"] + "(" + result + ")" + Request["key"]; result = Locker.Encrypt(result, Request["softName"]); } } else if (TYPE.Equals("DeletThisTab")) { result = DB.DeletTable(TAB).ToString(); } Response.Write(result); return; } else { // 显示接口使用说明 NoteInfo(); // 显示指定类型的订单信息 ScTool.showTable(this.Controls, DB, TAB); } }
private static DataBase DB_pre = null; // 本地数据库连接对象 /// <summary> /// 判断指定的machinCode/soft是否已完成支付 /// </summary> private bool IsPayed(string machinCode, string soft = null) { if (machinCode == null || machinCode.Equals("")) { return(false); } if (DB_pre == null) { DB_pre = new DataBase(ScTool.DBName("pre"), ScTool.UserName, ScTool.Password); } string result = QrPaySystem.Pages.OnlineCode.Check(DB_pre, ScTool.UserCode, machinCode, soft); return(result.Equals("success")); }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { ScTool.RecordUserAgent(Request); // 记录客户端信息 } getParam(); //获取参数记录log信息 DB = new DataBase(ScTool.DBName("pre"), ScTool.UserName, ScTool.Password); //DB.DeletTable(TAB); CreatTable(DB, TAB); if (TYPE != null) { string reslut = ""; if (TYPE.Equals("Check")) { reslut = Check(DB, TAB, Request["machinCode"], Request["soft"]); Response.Write(reslut); return; } if (TYPE.Equals("Add")) { int UserType = UserTool.UserType(Session); // 获取当前登录的用户类型信息 reslut = "false no allowed! " + "../PayFor/UserLogin.aspx"; if (UserType == 2) { reslut = Add(DB, TAB, Request["machinCode"], Request["soft"], Request["ext"], Request["msg"]); } Response.Write(reslut); return; } Response.Write("TYPE -> " + TYPE); } NoteInfo(); ScTool.showTable(this.Controls, DB, TAB); }
protected void Page_Load(object sender, EventArgs e) { UserType = UserTool.UserType(Session); // 获取当前登录的用户类型信息 author = Request["p"]; if (author == null || author.Equals("")) { author = UserTool.GetAccount(Session); // 获取登录的用户名 } if (author != null && !author.Equals("")) { LabelAccount.Text = author; DB = new DataBase(ScTool.DBName("pre"), ScTool.UserName, ScTool.Password); SoftInfo.confirmOrderTab(DB); showTable(DivTable.Controls, DB, TAB, author, UserType); } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { ScTool.RecordUserAgent(Request); // 记录客户端信息 } getParam(); //获取参数记录log信息 DB = new DataBase(ScTool.DBName("pre"), ScTool.UserName, ScTool.Password); //DB.DeletTable(TAB); CreatTable(DB, TAB); if (TYPE != null) { string reslut = ""; if (TYPE.Equals("GetRegSerial")) { reslut = GetRegSerial(Request["machinCode"], Request["soft"], Request["computerName"], Request["userName"], Request["ext"], Request["counter"]); Response.Write(reslut); return; } if (TYPE.Equals("GetValue")) { reslut = GetValue(Request["KEY"], Request["machinCode"], Request["soft"]); Response.Write(reslut); return; } else if (TYPE.Equals("UpdateSerial")) { reslut = Update(DB, Request["ID"], Request["machinCode"], Request["soft"], Request["computerName"], Request["userName"], Request["ext"], Request["startTimes"], Request["onlineSerial"], Request["msg"]); } Response.Write("UpdateSerial -> " + reslut); } NoteInfo(); ScTool.showTable(this.Controls, DB, TAB); }
/// <summary> /// 生成注册码信息 /// </summary> /// <param name="machinCode">机器码</param> /// <param name="soft">软件名称</param> public static string GenOnlineSerial(string machinCode, string soft, DataBase DB = null) { if (machinCode == null || machinCode.Trim().Equals("")) { return("fail"); } if (soft == null) { return("fail"); } if (DB == null) { DB = new DataBase(ScTool.DBName("pre"), ScTool.UserName, ScTool.Password); } CreatTable(DB, TAB); // 查询机器码、软件名称对应的,注册信息 Dictionary <string, string> condition = new Dictionary <string, string>(); condition.Add("soft", soft); Dictionary <string, string> Dic = DB.SelectValue(TAB, machinCode, "machinCode", null, condition).RowDic(); if (Dic.Keys.Count > 0 && Dic.ContainsKey("ID")) { // 若存在,则修改相应信息,并返回注册码信息 string ID = Dic["ID"]; string softSerial = SoftSerial(machinCode, soft); string onlineSerial = RegSerial(softSerial); return(Update(DB, ID, null, null, null, null, null, null, onlineSerial, null)); } return("fail"); }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { ScTool.RecordUserAgent(Request); // 记录客户端信息 } infoURL = "http://" + Request.Params.Get("HTTP_HOST") + "/WebInfo.aspx"; // 本地表信息路径 String param = getParam(); // 获取通知消息 //param = "param=com.sc.notificationservices#866170022772077#1518361220871#标题#内容"; //param=com.sc.notificationservices#681190477515911#1533107942652#标题#内容 //param = "com.eg.android.AlipayGphone#866170022772077#1533477407672#支付宝通知#成功收款0.1元。享免费提现等更多专属服务,点击查看"; if (param.StartsWith("param=")) { param = param.Substring("param=".Length); } NotifyData data = new NotifyData(param); string result = "fail"; if (data.package.Equals("com.sc.notificationservices")) { DB = new DataBase(ScTool.DBName(ScTool.PayTypeAli), ScTool.UserName, ScTool.Password); result = recordInCahsier(DB, data.phoneId); if (result.Equals("success")) { DB = new DataBase(ScTool.DBName(ScTool.PayTypeWechat), ScTool.UserName, ScTool.Password); result = recordInCahsier(DB, data.phoneId); } } else if (data.package.Equals("com.eg.android.AlipayGphone")) { result = param; if (data.content.Contains("成功收款") && data.content.Contains("元")) { int index1 = data.content.IndexOf("成功收款") + "成功收款".Length; int index2 = data.content.IndexOf("元", index1); string money = data.content.Substring(index1, index2 - index1).Trim(); DB = new DataBase(ScTool.DBName(ScTool.PayTypeAli), ScTool.UserName, ScTool.Password); string orderId = Cashier.PriceFinish(DB, data.phoneId, money); if (!orderId.Equals("")) { result = Order.OrderSuccess(DB, orderId); // 设置对应订单为支付成功 } else { result = "success"; } } else { result = "success"; } } else if (data.package.Equals("com.tencent.mm")) { int index1 = data.content.IndexOf("收款") + "收款".Length; if (index1 < 2 && data.content.Contains("到账")) { index1 = data.content.IndexOf("到账") + "到账".Length; } int index2 = data.content.IndexOf("元", index1); string money = data.content.Substring(index1, index2 - index1).Trim(); DB = new DataBase(ScTool.DBName(ScTool.PayTypeWechat), ScTool.UserName, ScTool.Password); string orderId = Cashier.PriceFinish(DB, data.phoneId, money); if (!orderId.Equals("")) { result = Order.OrderSuccess(DB, orderId); // 设置对应订单为支付成功 } else { result = "success"; } } else { result = "【package: " + data.package + "】\r\n" + param + ""; } //else if (data.package.Equals("com.sc.notificationservices")) //{ // DB = new DataBase(ScTool.DBName(ScTool.PayTypeAli), ScTool.UserName, ScTool.Password); //} Response.Write(result); //if (!param.Equals("") && param.Contains("#")) //{ // TAB = getTableName(param); // 生成表名 // String key = getPhoneSerial(param); // 获取手机序列号 // String result = SaveInfo(key, param); // 通知信息保存结果 // Response.Write(result); //} //else //{ // Response.Write("fail"); //} }
/// <summary> /// 载入后执行参数对应的sql请求 /// </summary> public override void Load(object sender, EventArgs e) { if (UserType == 0 && param.Equals("")) { Response.Redirect("../PayFor/UserLogin.aspx"); } DB = new DataBase(ScTool.DBName("pre"), ScTool.UserName, ScTool.Password); if (Page.IsPostBack) { //Timer1.Enabled = true; return; } body1.Visible = false; TYPE = Request["TYPE"]; if (TYPE == null) { TYPE = ""; } if (param.Contains("TYPE")) { int index = param.IndexOf("TYPE"); int start = param.IndexOf("&", index + 4); param = param.Substring(start + 1); } //DB.DeletTable(ScTool.ORDER); confirmOrderTab(); //DB = new DataBase("master", ScTool.UserName, ScTool.Password); //DB.DeletDataBase(ScTool.DBName("pre")); //DB.DeletDataBase(ScTool.DBName(ScTool.PayTypeAli)); //DB.DeletDataBase(ScTool.DBName(ScTool.PayTypeWechat)); if (TYPE.Equals("PreOrder")) // 生成新的pre订单 { //if (!ContainsAuthorInfo()) return; this.Controls.Clear(); string id = createOrder(param); Response.Write(ScTool.Reslut(id)); return; } else if (TYPE.Equals("ShowPreOrder")) // 显示预备下单订单号,对应的二维码待支付页面 { string preOrderId = Request["preOrderId"]; LabelPreOrderId.Text = "当前订单号:" + preOrderId; LabelPreOrderPrice.Text = getNeedPayMoney(preOrderId); if (preOrderId != null && !preOrderId.Equals("")) { string data = url + "?" + "TYPE=" + "CreateOrder" + "&" + "preOrderId=" + preOrderId; showQR(data); } else { Response.Write("支付失败!Pay.aspx创建订单失败"); } } else if (TYPE.Equals("OrderResult")) // 查询指定订单支付结果http://60.205.185.168:8002/pages/pay.aspx?TYPE=OrderResult&machinCode=J78Z-A906-E9ST-RING { this.Controls.Clear(); string order_param = Request["P"]; if (order_param == null || order_param.Equals("")) { string result = OrderResult(Request["preOrderId"]); // 通过订单号查询支付结果 Response.Write(ScTool.Reslut(result)); } else { string result = OrderResult_param(order_param); // 通过订单参数查询支付结果 Response.Write(ScTool.Reslut(result)); } return; } else if (TYPE.Equals("OrderResultX")) { this.Controls.Clear(); if (Request["preOrderId"] != null) { string result = OrderResult(Request["preOrderId"], false); // 通过订单号查询支付结果 Response.Write(ScTool.Reslut(result)); } else { string machinCode = Request["machinCode"]; string soft = Request["soft"]; string result = OnlineCode.Check(DB, OnlineCode.TAB, machinCode, soft); // 查询指定的机器码对应订单是否已支付 Response.Write(ScTool.Reslut(result)); } return; } else if (TYPE.Equals("CreateOrder")) // 使用预下单信息,创建正式订单 { string preOrderId = Request["preOrderId"]; if (preOrderId != null && !preOrderId.Equals("")) { Dictionary <string, string> row = DB.SelectValue(ScTool.ORDER, preOrderId, "ID").RowDic(); if (row.Count > 0 && row.ContainsKey("param")) { string oparam = row["param"]; string isSuccess = row["isSuccess"].ToLower(); if (isSuccess.Equals("true")) { Response.Write(ScTool.Alert("订单" + preOrderId + "已支付成功!")); } else { // 获取客户端类型 string agent = Request.Params.Get("HTTP_USER_AGENT"); string payType = ScTool.payType(agent); // 创建订单时,指定类型 if (payType.Equals("")) { string payTypeParam = Request["PayType"]; if (payTypeParam != null && (payTypeParam.Equals("Ali") || payTypeParam.Equals("Wechat"))) { payType = payTypeParam; } } //param = HttpUtility.UrlDecode(param); //Response.Redirect("Order.aspx?" + "PayType=" + payType + "&" + param); Order.StaticParam = "PayType=" + payType + "&" + oparam + "&preOrderId=" + preOrderId; Server.Transfer("Order.aspx"); } } else { Response.Write(ScTool.Alert("订单" + preOrderId + "不存在!请重新下单")); } } } else { if (!param.Equals("")) { //if (!ContainsAuthorInfo()) return; //param = HttpUtility.UrlEncode(param); string preOrderId = createOrder(param); LabelPreOrderId.Text = "当前订单号:" + preOrderId; string needMoney = Request["money"]; if (needMoney != null) { LabelPreOrderPrice.Text = "待支付金额:" + needMoney + " 元"; } if (!preOrderId.Equals("")) { string data = url + "?" + "TYPE=" + "CreateOrder" + "&" + "preOrderId=" + preOrderId; //Response.Redirect("QRTool.aspx?" + data); //QRTool.StaticParam = data; //Server.Transfer("QRTool.aspx"); showQR(data); } else { Response.Write("支付失败!Pay.aspx创建订单失败"); } } else { if (UserType == 2) { ScTool.showTable(this.Controls, DB, ScTool.ORDER); } else if (UserType == 1) { ScTool.showTable(this.Controls, DB, ScTool.ORDER, "where param like '%" + "author(" + UserAccount + ")" + "%' "); } NoteInfo(); } } }
string TAB = ScTool.ORDER; // 订单表名称 ///// <summary> ///// 判断ext中是否含有开发者帐号信息 ///// </summary> ///// <returns></returns> //private bool ContainsAuthorInfo() //{ // String orderExt = Request["ext"]; // bool ContainsAuthor = (orderExt != null && orderExt.Contains("author(" + UserAccount + ")")); // if (!ContainsAuthor) Response.Write("创建订单时需包含开发者信息" + "ext=author(" + UserAccount + ")author"); // return ContainsAuthor; //} /// <summary> /// 载入后执行参数对应的sql请求 /// </summary> public override void Load(object sender, EventArgs e) { if (UserType == 0 && (param.Equals("") || (param.Contains("ShowOrder") && !param.Contains("OrderSuccess")))) { Response.Redirect("../PayFor/UserLogin.aspx"); } Dictionary <string, string> staticPramsDic = null; // 静态参数字典 // 若存在静态参数,则使用静态参数 if (!StaticParam.Equals("")) { staticPramsDic = ScTool.ToParamsDic(StaticParam); StaticParam = ""; } //PayType = ScTool.PayTypeAli; string type = Request["PayType"]; if (staticPramsDic != null && staticPramsDic.ContainsKey("PayType")) { type = staticPramsDic["PayType"]; } if (type != null && !type.Equals("")) { PayType = type; } if (PayType.Equals("")) { if (staticPramsDic == null) { NoteInfo(); // 从Pay.aspx Transfer过来,不显示接口说明信息 } else { Response.Write("扫码客户端类型未知,创建订单失败!<br/>请使用支付宝或微信扫码支付"); } // 显示订单信息 string showOrder = Request["ShowOrder"]; if (staticPramsDic != null && staticPramsDic.ContainsKey("ShowOrder")) { showOrder = staticPramsDic["ShowOrder"]; } if (showOrder != null && !showOrder.Equals("")) { if (showOrder.Equals(ScTool.PayTypeAli) || showOrder.Equals(ScTool.PayTypeWechat)) { DB = new DataBase(ScTool.DBName(showOrder), ScTool.UserName, ScTool.Password); // 修改指定的订单为支付成功 string orderId = Request["OrderSuccess"]; if (staticPramsDic != null && staticPramsDic.ContainsKey("OrderSuccess")) { orderId = staticPramsDic["OrderSuccess"]; } if (orderId != null && !orderId.Equals("")) { string result = "fail"; if (UserType == 2) { result = OrderSuccess(DB, orderId); } //else if (UserType == 1) result = OrderSuccess(DB, orderId, UserAccount); else if (UserType == 1) { result = "false no allowed!"; } Response.Write(ScTool.Pre("OrderSuccess->" + orderId + ": " + result)); } // 显示指定类型的订单信息 if (UserType == 2) { ScTool.showTable(this.Controls, DB, ScTool.ORDER); } else if (UserType == 1) { ScTool.showTable(this.Controls, DB, ScTool.ORDER, "where ext like '%" + "author(" + UserAccount + ")" + "%' "); } } } } else { //if (!ContainsAuthorInfo()) return; // 连接指定的数据库,若不存在则创建 DB = new DataBase(ScTool.DBName(PayType), ScTool.UserName, ScTool.Password); //DB.DeletTable(ScTool.ORDER); confirmOrderTab(); //统计金额总数,指定是否清空 string ParamClear = Request["MoneyAllClear"]; if (ParamClear != null) { bool clear = ParamClear.Trim().ToLower().Equals("true"); if (clear) { string result = MoneyAllClear(DB, UserAccount); Response.Write(result); } else { String SuccessValue = ParamClear.Equals("TrueFinish") ? ParamClear : ""; string MoneyCount = MoneyAll(DB, UserAccount, SuccessValue); Response.Write(MoneyCount); } return; } // 解析创建订单参数信息 string machinCode = Request["machinCode"]; if (staticPramsDic != null && staticPramsDic.ContainsKey("machinCode")) { machinCode = staticPramsDic["machinCode"]; } if (machinCode == null) { machinCode = ""; } string soft = Request["soft"]; if (staticPramsDic != null && staticPramsDic.ContainsKey("soft")) { soft = staticPramsDic["soft"]; } if (soft == null) { soft = ""; } string product = Request["product"]; if (staticPramsDic != null && staticPramsDic.ContainsKey("product")) { product = staticPramsDic["product"]; } if (product == null) { product = ""; } string money = Request["money"]; if (staticPramsDic != null && staticPramsDic.ContainsKey("money")) { money = staticPramsDic["money"]; } string ext = Request["ext"]; if (staticPramsDic != null && staticPramsDic.ContainsKey("ext")) { ext = staticPramsDic["ext"]; } if (ext == null) { ext = ""; } string preOrderId = Request["preOrderId"]; if (staticPramsDic != null && staticPramsDic.ContainsKey("preOrderId")) { preOrderId = staticPramsDic["preOrderId"]; } if (preOrderId == null) { preOrderId = ""; } #region 一预下单号不再多次创建订单 String keyOrderId = "O_Id"; String keyLink = "O_Link"; // 若订单号不存在,或不相同则重新记录; 并清空链接地址信息 if (Session[keyOrderId] == null || !(Session[keyOrderId] as string).Equals(preOrderId)) { Session[keyOrderId] = preOrderId; Session[keyLink] = null; } if (Session[keyLink] != null && !(Session[keyLink] as string).Equals("")) { string link = (Session[keyLink] as string); Response.Redirect(link); // 直接重定向到二维码对应链接 return; } #endregion // 支付金额不可为空,根据给定的参数创建订单 if (money != null && !money.Equals("")) { string id = createOrder(machinCode, soft, product, money, ext, preOrderId); if (!id.Equals("")) { string link = Cashier.GetQrLink(DB, money, id); if (!link.Equals("")) { if (!preOrderId.Equals("")) // 设置预下单为扫码成功 { DataBase preDB = new DataBase(ScTool.DBName("pre"), ScTool.UserName, ScTool.Password); Pay.SetScanSuccess(preDB, preOrderId, PayType); } // 若若链接信息不存在,或不相同则重新记录 if (Session[keyLink] == null || !(Session[keyLink] as string).Equals(link)) { Session[keyLink] = link; } Response.Redirect(link); // 重定向到二维码对应链接 } else { deletOrder(id); Response.Write(ScTool.Alert("服务器忙或不支持该金额,请稍候再试! Order.aspx")); } } else { Response.Write("创建订单失败! Order.aspx"); } } else { Response.Write("创建订单金额为空! Order.aspx"); } //List<String> names = DB.DataBaseNames(); // 服务器中所有数据库名称 //List<String> names2 = DB.TableNames(); // 当前数据库中所有表名称 //DB.DeletDataBase("PayDataBase"); //List<String> names3 = DB.DataBaseNames(); // 服务器中所有数据库名称 } }
protected void Page_Load(object sender, EventArgs e) { // 获取订单号 string payType = ""; string preOrderId = ""; if (Request["a"] != null && !Request["a"].Equals("")) { payType = "Ali"; preOrderId = Request["a"]; } if (Request["w"] != null && !Request["w"].Equals("")) { payType = "Wechat"; preOrderId = Request["w"]; } if (preOrderId == null || preOrderId.Equals("")) { return; } DataBase DB = new DataBase(ScTool.DBName("pre"), ScTool.UserName, ScTool.Password); Dictionary <string, string> row = DB.SelectValue(ScTool.ORDER, preOrderId, "ID").RowDic(); if (row.Count > 0 && row.ContainsKey("param")) { string oparam = row["param"]; string isSuccess = row["isSuccess"].ToLower(); if (isSuccess.Equals("true")) { Response.Write(ScTool.Alert("订单" + preOrderId + "已支付成功!")); } else { // 获取客户端类型 //string agent = Request.Params.Get("HTTP_USER_AGENT"); //string payType = ScTool.payType(agent); // 创建订单时,指定类型 if (payType.Equals("")) { string payTypeParam = Request["PayType"]; if (payTypeParam != null && (payTypeParam.Equals("Ali") || payTypeParam.Equals("Wechat"))) { payType = payTypeParam; } } //param = HttpUtility.UrlDecode(param); //Response.Redirect("Order.aspx?" + "PayType=" + payType + "&" + param); Order.StaticParam = "PayType=" + payType + "&" + oparam + "&preOrderId=" + preOrderId; //Server.Transfer("Order.aspx"); Server.Transfer("../Pages/Order.aspx"); } } else { Response.Write(ScTool.Alert("订单" + preOrderId + "不存在!请重新下单")); } //{ // String param = "TYPE=CreateOrder&preOrderId=" + p + "&PayType=Ali"; // Server.Transfer("../pages/pay.aspx?" + param); //} //p = Request["w"]; //if (p != null && !p.Equals("")) //{ // String param = "TYPE=CreateOrder&preOrderId=" + p + "&PayType=Wechat"; // Server.Transfer("../pages/pay.aspx?" + param); //} }
/// <summary> /// 载入后执行参数对应的sql请求 /// </summary> public override void Load(object sender, EventArgs e) { DB = new DataBase(ScTool.DBName("pre"), ScTool.UserName, ScTool.Password); confirmOrderTab(); TYPE = Request["TYPE"]; if (TYPE != null) { if (TYPE.Equals("Add")) { string result = Add(Request["name"], Request["price"], Request["author"], Request["data"], Request["ext"]); Response.Write(result); return; } else if (TYPE.Equals("Update")) { Update(Request["ID"], Request["name"], Request["price"], Request["author"], Request["data"], Request["ext"]); } else if (TYPE.Equals("Delet")) { Delet(Request["ID"]); } else if (TYPE.Equals("Select")) { string result = Select(Request["ID"], Request["key"]); // 查询ID数据项对应的key值 //if (Request["key"].Equals("price") || Request["key"].Equals("ext")) // 若查询金额信息,则进行加密 //{ // result = Request["key"] + "(" + result + ")" + Request["key"]; // result = Locker.Encrypt(result, Request["name"]); //} Response.Write(result); return; } else if (TYPE.Equals("DeletThisTab")) { DB.DeletTable(TAB); } else if (TYPE.Equals("StaticIp")) { Product.UseStaticIpMode = !Product.UseStaticIpMode; Response.Write("设置付费资源,网址模式 StaticIp=" + Product.UseStaticIpMode); } } //-------------------------------------------------------- string resId = Request["ID"]; // 数据项对应的资源ID // 1、查询当前用户对应的对于该资源是否已创建订单号,若未创建则创建 // 2、查询该订单是否已支付,未支付则跳转支付,已支付则显示资源对应密码 if (TYPE == null && resId != null) { if (Session.Timeout != 60 * 24) { Session.Timeout = 60 * 24; // 设置Session有效时间为24小时 } string key = "ProductInfo" + resId + "_payId"; // 按资源ID记录,对应的支付预下单号 // string date = DateTime.Now.ToString("yyyyMMdd"); // 每天可领取一次,首次跳转 // (Session[key] as string).Equals(""); // 获取之前的session值 // 1、 string value = ""; if (Session[key] == null) // 若key对应的订单号不存在 { Dictionary <String, String> iteam = DB.SelectValue(TAB, resId, "ID").RowDic(); // 查询资源ID对应的数据 string preOrderId = CreateOrder(resId, iteam["name"], iteam["price"], iteam["author"]); // 生成预下单号 Session[key] = preOrderId; // 记录至session中 } value = Session[key] as string; // 2、 bool OrderIsPayed = OrderSuccess(value); //OrderIsPayed = true; if (!OrderIsPayed) { // 跳转支付 //GotoPay(value); // 展示资源支付页 TipPay(resId, value); } else { // 显示资源信息 Dictionary <String, String> iteam = DB.SelectValue(TAB, resId, "ID").RowDic(); // 查询资源ID对应的数据 ShowInfo(iteam["data"]); } } //-------------------------------------------------------- // 显示接口使用说明 NoteInfo(); // 显示指定类型的订单信息 ScTool.showTable(this.Controls, DB, TAB); }
public override void Load(object sender, EventArgs e) { if (UserType == 0) { Response.Redirect("../PayFor/UserLogin.aspx"); } else if (UserType == 1) { Response.Redirect("../PayFor/SDK.aspx"); } if (!Page.IsPostBack) { ScTool.RecordUserAgent(Request); // 记录客户端信息 } string type = Request["PayType"]; if (type != null && !type.Equals("")) { PayType = type; } DB = new DataBase(ScTool.DBName(PayType), ScTool.UserName, ScTool.Password); //getParam(); //获取参数记录log信息 TYPE = Request["TYPE"]; if (TYPE != null) { if (TYPE.Equals("SetQrTable")) { SetQrTable(Request["ID"], Request["TabName"]); } else if (TYPE.Equals("AddToQrTable")) { AddToQrTable(DB, Request["TabName"], Request["price"], Request["qrLink"]); } else if (TYPE.Equals("UpdateQrTable")) { UpdateQrTable(Request["TabName"], Request["ID"], Request["price"], Request["qrLink"], Request["orderId"], Request["isUsing"]); } else if (TYPE.Equals("DeletInTable")) { DeletInTable(Request["TabName"], Request["KeyValue"], Request["KeyName"]); } else if (TYPE.Equals("DeletTable")) { DeletTable(Request["TabName"]); } else if (TYPE.Equals("GetQrLink")) { string link = GetQrLink(DB, Request["price"], Request["orderId"]); Response.Write(link); return; } else if (TYPE.Equals("PriceFinish")) { string orderId = PriceFinish(DB, Request["phoneId"], Request["price"]); Response.Write(orderId); return; } } NoteInfo(); if (!DB.ExistTab(CASHER)) { Response.Write(ScTool.Pre("数据表" + CASHER + "不存在!请使用NotificationSender创建")); } else { ScTool.showTable(this.Controls, DB, CASHER); List <string> qrTableList = DB.ColumnList(CASHER, "qrTabName"); foreach (string table in qrTableList) { if (!table.Equals("")) { ScTool.showTable(this.Controls, DB, table, "", false); } } //Table table = DB.ExecuteTable("select * from Cahsier"); //this.Controls.Add(table); //PlaceHolder_Tab.Controls.Add(table); } }