/// <summary> /// 获取店铺信息 /// </summary> /// <param name="UserId"></param> /// <param name="ScoreId"></param> /// <returns></returns> internal tbShopInfo GetInfoFromTb(string NickName, int ScoreId) { tbShopInfo shopinfo = new tbShopInfo(); ITopClient client = new DefaultTopClient(StaticSystemConfig.soft.ApiURL, StaticSystemConfig.soft.AppKey, StaticSystemConfig.soft.AppSecret); ShopGetRequest req = new ShopGetRequest(); req.Fields = "sid,cid,title,nick,desc,bulletin,pic_path,created,modified"; req.Nick = NickName; ShopGetResponse response = client.Execute(req); Top.Api.Domain.Shop shop = response.Shop; shopinfo.Bulletin = shop.Bulletin; shopinfo.CateId = (int)shop.Cid; shopinfo.Created = DateTime.Parse(shop.Created); shopinfo.Desc = shop.Desc; shopinfo.Modified = DateTime.Parse(shop.Modified); shopinfo.NickName = shop.Nick; shopinfo.PicPath = shop.PicPath; shopinfo.Score = new tbShopScore(); shopinfo.Score.ScoreId = ScoreId; if (shop.ShopScore != null) { shopinfo.Score.ItemScore = shop.ShopScore.ItemScore; shopinfo.Score.ServiceScore = shop.ShopScore.ServiceScore; shopinfo.Score.DeliveryScore = shop.ShopScore.DeliveryScore; } shopinfo.TbShopId = (int)shop.Sid; shopinfo.Title = shop.Title; return(shopinfo); }
/// <summary> /// Get shop from Mall /// </summary> /// <param name="user"></param> /// <returns>Shop object</returns> public Shop GetShop(BUser user) { Shop shop = null; ShopGetRequest req = new ShopGetRequest(); req.Fields = "sid,cid,title,nick,desc,bulletin,pic_path,created,modified"; req.Nick = user.Mall_Name; ShopGetResponse response = client.Execute(req); if (response.IsError) { throw new KMJXCException("从" + this.MallType.Name + " 获取 " + user.Mall_Name + "的店铺信息失败"); } if (response.Shop != null) { shop = new Shop(); shop.Description = response.Shop.Desc; shop.Name = response.Shop.Title; shop.Mall_Shop_ID = response.Shop.Sid.ToString(); shop.Mall_Type_ID = this.MallType.ID; shop.Parent_Shop_ID = 0; shop.Shop_ID = 0; shop.User_ID = user.ID; } return(shop); }
/// <summary> /// 取得用户店铺基本信息 /// </summary> /// <param name="strkeywords">关键词</param> /// <returns>取得类目</returns> public ShopGetResponse TaobaoShopGet(EntityUser session, string fields) { var req = new ShopGetRequest { Nick = session.fSubUserName, Fields = fields }; var response = _client.Execute(req, session.fSession); return(response); }
/// <summary> /// 根据Nick获取店铺完整信息 /// </summary> public FullShopInfo GetFullShopInfoByNick(string nick) { ITopClient client = new TopRestClient("http://gw.api.taobao.com/router/rest", "12001666", "e121148ca8d31bc28a4743241b74c2bd", "json"); ShopGetRequest req = new ShopGetRequest(); req.Fields = "sid,cid,title,nick,desc,bulletin,pic_path,created,modified"; req.Nick = nick; Shop shop = client.Execute(req, new ShopJsonParser()); return GetFacadeObjectByDomain(shop); }
/// <summary> /// 根据卖家昵称获取店铺信息 /// </summary> /// <param name="nickName"></param> /// <returns></returns> public Shop GetShopByNickName(string nickName) { var req = new ShopGetRequest(); req.Fields = "sid,cid,title,nick,desc,bulletin,pic_path,created,modified,shop_score"; req.Nick = nickName; var response = _client.Execute(req); return(response.Shop); }
/// <summary> /// 根据Nick获取店铺完整信息 /// </summary> public FullShopInfo GetFullShopInfoByNick(string nick) { ITopClient client = new TopRestClient("http://gw.api.taobao.com/router/rest", "12001666", "e121148ca8d31bc28a4743241b74c2bd", "json"); ShopGetRequest req = new ShopGetRequest(); req.Fields = "sid,cid,title,nick,desc,bulletin,pic_path,created,modified"; req.Nick = nick; Shop shop = client.Execute(req, new ShopJsonParser()); return(GetFacadeObjectByDomain(shop)); }
/// <summary> /// 记录该会员的店铺信息 /// </summary> private void InsertUserInfo(string nick) { TopXmlRestClient client = new TopXmlRestClient("http://gw.api.taobao.com/router/rest", "21093339", "c1c22ba85fb91bd20279213ef7b9ee80"); //记录店铺基本信息 ShopGetRequest request = new ShopGetRequest(); request.Fields = "sid,cid,title,nick,desc,bulletin,pic_path,created,modified"; request.Nick = nick; Shop shop; try { shop = client.ShopGet(request); } catch { Response.Write("没有店铺的淘宝会员不可使用该应用,如果您想继续使用,请先去淘宝网开个属于您自己的店铺!<br> <a href='http://www.taobao.com/'>返回</a>"); Response.End(); return; } string ip = Request.UserHostAddress; //记录到本地数据库 string sql = "INSERT INTO TopTaobaoShop (" + "sid, " + "cid, " + "title, " + "nick, " + "[desc], " + "bulletin, " + "pic_path, " + "created, " + "modified, " + "shop_score, " + "ip, " + "session, " + "remain_count,refreshToken" + " ) VALUES ( " + " '" + shop.Sid + "', " + " '" + shop.Cid + "', " + " '" + shop.Title + "', " + " '" + shop.Nick + "', " + " '" + shop.Desc + "', " + " '" + shop.Bulletin + "', " + " '" + shop.PicPath + "', " + " '" + shop.Created + "', " + " '" + shop.Modified + "', " + " '" + shop.ShopScore + "', " + " '" + ip + "', " + " '" + top_session + "', " + " '" + shop.RemainCount + "','" + refreshToken + "'" + ") "; utils.ExecuteNonQuery(sql); }
public global::Top.Api.Domain.Shop Get(string parameter, int pageIndex, int pageNum, long total) { try { ITopClient client = TBManager.GetClient(); ShopGetRequest req = new ShopGetRequest(); req.Fields = "sid,cid,nick,title,desc,bulletin,pic_path,created,modified,shop_score"; req.Nick = Users.Nick; ShopGetResponse response = client.Execute(req, Users.SessionKey); return(response.Shop); } catch (Exception ex) { CHENGTUAN.Components.ExceptionReporter.WriteLog(ex, CHENGTUAN.Entity.ExceptionPostion.TBApply_Components); return(null); } }
private string GetShopTitle(string nick) { ITopClient client = GetProductTopClient(); ShopGetRequest req = new ShopGetRequest(); req.Fields = TopFieldsHelper.GetShopFields_OnlyTitle(); req.Nick = nick; User user = new User(); try { Shop shop = client.Execute <Shop>(req, new ShopJsonParser()); if (shop != null) { return(shop.Title); } } catch { } return(string.Empty); }
protected void lbtnSearch_Click(object sender, EventArgs e) { ITopClient client = GetProductTopClient(); ShopGetRequest req = new ShopGetRequest(); req.Fields = TopFieldsHelper.GetShopFields_Common(); req.Nick = txtKey.Text; try { Shop shop = client.Execute(req, new ShopJsonParser()); JavaScriptSerializer ser = new JavaScriptSerializer(); string json = ser.Serialize(shop); //JObject.FromObject(shop).ToString(); string arg = CompressionHelper.Compress(json); string url = "ImportShop2.aspx?Nick=" + Server.UrlEncode(txtKey.Text) + "&Shop=" + Server.UrlEncode(arg); Response.Redirect(url, false); } catch (Exception ex) { string msg = ex.Message; string arg = CompressionHelper.Compress(msg); string url = "ImportShop1.aspx?Nick=" + Server.UrlEncode(txtKey.Text) + "&ErrorMsg=" + Server.UrlEncode(arg); Response.Redirect(url, true); } }
protected void Page_Load(object sender, EventArgs e) { TopXmlRestClient client = new TopXmlRestClient("http://gw.api.tbsandbox.com/router/rest", "test", "test"); //UserGetRequest request = new UserGetRequest(); //request.Fields = "buyer_credit"; //request.Nick = "golddonkey"; //Taobao.Top.Api.Domain.User user = client.UserGet(request); //Response.Write(user.BuyerCredit.Score); //ProductsGetRequest request = new ProductsGetRequest(); //request.Fields = "product_id,name,pic_url,shop_price"; //request.Nick = "golddonkey"; //PageList<Product> product = client.ProductsGet(request); //Response.Write(product.Content.Count); //test.DataSource = product.Content; //test.DataBind(); ShopGetRequest request = new ShopGetRequest(); request.Fields = "title"; request.Nick = "golddonkey"; Shop shop = client.ShopGet(request); Response.Write(shop.Title); }
/// <summary> /// 记录该会员的店铺信息 /// </summary> private void InsertUserInfo(string nick) { TopXmlRestClient client = new TopXmlRestClient("http://gw.api.taobao.com/router/rest", "12159997", "614e40bfdb96e9063031d1a9e56fbed5"); //记录店铺基本信息 string ip = Request.UserHostAddress; ShopGetRequest request = new ShopGetRequest(); request.Fields = "sid,cid,title,nick,desc,bulletin,pic_path,created,modified"; request.Nick = nick; Shop shop; try { shop = client.ShopGet(request); } catch { Response.Write("没有店铺的淘宝会员不可使用该应用,如果您想继续使用,请先去淘宝网开个属于您自己的店铺!<br> <a href='http://www.taobao.com/'>返回</a>"); Response.End(); return; } //获取版本号 string appkey = "12159997"; string secret = "614e40bfdb96e9063031d1a9e56fbed5"; string version = "9"; IDictionary <string, string> param = new Dictionary <string, string>(); param.Add("article_code", "service-0-22904"); param.Add("nick", nick); Common.Cookie cookie = new Common.Cookie(); string result = PostJson("http://gw.api.taobao.com/router/rest", appkey, secret, "taobao.vas.subscribe.get", top_session, param); if (result.IndexOf("\"article_user_subscribes\":{}") == -1) { Regex reg = new Regex(@"""item_code"":""([^""]*)""", RegexOptions.IgnoreCase); //更新店铺的版本号 MatchCollection match = reg.Matches(result); for (int j = 0; j < match.Count; j++) { version = match[j].Groups[1].ToString().Replace("service-0-22904-", ""); if (version == "9") { version = "3"; } if (int.Parse(version) <= 3) { break; } } } string plus = string.Empty; if (version == "1") { version = "2"; } if (version == "2") { plus = "freecard"; } if (version == "3") { plus = "crm|freecard"; } string tuiguang = cookie.getCookie("tuiguang"); string istui = "0"; if (tuiguang != null && tuiguang != "") { istui = "1"; } //记录到本地数据库 string sql = "INSERT INTO TCS_ShopSession (" + "sid, " + "nick, " + "typ, " + "version, " + "plus, " + "token, " + "ip, " + "istui, " + "session" + " ) VALUES ( " + " '" + shop.Sid + "', " + " '" + shop.Nick + "', " + " 'taobao', " + " '" + version + "', " + " '" + plus + "', " + " '" + refreshToken + "', " + " '" + ip + "', " + " '" + istui + "', " + " '" + top_session + "' " + ") "; utils.ExecuteNonQuery(sql); //如果是好友推荐来的,记录到推荐数据库 string tuijianid = cookie.getCookie("tuijianid"); if (tuijianid != null && tuijianid != "") { Rijndael_ encode = new Rijndael_("tetesoft"); string nickFrom = encode.Decrypt(tuijianid); sql = "SELECT COUNT(*) FROM TCS_Tuijian WHERE nickfrom = '" + nickFrom + "' AND nickto = '" + shop.Nick + "'"; string count = utils.ExecuteString(sql); if (count != "0") { return; } sql = "INSERT INTO TCS_Tuijian (" + "nickfrom, " + "nickto " + " ) VALUES ( " + " '" + nickFrom + "', " + " '" + shop.Nick + "' " + ") "; utils.ExecuteNonQuery(sql); string giftMsg = "80"; //插入充值记录并更新短信条数 sql = "INSERT INTO TCS_PayLog (" + "typ, " + "enddate, " + "nick, " + "count " + " ) VALUES ( " + " '推荐好友【" + shop.Nick + "】赠送80条短信', " + " GETDATE(), " + " '" + nickFrom + "', " + " '" + giftMsg + "' " + ") "; utils.ExecuteNonQuery(sql); sql = "UPDATE TCS_ShopConfig SET total = total + " + giftMsg + " WHERE nick = '" + nickFrom + "'"; utils.ExecuteNonQuery(sql); } }
/// <summary> /// 记录该会员的店铺信息 /// </summary> private void InsertUserInfo(string nick) { TopXmlRestClient client = new TopXmlRestClient("http://gw.api.taobao.com/router/rest", "12287381", "d3486dac8198ef01000e7bd4504601a4"); //记录店铺基本信息 ShopGetRequest request = new ShopGetRequest(); request.Fields = "sid,cid,title,nick,desc,bulletin,pic_path,created,modified"; request.Nick = nick; Shop shop = client.ShopGet(request); //记录到本地数据库 string sql = "INSERT INTO TopTaobaoShop (" + "sid, " + "cid, " + "title, " + "nick, " + "[desc], " + "bulletin, " + "pic_path, " + "created, " + "modified, " + "shop_score, " + "remain_count " + " ) VALUES ( " + " '" + shop.Sid + "', " + " '" + shop.Cid + "', " + " '" + shop.Title + "', " + " '" + shop.Nick + "', " + " '" + shop.Desc + "', " + " '" + shop.Bulletin + "', " + " '" + shop.PicPath + "', " + " '" + shop.Created + "', " + " '" + shop.Modified + "', " + " '" + shop.ShopScore + "', " + " '" + shop.RemainCount + "' " + ") "; utils.ExecuteNonQuery(sql); //记录店铺分类信息 SellercatsListGetRequest request1 = new SellercatsListGetRequest(); request1.Fields = "cid,parent_cid,name,is_parent"; request1.Nick = nick; PageList <SellerCat> cat = client.SellercatsListGet(request1); 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 + "', " + " '" + nick + "', " + " '" + cat.Content[i].Modified + "' " + ") "; utils.ExecuteNonQuery(sql); } //记录店铺所有商品信息-暂不记录 }
private string GetShopTitle(string nick) { ITopClient client = GetProductTopClient(); ShopGetRequest req = new ShopGetRequest(); req.Fields = TopFieldsHelper.GetShopFields_OnlyTitle(); req.Nick = nick; User user = new User(); try { Shop shop = client.Execute<Shop>(req, new ShopJsonParser()); if (shop != null) { return shop.Title; } } catch { } return string.Empty; }
/// <summary> /// Get shop from Mall /// </summary> /// <param name="user"></param> /// <returns>Shop object</returns> public Shop GetShop(BUser user) { Shop shop = null; ShopGetRequest req = new ShopGetRequest(); req.Fields = "sid,cid,title,nick,desc,bulletin,pic_path,created,modified"; req.Nick = user.Mall_Name; ShopGetResponse response = client.Execute(req); if (response.IsError) { throw new KMJXCException("从"+this.MallType.Name+" 获取 "+user.Mall_Name +"的店铺信息失败"); } if (response.Shop != null) { shop = new Shop(); shop.Description = response.Shop.Desc; shop.Name = response.Shop.Title; shop.Mall_Shop_ID = response.Shop.Sid.ToString(); shop.Mall_Type_ID = this.MallType.ID; shop.Parent_Shop_ID = 0; shop.Shop_ID = 0; shop.User_ID = user.ID; } return shop; }
/// <summary> /// 记录该会员的店铺信息 /// </summary> private void InsertUserInfo(string nick) { TopXmlRestClient client = new TopXmlRestClient("http://gw.api.taobao.com/router/rest", top_appkey, app_secret); //记录店铺基本信息 string ip = Request.UserHostAddress; ShopGetRequest request = new ShopGetRequest(); request.Fields = "sid,cid,title,nick,desc,bulletin,pic_path,created,modified"; request.Nick = nick; Shop shop; try { shop = client.ShopGet(request); } catch { Response.Write("没有店铺的淘宝会员不可使用该应用,如果您想继续使用,请先去淘宝网开个属于您自己的店铺!<br> <a href='http://www.taobao.com/'>返回</a>"); Response.End(); return; } //获取版本号 string version = "9"; //IDictionary<string, string> param = new Dictionary<string, string>(); //param.Add("article_code", "service-0-22904"); //param.Add("nick", nick); //string result = PostJson("http://gw.api.taobao.com/router/rest", top_appkey, app_secret, "taobao.vas.subscribe.get", top_session, param); //if (result.IndexOf("\"article_user_subscribes\":{}") == -1) //{ // Regex reg = new Regex(@"""item_code"":""([^""]*)""", RegexOptions.IgnoreCase); // //更新店铺的版本号 // MatchCollection match = reg.Matches(result); // for (int j = 0; j < match.Count; j++) // { // version = match[j].Groups[1].ToString().Replace("service-0-22904-", ""); // if (version == "9") // { // version = "3"; // } // if (int.Parse(version) <= 3) // { // break; // } // } //} //记录到本地数据库 string sql = "INSERT INTO TCS_ShopSession (" + "sid, " + "nick, " + "typ, " + "version, " + "session" + " ) VALUES ( " + " '" + shop.Sid + "', " + " '" + shop.Nick + "', " + " 'taobao', " + " '" + version + "', " + " '" + top_session + "' " + ") "; utils.ExecuteNonQuery(sql); }
/// <summary> /// 记录该会员的店铺信息 /// </summary> private void InsertUserInfo(string nick) { TopXmlRestClient client = new TopXmlRestClient("http://gw.api.taobao.com/router/rest", "12159997", "614e40bfdb96e9063031d1a9e56fbed5"); //记录店铺基本信息 ShopGetRequest request = new ShopGetRequest(); request.Fields = "sid,cid,title,nick,desc,bulletin,pic_path,created,modified"; request.Nick = nick; Shop shop; try { shop = client.ShopGet(request); } catch { Response.Write("没有店铺的淘宝会员不可使用该应用,如果您想继续使用,请先去淘宝网开个属于您自己的店铺!<br> <a href='http://www.taobao.com/'>返回</a>"); Response.End(); return; } //记录到本地数据库 string sql = "INSERT INTO TopTaobaoShop (" + "sid, " + "cid, " + "title, " + "nick, " + "[desc], " + "bulletin, " + "pic_path, " + "created, " + "modified, " + "shop_score, " + "versionNo, " + "remain_count " + " ) VALUES ( " + " '" + shop.Sid + "', " + " '" + shop.Cid + "', " + " '" + shop.Title + "', " + " '" + shop.Nick + "', " + " '" + shop.Desc + "', " + " '" + shop.Bulletin + "', " + " '" + shop.PicPath + "', " + " '" + shop.Created + "', " + " '" + shop.Modified + "', " + " '" + shop.ShopScore + "', " + " '" + versionNo + "', " + " '" + shop.RemainCount + "' " + ") "; utils.ExecuteNonQuery(sql); //记录店铺分类信息 SellercatsListGetRequest request1 = new SellercatsListGetRequest(); request1.Fields = "cid,parent_cid,name,is_parent"; request1.Nick = nick; PageList <SellerCat> cat = client.SellercatsListGet(request1); 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 + "', " + " '" + nick + "', " + " '" + cat.Content[i].Modified + "' " + ") "; utils.ExecuteNonQuery(sql); } //记录店铺所有商品信息-暂不记录 }
/// <summary> /// 获取一条复制的宝贝 /// </summary> /// <returns></returns> public void Getids() { string shoptype = string.Empty; //复制类型 DataTable dt = sql.ExecuteDataTable("select * from crm_productscopy where state='4' and shoptype='0' "); //获取未处理的宝贝,id复制 //DataTable dt = sql.ExecuteDataTable("select * from crm_productscopy where state='0' and shoptype='0' and sellderid like '%" + textBox1.Text.ToString().Trim() + "'");//获取未处理的宝贝,id复制 //DataTable dt = sql.ExecuteDataTable("select * from crm_productscopy where state='0' and shoptype='1' and sellderid like '%" + textBox1.Text.ToString().Trim() + "'");//获取未处理的宝贝,全店复制 //#region 异常任务重新复制 //DataTable dt = sql.ExecuteDataTable("select * from crm_productscopychild WHERE TIMESTAMPDIFF(MINUTE,addtime,now())>100 and addtime is not null and state=0"); //if (dt != null) //{ // foreach (DataRow dr in dt.Rows) // { // this.listBox1.Items.Insert(0, "【" + sellderid + "】【单个宝贝id:" + dr["id"].ToString() + "】【任务ID:" + dr["pid"].ToString() + "】重新复制(" + DateTime.Now.ToString() + ")"); // sql.ExecuteNonQuery("delete from crm_productscopychild where id='" + dr["id"].ToString() + "'"); // sql.ExecuteNonQuery("update crm_productscopy set state=0 where id='" + dr["pid"].ToString() + "'"); // } //} //#endregion #region 制功能 //DataTable dt = sql.ExecuteDataTable("select * from crm_productscopy where state='0' and shoptype='1' and sellderid like '%"+textBox1.Text.ToString().Trim()+"'");//获取未处理的宝贝,全店复制 Copy cp = new Copy(); TmallCopy tc = new TmallCopy(); string ids = string.Empty; if (dt != null && dt.Rows.Count > 0) { int couts = 0; cp.dt = dt; tc.dt = dt; sellderid = dt.Rows[0]["sellderid"].ToString(); string uid = dt.Rows[0]["sellderid"].ToString(); string useplatform = dt.Rows[0]["useplatform"].ToString(); cp.useplatform = Convert.ToInt32(useplatform); tc.useplatform = Convert.ToInt32(useplatform); // DataTable dt1 = sql1.ExecuteDataTable("select * from crm_sellerinfo where userid='" + uid + "'") DataTable dt1 = null; if (useplatform == "2") { dt1 = dbsp.ExecuteDataTable("select * from crm_sellerinfo where userid='" + uid + "'"); } else { dt1 = sql1.ExecuteDataTable("select * from crm_sellerinfo where userid='" + uid + "'"); } cp.sessionKey = dt1.Rows[0]["SessionKey"].ToString(); tc.sessionKey = dt1.Rows[0]["SessionKey"].ToString(); //cp.sessionKey = "6201a25e36ce1973ce987c52b05163a6egi61aZZf135ab61805984332"; // tc.sessionKey = "61011132b3c5a6d3941df1260bZZ477b572153033640b952769513611"; ids = dt.Rows[0]["oldid"].ToString(); shoptype = dt.Rows[0]["shoptype"].ToString();//0:id复制,1:全店复制 if (shoptype == "1") { ShopGetRequest req = new ShopGetRequest(); req.Fields = "sid,cid,title,nick,desc,bulletin,pic_path,created,modified"; req.Nick = ids; ShopGetResponse rsp = TopClient.Execute(req); if (rsp.Shop != null) { string url = "https://shop" + rsp.Shop.Sid + ".taobao.com/"; cp.GetIds(url); ids = cp.ids; //writlog("ids", ids); } } if (ids.Contains(",")) { couts = ids.Substring(ids.Length - 1) == "," ? ids.Split(',').Length - 1 : ids.Split(',').Length; } else { couts = 1; } sql.ExecuteNonQuery("update crm_productscopy set state='3',nums='" + (couts > 500 ? 500 : couts) + "' where id='" + dt.Rows[0]["id"].ToString() + "'"); int nums = 0; //当前执行的总数量 string stype = dt1.Rows[0]["shopType"].ToString(); //b店 or C店 // string stype = "B"; if (ids.Contains(",")) { string[] aa = ids.Split(','); foreach (string id in aa) { if ((sql.ExecuteDataTable("select id from crm_productscopychild where bbid='" + id + "' ")).Rows.Count == 0) { nums = nums + 1; } if (nums == 0) { nums = Convert.ToInt32((sql.ExecuteDataTable("select id from crm_productscopychild where pid='" + dt.Rows[0]["id"].ToString() + "'")).Rows.Count); } if (nums > 500) { //this.listBox1.Items.Insert(0, nums + ":0:" + dt.Rows[0]["id"].ToString()); this.listBox1.Items.Insert(0, "【" + sellderid + "】【已复制500个宝贝】"); break; } //if (aa.Length > 500) //{ // if (aa[500].ToString() == id) // { // //this.listBox1.Items.Insert(0, nums+":1"); // this.listBox1.Items.Insert(0, "【" + sellderid + "】【已复制500个宝贝】"); // break; // } //} if (dt.Rows[0]["oldid"].ToString() == "大牌小价01") { sql.ExecuteNonQuery("insert into crm_productscopychild(id,pid,bbid,state,addtime,remark) values ('" + Guid.NewGuid().ToString() + "','" + dt.Rows[0]["id"].ToString() + "','" + id + "','2','" + System.DateTime.Now.ToString() + "','因类目调整当前类目已被淘宝网关闭,请您将商品发布在其他相应类目下, 本类目已不能发布商品, 请移至其他类目进行发布!')"); } else { if (!string.IsNullOrWhiteSpace(id)) { if (checkid(id, dt.Rows[0]["id"].ToString(), dt.Rows[0]["is_gl"].ToString())) { string a = AddChildCopy(id, dt.Rows[0]["id"].ToString(), shoptype, sellderid, dt.Rows[0]["is_gl"].ToString()); if (a != "0")//添加宝贝复制 { this.listBox1.Items.Insert(0, "【" + sellderid + "】【任务ID:" + a + "】开始复制(" + DateTime.Now.ToString() + ")"); if (stype == "B") { try { tc.AddTaobao(id, a, sellderid, this.textBox1.Text); } catch (Exception ex) { writlog("copy", ex.ToString()); } } else { //tc.AddTaobao(id, a, sellderid); try { cp.AddTaobao(id, a, sellderid, this.textBox1.Text); } catch (Exception ex) { writlog("copy", ex.ToString()); } } this.listBox1.Items.Insert(0, "【" + sellderid + "】【任务ID:" + a + "】复制成功(" + DateTime.Now.ToString() + ")"); } } } } } } else { string a = AddChildCopy(ids, dt.Rows[0]["id"].ToString(), shoptype, sellderid, dt.Rows[0]["is_gl"].ToString()); if (a != "0")//添加宝贝复制 { this.listBox1.Items.Insert(0, "【" + sellderid + "】【任务ID:" + a + "】开始复制(" + DateTime.Now.ToString() + ")"); if (stype == "B") { tc.AddTaobao(ids, a, sellderid, this.textBox1.Text); } else { //tc.AddTaobao(ids, a, sellderid); cp.AddTaobao(ids, a, sellderid, this.textBox1.Text); } //cp.AddTaobao(ids, a, sellderid); this.listBox1.Items.Insert(0, "【" + sellderid + "】【任务ID:" + a + "】复制成功(" + DateTime.Now.ToString() + ")"); } //} } sql.ExecuteNonQuery("update crm_productscopy set state='1' where id='" + dt.Rows[0]["id"].ToString() + "'"); sql.ExecuteNonQuery("update crm_productscopychild set state='2' where id='" + dt.Rows[0]["id"].ToString() + "' and state='3' "); sql.ExecuteNonQuery("update crm_productscopychild set state='2' where id='" + dt.Rows[0]["id"].ToString() + "' and state='0' "); } #endregion }
/// <summary> /// 记录该会员的店铺信息 /// </summary> private void InsertUserInfo(string nick) { TopXmlRestClient client = new TopXmlRestClient("http://gw.api.taobao.com/router/rest", "12223169", "ff3d3442ab809930d187623ffad8e91e"); //记录店铺基本信息 string ip = Request.UserHostAddress; ShopGetRequest request = new ShopGetRequest(); request.Fields = "sid,cid,title,nick,desc,bulletin,pic_path,created,modified"; request.Nick = nick; Shop shop; try { shop = client.ShopGet(request); } catch { Response.Write("没有店铺的淘宝会员不可使用该应用,如果您想继续使用,请先去淘宝网开个属于您自己的店铺!<br> <a href='http://www.taobao.com/'>返回</a>"); Response.End(); return; } //记录到本地数据库 string sql = "INSERT INTO TopTaobaoShop (" + "sid, " + "cid, " + "title, " + "nick, " + "[desc], " + "bulletin, " + "pic_path, " + "created, " + "modified, " + "shop_score, " + "versionNo, " + "sessionblog, " + "ip, " + "remain_count " + " ) VALUES ( " + " '" + shop.Sid + "', " + " '" + shop.Cid + "', " + " '" + shop.Title + "', " + " '" + shop.Nick + "', " + " '" + shop.Desc + "', " + " '" + shop.Bulletin + "', " + " '" + shop.PicPath + "', " + " '" + shop.Created + "', " + " '" + shop.Modified + "', " + " '" + shop.ShopScore + "', " + " '" + versionNo + "', " + " '" + top_session + "', " + " '" + ip + "', " + " '" + shop.RemainCount + "' " + ") "; sql = "INSERT INTO TCS_ShopSession (" + "sid, " + "nick, " + "typ, " + "version, " + "session" + " ) VALUES ( " + " '" + shop.Sid + "', " + " '" + shop.Nick + "', " + " 'taobao', " + " '" + versionNo + "', " + " '" + top_session + "' " + ") "; utils.ExecuteNonQuery(sql); //记录店铺分类信息 /*SellercatsListGetRequest request1 = new SellercatsListGetRequest(); * request1.Fields = "cid,parent_cid,name,is_parent"; * request1.Nick = nick; * PageList<SellerCat> cat = client.SellercatsListGet(request1); * * 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 + "', " + * " '" + nick + "', " + * " '" + cat.Content[i].Modified + "' " + * ") "; * utils.ExecuteNonQuery(sql); * } */ //记录店铺所有商品信息-暂不记录 }