///// <summary> ///// 清除店铺活动图片 ///// </summary> ///// <param name="sender"></param> ///// <param name="e"></param> //protected void Button2_Click(object sender, EventArgs e) //{ //} /// <summary> /// 增加活动图片到宝贝描述 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Button3_Click(object sender, EventArgs e) { string appkey = "12159997"; string secret = "614e40bfdb96e9063031d1a9e56fbed5"; //保存到数据库 string name = utils.NewRequest("detail", utils.RequestType.Form); string istop = utils.NewRequest("detailimgistop", utils.RequestType.Form); string sql = "UPDATE TCS_ShopConfig SET detailimgname = '" + name + "', detailimgistop = '" + istop + "' WHERE nick = '" + nick + "'"; StringBuilder builder = new StringBuilder(); utils.ExecuteNonQuery(sql); //上传到宝贝描述 TopXmlRestClient client = new TopXmlRestClient("http://gw.api.taobao.com/router/rest", appkey, secret); for (int j = 1; j <= 500; j++) { ItemsOnsaleGetRequest request = new ItemsOnsaleGetRequest(); request.Fields = "num_iid"; request.PageSize = 200; request.PageNo = j; PageList <Item> product = client.ItemsOnsaleGet(request, session); for (int i = 0; i < product.Content.Count; i++) { try { //获取商品详细 ItemGetRequest requestItem = new ItemGetRequest(); requestItem.Fields = "desc"; requestItem.NumIid = product.Content[i].NumIid; Item item = client.ItemGet(requestItem, session); //判断是否增加过该图片 string newcontent = CreateDesc(item.Desc, istop); //更新宝贝描述 IDictionary <string, string> param = new Dictionary <string, string>(); param.Add("num_iid", product.Content[i].NumIid.ToString()); param.Add("desc", newcontent); string resultpro = Post("http://gw.api.taobao.com/router/rest", appkey, secret, "taobao.item.update", session, param); builder.Append("宝贝ID:" + product.Content[i].NumIid.ToString() + "\r\n" + resultpro + "\r\n"); } catch { } } if (product.Content.Count < 200) { break; } } File.WriteAllText(Server.MapPath("htmlLog/" + DateTime.Now.ToString("yyyyMMddHHmmss") + "-" + nick + ".txt"), builder.ToString()); Response.Write("<script>alert('同步成功!');window.location.href='html.aspx';</script>"); Response.End(); return; }
/// <summary> /// 数据绑定 /// </summary> private void BindData() { Cookie cookie = new Cookie(); string taobaoNick = cookie.getCookie("nick"); string session = cookie.getCookie("top_sessiongroupbuy"); //COOKIE过期判断 if (taobaoNick == "") { //SESSION超期 跳转到登录页 Response.Write("<script>parent.location.href='http://container.open.taobao.com/container?appkey=12287381'</script>");//12287381 Response.End(); } Rijndael_ encode = new Rijndael_("tetesoft"); taobaoNick = encode.Decrypt(taobaoNick); string sql = "SELECT * FROM TopTaobaoShopCat WHERE nick = '" + taobaoNick + "'"; DataTable dt = utils.ExecuteDataTable(sql); rptShopCat.DataSource = dt; rptShopCat.DataBind(); Repeater1.DataSource = dt; Repeater1.DataBind(); //获取用户店铺商品列表 TopXmlRestClient client = new TopXmlRestClient("http://gw.api.taobao.com/router/rest", "12287381", "d3486dac8198ef01000e7bd4504601a4"); ItemsOnsaleGetRequest request = new ItemsOnsaleGetRequest(); request.Fields = "num_iid,title,price,pic_url"; request.PageSize = 10; PageList <Item> product = new PageList <Item>(); try { product = client.ItemsOnsaleGet(request, session); } catch (Exception e) { if (e.Message == "27:Invalid session:Session not exist") { //SESSION超期 跳转到登录页 Response.Write("<script>parent.location.href='http://container.open.taobao.com/container?appkey=12287381'</script>"); Response.End(); } return; } rptItems.DataSource = product.Content; rptItems.DataBind(); //团购数据绑定 string sqlNew = "SELECT * FROM TopGroupBuy WHERE nick = '" + taobaoNick + "' AND isdelete = 0 ORDER BY id DESC"; DataTable dtNew = utils.ExecuteDataTable(sqlNew); rptAds.DataSource = dtNew; rptAds.DataBind(); }
private void BindData() { Common.Cookie cookie = new Common.Cookie(); string taobaoNick = cookie.getCookie("nick"); string session = cookie.getCookie("top_sessionblog"); //COOKIE过期判断 if (taobaoNick == "") { //SESSION超期 跳转到登录页 Response.Write("<script>parent.location.href='http://container.open.taobao.com/container?appkey=12159997'</script>"); Response.End(); } Rijndael_ encode = new Rijndael_("tetesoft"); taobaoNick = encode.Decrypt(taobaoNick); //获取用户店铺商品列表 TopXmlRestClient client = new TopXmlRestClient("http://gw.api.taobao.com/router/rest", "12159997", "614e40bfdb96e9063031d1a9e56fbed5"); ItemsOnsaleGetRequest request = new ItemsOnsaleGetRequest(); request.Fields = "num_iid,title,price,pic_url"; request.Q = tbKey.Text; request.PageSize = 5; request.OrderBy = "volume:desc"; PageList <Item> product = new PageList <Item>(); try { product = client.ItemsOnsaleGet(request, session); } catch (Exception e) { if (e.Message == "27:Invalid session:Session not exist") { //SESSION超期 跳转到登录页 Response.Write("<script>parent.location.href='http://container.open.taobao.com/container?appkey=12159997'</script>"); Response.End(); } return; } rptProduct.DataSource = product.Content; rptProduct.DataBind(); //数据绑定 string sqlNew = "SELECT TOP 10 * FROM TopIdea WHERE nick = '" + taobaoNick + "' ORDER BY id DESC"; DataTable dtNew = utils.ExecuteDataTable(sqlNew); rptAds.DataSource = dtNew; rptAds.DataBind(); //数据绑定 sqlNew = "SELECT * FROM TopBlogLink WHERE nick = '" + taobaoNick + "' ORDER BY id DESC"; dtNew = utils.ExecuteDataTable(sqlNew); rptLink.DataSource = dtNew; rptLink.DataBind(); }
/// <summary> /// 删除团购 /// </summary> /// <param name="gid">团购ID</param> private void DeleteTaobao(string gid) { //获取正在进行中的宝贝同步任务 string appkey = "12287381"; string secret = "d3486dac8198ef01000e7bd4504601a4"; string session = string.Empty; string id = string.Empty; string missionid = string.Empty; string html = string.Empty; TopXmlRestClient client = new TopXmlRestClient("http://gw.api.taobao.com/router/rest", appkey, secret); string sql = "SELECT t.*, s.sessiongroupbuy FROM TopMission t INNER JOIN TopTaobaoShop s ON s.nick = t.nick WHERE groupbuyid=" + gid; DataTable dt = utils.ExecuteDataTable(sql); for (int i = 0; i < dt.Rows.Count; i++) { id = dt.Rows[i]["groupbuyid"].ToString(); clearGroupbuy(id); session = dt.Rows[i]["sessiongroupbuy"].ToString(); missionid = dt.Rows[i]["id"].ToString(); html = ""; sql = "delete from TopWriteContent where groupbuyid = '" + dt.Rows[i]["groupbuyid"].ToString() + "'"; utils.ExecuteNonQuery(sql); if (dt.Rows[i]["itemid"] != null && dt.Rows[i]["itemid"].ToString() != "" && dt.Rows[i]["itemid"].ToString() != "NULL") { RecordMissionDetail(id, missionid, dt.Rows[i]["itemid"].ToString(), ""); } for (int j = 1; j <= 500; j++) { ItemsOnsaleGetRequest request = new ItemsOnsaleGetRequest(); request.Fields = "num_iid,title,price,pic_url"; request.PageSize = 200; request.PageNo = j; Common.Cookie cookie = new Common.Cookie(); string taobaoNick = dt.Rows[i]["nick"].ToString(); try { PageList <Item> product = client.ItemsOnsaleGet(request, session); for (int num = 0; num < product.Content.Count; num++) { RecordMissionDetail(id, missionid, product.Content[num].NumIid.ToString(), html); } if (product.Content.Count < 200) { break; } } catch (Exception e) { sql = "UPDATE TopMission SET fail = fail + 1,isok = -1 WHERE id = " + dt.Rows[i]["id"].ToString(); utils.ExecuteNonQuery(sql); break; } } } }
private void DeleteTaobaAutoOld(string session) { string appkey = "12132145"; string secret = "1fdd2aadd5e2ac2909db2967cbb71e7f"; //上传到宝贝描述 TopXmlRestClient client = new TopXmlRestClient("http://gw.api.taobao.com/router/rest", appkey, secret); for (int j = 1; j <= 3; j++) { ItemsOnsaleGetRequest request = new ItemsOnsaleGetRequest(); request.Fields = "num_iid"; request.PageSize = 200; request.PageNo = j; PageList <Item> product = client.ItemsOnsaleGet(request, session); for (int i = 0; i < product.Content.Count; i++) { try { //获取商品详细 ItemGetRequest requestItem = new ItemGetRequest(); requestItem.Fields = "desc"; requestItem.NumIid = product.Content[i].NumIid; Item item = client.ItemGet(requestItem, session); //判断是否增加过该图片 string newcontent = CreateDescDel(item.Desc); //Response.Write(newcontent); if (newcontent == "") { continue; } //更新宝贝描述 IDictionary <string, string> param = new Dictionary <string, string>(); param.Add("num_iid", product.Content[i].NumIid.ToString()); param.Add("desc", newcontent); string resultpro = Post("http://gw.api.taobao.com/router/rest", appkey, secret, "taobao.item.update", session, param); Response.Write(product.Content[i].NumIid.ToString() + "----" + resultpro + "<br>"); //return; //return; } catch (Exception e) { Response.Write(e.Message); } } //Response.Write(product.Content.Count.ToString() + "<br>"); if (product.Content.Count < 200) { break; } } Response.Write("<script>alert('清除成功!');</script>"); Response.End(); }
private string BindDataProduct() { string str = string.Empty; Common.Cookie cookie = new Common.Cookie(); string taobaoNick = cookie.getCookie("nick"); string session = cookie.getCookie("top_sessionblog"); //COOKIE过期判断 if (taobaoNick == "") { //SESSION超期 跳转到登录页 Response.Write("<script>parent.location.href='http://container.open.taobao.com/container?appkey=12159997'</script>"); Response.End(); } Rijndael_ encode = new Rijndael_("tetesoft"); taobaoNick = encode.Decrypt(taobaoNick); //获取用户店铺商品列表 TopXmlRestClient client = new TopXmlRestClient("http://gw.api.taobao.com/router/rest", "12159997", "614e40bfdb96e9063031d1a9e56fbed5"); ItemsOnsaleGetRequest request = new ItemsOnsaleGetRequest(); request.Fields = "num_iid,title,price,pic_url"; request.Q = key; request.PageSize = 5; request.OrderBy = "volume:desc"; PageList <Item> product = new PageList <Item>(); try { product = client.ItemsOnsaleGet(request, session); } catch (Exception e) { if (e.Message == "27:Invalid session:Session not exist") { //SESSION超期 跳转到登录页 Response.Write("<script>parent.location.href='http://container.open.taobao.com/container?appkey=12159997'</script>"); Response.End(); } return(""); } for (int i = 0; i < product.Content.Count; i++) { str += "<a href=\"http://item.taobao.com/item.htm?id=" + product.Content[i].NumIid.ToString() + "\" title=\"" + product.Content[i].Title + "\" target=\"_blank\"><img src=\"" + product.Content[i].PicUrl + "\" border=\"0\" /></a><br />"; str += "<a href=\"http://item.taobao.com/item.htm?id=" + product.Content[i].NumIid.ToString() + "\" title=\"" + product.Content[i].Title + "\" target=\"_blank\">" + product.Content[i].Title + "</a> 售价:" + product.Content[i].Price + "元<br><br>"; } return(str); }
/// <summary> /// 数据绑定 /// </summary> private void BindData() { Cookie cookie = new Cookie(); string taobaoNick = cookie.getCookie("nick"); string session = cookie.getCookie("top_session"); //COOKIE过期判断 if (taobaoNick == "") { //SESSION超期 跳转到登录页 Response.Write("<script>parent.location.href='http://container.open.taobao.com/container?appkey=12132145'</script>"); Response.End(); } Rijndael_ encode = new Rijndael_("tetesoft"); taobaoNick = encode.Decrypt(taobaoNick); string sql = "SELECT * FROM TopTaobaoShopCat WHERE nick = '" + taobaoNick + "'"; DataTable dt = utils.ExecuteDataTable(sql); rptShopCat.DataSource = dt; rptShopCat.DataBind(); Repeater1.DataSource = dt; Repeater1.DataBind(); //获取用户店铺商品列表 TopXmlRestClient client = new TopXmlRestClient("http://gw.api.taobao.com/router/rest", "12132145", "1fdd2aadd5e2ac2909db2967cbb71e7f"); ItemsOnsaleGetRequest request = new ItemsOnsaleGetRequest(); request.Fields = "num_iid,title,price,pic_url"; request.PageSize = 10; PageList <Item> product = new PageList <Item>(); try { product = client.ItemsOnsaleGet(request, session); } catch (Exception e) { if (e.Message == "27:Invalid session:Session not exist") { //SESSION超期 跳转到登录页 Response.Write("<script>parent.location.href='http://container.open.taobao.com/container?appkey=12132145'</script>"); Response.End(); } return; } rptItems.DataSource = product.Content; rptItems.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { Cookie cookie = new Cookie(); string taobaoNick = cookie.getCookie("nick"); string session = cookie.getCookie("top_sessionblog"); //COOKIE过期判断 if (taobaoNick == "") { //SESSION超期 跳转到登录页 Response.Write("<script>parent.location.href='http://container.open.taobao.com/container?appkey=12159997'</script>"); Response.End(); } Rijndael_ encode = new Rijndael_("tetesoft"); taobaoNick = encode.Decrypt(taobaoNick); string sql = "SELECT * FROM TopTaobaoShopCat WHERE nick = '" + taobaoNick + "'"; DataTable dt = utils.ExecuteDataTable(sql); Repeater1.DataSource = dt; Repeater1.DataBind(); //获取用户店铺商品列表 TopXmlRestClient client = new TopXmlRestClient("http://gw.api.taobao.com/router/rest", "12159997", "614e40bfdb96e9063031d1a9e56fbed5"); ItemsOnsaleGetRequest request = new ItemsOnsaleGetRequest(); request.Fields = "num_iid,title,price,pic_url"; request.PageSize = 10; PageList <Item> product = new PageList <Item>(); try { product = client.ItemsOnsaleGet(request, session); } catch (Exception ex) { if (ex.Message == "27:Invalid session:Session not exist") { //SESSION超期 跳转到登录页 Response.Write("<script>parent.location.href='http://container.open.taobao.com/container?appkey=12159997'</script>"); Response.End(); } return; } rptItems.DataSource = product.Content; rptItems.DataBind(); }
private void BindData() { //获取用户信息 Cookie cookie = new Cookie(); string taobaoNick = cookie.getCookie("nick"); string session = cookie.getCookie("top_session"); Rijndael_ encode = new Rijndael_("tetesoft"); taobaoNick = encode.Decrypt(taobaoNick); //判断是否删除 string act = utils.NewRequest("act", utils.RequestType.QueryString); string id = utils.NewRequest("id", utils.RequestType.QueryString); if (id != "" && !utils.IsInt32(id)) { Response.Write("非法参数"); Response.End(); return; } if (act == "del") { string sql = "DELETE FROM TopIdea WHERE nick = '" + taobaoNick + "' AND id = " + id; utils.ExecuteNonQuery(sql); Response.Redirect("idealist.aspx"); return; } else if (act == "update") { //如果是自动更新模式,需要更新店铺商品数据 string sql = "SELECT shopcategoryid,query,nick,showtype FROM TopIdea WHERE nick = '" + taobaoNick + "' AND id = " + id; DataTable dt1 = utils.ExecuteDataTable(sql); string shopcat = string.Empty; string query = string.Empty; if (dt1.Rows[0]["showtype"].ToString() == "0") { //更新下架商品数据 shopcat = dt1.Rows[0][0].ToString(); query = dt1.Rows[0][1].ToString(); taobaoNick = dt1.Rows[0][2].ToString(); //获取新商品列表 TopXmlRestClient client = new TopXmlRestClient("http://gw.api.taobao.com/router/rest", "12132145", "1fdd2aadd5e2ac2909db2967cbb71e7f"); ItemsOnsaleGetRequest request = new ItemsOnsaleGetRequest(); request.Fields = "num_iid,title,price,pic_url"; request.PageSize = 12; request.OrderBy = "list_time:desc"; request.OrderBy = "volume:desc"; if (shopcat != "0") { request.SellerCids = shopcat; } request.Q = query; //清理关联商品 sql = "DELETE FROM TopIdeaProduct WHERE ideaid = " + id; utils.ExecuteNonQuery(sql); //未登录用户不能获取小二下架或删除的商品-错误过滤,原因未知 try { PageList <Item> product = client.ItemsOnsaleGet(request, session); for (int i = 0; i < product.Content.Count; i++) { sql = "INSERT INTO TopIdeaProduct (" + "itemid, " + "itemname, " + "itemprice, " + "itempicurl, " + "ideaid " + " ) VALUES ( " + " '" + product.Content[i].NumIid + "', " + " '" + product.Content[i].Title + "', " + " '" + product.Content[i].Price + "', " + " '" + product.Content[i].PicUrl + "', " + " '" + id + "' " + ") "; utils.ExecuteNonQuery(sql); } } catch { } } //清理广告缓存 CacheManager testcaching1 = CacheFactory.GetCacheManager(); if (testcaching1.Contains("cache_1_" + id)) { testcaching1.Remove("cache_1_" + id); } //更新广告图片 string folderPath = Server.MapPath("\\show\\folder\\" + MD5(taobaoNick) + "\\result_" + id + ".jpg"); if (File.Exists(folderPath)) { File.Delete(folderPath); } //Response.Write("推广更新成功!!<br> <a href='../../show/plist.aspx?id=" + id + "' target='_blank'>查看更新过的广告</a> <br> <a href='idealist.aspx'>返回</a>"); Response.Redirect("success.aspx?id=" + id); return; } DataTable dt = utils.ExecuteDataTable("SELECT * FROM TopIdea WHERE nick = '" + taobaoNick + "' ORDER BY id DESC"); rptIdeaList.DataSource = dt; rptIdeaList.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { Cookie cookie = new Cookie(); string taobaoNick = cookie.getCookie("nick"); string session = cookie.getCookie("top_sessionblog"); Rijndael_ encode = new Rijndael_("tetesoft"); taobaoNick = encode.Decrypt(taobaoNick); //获取参数 string q = utils.NewRequest("query", utils.RequestType.QueryString); string page = utils.NewRequest("p", utils.RequestType.QueryString); if (page == "") { page = "1"; } string catid = utils.NewRequest("catid", utils.RequestType.QueryString); string isradio = utils.NewRequest("isradio", utils.RequestType.QueryString); string act = utils.NewRequest("act", utils.RequestType.QueryString); TopXmlRestClient client = new TopXmlRestClient("http://gw.api.taobao.com/router/rest", "12159997", "614e40bfdb96e9063031d1a9e56fbed5"); int pageSizeNow = 15; if (act == "get") { //获取用户店铺商品列表 ItemsOnsaleGetRequest request = new ItemsOnsaleGetRequest(); request.Fields = "num_iid,title,price,pic_url"; request.PageSize = pageSizeNow; request.PageNo = int.Parse(page); request.Q = q; if (catid != "0") { request.SellerCids = catid; } PageList <Item> product = client.ItemsOnsaleGet(request, session); //输出页面HTML for (int i = 0; i < product.Content.Count; i++) { if (isradio == "1") { Response.Write("<input type='radio' name='items' id='item_" + product.Content[i].NumIid + "' title='" + product.Content[i].Title + "' value='" + product.Content[i].NumIid + "' onclick=\"InitArea(this)\"><label onMouseOver=\"javascript:ddrivetip('<img src=" + product.Content[i].PicUrl + "_80x80.jpg>','#ffffff',100)\" onMouseOut=\"hideddrivetip()\" for='item_" + product.Content[i].NumIid + "'>" + product.Content[i].Title + "</label><br>"); } else { Response.Write("<input type='checkbox' name='items' id='item_" + product.Content[i].NumIid + "' title='" + product.Content[i].Title + "' value='" + product.Content[i].NumIid + "' onclick=\"InitArea(this)\"><label onMouseOver=\"javascript:ddrivetip('<img src=" + product.Content[i].PicUrl + "_80x80.jpg>','#ffffff',100)\" onMouseOut=\"hideddrivetip()\" for='item_" + product.Content[i].NumIid + "'>" + product.Content[i].Title + "</label><br>"); } } Response.Write("<br>"); long totalPage = (product.TotalResults % pageSizeNow == 0) ? (product.TotalResults / pageSizeNow) : (product.TotalResults / pageSizeNow + 1); //输出分页HTML for (int i = 1; i <= totalPage; i++) { if (page == i.ToString()) { Response.Write(i.ToString() + " "); } else { Response.Write("<a href=\"javascript:spreadStat(" + i.ToString() + ")\">[" + i.ToString() + "]</a> "); } } } else if (act == "getCat") { //记录店铺分类信息 SellercatsListGetRequest request1 = new SellercatsListGetRequest(); request1.Fields = "cid,parent_cid,name,is_parent"; request1.Nick = taobaoNick; PageList <SellerCat> cat = client.SellercatsListGet(request1); //清除老分类 string sql = "DELETE FROM TopTaobaoShopCat WHERE nick = '" + taobaoNick + "'"; utils.ExecuteNonQuery(sql); //插入新分类 for (int i = 0; i < cat.Content.Count; i++) { sql = "INSERT INTO TopTaobaoShopCat (" + "cid, " + "parent_cid, " + "name, " + "pic_url, " + "sort_order, " + "created, " + "nick, " + "modified " + " ) VALUES ( " + " '" + cat.Content[i].Cid + "', " + " '" + cat.Content[i].ParentCid + "', " + " '" + cat.Content[i].Name + "', " + " '" + cat.Content[i].PicUrl + "', " + " '" + cat.Content[i].SortOrder + "', " + " '" + cat.Content[i].Created + "', " + " '" + taobaoNick + "', " + " '" + cat.Content[i].Modified + "' " + ") "; utils.ExecuteNonQuery(sql); } //输出页面HTML Response.Write("<select id=\"shopcat\" name=\"shopcat\"><option value=\"0\"></option>"); for (int i = 0; i < cat.Content.Count; i++) { Response.Write("<option value='" + cat.Content[i].Cid + "'>" + cat.Content[i].Name + "</option>"); } Response.Write("</select>"); } else if (act == "getResultStr") { string items = utils.NewRequest("ids", utils.RequestType.QueryString); string[] arr = items.Split(','); List <Item> itemList = new List <Item>(); //标志 int flag = 1; if (arr.Length == 1) { flag = 0; } for (int i = flag; i < arr.Length; i++) { ItemGetRequest request = new ItemGetRequest(); request.Fields = "num_iid,title,price,pic_url"; request.NumIid = long.Parse(arr[i]); Item product = client.ItemGet(request); itemList.Add(product); } string str = string.Empty; //根据不同样式显示不同的字符串 string style = utils.NewRequest("style", utils.RequestType.QueryString); string sqlNew = "SELECT sid FROM TopTaobaoShop WHERE nick = '" + taobaoNick + "'"; DataTable dtNew = utils.ExecuteDataTable(sqlNew); string nickid = string.Empty; if (dtNew.Rows.Count != 0) { nickid = "http://shop" + dtNew.Rows[0]["sid"].ToString() + ".taobao.com/"; } else { nickid = "http://www.taobao.com/"; } if (isradio == "1") { //团购需要的商品数据 for (int i = 0; i < itemList.Count; i++) { str = "<A href=\"http://item.taobao.com/item.htm?id=" + itemList[i].NumIid.ToString() + "\" target=\"_blank\"><IMG src=\"" + itemList[i].PicUrl + "_160x160.jpg\" border=0 /></A><br>" + itemList[i].Title + "<br>" + itemList[i].Price + "<input type=\"hidden\" id=\"productid\" name=\"productid\" value=\"" + itemList[i].NumIid.ToString() + "\"><input type=\"hidden\" id=\"price\" name=\"price\" value=\"" + itemList[i].Price.ToString() + "\">"; } } else { if (style == "1") { str += "<table background=\"http://www.7fshop.com/top/show1/4.gif\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" height=\"30\" style=\"border-right: #999999 1px solid; border-top: #999999 1px solid;border-left: #999999 1px solid; border-bottom: #999999 1px solid\" width=\"580\"><tr><td> <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\"><tr><td align=\"left\"><table align=\"left\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" height=\"30\"><tr><td width=\"10\"></td><td background=\"http://www.7fshop.com/top/show1/1.gif\" width=\"24\"></td><td background=\"http://www.7fshop.com/top/show1/2.gif\"><font color=\"white\" style=\"font-size: 13px\"><strong>掌柜推荐商品</strong></font></td><td><img src=\"http://www.7fshop.com/top/show1/3.gif\" /></td></tr></table></td><td align=\"right\"></td></tr></table></td></tr></table> <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"border-right: #999999 1px solid;border-top: #999999 1px solid; overflow: hidden; border-left: #999999 1px solid;border-bottom: #999999 1px solid\" width=\"578\"><tr><td valign=\"top\"><TABLE cellSpacing=0 cellPadding=0 width=578 border=0><TBODY><TR><TD align=\"middle\"><TABLE cellSpacing=8 cellPadding=0 align=center border=0><TBODY><TR>"; for (int i = 0; i < itemList.Count; i++) { str += "<TD vAlign=top align=\"middle\" width=175 bgColor=white><TABLE cellSpacing=0 cellPadding=0 align=center border=0><TBODY><TR><TD vAlign=top align=\"middle\" width=175 bgColor=white><TABLE cellSpacing=0 cellPadding=0 align=center border=0><TBODY><TR><TD align=\"middle\"><DIV style=\"BORDER-RIGHT: #cccccc 1px solid; BORDER-TOP: #cccccc 1px solid; MARGIN-TOP: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 160px; BORDER-BOTTOM: #cccccc 1px solid; HEIGHT: 160px\"><DIV style=\"OVERFLOW: hidden; WIDTH: 160px; HEIGHT: 160px\"><A href=\"http://item.taobao.com/item.htm?id=" + itemList[i].NumIid.ToString() + "\" target=\"_blank\"><IMG src=\"" + itemList[i].PicUrl + "_160x160.jpg\" border=0 /></A></DIV></DIV></TD></TR><TR><TD align=\"middle\"><DIV style=\"PADDING-RIGHT: 4px; PADDING-LEFT: 4px; FONT-SIZE: 12px; PADDING-BOTTOM: 4px; PADDING-TOP: 4px\"><A style=\"FONT-SIZE: 12px; COLOR: #3f3f3f; TEXT-DECORATION: none\" href=\"http://item.taobao.com/item.htm?id=" + itemList[i].NumIid.ToString() + "\" target=\"_blank\">" + itemList[i].Title + "</A><BR /><FONT style=\"COLOR: #fe596a\"><B>¥ " + itemList[i].Price + "元</B></FONT> </DIV><A href=\"http://item.taobao.com/item.htm?id=" + itemList[i].NumIid.ToString() + "\" target=\"_blank\"><IMG src=\"http://www.7fshop.com/top/show1/buy1.gif\" border=0 /></A> <DIV></DIV></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></TD>"; if ((i + 1) % 3 == 0) { str += "</tr><tr>"; } } str += "</TR></TBODY></TABLE></td></tr><tr><td align=\"right\" height=\"24\" style=\"border-bottom: #999999 1px solid\" valign=\"center\"><a href=\"" + nickid + "\" style=\"text-decoration: none\" target=\"_blank\"><font style=\"font-size: 13px; color: #ff6600\"><strong>更多详情请见 " + nickid + "</strong> </font></a></td></tr></table></td></tr></table>"; } else { for (int i = 0; i < itemList.Count; i++) { str += "<a href=\"http://item.taobao.com/item.htm?id=" + itemList[i].NumIid.ToString() + "\" target=\"_blank\"><img src=\"" + itemList[i].PicUrl + "\" border=\"0\" /></a><br />"; str += "<a href=\"http://item.taobao.com/item.htm?id=" + itemList[i].NumIid.ToString() + "\" target=\"_blank\">" + itemList[i].Title + "</a> 售价:" + itemList[i].Price + "元<br><br>"; } } } Response.Write(str); } }
private void Act(string uid, string taobaonick) { string sql = "SELECT * FROM TeteShop WHERE nick = '" + uid + "'"; DataTable dt = utils.ExecuteDataTable(sql); if (dt.Rows.Count != 0) { //同步分类数据 TopXmlRestClient client = new TopXmlRestClient("http://gw.api.taobao.com/router/rest", dt.Rows[0]["appkey"].ToString(), dt.Rows[0]["appsecret"].ToString()); SellercatsListGetRequest request1 = new SellercatsListGetRequest(); request1.Fields = "cid,parent_cid,name,is_parent,"; request1.Nick = taobaonick; PageList <SellerCat> cat = client.SellercatsListGet(request1); //清除之前的老分类 //sql = "DELETE FROM TeteShopCategory WHERE nick = '" + uid + "'"; //utils.ExecuteNonQuery(sql); for (int i = 0; i < cat.Content.Count; i++) { //过滤其他软件增加的分类 if (cat.Content[i].Name.IndexOf("统计") != -1 || cat.Content[i].Name.IndexOf("多买多优惠") != -1) { continue; } //如果已经存在则不处理 sql = "SELECT COUNT(*) FROM TeteShopCategory WHERE cateid='" + cat.Content[i].Cid + "'"; string count2 = utils.ExecuteString(sql); if (count2 == "0") { sql = "INSERT INTO TeteShopCategory (" + "cateid, " + "catename, " + "oldname, " + "parentid, " + "nick " + " ) VALUES ( " + " '" + cat.Content[i].Cid + "', " + " '" + cat.Content[i].Name + "', " + " '" + cat.Content[i].Name + "', " + " '" + cat.Content[i].ParentCid + "', " + " '" + uid + "' " + ") "; //Response.Write(sql + "<br>"); utils.ExecuteNonQuery(sql); } if (cat.Content[i].ParentCid == 0) { sql = "SELECT COUNT(*) FROM TeteShopAds WHERE nick = '" + uid + "' AND typ = '" + cat.Content[i].Cid + "'"; string count1 = utils.ExecuteString(sql); if (count1 == "0") { sql = "INSERT INTO TeteShopAds (" + "typ, " + "url, " + "orderid, " + "nick " + " ) VALUES ( " + " '" + cat.Content[i].Cid + "', " + " 'http://langbow.tmall.com', " + " '1', " + " '" + uid + "' " + ") "; utils.ExecuteNonQuery(sql); sql = "INSERT INTO TeteShopAds (" + "typ, " + "url, " + "orderid, " + "nick " + " ) VALUES ( " + " '" + cat.Content[i].Cid + "', " + " 'http://langbow.tmall.com', " + " '2', " + " '" + uid + "' " + ") "; utils.ExecuteNonQuery(sql); sql = "INSERT INTO TeteShopAds (" + "typ, " + "url, " + "orderid, " + "nick " + " ) VALUES ( " + " '" + cat.Content[i].Cid + "', " + " 'http://langbow.tmall.com', " + " '3', " + " '" + uid + "' " + ") "; utils.ExecuteNonQuery(sql); } } } //清除之前的老商品数据 //sql = "DELETE FROM TeteShopItem WHERE nick = '" + uid + "'"; //utils.ExecuteNonQuery(sql); //同步商品数据 for (int j = 1; j <= 500; j++) { ItemsOnsaleGetRequest request = new ItemsOnsaleGetRequest(); request.Fields = "num_iid,title,price,pic_url,seller_cids"; request.PageSize = 200; request.PageNo = j; PageList <Item> product = client.ItemsOnsaleGet(request, dt.Rows[0]["session"].ToString()); for (int i = 0; i < product.Content.Count; i++) { //Response.Write(i.ToString() + "--" + product.Content[i].Title + "<br>"); sql = "SELECT COUNT(*) FROM TeteShopItem WHERE nick = '" + uid + "' AND itemid = '" + product.Content[i].NumIid + "'"; string count3 = utils.ExecuteString(sql); //Response.Write(count3 + "<br>"); if (count3 == "0") { sql = "INSERT INTO TeteShopItem (" + "cateid, " + "itemid, " + "itemname, " + "picurl, " + "linkurl, " + "price, " + "nick " + " ) VALUES ( " + " '" + product.Content[i].SellerCids + "', " + " '" + product.Content[i].NumIid + "', " + " '" + product.Content[i].Title + "', " + " '" + product.Content[i].PicUrl + "', " + " 'http://a.m.taobao.com/i" + product.Content[i].NumIid + ".htm', " + " '" + product.Content[i].Price + "', " + " '" + uid + "' " + ") "; utils.ExecuteNonQuery(sql); Response.Write(sql + "<br>"); //更新分类数量 sql = "UPDATE TeteShopCategory SET catecount = catecount + 1 WHERE nick = '" + uid + "' AND CHARINDEX(cateid, '" + product.Content[i].SellerCids + "') > 0"; Response.Write(sql + "<br>"); utils.ExecuteNonQuery(sql); } else { sql = "UPDATE TeteShopItem SET cateid = '" + product.Content[i].SellerCids + "' WHERE itemid = '" + product.Content[i].NumIid + "'"; Response.Write(sql + "<br>"); utils.ExecuteNonQuery(sql); } } //Response.Write(product.Content.Count + "<br>"); if (product.Content.Count < 200) { break; } } //更新大类商品数量 sql = "SELECT * FROM TeteShopCategory WHERE nick = '" + uid + "' AND parentid <> 0"; DataTable dtCate = utils.ExecuteDataTable(sql); for (int k = 0; k < dtCate.Rows.Count; k++) { //Response.Write(sql + "<br>"); sql = "UPDATE TeteShopCategory SET catecount = catecount + " + dtCate.Rows[k]["catecount"].ToString() + " WHERE nick = '" + uid + "' AND cateid = " + dtCate.Rows[k]["parentid"].ToString(); utils.ExecuteNonQuery(sql); } } }
protected void Button2_Click(object sender, EventArgs e) { nick = this.TextBox1.Text; session = this.TextBox2.Text; string appkey = "12132145"; string secret = "1fdd2aadd5e2ac2909db2967cbb71e7f"; //上传到宝贝描述 TopXmlRestClient client = new TopXmlRestClient("http://gw.api.taobao.com/router/rest", appkey, secret); for (int j = 1; j <= 500; j++) { ItemsOnsaleGetRequest request = new ItemsOnsaleGetRequest(); request.Fields = "num_iid"; request.PageSize = 200; request.PageNo = j; PageList <Item> product = client.ItemsOnsaleGet(request, session); for (int i = 0; i < product.Content.Count; i++) { try { //获取商品详细 ItemGetRequest requestItem = new ItemGetRequest(); requestItem.Fields = "desc"; requestItem.NumIid = product.Content[i].NumIid; Item item = client.ItemGet(requestItem, session); //判断是否增加过该图片 string newcontent = CreateDescDelHaoping(item.Desc); //if (product.Content[i].NumIid.ToString() == "10002247109") //{ // Response.Write(item.Desc); // Response.Write("**************************************************"); // Response.Write(newcontent); // return; //} if (newcontent == "") { continue; } //更新宝贝描述 IDictionary <string, string> param = new Dictionary <string, string>(); param.Add("num_iid", product.Content[i].NumIid.ToString()); param.Add("desc", newcontent); string resultpro = Post("http://gw.api.taobao.com/router/rest", appkey, secret, "taobao.item.update", session, param); } catch { } } if (product.Content.Count < 200) { break; } } Response.Write("<script>alert('清除成功!');</script>"); Response.End(); }
protected void Page_Load(object sender, EventArgs e) { Cookie cookie = new Cookie(); string taobaoNick = cookie.getCookie("nick"); string session = cookie.getCookie("top_sessiongroupbuy"); Rijndael_ encode = new Rijndael_("tetesoft"); taobaoNick = encode.Decrypt(taobaoNick); //获取参数 string q = utils.NewRequest("query", utils.RequestType.QueryString); string page = utils.NewRequest("p", utils.RequestType.QueryString); if (page == "") { page = "1"; } string catid = utils.NewRequest("catid", utils.RequestType.QueryString); string isradio = utils.NewRequest("isradio", utils.RequestType.QueryString); string act = utils.NewRequest("act", utils.RequestType.QueryString); TopXmlRestClient client = new TopXmlRestClient("http://gw.api.taobao.com/router/rest", "12287381", "d3486dac8198ef01000e7bd4504601a4"); int pageSizeNow = 15; if (act == "get") { //获取用户店铺商品列表 ItemsOnsaleGetRequest request = new ItemsOnsaleGetRequest(); request.Fields = "num_iid,title,price,pic_url"; request.PageSize = pageSizeNow; request.PageNo = int.Parse(page); request.Q = q; if (catid != "0") { request.SellerCids = catid; } PageList <Item> product = client.ItemsOnsaleGet(request, session); //输出页面HTML for (int i = 0; i < product.Content.Count; i++) { string tempstr = "未参加促销活动"; string sql = "select * from Tete_activitylist where Status<>4 and Status<>3 and Status<>2 and ProductID=" + product.Content[i].NumIid.ToString().Trim(); DataTable dt = utils.ExecuteDataTable(sql); if (dt != null && dt.Rows.Count > 0) { tempstr = " <font color=green> 已参加促销活动</font><br/><a href=\"javascript:delItemAction(" + product.Content[i].NumIid.ToString().Trim() + "," + dt.Rows[0]["ActivityID"].ToString() + ")\">删除此促销活动</a><div id='del" + product.Content[i].NumIid.ToString().Trim() + "'></div>"; } string str = " <table width=\"800px;\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" style=\"margin:0px; padding:0px\"> <tr><td style=\" width:100px;\"><img width=50px src=" + product.Content[i].PicUrl + "_80x80.jpg></td><td style=\" width:300px;\"><a href=\"http://item.taobao.com/item.htm?id=" + product.Content[i].NumIid.ToString() + "\" target=\"_blank\">" + product.Content[i].Title + "</a></td><td style=\" width:150px;\">" + product.Content[i].Price.ToString() + "</td><td style=\" width:250px;\">" + tempstr + "</td></tr> </table><hr/>"; Response.Write(str); } Response.Write("<br>"); long totalPage = (product.TotalResults % pageSizeNow == 0) ? (product.TotalResults / pageSizeNow) : (product.TotalResults / pageSizeNow + 1); //输出分页HTML for (int i = 1; i <= totalPage; i++) { if (page == i.ToString()) { Response.Write(i.ToString() + " "); } else { Response.Write("<a href=\"javascript:spreadStat(" + i.ToString() + ")\">[" + i.ToString() + "]</a> "); } } Response.End(); } else if (act == "getCat") { //记录店铺分类信息 SellercatsListGetRequest request1 = new SellercatsListGetRequest(); request1.Fields = "cid,parent_cid,name,is_parent"; request1.Nick = taobaoNick; PageList <SellerCat> cat = client.SellercatsListGet(request1); //清除老分类 string sql = "DELETE FROM TopTaobaoShopCat WHERE nick = '" + taobaoNick + "'"; utils.ExecuteNonQuery(sql); //插入新分类 for (int i = 0; i < cat.Content.Count; i++) { sql = "INSERT INTO TopTaobaoShopCat (" + "cid, " + "parent_cid, " + "name, " + "pic_url, " + "sort_order, " + "created, " + "nick, " + "modified " + " ) VALUES ( " + " '" + cat.Content[i].Cid + "', " + " '" + cat.Content[i].ParentCid + "', " + " '" + cat.Content[i].Name + "', " + " '" + cat.Content[i].PicUrl + "', " + " '" + cat.Content[i].SortOrder + "', " + " '" + cat.Content[i].Created + "', " + " '" + taobaoNick + "', " + " '" + cat.Content[i].Modified + "' " + ") "; utils.ExecuteNonQuery(sql); } //输出页面HTML Response.Write("<select id=\"shopcat\" name=\"shopcat\"><option value=\"0\"></option>"); for (int i = 0; i < cat.Content.Count; i++) { Response.Write("<option value='" + cat.Content[i].Cid + "'>" + cat.Content[i].Name + "</option>"); } Response.Write("</select>"); Response.End(); } else if (act == "getResultStr") { string items = utils.NewRequest("ids", utils.RequestType.QueryString); string[] arr = items.Split(','); List <Item> itemList = new List <Item>(); //标志 int flag = 1; if (arr.Length == 1) { flag = 0; } for (int i = flag; i < arr.Length; i++) { ItemGetRequest request = new ItemGetRequest(); request.Fields = "num_iid,title,price,pic_url"; request.NumIid = long.Parse(arr[i]); Item product = client.ItemGet(request); itemList.Add(product); } string str = string.Empty; //根据不同样式显示不同的字符串 string style = utils.NewRequest("style", utils.RequestType.QueryString); string sqlNew = "SELECT sid FROM TopTaobaoShop WHERE nick = '" + taobaoNick + "'"; DataTable dtNew = utils.ExecuteDataTable(sqlNew); string nickid = string.Empty; if (dtNew.Rows.Count != 0) { nickid = "http://shop" + dtNew.Rows[0]["sid"].ToString() + ".taobao.com/"; } else { nickid = "http://www.taobao.com/"; } for (int i = 0; i < itemList.Count; i++) { str += "<div id='div" + itemList[i].NumIid.ToString() + "' width=\"800px\"><table width=\"800px\"><tr width=\"800px\"><td width=\"90px\"><a href=\"http://item.taobao.com/item.htm?id=" + itemList[i].NumIid.ToString() + "\" target=\"_blank\"><img src=\"" + itemList[i].PicUrl + "_80x80.jpg\" border=\"0\" /></a></td>"; str += "<td width=\"140px\"><a href=\"http://item.taobao.com/item.htm?id=" + itemList[i].NumIid.ToString() + "\" target=\"_blank\">" + itemList[i].Title + "</a> </td><td width=\"200px\"><input type=\"text\" size=\"27\" id=\"groupbuylistname" + itemList[i].NumIid.ToString() + "\" name=\"groupbuylistname\" maxlength=\"30\" value=\"\" /></td><td width=\"100px\"> " + itemList[i].Price + "元 <input type=\"hidden\" id=\"productid" + itemList[i].NumIid.ToString() + "\" name=\"productid\" value=\"" + itemList[i].NumIid.ToString() + "\"><input type=\"hidden\" id=\"price" + itemList[i].NumIid.ToString() + "\" name=\"price\" value=\"" + itemList[i].Price.ToString() + "\"></td><td width=\"100px\"> <input type=\"text\" id=\"zhekou" + itemList[i].NumIid.ToString() + "\" size=\"10\" name=\"zhekou\" onblur=\"setzekou(this)\" /> 元 <br /> 打<input type=\"text\" size=\"8\" id=\"zhekou1" + itemList[i].NumIid.ToString() + "\" name=\"zhekou1\" onblur=\"setprice(this)\"/> 折 <br />限购:<select id=\"xiangou" + itemList[i].NumIid.ToString() + "\" name=\"xiangou\"> <OPTION selected value=0>否</OPTION> <OPTION value=1>是</OPTION> </select> <span id=\"errmsg" + i + "\" style=\"color:Red\"></span> </td><td width=\"90px\"> <input type=\"text\" size=\"8\" name=\"rcount\" value=\"300\" /> </td><td width=\"80px\"><a onclick=\"deleteDIV('del1" + itemList[i].NumIid.ToString() + "')\" style=\"cursor:hand;\">删除</a></td></tr></table><input id=\"del1" + itemList[i].NumIid.ToString() + "\" name=\"del\" value='' type=\"hidden\" ></div>"; } Response.Write(str); Response.End(); } else if (act == "getactivityitem") { //获取用户店铺商品列表 ItemsOnsaleGetRequest request = new ItemsOnsaleGetRequest(); request.Fields = "num_iid,title,price,pic_url"; request.PageSize = pageSizeNow; request.PageNo = int.Parse(page); request.Q = q; if (catid != "0") { request.SellerCids = catid; } PageList <Item> product = client.ItemsOnsaleGet(request, session); string str = string.Empty; string discountType = string.Empty; //促销方式(打折:DISCOUNT,减价:PRICE) string discountValue = string.Empty; //促销力度(7折限制) string Rcount = "300"; //已参团人数(只在对设置团购模板时有用) string newPrice2 = string.Empty; //促销价 string price2 = string.Empty; //商品价格 string itemtype2 = string.Empty; string itemtypevalue2 = string.Empty; string yhCount = string.Empty; string hdstr = string.Empty; string aid = Request.QueryString["aid"].ToString(); string yuanitemtype = ""; string yuandiscountType = ""; string yuandiscountValue = ""; string yuandecreaseNum = ""; string sql2 = "select * from tete_activity where id=" + aid; DataTable dt33 = utils.ExecuteDataTable(sql2); if (dt33 != null) { yuanitemtype = dt33.Rows[0]["itemType"].ToString(); yuandiscountType = dt33.Rows[0]["discountType"].ToString(); yuandiscountValue = dt33.Rows[0]["discountValue"].ToString(); yuandecreaseNum = dt33.Rows[0]["decreaseNum"].ToString(); } //输出页面HTML for (int i = 0; i < product.Content.Count; i++) { //先判断该商品是否已经参团(状态为:进行中和暂停中) string sql = "SELECT * FROM tete_activitylist where ProductID=" + product.Content[i].NumIid.ToString() + " and (Status=3 or Status=1 or Status=0) and nick='" + taobaoNick + "'"; DataTable dtNew2 = utils.ExecuteDataTable(sql); // 取得促销价格 if (dtNew2 != null && dtNew2.Rows.Count > 0) { Rcount = dtNew2.Rows[0]["Rcount"].ToString(); discountValue = dtNew2.Rows[0]["discountValue"].ToString(); discountType = dtNew2.Rows[0]["discountType"].ToString(); price2 = product.Content[i].Price; hdstr = "<div id=\"del" + product.Content[i].NumIid.ToString() + "\">已参加活动:" + dtNew2.Rows[0]["name"].ToString() + " <br><a href=\"javascript:delItemAction(" + product.Content[i].NumIid.ToString() + ")\">删除此促销活动</a></div> <div style=\"display:none\" id=\"add" + product.Content[i].NumIid.ToString() + "\"><a href=\"javascript:addItemAction(" + product.Content[i].NumIid.ToString() + ")\">参加活动</a></div> "; if (discountType.Trim() == "DISCOUNT") { itemtype2 = "<select onchange=\"changeSelect(" + product.Content[i].NumIid.ToString() + ")\" id=\"discountType" + product.Content[i].NumIid.ToString() + "\" name=\"discountType\" > <option selected=\"selected\" value=\"DISCOUNT\">打折</option><option value=\"PRICE\">减价</option> </select>"; itemtypevalue2 = " <div id=\"zheDiv" + product.Content[i].NumIid.ToString() + "\" style=\"display: block;\"><input type=\"text\" onkeyup=\"blurValue(" + product.Content[i].NumIid.ToString() + ")\" id=\"changeZhe" + product.Content[i].NumIid.ToString() + "\" value=\"" + discountValue + "\" name=\"discountValue\" style=\"width:30px\">折</div><div style=\"display: none;\" id=\"jianDiv" + product.Content[i].NumIid.ToString() + "\">减<input type=\"text\" onkeyup=\"blurValue(" + product.Content[i].NumIid.ToString() + ")\" id=\"changeJian" + product.Content[i].NumIid.ToString() + "\" name=\"discountValue\" style=\"width:30px\" >元</div>"; if (discountValue != "") { newPrice2 = (decimal.Parse(price2) * decimal.Parse(discountValue) * 0.1m).ToString(); } else { newPrice2 = price2; } yhCount = " <span id=\"duojian" + product.Content[i].NumIid.ToString() + "\" style=\"display: inline;\">多件<input type=\"hidden\" id=\"decreaseNumHiden" + product.Content[i].NumIid.ToString() + "\" value=\"0\" name=\"decreaseNumHiden\"></span> <span style=\"display: none;\" id=\"yijian" + product.Content[i].NumIid.ToString() + "\"><select onchange=\"decreaseNumChange(" + product.Content[i].NumIid.ToString() + ")\" id=\"decreaseNumSel" + product.Content[i].NumIid.ToString() + "\" name=\"decreaseNumSel\"> <option selected=\"selected\" value=\"0\">多件</option> <option value=\"1\">一件</option> </select></span>"; } else { itemtype2 = "<select onchange=\"changeSelect(" + product.Content[i].NumIid.ToString() + ")\" id=\"discountType" + product.Content[i].NumIid.ToString() + "\" name=\"discountType\" > <option value=\"DISCOUNT\">打折</option><option selected=\"selected\" value=\"PRICE\">减价</option> </select>"; if (dtNew2.Rows[0]["decreaseNum"].ToString() == "0") { yhCount = " <span id=\"duojian" + product.Content[i].NumIid.ToString() + "\" style=\"display: none;\">多件<input type=\"hidden\" id=\"decreaseNumHiden" + product.Content[i].NumIid.ToString() + "\" value=\"0\" name=\"decreaseNumHiden\"></span> <span style=\"display: inline;\" id=\"yijian" + product.Content[i].NumIid.ToString() + "\"><select onchange=\"decreaseNumChange(" + product.Content[i].NumIid.ToString() + ")\" id=\"decreaseNumSel" + product.Content[i].NumIid.ToString() + "\" name=\"decreaseNumSel\"> <option selected=\"selected\" value=\"0\">多件</option> <option value=\"1\">一件</option> </select></span>"; } else { yhCount = " <span id=\"duojian" + product.Content[i].NumIid.ToString() + "\" style=\"display: none;\">多件<input type=\"hidden\" id=\"decreaseNumHiden" + product.Content[i].NumIid.ToString() + "\" value=\"0\" name=\"decreaseNumHiden\"></span> <span style=\"display: inline;\" id=\"yijian" + product.Content[i].NumIid.ToString() + "\"><select onchange=\"decreaseNumChange(" + product.Content[i].NumIid.ToString() + ")\" id=\"decreaseNumSel" + product.Content[i].NumIid.ToString() + "\" name=\"decreaseNumSel\"> <option value=\"0\">多件</option> <option value=\"1\" selected=\"selected\">一件</option> </select></span>"; } itemtypevalue2 = " <div id=\"zheDiv" + product.Content[i].NumIid.ToString() + "\" style=\"display: none;\" ><input type=\"text\" onkeyup=\"blurValue(" + product.Content[i].NumIid.ToString() + ")\" id=\"changeZhe" + product.Content[i].NumIid.ToString() + "\" value=\"9\" name=\"discountValue\" style=\"width:30px\">折</div><div style=\"display: block;\" id=\"jianDiv" + product.Content[i].NumIid.ToString() + "\">减<input type=\"text\" onkeyup=\"blurValue(" + product.Content[i].NumIid.ToString() + ")\" id=\"changeJian" + product.Content[i].NumIid.ToString() + "\" name=\"discountValue\" style=\"width:30px\" value=\"" + discountValue + "\" >元</div>"; if (discountValue != "") { newPrice2 = (decimal.Parse(price2) - decimal.Parse(discountValue)).ToString(); } else { newPrice2 = price2; } } } else { hdstr = " <div id=\"add" + product.Content[i].NumIid.ToString() + "\"><a href=\"javascript:addItemAction(" + product.Content[i].NumIid.ToString() + ")\">参加活动</a></div>"; if (yuanitemtype == "same") { //same:每个参加活动的宝贝设置相同促销力度,different:每个参加活动的宝贝设置不同促销力度) //decreaseNum 是否优惠限制(0,1) if (yuandiscountType == "PRICE") { itemtype2 = "<select onchange=\"changeSelect(" + product.Content[i].NumIid.ToString() + ")\" id=\"discountType" + product.Content[i].NumIid.ToString() + "\" name=\"discountType\" > <option value=\"DISCOUNT\">打折</option><option selected=\"selected\" value=\"PRICE\">减价</option> </select>"; itemtypevalue2 = " <div id=\"zheDiv" + product.Content[i].NumIid.ToString() + "\" style=\"display: none;\"><input type=\"text\" onkeyup=\"blurValue(" + product.Content[i].NumIid.ToString() + ")\" id=\"changeZhe" + product.Content[i].NumIid.ToString() + "\" value=\"\" name=\"discountValue\" style=\"width:30px\">折</div><div style=\"display:block ;\" id=\"jianDiv" + product.Content[i].NumIid.ToString() + "\">减<input type=\"text\" onkeyup=\"blurValue(" + product.Content[i].NumIid.ToString() + ")\" id=\"changeJian" + product.Content[i].NumIid.ToString() + "\" name=\"discountValue\" style=\"width:30px\" value=\"" + yuandiscountValue + "\" >元</div>"; if (yuandecreaseNum == "0") { yhCount = " <span id=\"duojian" + product.Content[i].NumIid.ToString() + "\" style=\"display: none;\">多件<input type=\"hidden\" id=\"decreaseNumHiden" + product.Content[i].NumIid.ToString() + "\" value=\"0\" name=\"decreaseNumHiden\"></span> <span style=\"display: inline;\" id=\"yijian" + product.Content[i].NumIid.ToString() + "\"><select onchange=\"decreaseNumChange(" + product.Content[i].NumIid.ToString() + ")\" id=\"decreaseNumSel" + product.Content[i].NumIid.ToString() + "\" name=\"decreaseNumSel\"> <option selected=\"selected\" value=\"0\">多件</option> <option value=\"1\">一件</option> </select></span>"; } else { yhCount = " <span id=\"duojian" + product.Content[i].NumIid.ToString() + "\" style=\"display: none;\">多件<input type=\"hidden\" id=\"decreaseNumHiden" + product.Content[i].NumIid.ToString() + "\" value=\"0\" name=\"decreaseNumHiden\"></span> <span style=\"display: inline;\" id=\"yijian" + product.Content[i].NumIid.ToString() + "\"><select onchange=\"decreaseNumChange(" + product.Content[i].NumIid.ToString() + ")\" id=\"decreaseNumSel" + product.Content[i].NumIid.ToString() + "\" name=\"decreaseNumSel\"> <option value=\"0\">多件</option> <option value=\"1\" selected=\"selected\">一件</option> </select></span>"; } if (discountValue != "") { newPrice2 = (decimal.Parse(product.Content[i].Price) - decimal.Parse(yuandiscountValue)).ToString(); } else { newPrice2 = product.Content[i].Price; } } else { itemtype2 = "<select onchange=\"changeSelect(" + product.Content[i].NumIid.ToString() + ")\" id=\"discountType" + product.Content[i].NumIid.ToString() + "\" name=\"discountType\" > <option selected=\"selected\" value=\"DISCOUNT\">打折</option><option value=\"PRICE\">减价</option> </select>"; yhCount = " <span id=\"duojian" + product.Content[i].NumIid.ToString() + "\" style=\"display: inline;\">多件<input type=\"hidden\" id=\"decreaseNumHiden" + product.Content[i].NumIid.ToString() + "\" value=\"0\" name=\"decreaseNumHiden\"></span> <span style=\"display: none;\" id=\"yijian" + product.Content[i].NumIid.ToString() + "\"><select onchange=\"decreaseNumChange(" + product.Content[i].NumIid.ToString() + ")\" id=\"decreaseNumSel" + product.Content[i].NumIid.ToString() + "\" name=\"decreaseNumSel\"> <option selected=\"selected\" value=\"0\">多件</option> <option value=\"1\">一件</option> </select></span>"; itemtypevalue2 = " <div id=\"zheDiv" + product.Content[i].NumIid.ToString() + "\" style=\"display: block;\"><input type=\"text\" onkeyup=\"blurValue(" + product.Content[i].NumIid.ToString() + ")\" id=\"changeZhe" + product.Content[i].NumIid.ToString() + "\" value=\"" + yuandiscountValue + "\" name=\"discountValue\" style=\"width:30px\">折</div><div style=\"display: none;\" id=\"jianDiv" + product.Content[i].NumIid.ToString() + "\">减<input type=\"text\" onkeyup=\"blurValue(" + product.Content[i].NumIid.ToString() + ")\" id=\"changeJian" + product.Content[i].NumIid.ToString() + "\" name=\"discountValue\" style=\"width:30px\" value=\"\" >元</div>"; if (discountValue != "") { newPrice2 = (decimal.Parse(product.Content[i].Price) * decimal.Parse(yuandiscountValue) * 0.1m).ToString(); } else { newPrice2 = product.Content[i].Price; } } } else { itemtype2 = "<select onchange=\"changeSelect(" + product.Content[i].NumIid.ToString() + ")\" id=\"discountType" + product.Content[i].NumIid.ToString() + "\" name=\"discountType\" > <option selected=\"selected\" value=\"DISCOUNT\">打折</option><option value=\"PRICE\">减价</option> </select>"; yhCount = " <span id=\"duojian" + product.Content[i].NumIid.ToString() + "\" style=\"display: inline;\">多件<input type=\"hidden\" id=\"decreaseNumHiden" + product.Content[i].NumIid.ToString() + "\" value=\"0\" name=\"decreaseNumHiden\"></span> <span style=\"display: none;\" id=\"yijian" + product.Content[i].NumIid.ToString() + "\"><select onchange=\"decreaseNumChange(" + product.Content[i].NumIid.ToString() + ")\" id=\"decreaseNumSel" + product.Content[i].NumIid.ToString() + "\" name=\"decreaseNumSel\"> <option selected=\"selected\" value=\"0\">多件</option> <option value=\"1\">一件</option> </select></span>"; itemtypevalue2 = " <div id=\"zheDiv" + product.Content[i].NumIid.ToString() + "\" style=\"display: block;\"><input type=\"text\" onkeyup=\"blurValue(" + product.Content[i].NumIid.ToString() + ")\" id=\"changeZhe" + product.Content[i].NumIid.ToString() + "\" value=\"9\" name=\"discountValue\" style=\"width:30px\">折</div><div style=\"display: none;\" id=\"jianDiv" + product.Content[i].NumIid.ToString() + "\">减<input type=\"text\" onkeyup=\"blurValue(" + product.Content[i].NumIid.ToString() + ")\" id=\"changeJian" + product.Content[i].NumIid.ToString() + "\" name=\"discountValue\" style=\"width:30px\" value=\"\" >元</div>"; newPrice2 = product.Content[i].Price; } } str += "<div id='div" + product.Content[i].NumIid.ToString() + "' width=\"800px\"><table width=\"800px\"><tr width=\"800px\"><td width=\"15px\"><!--<input type=\"checkbox\" id=\"" + product.Content[i].NumIid.ToString() + "\" class=\"selector\" value=\"" + product.Content[i].NumIid.ToString() + "\" name=\"iids\">--></td><td width=\"100px\"> <a href=\"http://item.taobao.com/item.htm?id=" + product.Content[i].NumIid.ToString() + "\" target=\"_blank\"><img src=\"" + product.Content[i].PicUrl + "_80x80.jpg\" width=\"50px\" height=\"50px\" border=\"0\" /></a></td>"; //图片 str += "<td width=\"140px\"><a href=\"http://item.taobao.com/item.htm?id=" + product.Content[i].NumIid.ToString() + "\" target=\"_blank\">" + product.Content[i].Title + "</a> </td>"; //名称 str += "<td width=\"70px\"> " + product.Content[i].Price + " <input type=\"hidden\" id=\"price" + product.Content[i].NumIid.ToString() + "\" name=\"price\" value=\"" + product.Content[i].Price.ToString() + "\"></td>"; //商品原价 str += "<td width=\"70px\" id=\"newPrice" + product.Content[i].NumIid.ToString() + "\"> " + newPrice2 + "</td>"; //促销价 str += "<td width=\"70px\"><div id=\"yhlxDiv" + product.Content[i].NumIid.ToString() + "\"> " + itemtype2 + "</div></td>"; //优惠类型 str += "<td width=\"70px\"> <div id=\"yhhdDiv" + product.Content[i].NumIid.ToString() + "\"> " + itemtypevalue2 + "</div></td>"; //优惠幅度 str += "<td width=\"70px\"> <div id=\"yhslDiv" + product.Content[i].NumIid.ToString() + "\">" + yhCount + "</div></td>"; //优惠数量 str += "<td width=\"70px\"> <input type=\"text\" id=\"Rcount" + product.Content[i].NumIid.ToString() + "\" name=\"Rcount\" style=\"width:30px\" value=\"" + Rcount + "\" ></td>"; //参团人数 str += "<td width=\"140px\">" + hdstr + " </td>"; //操作 str += "</tr></table></div>"; } Response.Write(str); Response.Write("<br>"); long totalPage = (product.TotalResults % pageSizeNow == 0) ? (product.TotalResults / pageSizeNow) : (product.TotalResults / pageSizeNow + 1); //输出分页HTML for (int i = 1; i <= totalPage; i++) { if (page == i.ToString()) { Response.Write(i.ToString() + " "); } else { Response.Write("<a href=\"javascript:spreadStat(" + i.ToString() + ")\">[" + i.ToString() + "]</a> "); } } Response.End(); } }
protected void Page_Load(object sender, EventArgs e) { Cookie cookie = new Cookie(); string taobaoNick = cookie.getCookie("nick"); string session = cookie.getCookie("top_session"); Rijndael_ encode = new Rijndael_("tetesoft"); taobaoNick = encode.Decrypt(taobaoNick); //获取参数 string q = utils.NewRequest("query", utils.RequestType.QueryString); string page = utils.NewRequest("p", utils.RequestType.QueryString); if (page == "") { page = "1"; } string catid = utils.NewRequest("catid", utils.RequestType.QueryString); string act = utils.NewRequest("act", utils.RequestType.QueryString); TopXmlRestClient client = new TopXmlRestClient("http://gw.api.taobao.com/router/rest", "12132145", "1fdd2aadd5e2ac2909db2967cbb71e7f"); int pageSizeNow = 15; if (act == "get") { //获取用户店铺商品列表 ItemsOnsaleGetRequest request = new ItemsOnsaleGetRequest(); request.Fields = "num_iid,title,price,pic_url"; request.PageSize = pageSizeNow; request.PageNo = int.Parse(page); request.Q = q; if (catid != "0") { request.SellerCids = catid; } PageList <Item> product = client.ItemsOnsaleGet(request, session); //输出页面HTML for (int i = 0; i < product.Content.Count; i++) { Response.Write("<input type='checkbox' name='items' id='item_" + product.Content[i].NumIid + "' title='" + product.Content[i].Title + "' value='" + product.Content[i].NumIid + "' onclick=\"InitArea(this)\"><label for='item_" + product.Content[i].NumIid + "'>" + product.Content[i].Title + "</label><br>"); } Response.Write("<br>"); long totalPage = (product.TotalResults % pageSizeNow == 0) ? (product.TotalResults / pageSizeNow) : (product.TotalResults / pageSizeNow + 1); //输出分页HTML for (int i = 1; i <= totalPage; i++) { if (page == i.ToString()) { Response.Write(i.ToString() + " "); } else { Response.Write("<a href=\"javascript:spreadStat(" + i.ToString() + ")\">[" + i.ToString() + "]</a> "); } } } else if (act == "getCat") { //记录店铺分类信息 SellercatsListGetRequest request1 = new SellercatsListGetRequest(); request1.Fields = "cid,parent_cid,name,is_parent"; request1.Nick = taobaoNick; PageList <SellerCat> cat = client.SellercatsListGet(request1); //清除老分类 string sql = "DELETE FROM TopTaobaoShopCat WHERE nick = '" + taobaoNick + "'"; utils.ExecuteNonQuery(sql); //插入新分类 for (int i = 0; i < cat.Content.Count; i++) { sql = "INSERT INTO TopTaobaoShopCat (" + "cid, " + "parent_cid, " + "name, " + "pic_url, " + "sort_order, " + "created, " + "nick, " + "modified " + " ) VALUES ( " + " '" + cat.Content[i].Cid + "', " + " '" + cat.Content[i].ParentCid + "', " + " '" + cat.Content[i].Name + "', " + " '" + cat.Content[i].PicUrl + "', " + " '" + cat.Content[i].SortOrder + "', " + " '" + cat.Content[i].Created + "', " + " '" + taobaoNick + "', " + " '" + cat.Content[i].Modified + "' " + ") "; utils.ExecuteNonQuery(sql); } //输出页面HTML Response.Write("<select id=\"shopcat\" name=\"shopcat\"><option value=\"0\"></option>"); for (int i = 0; i < cat.Content.Count; i++) { Response.Write("<option value='" + cat.Content[i].Cid + "'>" + cat.Content[i].Name + "</option>"); } Response.Write("</select>"); } }
protected void Page_Load(object sender, EventArgs e) { Cookie cookie = new Cookie(); string taobaoNick = cookie.getCookie("nick"); string session = cookie.getCookie("top_sessiongroupbuy"); Rijndael_ encode = new Rijndael_("tetesoft"); taobaoNick = encode.Decrypt(taobaoNick); string appkey = "12159997"; string secret = "614e40bfdb96e9063031d1a9e56fbed5"; //获取参数 string q = utils.NewRequest("query", utils.RequestType.QueryString); string page = utils.NewRequest("p", utils.RequestType.QueryString); if (page == "") { page = "1"; } string catid = utils.NewRequest("catid", utils.RequestType.QueryString); string isradio = utils.NewRequest("isradio", utils.RequestType.QueryString); string act = utils.NewRequest("act", utils.RequestType.QueryString); TopXmlRestClient client = new TopXmlRestClient("http://gw.api.taobao.com/router/rest", appkey, secret); int pageSizeNow = 15; if (act == "get") { //获取用户店铺商品列表 ItemsOnsaleGetRequest request = new ItemsOnsaleGetRequest(); request.Fields = "num_iid,title,price,pic_url"; request.PageSize = pageSizeNow; request.PageNo = int.Parse(page); request.Q = q; if (catid != "0") { request.SellerCids = catid; } PageList <Item> product = client.ItemsOnsaleGet(request, session); //输出页面HTML for (int i = 0; i < product.Content.Count; i++) { if (isradio == "1") { Response.Write("<input type='radio' name='items' id='item_" + product.Content[i].NumIid + "' title='" + product.Content[i].Title.Replace("%", "") + "' value='" + product.Content[i].NumIid + "' onclick=\"InitArea(this)\"><label onMouseOver=\"javascript:ddrivetip('<img src=" + product.Content[i].PicUrl + "_80x80.jpg>','#ffffff',100)\" onMouseOut=\"hideddrivetip()\" for='item_" + product.Content[i].NumIid + "'>" + product.Content[i].Title.Replace("%", "") + "</label><br>"); } else { Response.Write("<input type='checkbox' name='items' id='item_" + product.Content[i].NumIid + "' title='" + product.Content[i].Title.Replace("%", "") + "' value='" + product.Content[i].NumIid + "' onclick=\"InitArea(this)\"><label onMouseOver=\"javascript:ddrivetip('<img src=" + product.Content[i].PicUrl + "_80x80.jpg>','#ffffff',100)\" onMouseOut=\"hideddrivetip()\" for='item_" + product.Content[i].NumIid + "'>" + product.Content[i].Title.Replace("%", "") + "</label><br>"); } } Response.Write("<br>"); long totalPage = (product.TotalResults % pageSizeNow == 0) ? (product.TotalResults / pageSizeNow) : (product.TotalResults / pageSizeNow + 1); //输出分页HTML for (int i = 1; i <= totalPage; i++) { if (page == i.ToString()) { Response.Write(i.ToString() + " "); } else { Response.Write("<a href=\"javascript:spreadStat(" + i.ToString() + ")\">[" + i.ToString() + "]</a> "); } } } else if (act == "getCat") { //记录店铺分类信息 SellercatsListGetRequest request1 = new SellercatsListGetRequest(); request1.Fields = "cid,parent_cid,name,is_parent"; request1.Nick = taobaoNick; PageList <SellerCat> cat = client.SellercatsListGet(request1); //清除老分类 string sql = "DELETE FROM TopTaobaoShopCat WHERE nick = '" + taobaoNick + "'"; utils.ExecuteNonQuery(sql); //插入新分类 for (int i = 0; i < cat.Content.Count; i++) { sql = "INSERT INTO TopTaobaoShopCat (" + "cid, " + "parent_cid, " + "name, " + "pic_url, " + "sort_order, " + "created, " + "nick, " + "modified " + " ) VALUES ( " + " '" + cat.Content[i].Cid + "', " + " '" + cat.Content[i].ParentCid + "', " + " '" + cat.Content[i].Name + "', " + " '" + cat.Content[i].PicUrl + "', " + " '" + cat.Content[i].SortOrder + "', " + " '" + cat.Content[i].Created + "', " + " '" + taobaoNick + "', " + " '" + cat.Content[i].Modified + "' " + ") "; utils.ExecuteNonQuery(sql); } //输出页面HTML Response.Write("<select id=\"shopcat\" name=\"shopcat\"><option value=\"0\"></option>"); for (int i = 0; i < cat.Content.Count; i++) { Response.Write("<option value='" + cat.Content[i].Cid + "'>" + cat.Content[i].Name + "</option>"); } Response.Write("</select>"); } else if (act == "getResultStr") { string items = utils.NewRequest("ids", utils.RequestType.QueryString); string[] arr = items.Split(','); List <Item> itemList = new List <Item>(); //标志 int flag = 1; if (arr.Length == 1) { flag = 0; } for (int i = flag; i < arr.Length; i++) { ItemGetRequest request = new ItemGetRequest(); request.Fields = "num_iid,title,price,pic_url"; request.NumIid = long.Parse(arr[i]); Item product = client.ItemGet(request); itemList.Add(product); } string str = string.Empty; //根据不同样式显示不同的字符串 string style = utils.NewRequest("style", utils.RequestType.QueryString); //string sqlNew = "SELECT sid FROM TopTaobaoShop WHERE nick = '" + taobaoNick + "'"; //DataTable dtNew = utils.ExecuteDataTable(sqlNew); //string nickid = string.Empty; //if (dtNew.Rows.Count != 0) //{ // nickid = "http://shop" + dtNew.Rows[0]["sid"].ToString() + ".taobao.com/"; //} //else //{ // nickid = "http://www.taobao.com/"; //} if (isradio == "1") { //团购需要的商品数据 for (int i = 0; i < itemList.Count; i++) { str = "<div id=item_" + itemList[i].NumIid.ToString() + " style=\"float:left;width:46px;border:solid 1px #ccc;padding:2px;margin:2px;\"><A href=\"http://item.taobao.com/item.htm?id=" + itemList[i].NumIid.ToString() + "\" target=\"_blank\"><IMG src=\"" + itemList[i].PicUrl + "_40x40.jpg\" border=0 title=\"" + itemList[i].Title + "\" /></A><br>" + itemList[i].Price + "<input type=\"hidden\" id=\"productid\" name=\"productid\" value=\"" + itemList[i].NumIid.ToString() + "\"><input type=\"hidden\" id=\"price\" name=\"price\" value=\"" + itemList[i].Price.ToString() + "\"><br><a href=\"javascript:delitem(" + itemList[i].NumIid.ToString() + ")\">删除</a></div>"; } } Response.Write(str); } }
private void DeleteTaobao(string nick2) { //try //{ //获取正在进行中的宝贝同步任务 string appkey = "12287381"; string secret = "d3486dac8198ef01000e7bd4504601a4"; string session = string.Empty; string id = string.Empty; string missionid = string.Empty; string html = string.Empty; string shopcat = "0"; TopXmlRestClient client = new TopXmlRestClient("http://gw.api.taobao.com/router/rest", appkey, secret); string sql = "SELECT top 300 t.*, s.sessiongroupbuy,s.sid FROM TopMission t INNER JOIN TopTaobaoShop s ON s.nick = t.nick WHERE t.isok = 0 AND t.typ = 'delete' and s.nick='" + nick2 + "' ORDER BY t.id ASC"; DataTable dt = utils.ExecuteDataTable(sql); DataTable dtWrite = null; for (int i = 0; i < dt.Rows.Count; i++) { id = dt.Rows[i]["groupbuyid"].ToString(); session = dt.Rows[i]["sessiongroupbuy"].ToString(); missionid = dt.Rows[i]["id"].ToString(); html = ""; sql = "SELECT DISTINCT itemid FROM TopWriteContent WHERE groupbuyid = '" + dt.Rows[i]["groupbuyid"].ToString() + "' AND isok = 1"; dtWrite = utils.ExecuteDataTable(sql); if (dtWrite == null || dtWrite.Rows.Count < 1) { for (int j = 1; j <= 500; j++) { ItemsOnsaleGetRequest request = new ItemsOnsaleGetRequest(); request.Fields = "num_iid,title,price,pic_url"; request.PageSize = 200; request.PageNo = j; string taobaoNick = dt.Rows[i]["nick"].ToString(); try { PageList <Item> product = client.ItemsOnsaleGet(request, session); WriteLog(taobaoNick + "INGCount:" + product.Content.Count.ToString(), "1", nick2, ""); for (int num = 0; num < product.Content.Count; num++) { RecordMissionDetail(id, missionid, product.Content[num].NumIid.ToString(), html); } if (product.Content.Count < 200) { break; } } catch (Exception e) { WriteLog(e.StackTrace, "1", nick2, ""); WriteLog(e.Message, "1", nick2, ""); sql = "UPDATE TopMission SET fail = fail + 1,isok = -1 WHERE id = " + dt.Rows[i]["id"].ToString(); utils.ExecuteNonQuery(sql); break; } } sql = "SELECT DISTINCT itemid FROM TopWriteContent WHERE groupbuyid = '" + dt.Rows[i]["groupbuyid"].ToString() + "' AND isok = 1"; dtWrite = utils.ExecuteDataTable(sql); } WriteLog("ING:" + dtWrite.Rows.Count.ToString(), "1", nick2, ""); for (int j = 0; j < dtWrite.Rows.Count; j++) { try { //获取原宝贝描述 ItemGetRequest requestItem = new ItemGetRequest(); requestItem.Fields = "desc"; requestItem.NumIid = long.Parse(dtWrite.Rows[j]["itemid"].ToString()); WriteLog("更新删除准备中", "1", nick2, ""); Item product = client.ItemGet(requestItem, session); WriteLog("更新删除准备中。。。。", "1", nick2, ""); string newContent2 = string.Empty; string groupid = dt.Rows[i]["groupbuyid"].ToString(); string tetegroupbuyGuid = groupid; string sqltemp = "SELECT * FROM TopGroupBuy WHERE id = '" + groupid + "'"; DataTable dttemp = utils.ExecuteDataTable(sqltemp); if (dttemp == null) { continue; } //判断团购是多模板 if (dttemp.Rows[0]["groupbuyGuid"].ToString() != "") { tetegroupbuyGuid = dttemp.Rows[0]["groupbuyGuid"].ToString(); } if (!Regex.IsMatch(product.Desc, @"<div>[\s]*<a name=""tetesoft-area-start-" + tetegroupbuyGuid + @""">[\s]*</a>[\s]*</div>[\s]*([\s\S]*)<div>[\s]*<a name=""tetesoft-area-end-" + tetegroupbuyGuid + @""">[\s]*</a>[\s]*</div>")) { //更新状态 WriteLog(DateTime.Now.ToString() + "http://item.taobao.com/item.htm?id=" + dtWrite.Rows[j]["itemid"].ToString() + " 不含需要清除的代码", "", nick2, ""); sql = "UPDATE TopMission SET success = success + 1,isok = 1 WHERE id = " + dt.Rows[i]["id"].ToString(); utils.ExecuteNonQuery(sql); continue; } else { newContent2 = Regex.Replace(product.Desc, @"<div>[\s]*<a name=""tetesoft-area-start-" + tetegroupbuyGuid + @""">[\s]*</a>[\s]*</div>[\s]*([\s\S]*)<div>[\s]*<a name=""tetesoft-area-end-" + tetegroupbuyGuid + @""">[\s]*</a>[\s]*</div>", @""); } //更新宝贝描述 IDictionary <string, string> param = new Dictionary <string, string>(); param.Add("num_iid", dtWrite.Rows[j]["itemid"].ToString()); param.Add("desc", newContent2); string resultpro = Post("http://gw.api.taobao.com/router/rest", appkey, secret, "taobao.item.update", session, param); //插入宝贝错误日志 if (resultpro.ToLower().IndexOf("ITEM_PROPERTIES_ERROR") != -1) { WriteLog("删除活动更新宝贝描述:宝贝ID:" + dtWrite.Rows[j]["itemid"].ToString() + "返回的错误信息" + resultpro.Replace("<?xml version=\"1.0\" encoding=\"utf-8\" ?>", ""), "1", nick2, ""); } else { WriteLog("删除活动更新宝贝描述:宝贝ID:" + dtWrite.Rows[j]["itemid"].ToString() + "返回的成功信息" + resultpro.Replace("<?xml version=\"1.0\" encoding=\"utf-8\" ?>", ""), "", nick2, ""); } if (resultpro.IndexOf("ITEM_PROPERTIES_ERROR") != -1) { WriteLog("删除宝贝更新宝贝描述结果:宝贝ID:" + dtWrite.Rows[j]["itemid"].ToString() + "返回的错误信息" + resultpro, "", nick2, ""); //更新宝贝错误数 sql = "UPDATE TopMission SET fail = fail + 1,isok = -1 WHERE id = " + dt.Rows[i]["id"].ToString(); utils.ExecuteNonQuery(sql); } else { //更新状态 sql = "UPDATE TopWriteContent SET isok = 1 WHERE id = " + dtWrite.Rows[j]["itemid"].ToString(); utils.ExecuteNonQuery(sql); //更新状态 sql = "UPDATE TopMission SET success = success + 1,isok = 1 WHERE id = " + dt.Rows[i]["id"].ToString(); utils.ExecuteNonQuery(sql); } } catch (Exception e) { WriteLog("删除宝贝" + e.StackTrace, "1", nick2, ""); WriteLog("删除宝贝" + e.Message, "1", nick2, ""); sql = "UPDATE TopMission SET fail = fail + 1,isok = -1 WHERE id = " + dt.Rows[i]["id"].ToString(); utils.ExecuteNonQuery(sql); continue; } } dtWrite.Dispose(); } dt.Dispose(); WriteLog("**********************************************************", "", nick2, ""); }
protected void Page_Load(object sender, EventArgs e) { //TopXmlRestClient client = new TopXmlRestClient("http://gw.api.tbsandbox.com/router/rest", "test", "test"); id = utils.NewRequest("id", utils.RequestType.QueryString); string itemid = utils.NewRequest("itemid", utils.RequestType.QueryString); string ideaid = utils.NewRequest("idea", utils.RequestType.QueryString); string act = utils.NewRequest("act", utils.RequestType.QueryString); url = utils.NewRequest("url", utils.RequestType.QueryString); width = utils.NewRequest("width", utils.RequestType.QueryString); height = utils.NewRequest("height", utils.RequestType.QueryString); num = utils.NewRequest("num", utils.RequestType.QueryString); string size = string.Empty; if (id != "" && !utils.IsInt32(id)) { Response.Write("非法参数1"); Response.End(); return; } if (num != "" && !utils.IsInt32(id)) { Response.Write("非法参数0"); Response.End(); return; } if (itemid != "" && !IsLong(itemid)) { Response.Write("非法参数2"); Response.End(); return; } if (ideaid != "" && !utils.IsInt32(ideaid)) { Response.Write("非法参数3"); Response.End(); return; } string sql = string.Empty; //只有正式模式下才统计相关信息 if (id != "0") { if (act == "hit") { return; //记录广告点击 sql = "UPDATE TopIdea SET hitcount = hitcount + 1 WHERE id = " + ideaid; utils.ExecuteNonQuery(sql); //记录点击日志 sql = "INSERT INTO TopIdeaHitLog (ideaid, itemid, url) VALUES ('" + ideaid + "', '" + itemid + "', '" + url + "')"; utils.ExecuteNonQuery(sql); Response.End(); return; } else // if (act == "view") { //记录广告浏览次数 sql = "UPDATE TopIdea SET viewcount = viewcount + 1 WHERE id = " + id; utils.ExecuteNonQuery(sql); //记录浏览日志 sql = "INSERT INTO TopIdeaLog (ideaid, url) VALUES ('" + id + "', '" + url + "')"; utils.ExecuteNonQuery(sql); //Response.End(); //return; } } //开启缓存 CacheManager testcaching1 = CacheFactory.GetCacheManager(); if (testcaching1.Contains("cache_1_" + id) && id != "3972") { Response.Write(testcaching1.GetData("cache_1_" + id)); Response.End(); return; } TopXmlRestClient client = new TopXmlRestClient("http://gw.api.taobao.com/router/rest", "12132145", "1fdd2aadd5e2ac2909db2967cbb71e7f"); //如果为0则为调试模式,自动按照参数进行调用 if (id == "0") { Cookie cookie1 = new Cookie(); string taobaoNick1 = cookie1.getCookie("nick"); //COOKIE过期判断 if (taobaoNick1 == "") { //SESSION超期 跳转到登录页 Response.Write("<script>parent.location.href='http://container.open.taobao.com/container?appkey=12132145'</script>"); Response.End(); } Rijndael_ encode = new Rijndael_("tetesoft"); taobaoNick1 = encode.Decrypt(taobaoNick1); string sqlNew = "SELECT sid FROM TopTaobaoShop WHERE nick = '" + taobaoNick1 + "'"; DataTable dtNew = utils.ExecuteDataTable(sqlNew); if (dtNew.Rows.Count != 0) { nickid = "http://shop" + dtNew.Rows[0]["sid"].ToString() + ".taobao.com/"; } else { nickid = "http://www.taobao.com/"; } width = (int.Parse(width) - 10).ToString(); Cookie cookie = new Cookie(); string taobaoNick = cookie.getCookie("nick"); string session = cookie.getCookie("top_session"); string style = utils.NewRequest("style", utils.RequestType.QueryString); size = utils.NewRequest("size", utils.RequestType.QueryString); string type = utils.NewRequest("type", utils.RequestType.QueryString); string orderby = utils.NewRequest("orderby", utils.RequestType.QueryString); string query = utils.NewRequest("query", utils.RequestType.QueryString); string shopcat = utils.NewRequest("shopcat", utils.RequestType.QueryString); string items = utils.NewRequest("items", utils.RequestType.QueryString); title = utils.NewRequest("title", utils.RequestType.QueryString); //如果为自动选择模式 if (type == "0") { //如果没有选择具体商品 ItemsOnsaleGetRequest request = new ItemsOnsaleGetRequest(); request.Fields = "num_iid,title,price,pic_url"; request.PageSize = int.Parse(num); if (orderby == "new") { request.OrderBy = "list_time:desc"; } else if (orderby == "sale") { request.OrderBy = "volume:desc"; } if (shopcat != "0") { request.SellerCids = shopcat; } if (query != "0") { request.Q = query; } try { PageList <Item> product = client.ItemsOnsaleGet(request, session); if (size == "743*308") { panel1.Visible = false; panel2.Visible = true; Repeater2.DataSource = product.Content; Repeater2.DataBind(); } else { Repeater1.DataSource = product.Content; Repeater1.DataBind(); } } catch { Response.Write(session + "- miss session!!"); Response.End(); } } //如果选择了具体商品 else { if (items == "") { return; } string[] arr = items.Split(','); List <Item> itemList = new List <Item>(); //过滤可能发生的错误 try { for (int i = 0; i < arr.Length; i++) { if (i >= int.Parse(num)) { break; } ItemGetRequest request = new ItemGetRequest(); request.Fields = "num_iid,title,price,pic_url"; request.NumIid = long.Parse(arr[i]); Item product = client.ItemGet(request); itemList.Add(product); } } catch { } if (size == "743*308") { panel1.Visible = false; panel2.Visible = true; Repeater2.DataSource = itemList; Repeater2.DataBind(); } else { Repeater1.DataSource = itemList; Repeater1.DataBind(); } } return; } //获取广告标题 sql = "SELECT name,size FROM TopIdea WHERE id = " + id; DataTable dt = utils.ExecuteDataTable(sql); if (dt.Rows.Count != 0) { title = dt.Rows[0]["name"].ToString(); size = dt.Rows[0]["size"].ToString(); string[] arr = size.Split('*'); width = arr[0]; height = arr[1]; switch (size) { case "514*160": num = "5"; break; case "514*288": num = "10"; break; case "664*160": num = "6"; break; case "312*288": num = "6"; break; case "336*280": num = "4"; break; case "714*160": num = "7"; break; case "114*418": num = "3"; break; case "218*286": num = "4"; break; case "743*308": num = "4"; break; default: num = "4"; break; } } //获取数据库中保存的商品 sql = "SELECT TOP " + num + " * FROM TopIdeaProduct WHERE ideaid = " + id + "";// ORDER BY NEWID()"; dt = utils.ExecuteDataTable(sql); test.DataSource = dt; test.DataBind(); //获取店铺地址 sql = "SELECT name,size,nick FROM TopIdea WHERE id = " + id; DataTable dt22 = utils.ExecuteDataTable(sql); if (dt22.Rows.Count != 0) { string taobaoNick = dt22.Rows[0]["nick"].ToString(); string sqlNew = "SELECT sid FROM TopTaobaoShop WHERE nick = '" + taobaoNick + "'"; DataTable dtNew = utils.ExecuteDataTable(sqlNew); if (dtNew.Rows.Count != 0) { nickid = "http://shop" + dtNew.Rows[0]["sid"].ToString() + ".taobao.com/"; } else { nickid = "http://www.taobao.com/"; } } //生成HTML缓存 string cache = string.Empty; if (size == "743*308") { cache += "<table background=\"/top/show1/4.gif\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" height=\"30\" style=\"border-right: #999999 1px solid; border-top: #999999 1px solid;border-left: #999999 1px solid; border-bottom: #999999 1px solid\" width=\"740\"><tr><td> <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\"><tr><td align=\"left\"><table align=\"left\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" height=\"30\"><tr><td width=\"10\"></td><td background=\"/top/show1/1.gif\" width=\"24\"></td><td background=\"/top/show1/2.gif\"><font color=\"white\" style=\"font-size: 13px\"><strong>" + title + "</strong></font></td><td><img src=\"/top/show1/3.gif\" /></td></tr></table></td><td align=\"right\"></td></tr></table></td></tr></table> <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"border-right: #999999 1px solid;border-top: #999999 1px solid; overflow: hidden; border-left: #999999 1px solid;border-bottom: #999999 1px solid\" width=\"740\"><tr><td valign=\"top\"><TABLE cellSpacing=0 cellPadding=0 width=730 border=0><TBODY><TR><TD align=\"middle\"><TABLE cellSpacing=8 cellPadding=0 align=center border=0><TBODY><TR>"; for (int i = 0; i < dt.Rows.Count; i++) { cache += "<TD vAlign=top align=\"middle\" width=175 bgColor=white><TABLE cellSpacing=0 cellPadding=0 align=center border=0><TBODY><TR><TD vAlign=top align=\"middle\" width=175 bgColor=white><TABLE cellSpacing=0 cellPadding=0 align=center border=0><TBODY><TR><TD align=\"middle\"><DIV style=\"BORDER-RIGHT: #cccccc 1px solid; BORDER-TOP: #cccccc 1px solid; MARGIN-TOP: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 160px; BORDER-BOTTOM: #cccccc 1px solid; HEIGHT: 160px\"><DIV style=\"OVERFLOW: hidden; WIDTH: 160px; HEIGHT: 160px\"><A href=\"/click/?s=" + EncodeStr(new string[] { id, dt.Rows[i]["itemid"].ToString(), "http://item.taobao.com/item.htm?id=" + dt.Rows[i]["itemid"].ToString() }) + "\" onclick=\"javascript:spreadStat('" + id + "','" + dt.Rows[i]["itemid"].ToString() + "');\" target=\"_blank\"><IMG alt=\"" + dt.Rows[i]["itemname"].ToString() + "\" src=\"" + dt.Rows[i]["itempicurl"].ToString() + "_160x160.jpg\" border=0 /></A></DIV></DIV></TD></TR><TR><TD align=\"middle\"><DIV style=\"PADDING-RIGHT: 4px; PADDING-LEFT: 4px; FONT-SIZE: 12px; PADDING-BOTTOM: 4px; PADDING-TOP: 4px\"><A style=\"FONT-SIZE: 12px; COLOR: #3f3f3f; TEXT-DECORATION: none\" href=\"/click/?s=" + EncodeStr(new string[] { id, dt.Rows[i]["itemid"].ToString(), "http://item.taobao.com/item.htm?id=" + dt.Rows[i]["itemid"].ToString() }) + "\" onclick=\"javascript:spreadStat('" + id + "','" + dt.Rows[i]["itemid"].ToString() + "');\" target=\"_blank\" title=\"" + dt.Rows[i]["itemname"].ToString() + "\">" + dt.Rows[i]["itemname"].ToString() + "</A><BR /><FONT style=\"COLOR: #fe596a\"><B>¥ " + dt.Rows[i]["itemprice"].ToString() + "元</B></FONT> </DIV><A href=\"/click/?s=" + EncodeStr(new string[] { id, dt.Rows[i]["itemid"].ToString(), "http://item.taobao.com/item.htm?id=" + dt.Rows[i]["itemid"].ToString() }) + "\" onclick=\"javascript:spreadStat('" + id + "','" + dt.Rows[i]["itemid"].ToString() + "');\" target=\"_blank\"><IMG src=\"/top/show1/buy1.gif\" border=0 /></A> <DIV></DIV></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></TD>"; } cache += "</TR></TBODY></TABLE></td></tr><tr><td align=\"right\" height=\"24\" style=\"border-bottom: #999999 1px solid\" valign=\"center\"><a href=\"/click/?s=" + EncodeStr(new string[] { id, "0", nickid }) + "\" style=\"text-decoration: none\" target=\"_blank\"><font style=\"font-size: 13px; color: #ff6600\"><strong>更多详情请见 " + nickid + "</strong> </font></a></td></tr></table>"; cache += "<script type=\"text/javascript\" language=\"javascript\" src=\"css/common.js\"></script>"; cache += "<script type=\"text/javascript\">"; cache += "var xmlHttp;"; cache += "var url = '" + url + "';"; cache += "if(\"0\" != \"" + id + "\" && url != \"\"){"; cache += "createxmlHttpRequest();"; cache += "var queryString = \"http://www.7fshop.com/show/plist.aspx?act=view&id=" + id + "&url=\"+escape(url)+\"&t=\"+new Date().getTime();"; cache += "xmlHttp.open(\"GET\",queryString);"; cache += "xmlHttp.send(null); }"; cache += "</script>"; } else { cache = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">"; cache += "<html xmlns=\"http://www.w3.org/1999/xhtml\">"; cache += "<head>"; cache += "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />"; cache += "<title>特特推广</title>"; cache += "<link type=\"text/css\" href=\"css/css.css\" rel=\"stylesheet\"/>"; cache += "</head>"; cache += "<body>"; cache += "<div id=\"container\" style=\"width:" + width + "px; height:" + height + "px; overflow:hidden\">"; cache += "<div class=\"navigation\">" + title + "</div>"; cache += "<div class=\"outer\">"; cache += "<div class=\"inner\">"; for (int i = 0; i < dt.Rows.Count; i++) { cache += "<dl>"; cache += "<dt><a href='/click/?s=" + EncodeStr(new string[] { id, dt.Rows[i]["itemid"].ToString(), "http://item.taobao.com/item.htm?id=" + dt.Rows[i]["itemid"].ToString() }) + "' title='" + dt.Rows[i]["itemname"].ToString() + "' onclick='javascript:spreadStat('" + id + "','" + dt.Rows[i]["itemid"].ToString() + "');' target='_blank'><img src='" + dt.Rows[i]["itempicurl"].ToString() + "_80x80.jpg' border='0' /></a></dt>"; cache += "<dd><a href='/click/?s=" + EncodeStr(new string[] { id, dt.Rows[i]["itemid"].ToString(), "http://item.taobao.com/item.htm?id=" + dt.Rows[i]["itemid"].ToString() }) + "' onclick='javascript:spreadStat('" + id + "','" + dt.Rows[i]["itemid"].ToString() + "');' target='_blank'>" + left(dt.Rows[i]["itemname"].ToString(), 16) + "</a></dd>"; cache += "</dl>"; } cache += "<br class=\"clearfloat\"/>"; cache += "</div>"; cache += "</div>"; cache += "</div>"; cache += "<script type=\"text/javascript\" language=\"javascript\" src=\"css/common.js\"></script>"; cache += "<script type=\"text/javascript\">"; cache += "var xmlHttp;"; cache += "var url = '" + url + "';"; cache += "if(\"0\" != \"" + id + "\" && url != \"\"){"; cache += "createxmlHttpRequest();"; cache += "var queryString = \"http://www.7fshop.com/show/plist.aspx?act=view&id=" + id + "&url=\"+escape(url)+\"&t=\"+new Date().getTime();"; cache += "xmlHttp.open(\"GET\",queryString);"; cache += "xmlHttp.send(null); }"; cache += "</script>"; } CacheManager testcaching = CacheFactory.GetCacheManager(); if (!testcaching.Contains("cache_1_" + id)) { testcaching.Add("cache_1_" + id, cache); } //如果是743*308,则直接显示 Response.Write(cache); Response.End(); }
protected void Page_Load(object sender, EventArgs e) { //try //{ id = utils.NewRequest("id", Common.utils.RequestType.QueryString); if (id != "" && !utils.IsInt32(id)) { Response.Write("非法参数1"); Response.End(); return; } style = utils.NewRequest("style", Common.utils.RequestType.Form); size = utils.NewRequest("size", Common.utils.RequestType.Form); type = utils.NewRequest("type", Common.utils.RequestType.Form); orderby = utils.NewRequest("orderby", Common.utils.RequestType.Form); query = utils.NewRequest("query", Common.utils.RequestType.Form); shopcat = utils.NewRequest("shopcat", Common.utils.RequestType.Form); name = utils.NewRequest("name", Common.utils.RequestType.Form); items = utils.NewRequest("items", Common.utils.RequestType.Form); ads = utils.NewRequest("ads", Common.utils.RequestType.Form); string missionid = string.Empty; string html = CreateGroupbuyHtml(id); if (html.Length == 0) { return; } int itemcount = 0; string act = utils.NewRequest("act", Common.utils.RequestType.Form); //创建任务时,判断是否有同类型任务在进行 if (act == "save" && NoRepeat(id, type)) { //记录该任务 missionid = RecordMission(); TopXmlRestClient client = new TopXmlRestClient("http://gw.api.taobao.com/router/rest", "12287381", "d3486dac8198ef01000e7bd4504601a4"); //提交更新到淘宝商品上去 if (type != "1") { for (int j = 1; j <= 500; j++) { ItemsOnsaleGetRequest request = new ItemsOnsaleGetRequest(); request.Fields = "num_iid,title,price,pic_url"; request.PageSize = 200; request.PageNo = j; if (orderby == "new") { request.OrderBy = "list_time:desc"; } else if (orderby == "sale") { request.OrderBy = "volume:desc"; } if (shopcat != "0") { request.SellerCids = shopcat; } if (query != "0") { request.Q = query; } Cookie cookie = new Cookie(); string taobaoNick = cookie.getCookie("nick"); string session = cookie.getCookie("top_sessiongroupbuy"); PageList <Item> product = client.ItemsOnsaleGet(request, session); for (int i = 0; i < product.Content.Count; i++) { RecordMissionDetail(id, missionid, product.Content[i].NumIid.ToString(), html); itemcount++; } if (product.Content.Count < 200) { break; } } } else { string[] itemId = items.Split(','); for (int i = 0; i < itemId.Length; i++) { RecordMissionDetail(id, missionid, itemId[i], html); itemcount++; } } } //} //catch { } //更新总数量 string sql = "UPDATE TopMission SET total = '" + itemcount + "' WHERE id = " + missionid; utils.ExecuteNonQuery(sql); //更新任务 DoMyJob(missionid); //Response.Redirect("missionlist.aspx"); }
/// <summary> /// 清除宝贝描述里面的活动页面 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Button4_Click(object sender, EventArgs e) { string appkey = "12690738"; string secret = "66d488555b01f7b85f93d33bc2a1c001"; session = utils.NewRequest("session", utils.RequestType.QueryString); StringBuilder builder = new StringBuilder(); //上传到宝贝描述 TopXmlRestClient client = new TopXmlRestClient("http://gw.api.taobao.com/router/rest", appkey, secret); for (int j = 1; j <= 500; j++) { ItemsOnsaleGetRequest request = new ItemsOnsaleGetRequest(); request.Fields = "num_iid"; request.PageSize = 200; request.PageNo = j; PageList <Item> product = client.ItemsOnsaleGet(request, session); for (int i = 0; i < product.Content.Count; i++) { try { //获取商品详细 ItemGetRequest requestItem = new ItemGetRequest(); requestItem.Fields = "desc"; requestItem.NumIid = product.Content[i].NumIid; Item item = client.ItemGet(requestItem, session); //判断是否增加过该图片 string newcontent = CreateDescDel(item.Desc); //if (product.Content[i].NumIid.ToString() == "10002247109") //{ // Response.Write(item.Desc); // Response.Write("**************************************************"); // Response.Write(newcontent); // return; //} if (newcontent == "") { continue; } //更新宝贝描述 IDictionary <string, string> param = new Dictionary <string, string>(); param.Add("num_iid", product.Content[i].NumIid.ToString()); param.Add("desc", newcontent); string resultpro = Post("http://gw.api.taobao.com/router/rest", appkey, secret, "taobao.item.update", session, param); builder.Append(resultpro + "\r\n"); //Response.Write(resultpro + "<br>\r\n"); } catch { } } if (product.Content.Count < 200) { break; } } File.WriteAllText(Server.MapPath("htmlLog/" + DateTime.Now.ToString("yyyyMMddHHmmss") + "-" + nick + ".txt"), builder.ToString()); Response.Write("<script>alert('清除成功!');</script>"); Response.End(); }
protected void Page_Load(object sender, EventArgs e) { try { id = utils.NewRequest("id", Common.utils.RequestType.QueryString); if (id != "" && !utils.IsInt32(id)) { Response.Write("非法参数1"); Response.End(); return; } style = utils.NewRequest("style", Common.utils.RequestType.Form); size = utils.NewRequest("size", Common.utils.RequestType.Form); type = utils.NewRequest("type", Common.utils.RequestType.Form); orderby = utils.NewRequest("orderby", Common.utils.RequestType.Form); query = utils.NewRequest("query", Common.utils.RequestType.Form); shopcat = utils.NewRequest("shopcat", Common.utils.RequestType.Form); name = utils.NewRequest("name", Common.utils.RequestType.Form); items = utils.NewRequest("items", Common.utils.RequestType.Form); string act = utils.NewRequest("act", Common.utils.RequestType.Form); if (act == "save") { Cookie cookie = new Cookie(); string taobaoNick = cookie.getCookie("nick"); string session = cookie.getCookie("top_session"); Rijndael_ encode = new Rijndael_("tetesoft"); taobaoNick = encode.Decrypt(taobaoNick); //记录到本地数据库 string sql = "INSERT INTO TopIdea (" + "name, " + "showtype, " + "nick, " + "size, " + "style, " + "orderby, " + "shopcategoryid, " + "query " + " ) VALUES ( " + " '" + name + "', " + " '" + type + "', " + " '" + taobaoNick + "', " + " '" + size + "', " + " '" + style + "', " + " '" + orderby + "', " + " '" + shopcat + "', " + " '" + query + "' " + ") "; //如果为编辑模式 if (id != "" && id != "0") { //更新广告 sql = "UPDATE TopIdea SET " + "name = '" + name + "', " + "showtype = '" + type + "', " + "size = '" + size + "', " + "style = '" + style + "', " + "orderby = '" + orderby + "', " + "shopcategoryid = '" + shopcat + "', " + "query = '" + query + "' " + " WHERE id = " + id; utils.ExecuteNonQuery(sql); //如果是自动更新模式,需要更新店铺商品数据 sql = "SELECT shopcategoryid,query,nick,showtype FROM TopIdea WHERE nick = '" + taobaoNick + "' AND id = " + id; DataTable dt1 = utils.ExecuteDataTable(sql); if (dt1.Rows[0]["showtype"].ToString() == "0") { //更新下架商品数据 shopcat = dt1.Rows[0][0].ToString(); query = dt1.Rows[0][1].ToString(); taobaoNick = dt1.Rows[0][2].ToString(); //获取新商品列表 TopXmlRestClient clientaa = new TopXmlRestClient("http://gw.api.taobao.com/router/rest", "12132145", "1fdd2aadd5e2ac2909db2967cbb71e7f"); ItemsOnsaleGetRequest request = new ItemsOnsaleGetRequest(); request.Fields = "num_iid,title,price,pic_url"; request.PageSize = 12; request.OrderBy = "list_time:desc"; request.OrderBy = "volume:desc"; if (shopcat != "0") { request.SellerCids = shopcat; } request.Q = query; //清理关联商品 sql = "DELETE FROM TopIdeaProduct WHERE ideaid = " + id; utils.ExecuteNonQuery(sql); //未登录用户不能获取小二下架或删除的商品-错误过滤,原因未知 try { PageList <Item> product = clientaa.ItemsOnsaleGet(request, session); for (int i = 0; i < product.Content.Count; i++) { sql = "INSERT INTO TopIdeaProduct (" + "itemid, " + "itemname, " + "itemprice, " + "itempicurl, " + "ideaid " + " ) VALUES ( " + " '" + product.Content[i].NumIid + "', " + " '" + product.Content[i].Title + "', " + " '" + product.Content[i].Price + "', " + " '" + product.Content[i].PicUrl + "', " + " '" + id + "' " + ") "; utils.ExecuteNonQuery(sql); } } catch { } } //清理关联商品 sql = "DELETE FROM TopIdeaProduct WHERE ideaid = " + id; utils.ExecuteNonQuery(sql); //清理广告缓存 CacheManager testcaching1 = CacheFactory.GetCacheManager(); if (testcaching1.Contains("cache_1_" + id)) { testcaching1.Remove("cache_1_" + id); } //更新广告图片 string folderPath = Server.MapPath("\\show\\folder\\" + MD5(taobaoNick) + "\\result_" + id + ".jpg"); if (File.Exists(folderPath)) { File.Delete(folderPath); } } utils.ExecuteNonQuery(sql); if (id != "" && id != "0") { //编辑模式,ID不变 } else { //插入模式,获取最新ID sql = "SELECT TOP 1 id FROM TopIdea WHERE nick = '" + taobaoNick + "' ORDER BY id DESC"; id = utils.ExecuteString(sql); } //获取符合结果集的相关商品并记录到本地数据库 TopXmlRestClient client = new TopXmlRestClient("http://gw.api.taobao.com/router/rest", "12132145", "1fdd2aadd5e2ac2909db2967cbb71e7f"); //如果为自动选择模式 if (type == "0") { ItemsOnsaleGetRequest request = new ItemsOnsaleGetRequest(); request.Fields = "num_iid,title,price,pic_url"; request.PageSize = 12; if (orderby == "new") { request.OrderBy = "list_time:desc"; } else if (orderby == "sale") { request.OrderBy = "volume:desc"; } if (shopcat != "0") { request.SellerCids = shopcat; } if (query != "0") { request.Q = query; } //未登录用户不能获取小二下架或删除的商品-错误过滤,原因未知 try { PageList <Item> product = client.ItemsOnsaleGet(request, session); for (int i = 0; i < product.Content.Count; i++) { sql = "INSERT INTO TopIdeaProduct (" + "itemid, " + "itemname, " + "itemprice, " + "itempicurl, " + "ideaid " + " ) VALUES ( " + " '" + product.Content[i].NumIid + "', " + " '" + product.Content[i].Title + "', " + " '" + product.Content[i].Price + "', " + " '" + product.Content[i].PicUrl + "', " + " '" + id + "' " + ") "; utils.ExecuteNonQuery(sql); } } catch { } } else { string[] arr = items.Split(','); List <Item> itemList = new List <Item>(); for (int i = 0; i < arr.Length; i++) { string strSPID = "29230000ea039296234e9d74d8d3d5b7"; string strSKEY = "2dsi35b3fdx050a41jufbnzirrlqd9kl"; string strUIN = taobaoNick; string strTOKEN = session; ApiClient clientQQ = new ApiClient(strSPID, strSKEY, Convert.ToInt32(strUIN), strTOKEN); //通过以下的接口函数添加这些参数 clientQQ.addParamInStringField("itemCode", arr[i]); clientQQ.invokeApi("http://api.paipai.com/item/getItem.xhtml?charset=utf-8"); string result = clientQQ.ToString(); Regex reg = new Regex(@"""itemName"":""([^""]*)"",[\s\S]*""itemPrice"":""([^""]*)"",[\s\S]*""picLink"":""([^""]*)"",", RegexOptions.IgnoreCase); MatchCollection match = reg.Matches(result); for (int j = 0; j < match.Count; j++) { sql = "INSERT INTO TopIdeaProduct (" + "itemid, " + "itemname, " + "itemprice, " + "itempicurl, " + "ideaid " + " ) VALUES ( " + " '" + arr[i] + "', " + " '" + match[j].Groups[1].ToString() + "', " + " '" + match[j].Groups[2].ToString() + "', " + " '" + match[j].Groups[3].ToString() + "', " + " '" + id + "' " + ") "; utils.ExecuteNonQuery(sql); } } } } //获取NICK的淘宝ID Cookie cookieNew = new Cookie(); string taobaoNickNew = cookieNew.getCookie("nick"); Rijndael_ encodeaa = new Rijndael_("tetesoft"); taobaoNickNew = encodeaa.Decrypt(taobaoNickNew); md5nick = MD5(taobaoNickNew); //string sqlNew = "SELECT sid FROM TopTaobaoShop WHERE nick = '" + taobaoNickNew + "'"; string sqlNew = "SELECT sellerUin FROM TopPaipaiShop WHERE sellerUin = '" + taobaoNickNew + "'"; DataTable dtNew = utils.ExecuteDataTable(sqlNew); if (dtNew.Rows.Count != 0) { nickid = "http://shop.paipai.com/" + dtNew.Rows[0][0].ToString(); } else { nickid = "http://www.paipai.com/"; } nickidEncode = "http://www.7fshop.com/click/?s=" + EncodeStr(new string[] { id, "0", nickid }); string sql112 = "SELECT * FROM TopIdea WHERE id = " + id; DataTable newdt1 = utils.ExecuteDataTable(sql112); if (newdt1.Rows.Count != 0) { tabletitle = newdt1.Rows[0]["name"].ToString(); size = newdt1.Rows[0]["size"].ToString(); } string num = string.Empty; string row = string.Empty; switch (size) { case "514*160": num = "5"; row = "5"; break; case "514*288": num = "10"; row = "5"; break; case "664*160": num = "6"; row = "6"; break; case "312*288": num = "6"; row = "3"; break; case "336*280": num = "4"; row = "2"; break; case "714*160": num = "7"; row = "7"; break; case "114*418": num = "3"; row = "1"; break; case "218*286": num = "4"; row = "2"; break; case "743*308": num = "4"; row = "4"; break; default: num = "4"; row = "4"; break; } //绑定商品列表 string sql11 = "SELECT TOP " + num + " *,'' AS html FROM TopIdeaProduct WHERE ideaid = " + id; DataTable newdt = utils.ExecuteDataTable(sql11); //加换行符 for (int i = 0; i < newdt.Rows.Count; i++) { if ((i + 1) % int.Parse(row) == 0) { newdt.Rows[i]["html"] = "</tr><tr>"; } } if (size != "743*308") { panel1.Visible = true; panel2.Visible = false; rptProduct.DataSource = newdt; rptProduct.DataBind(); } else { panel1.Visible = false; panel2.Visible = true; rptProduct2.DataSource = newdt; rptProduct2.DataBind(); } string[] arrNew = size.Split('*'); width = arrNew[0]; height = arrNew[1]; } catch { } }
/// <summary> /// 清除宝贝描述里面的活动页面 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Button4_Click(object sender, EventArgs e) { string appkey = "12159997"; string secret = "614e40bfdb96e9063031d1a9e56fbed5"; //上传到宝贝描述 TopXmlRestClient client = new TopXmlRestClient("http://gw.api.taobao.com/router/rest", appkey, secret); for (int j = 1; j <= 500; j++) { ItemsOnsaleGetRequest request = new ItemsOnsaleGetRequest(); request.Fields = "num_iid"; request.PageSize = 200; request.PageNo = j; PageList <Item> product = client.ItemsOnsaleGet(request, session); for (int i = 0; i < product.Content.Count; i++) { try { //获取商品详细 ItemGetRequest requestItem = new ItemGetRequest(); requestItem.Fields = "desc"; requestItem.NumIid = product.Content[i].NumIid; Item item = client.ItemGet(requestItem, session); //判断是否增加过该图片 string newcontent = CreateDescDel(item.Desc); //if (product.Content[i].NumIid.ToString() == "10002247109") //{ // Response.Write(item.Desc); // Response.Write("**************************************************"); // Response.Write(newcontent); // return; //} if (newcontent == "") { continue; } //更新宝贝描述 IDictionary <string, string> param = new Dictionary <string, string>(); param.Add("num_iid", product.Content[i].NumIid.ToString()); param.Add("desc", newcontent); string resultpro = Post("http://gw.api.taobao.com/router/rest", appkey, secret, "taobao.item.update", session, param); } catch { } } if (product.Content.Count < 200) { break; } } Response.Write("<script>alert('清除成功!');window.location.href='html.aspx';</script>"); Response.End(); }
private void BindData(string items, string adsid) { string html = string.Empty; string total = string.Empty; TopXmlRestClient client = new TopXmlRestClient("http://gw.api.taobao.com/router/rest", "12287381", "d3486dac8198ef01000e7bd4504601a4");//d3486dac8198ef01000e7bd4504601a4 if (type != "1") { ItemsOnsaleGetRequest request = new ItemsOnsaleGetRequest(); request.Fields = "num_iid,title,price,pic_url"; request.PageSize = 1; if (orderby == "new") { request.OrderBy = "list_time:desc"; } else if (orderby == "sale") { request.OrderBy = "volume:desc"; } if (shopcat != "0") { request.SellerCids = shopcat; } if (query != "0") { request.Q = query; } Cookie cookie = new Cookie(); string taobaoNick = cookie.getCookie("nick"); string session = cookie.getCookie("top_sessiongroupbuy"); PageList <Item> product = client.ItemsOnsaleGet(request, session); ItemGetRequest request1 = new ItemGetRequest(); request1.Fields = "num_iid,title,price,pic_url,desc"; request1.NumIid = product.Content[0].NumIid; Item product1 = client.ItemGet(request1); html = product1.Desc; } else { string itemId = items.Split(',')[0]; ItemGetRequest request = new ItemGetRequest(); request.Fields = "num_iid,title,price,pic_url,desc"; request.NumIid = long.Parse(itemId); Item product = client.ItemGet(request); //获取商品详细描述 html = product.Desc; } //获取广告代码 string adsHtml = "团购的HTML代码";// getAdsContent(ads); if (!Regex.IsMatch(html, @"<img alt=""tetesoft-area-start"" width=""0"" height=""0"">([\s\S]*)<img alt=""tetesoft-area-end"" width=""0"" height=""0"">")) { html += @"<img alt=""tetesoft-area-start"" width=""0"" height=""0"">" + adsHtml + @"<img alt=""tetesoft-area-end"" width=""0"" height=""0"">"; } else { html = Regex.Replace(html, @"<img alt=""tetesoft-area-start"" width=""0"" height=""0"">([\s\S]*)<img alt=""tetesoft-area-end"" width=""0"" height=""0"">", @"<img alt=""tetesoft-area-start"" width=""0"" height=""0"">" + adsHtml + @"<img alt=""tetesoft-area-end"" width=""0"" height=""0"">"); } lbView.InnerHtml = html; //Response.Write("搜索结果共计" + total + "个商品...<br>"); }
protected void Page_Load(object sender, EventArgs e) { //try //{ id = utils.NewRequest("id", Common.utils.RequestType.QueryString); if (id != "" && !utils.IsInt32(id)) { Response.Write("非法参数1"); Response.End(); return; } style = utils.NewRequest("style", Common.utils.RequestType.Form); size = utils.NewRequest("size", Common.utils.RequestType.Form); type = utils.NewRequest("type", Common.utils.RequestType.Form); orderby = utils.NewRequest("orderby", Common.utils.RequestType.Form); query = utils.NewRequest("query", Common.utils.RequestType.Form); shopcat = utils.NewRequest("shopcat", Common.utils.RequestType.Form); name = utils.NewRequest("name", Common.utils.RequestType.Form); items = utils.NewRequest("items", Common.utils.RequestType.Form); ads = utils.NewRequest("ads", Common.utils.RequestType.Form); string act = utils.NewRequest("act", Common.utils.RequestType.Form); if (act == "save") { TopXmlRestClient client = new TopXmlRestClient("http://gw.api.taobao.com/router/rest", "12132145", "1fdd2aadd5e2ac2909db2967cbb71e7f"); //提交更新到淘宝商品上去 if (type == "0") { ItemsOnsaleGetRequest request = new ItemsOnsaleGetRequest(); request.Fields = "num_iid,title,price,pic_url"; request.PageSize = 1; if (orderby == "new") { request.OrderBy = "list_time:desc"; } else if (orderby == "sale") { request.OrderBy = "volume:desc"; } if (shopcat != "0") { request.SellerCids = shopcat; } if (query != "0") { request.Q = query; } Cookie cookie = new Cookie(); string taobaoNick = cookie.getCookie("nick"); string session = cookie.getCookie("top_session"); PageList <Item> product = client.ItemsOnsaleGet(request, session); for (int i = 0; i < product.Content.Count; i++) { string newContent = BindData(product.Content[i].NumIid.ToString(), ads); UpdateProductInfo(product.Content[i].NumIid, newContent); break; } } else { string[] itemId = items.Split(','); for (int i = 0; i < itemId.Length; i++) { string newContent = BindData(itemId[i], ads); UpdateProductInfo(long.Parse(itemId[i]), newContent); break; } } } //} //catch { } }