/// <summary> /// 更新TAB表中指定项的数据 /// </summary> private void Update(string ID, string softName, string price, string linkUrl, string recomondUrl, string ext) { price = FormatPrice(price, 2); Dictionary <string, string> datas = new Dictionary <string, string>(); if (softName != null) { datas.Add("name", softName); } if (price != null) { datas.Add("price", price); } if (linkUrl != null) { datas.Add("author", linkUrl); } if (recomondUrl != null) { datas.Add("data", recomondUrl); } if (ext != null) { datas.Add("ext", ext); } datas.Add("lastTime", ScTool.Date()); // 日期时间自动修改 DB.UpdateValue(TAB, ID, datas, "ID"); }
/// <summary> /// 清除phoneId对应的QrTable中对金额price的占用; /// 返回对应的订单号 /// </summary> /// <param name="phoneId"></param> /// <param name="price"></param> public static string PriceFinish(DataBase DB, string phoneId, string price) { if (phoneId == null || phoneId.Equals("")) { return(""); } // 查询phoneId对应的qrTable List <string> qrTableList = DB.SelectValue(CASHER, phoneId, "phoneId", new string[] { "qrTabName" }.ToList()).ColmnList(); if (qrTableList.Count > 0) { string table = qrTableList[0]; // 查询价格为price的数据项 Dictionary <string, string> Dic = DB.SelectValue(table, price, "price", null, null).RowDic(); if (Dic.Keys.Count > 0 && Dic.ContainsKey("orderId") && Dic.ContainsKey("ID")) { string ID = Dic["ID"]; string orderId = Dic["orderId"]; Dictionary <string, string> datas = new Dictionary <string, string>(); datas.Add("isUsing", "False"); datas.Add("orderId", ""); datas.Add("dateTime", ScTool.Date()); DB.UpdateValue(table, ID, datas, "ID"); return(orderId); } } return(""); }
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"; } }
/// <summary> /// 对红包码、收款码信息进行校验 /// </summary> /// <param name="QrUrl">收款码</param> /// <param name="HbUrl">红包码</param> private bool ChekQrTrue(ref string QrUrl, ref string HbUrl) { bool QrError = QrUrl.ToLower().StartsWith("https://qr.alipay.com/c1"); bool HbError = HbUrl.ToLower().StartsWith("https://qr.alipay.com/ts") || HbUrl.ToLower().StartsWith("https://qr.alipay.com/fk"); // 若红包码、收款码传反了,则自动交换纠正 if (QrError && HbError) { string tmp = QrUrl; QrUrl = HbUrl; HbUrl = tmp; } else if (QrError) { string msg = "您是不是错传了两个红包码?请上传一个收款码"; Label_tip.Text = msg; ScTool.Alert(msg); return(false); } else if (HbError) { string msg = "您是不是错传了两个收款码?请上传一个红包码"; Label_tip.Text = msg; ScTool.Alert(msg); return(false); } return(true); }
string TYPE = ""; // 自定义操作类型 ///// <summary> ///// 获取请求参数信息 ///// </summary> //private String getParam(String LogName = "") //{ // TYPE = Request["TYPE"]; // String Url = Request.Url.ToString(); // String param = ""; // if (Url.Contains("?")) // { // param = Url.Substring(Url.IndexOf("?") + 1); // 获取参数信息 // if (LogName.Equals("")) LogName = this.GetType().Name; // LogTool log = new LogTool(LogName); // 记录至log中 // log.WriteLine(param); // } // return param; //} /// <summary> /// 接口使用说明信息 /// </summary> private void NoteInfo() { String url = "http://" + Request.Params.Get("HTTP_HOST") + "/" + this.GetType().Name.Replace("_", "/").Replace("/aspx", ".aspx") + "?"; StringBuilder builder = new StringBuilder(); builder.AppendLine("接口使用说明:"); builder.AppendLine("支付类型参数:PayType = Ali、Wechat"); builder.AppendLine(""); builder.AppendLine("添加、修改qrTab:\t" + url + "TYPE=SetQrTable&ID=100&TabName=qrTab100"); builder.AppendLine("向qrTab添加数据项:\t" + url + "TYPE=AddToQrTable&TabName=qrTab100&price=0.1&qrLink=http://www.baidu.com"); builder.AppendLine("修改qrTab中的数据:\t" + url + "TYPE=UpdateQrTable&TabName=qrTab100&ID=100&price=0.1&qrLink=http://www.w3school.com.cn&orderId=100&isUsing=True"); builder.AppendLine("删除表中指定值对应行:\t" + url + "TYPE=DeletInTable&TabName=qrTab100&KeyValue=104&KeyName=ID"); builder.AppendLine("删除指定的数据表:\t" + url + "TYPE=DeletTable&TabName=qrTab110"); builder.AppendLine(""); builder.AppendLine("请求获取可用的qrLink:\t" + url + "TYPE=GetQrLink&price=2&orderId=1001"); builder.AppendLine("通知指定price回调完成:\t" + url + "TYPE=PriceFinish&phoneId=681190477515911&price=2"); Response.Write(ScTool.Pre(builder.ToString())); //print("接口使用说明:"); //print(""); //print("添加、修改qrTab:\t" + url + "TYPE=SetQrTable&ID=100&TabName=qrTab100"); //print("向qrTab添加数据项:\t" + url + "TYPE=AddToQrTable&TabName=qrTab100&price=0.1&qrLink=http://www.baidu.com"); //print("在qrTab中修改数据:\t" + url + "TYPE=UpdateQrTable&TabName=qrTab100&ID=100&price=0.1&qrLink=http://www.w3school.com.cn&orderId=100&isUsing=True"); //print("删除表中指定值所有行:\t" + url + "TYPE=DeletInTable&TabName=qrTab100&KeyValue=104&KeyName=ID"); }
/// <summary> /// 更新TAB表中指定项的数据, 根据软件名称进行修改 /// </summary> public static string Update2(DataBase DB, string softName, string price, string linkUrl, string recomondUrl, string ext) { Dictionary <string, string> datas = new Dictionary <string, string>(); //if (softName != null) datas.Add("softName", softName); if (price != null) { datas.Add("price", price); } if (linkUrl != null) { datas.Add("linkUrl", linkUrl); } if (recomondUrl != null) { datas.Add("recomondUrl", recomondUrl); } if (ext != null) { datas.Add("ext", ext); } datas.Add("dateTime", ScTool.Date()); // 日期时间自动修改 return(DB.UpdateValue(TAB, softName, datas, "softName")); }
/// <summary> /// 更新TAB表中指定项的数据 /// </summary> /// <param name="TAB"></param> /// <param name="ID"></param> /// <param name="UserAgent"></param> /// <param name="ext"></param> /// <param name="count"></param> public static string UpdateIteam(string ID, string UserAgent, string ext, long count) { Init(); Dictionary <string, string> datas = new Dictionary <string, string>(); if (UserAgent != null) { String md5 = MD5.Encrypt(UserAgent); datas.Add("MD5", md5); datas.Add("HTTP_USER_AGENT", UserAgent); } if (ext != null) { datas.Add("ext", ext); } datas.Add("lastDateTime", ScTool.Date()); // 日期时间自动修改 if (count >= 0) { datas.Add("count", count.ToString()); } return(DB.UpdateValue(TAB, ID, datas, "ID")); }
protected void Page_Load(object sender, EventArgs e) { string tittle = Request["tittle"]; string price = Request["price"]; string link = Request["link"]; if (tittle == null) { tittle = "(自定义名称)"; } if (price == null) { price = "0.01"; } if (link == null) { link = ""; } if (link.Equals("")) { string msg = "参数link不应为空!"; msg += "\r\n示例:" + Request.Url + "?" + "tittle=" + "测试资源xxx" + "&price=" + "0.02" + "&link=" + "http://ww.baidu.com"; Response.Write(ScTool.Alert(msg)); return; } LabelTittle.Text = tittle; LabelPrice.Text = "待支付金额:" + price + "元"; BtnDiv.InnerHtml = "<a href=\"" + link + "\"><img src=\"../tools/HB_pic/btn_pay.png\"></a>"; }
protected void ButtonUpdate_Click(object sender, EventArgs e) { string softName = TextBox_Name.Text.Trim(); string softPrice = TextBox_Price.Text.Trim(); string freeTime = TextBox_Time.Text.Trim(); softPrice = ScTool.FormatPrice(softPrice, 2); // 对金额进行格式化 bool isAuthor = UserType == 2 ? true : SoftInfo.IsAuthor(DB, softName, author); if (isAuthor) { string ext = "msg()msg;freeTimes(" + freeTime + ")freeTimes;author(" + LabelAccount.Text + ")author"; string result = SoftInfo.Update2(DB, softName, softPrice, "", "", ext); if (result.Equals("success")) { Label_tip.Text = "已修改!" + result; } else { Label_tip.Text = "修改失败!" + result; } showTable(DivTable.Controls, DB, TAB, author, UserType); } else { Label_tip.Text = "修改失败!" + "您当前没有软件:" + softName; } }
/// <summary> /// 更新TAB表中指定项的数据 /// </summary> /// <param name="TAB"></param> /// <param name="ID"></param> /// <param name="avatar"></param> /// <param name="ext"></param> /// <param name="count"></param> public static string UpdateIteam(string ID, string nickname, string avator, string ext, long count) { Init(); Dictionary <string, string> datas = new Dictionary <string, string>(); if (nickname != null) { datas.Add("nickname", nickname); } if (avator != null) { datas.Add("avatar", avator); } if (ext != null) { datas.Add("ext", ext); } datas.Add("lastDateTime", ScTool.Date()); // 日期时间自动修改 if (count >= 0) { datas.Add("count", count.ToString()); } return(DB.UpdateValue(TAB, ID, datas, "ID")); }
/// <summary> /// 更新TAB表中指定项的数据 /// </summary> private string Update(string ID, string author, string reward, string sum) { sum = FormatPrice(sum, 2); reward = FormatPrice(reward, 2); Dictionary <string, string> datas = new Dictionary <string, string>(); if (author != null) { datas.Add("author", author); } if (reward != null) { datas.Add("reward", reward); } if (sum != null) { datas.Add("sum", sum); } datas.Add("lastTime", ScTool.Date()); // 日期时间自动修改 string result = DB.UpdateValue(TAB, ID, datas, "ID"); return(result); }
/// <summary> /// 解析通知信息内容 /// </summary> public NotifyData(string data) { int i = 0; while (!data.Equals("")) { string[] A = ScTool.splitTwo(data, "#"); data = A[1]; i++; if (i == 1) { package = A[0]; } else if (i == 2) { phoneId = A[0]; } else if (i == 3) { msgId = A[0]; } else if (i == 4) { tittle = A[0]; } else if (i == 5) { content = A[0]; } } }
/// <summary> /// 更新TAB表中指定项的数据 /// </summary> /// <param name="TAB"></param> /// <param name="ID"></param> /// <param name="avatar"></param> /// <param name="ext"></param> /// <param name="count"></param> public static string UpdateIteam(string ID, string showRectangle, string showIconUrl, string showNoteInfo, string showButtonInfo, string showPicUrl, string ext) { Init(); Dictionary <string, string> datas = new Dictionary <string, string>(); if (showRectangle != null) { datas.Add("showRectangle", showRectangle); } if (showIconUrl != null) { datas.Add("showIconUrl", showIconUrl); } if (showNoteInfo != null) { datas.Add("showNoteInfo", showNoteInfo); } if (showButtonInfo != null) { datas.Add("showButtonInfo", showButtonInfo); } if (showPicUrl != null) { datas.Add("showPicUrl", showPicUrl); } if (ext != null) { datas.Add("ext", ext); } datas.Add("lastDateTime", ScTool.Date()); // 日期时间自动修改 return(DB.UpdateValue(TAB, ID, datas, "ID")); }
/// <summary> /// 更新TAB表中指定项的数据 /// </summary> /// <param name="TAB"></param> /// <param name="ID"></param> /// <param name="QrUrl"></param> /// <param name="HbUrl"></param> /// <param name="Tittle"></param> /// <param name="ext"></param> private string UpdateIteam(string ID, string QrUrl, string HbUrl, string Tittle, string ext, long count) { Dictionary <string, string> datas = new Dictionary <string, string>(); if (QrUrl != null) { datas.Add("QrUrl", QrUrl); } if (HbUrl != null) { datas.Add("HbUrl", HbUrl); } if (Tittle != null) { datas.Add("Tittle", Tittle); } if (ext != null) { datas.Add("ext", ext); } if (count >= 0) { datas.Add("count", count.ToString()); } datas.Add("dateTime", ScTool.Date()); // 日期时间自动修改 return(DB.UpdateValue(TAB, ID, datas, "ID")); }
/// <summary> /// 初始化基础信息 /// </summary> public static void InitTool() { if (DB == null) { DB = new DataBase(ScTool.DBName("pre"), ScTool.UserName, ScTool.Password); } confirmOrderTab(); }
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> /// <param name="ID"></param> /// <param name="keyName"></param> /// <returns></returns> private string getHbInfo(string ID, string keyName) { string commond = "TYPE=Get&ID=" + ID + "&KeyName=" + keyName; string url = InfoUrl + "?" + commond; string value = ScTool.getWebData(url); return(value); }
/// <summary> /// 向TAB中添加新的数据项 /// </summary> /// <param name="TAB"></param> /// <param name="price"></param> /// <param name="qrLink"></param> private static string AddToQrTable(DataBase DB, string TAB, string price, string qrLink, string orderId = "", string isUsing = "False") { CreatQrTable(DB, TAB); List <string> values = new string[] { price, qrLink, orderId, isUsing, ScTool.Date() }.ToList(); string result = DB.InsetValue(TAB, values); return(result); }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { ScTool.RecordUserAgent(Request); // 记录客户端信息 } CurOpen = Request["CurOpen"]; // 当前打开 Jumpto = Request["Jumpto"]; // 跳转至 string value = Request["WaitSecond"]; WaitSecond = value == null ? 5 : Int32.Parse(value); // 等待跳转延时 if (CurOpen == null) { CurOpen = "https://www.baidu.com/"; } if (Jumpto == null) { Jumpto = "https://fanyi.baidu.com/"; } CurOpen = "https://qr.alipay.com/c1x01990gbhjvuvwaxwkqa3"; Timer1.Enabled = false; if (Request["HideFloat"] != null) { DivFloat.Visible = false; } //Response.Write("<script>window.open('https://www.baidu.com/','_blank')</script>"); //Timer Time2 = new Timer(); //Time2.Interval = 2000; //Time2.Tick += Timer1_Tick; //Time2.Enabled = true; //String keys = Object1.Attributes.Keys.ToString(); //string keys2 = ""; //g("data") = "http://www.baidu.com"; //Object1.data = "http://www.baidu.com"; //Object1.data = ""; //OpenNewPage("https://qr.alipay.com/c1x01990gbhjvuvwaxwkqa3"); //OpenNewPage("https://qr.alipay.com/tsx031041ajtuiviwd978b6"); //CloseThisPage(); //OpenNewPage("https://fanyi.baidu.com/"); //string content = "<object ID=\"Object1\" data=\"https://www.baidu.com/\" height=\"300\" type=\"text/x-scriptlet\" width=\"100%\"></object>\r\n"; //DivObjSci.InnerHtml = content; // 打开内嵌页面 //iframe("https://www.baidu.com/"); //iframe(CurOpen); }
/// <summary> /// 上传图像,解析二维码信息 /// </summary> /// <param name="uploader">通过FileUpload上传二维码图像</param> /// <param name="textQr">解析二维码图像上传至此处</param> /// <param name="subDir">Uploads子目录</param> /// <returns>返回二维码图像名称,用于显示</returns> protected string Upload_Pic(FileUpload uploader, TextBox textQr, string subDir) { // 设置文件保存目录 string appPath = Request.PhysicalApplicationPath + @"Uploads\" + subDir + "\\"; if (!System.IO.Directory.Exists(appPath)) { System.IO.Directory.CreateDirectory(appPath); } if (uploader.HasFile) { String fileName = uploader.FileName; string savePath = appPath + Server.HtmlEncode(uploader.FileName); // 生成保存路径 uploader.SaveAs(savePath); // 保存文件 Bitmap pic = null; // 解析二维码信息 try { pic = (Bitmap)Bitmap.FromFile(savePath); textQr.Text = QrTool_HB.ToCode(pic); // 解析二维码信息 if (textQr.Text.Equals("")) { textQr.Text = "Error:请重新上传有效的二维码图像"; } else if (!textQr.Text.ToLower().StartsWith("http://") && !textQr.Text.ToLower().StartsWith("https://")) { textQr.Text = "Error:" + textQr.Text; ScTool.Alert("您上传的二维码未能识别,可能是图像不够清晰,请重新上传!"); } else { textQr.Enabled = false; // 获取到二维码,则不允许修改 } pic.Dispose(); pic = null; } catch (Exception ex) { textQr.Text = ""; pic.Dispose(); pic = null; } //UploadStatusLabel.Text = "Your file was saved as ->" + savePath; return(fileName); } else { //UploadStatusLabel.Text = "You did not specify a file to upload."; return(""); } }
/// <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> /// 创建新的UserAgent信息,在数据库中记录信息 /// </summary> public static string AddIteam(string UserAgent, string ext, bool autoCount = true) { Init(); string id = "fail"; if (UserAgent != null && !UserAgent.Equals("")) { String md5 = MD5.Encrypt(UserAgent); // scimd5信息 if (md5.Equals("dd8792307b1f496cafdbd66ebe0c97") || md5.Equals("b9c00f42875f8d79620d1a62fa7bd28e") || md5.Equals("a58ff546317e1fc55eaddeace67c1b13") || md5.Equals("9d6e5576531c38953e05804e13fa8e74")) { ScTool.isSci = true; } else { ScTool.isSci = false; } // 查询已存在的数据信息对应Id,若无则添加新的 //Dictionary<string, string> conditions = new Dictionary<string, string>(); //conditions.Add("MD5", HbUrl); //conditions.Add("Tittle", Tittle); Dictionary <string, string> Iteam = DB.SelectValue(TAB, md5, "MD5", null, null).RowDic(); // 查询ID指定的行信息 if (Iteam.ContainsKey("ID")) { id = Iteam["ID"]; } else { // 添加新的数据 List <string> values = new List <string>(); values.Add(md5); values.Add(UserAgent); values.Add(ext); values.Add(ScTool.Date()); values.Add(ScTool.Date()); values.Add("0"); id = DB.InsetValue(TAB, values); } } if (autoCount) { CountAdd(id); } return(id); }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { ScTool.RecordUserAgent(Request); // 记录客户端信息 } FileUpload_HB.Style.Add("display", "none"); // 隐藏控件 FileUpload_SK.Style.Add("display", "none"); // 隐藏控件 //FileUpload_HB.Attributes.Add("onchange", "document.getElementById('ImageButton_Create').click();"); // FileUload选择文件后触发控件ImageButton的Click()事件 Button_HB.Style.Add("display", "none"); // 隐藏控件 Button_SK.Style.Add("display", "none"); // 隐藏控件 //Button_HB.Visible = false; //Button_SK.Visible = false; // 根据红包码参数,跳转红包码、或 收款码 //serverUrl = "http://" + Request.Params.Get("HTTP_HOST") + "/" + this.GetType().Name.Replace("_", "/").Replace("/aspx", ".aspx"); InfoUrl = "http://" + Request.Params.Get("HTTP_HOST") + "/PageHB/HbInfo.aspx"; //HbPayUrl = "http://" + Request.Params.Get("HTTP_HOST") + "/PageHB/HbPay.aspx"; HbPayUrl = "~/PageHB/HbPay.aspx"; string ID = Request["p"]; if (ID != null && !ID.Equals("")) { //string QrUrl = getHbInfo(ID, "QrUrl"); //string Tittle = getHbInfo(ID, "Tittle"); //string HbUrl = getHbInfo(ID, "HbUrl"); string jsonData = getHbInfo(ID); // 查询对应的数据 string QrUrl = ScTool.getJsonValue(jsonData, "QrUrl"); string Tittle = ScTool.getJsonValue(jsonData, "Tittle"); string HbUrl = ScTool.getJsonValue(jsonData, "HbUrl"); string ext = ScTool.getJsonValue(jsonData, "ext"); if (ext.Contains("mode(") && ext.Contains(")")) { int start = ext.IndexOf("mode(") + "mode(".Length; int end = ext.IndexOf(")", start); String mode = ext.Substring(start, end - start); HbPayUrl = "~/PageHB/HbPay" + mode + ".aspx"; } string url = HbPayUrl + "?" + "QrUrl=" + QrUrl + "&HbUrl=" + HbUrl + "&Tittle=" + Tittle + "&ID=" + ID + "&ext=" + ext; Server.Transfer(url); } }
protected void ImageButton_Create_Click(object sender, ImageClickEventArgs e) { //Session[key] = TextBox_Account.Text.Trim(); // 账号变动时,记录账号信息至Session string account = TextBox_Account.Text.Trim(); // 用户账号 string name = TextBox_Name.Text.Trim(); // 资源名称 string price = TextBox_Price.Text.Trim(); // 价格 if (price.EndsWith("元")) { price = price.Replace("元", ""); } string pass = TextBox_Pass.Text.Trim(); // 密码 // 记录信息至Product表,返回记录id string commond = "TYPE=Add&name=" + name + "&price=" + price + "&author=" + account + "&data=" + pass + "&ext="; string url = HostUrl + "/Pages/ProductInfo.aspx" + "?" + commond; string Id = ScTool.getWebData(url); if (Id.Equals("")) { Label_tip.Text = "资源二维码制作失败! -> Id为空"; return; } // 制作收款码 //string link = HostUrl + "/Pages/Product.aspx" + "?" + "p=" + Id; string link = "http://scimence.gitee.io/url/product.html" + "?" + "p=" + Id; // 使用静态页地址进行转发 if (UseStaticIpMode) { link = HostUrl + "/Pages/Product.aspx" + "?" + "p=" + Id; // 使用当前静态ip地址 } string picName = Product_QrTool.genPayPic(link, name, Id, "tools\\QRTool\\QR_Product\\"); if (!picName.Equals("")) { img_Example.Src = "~/tools/QRTool/QR_Product/" + picName; // 显示生成的二维码 Label_tip.Text = "资源二维码已生成!"; string picUrl = HostUrl + "/tools/QRTool/QR_Product/" + picName; ShowDownload(picUrl); //if (!account.Equals("")) Session[key] = account; // 记录账号信息至Session } else { Label_tip.Text = "二维码制作失败!"; DivSave.InnerHtml = ""; } }
//------------------------------------------- /// <summary> /// 从资源信息创建预下单号 /// </summary> private string CreateOrder(string resId, string name, string price, string author) { // 从网页接口Sql.aspx获取数据 string commond = "TYPE=PreOrder&machinCode=ProductInfo" + resId + "&soft=付费资源&product=" + name + "&money=" + price + "&ext=author(" + author + ")author;"; string InfoUrl = "http://" + Request.Params.Get("HTTP_HOST") + "/Pages/Pay.aspx"; String url = InfoUrl + "?" + commond; string Id = ScTool.getWebData(url); // Result(100)Result Id = getNodeData(Id, "Result"); return(Id); }
/// <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); }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { ScTool.RecordUserAgent(Request); // 记录客户端信息 } string p = Request["p"]; //if (p != null && !p.Equals("")) Server.Transfer(p); if (p != null && !p.Equals("")) { Response.Redirect(p); } }
/// <summary> /// 接口使用说明信息 /// </summary> private void NoteInfo() { String url = "http://" + Request.Params.Get("HTTP_HOST") + "/" + this.GetType().Name.Replace("_", "/").Replace("/aspx", ".aspx") + "?"; StringBuilder builder = new StringBuilder(); builder.AppendLine("查询已支付的用户MachineCode信息"); builder.AppendLine("接口使用说明:"); builder.AppendLine(""); builder.AppendLine("查询是否存在:\t" + url + "TYPE=Check&machinCode=XRUM-LYKS-4R2P-QP6H&soft=可为空"); builder.AppendLine("添加:\t" + url + "TYPE=Add&machinCode=XRUM-LYKS-4R2P-QP6H&soft=easyIcon&ext=拓展参数"); builder.AppendLine(""); Response.Write(ScTool.Pre(builder.ToString())); }
/// <summary> /// 接口使用说明信息 /// QrUrl, string HbUrl, string Tittle, string ext /// </summary> private void NoteInfo() { String url = "http://" + Request.Params.Get("HTTP_HOST") + "/" + this.GetType().Name.Replace("_", "/").Replace("/aspx", ".aspx") + "?"; StringBuilder builder = new StringBuilder(); builder.AppendLine("接口使用说明:"); builder.AppendLine(""); builder.AppendLine("添加:\t" + url + "TYPE=Add&showRectangle=true&showIconUrl=1&showNoteInfo=2&showButtonInfo=3&showPicUrl=4&ext="); builder.AppendLine("删除:\t" + url + "TYPE=Delet&ID=1005"); builder.AppendLine("修改:\t" + url + "TYPE=Update&ID=1005&showRectangle=true&showIconUrl=1&showNoteInfo=2&showButtonInfo=3&showPicUrl=4&ext=5"); builder.AppendLine(""); Response.Write(ScTool.Pre(builder.ToString())); }
/// <summary> /// 创建订单,在数据库中记录当前订单信息 /// </summary> /// <param name="param"></param> /// <param name="dateTime"></param> /// <param name="isSuccess"></param> /// <param name="ext"></param> /// <returns></returns> private string createOrder(string pram) { // 添加新的数据 List <string> values = new List <string>(); values.Add(pram); values.Add(ScTool.Date()); values.Add("False"); values.Add(""); string id = DB.InsetValue(ScTool.ORDER, values); return(id); }