/// <summary> /// 当日关建字流量 /// </summary> public void NowKeyWordsgetai() { int HourNumber = DateTime.Now.Hour; PostServer.Getcookie = FPPcokk.ToString(); string KKurl = "https://sycm.taobao.com/mc/rivalItem/analysis/getLiveKeywords.json?dateRange=" + CDateTime + "%7C" + CDateTime + "&dateType=today&pageSize=20&page=1&device=2&sellerType=0&cateId=" + CcateId + "&itemId=" + CItemid + "&topType=flow&indexCode=uv"; PostServer.GetHTTPTaobaoTID(KKurl, TID, "https://sycm.taobao.com/mc/ci/item/analysis?"); string gHtml = PostServer.GetHtml; JObject EJson = (JObject)JsonConvert.DeserializeObject(gHtml); string strJson = EJson["data"].ToString(); Etrace EtrJson = new Etrace(); string ToJson = EtrJson.stringJson(strJson); JObject json = (JObject)JsonConvert.DeserializeObject(ToJson); string zone = json["data"].ToString(); DataTable kew = CLDataTable("关键字", "访客"); JArray results = JArray.Parse(zone); DataRow dr = null; for (int i = 0; i < results.Count; i++) { dr = kew.NewRow(); string keyshopName = results[i]["keyword"]["value"].ToString(); dr["关键字"] = keyshopName; dr["访客"] = int.Parse(results[i]["uv"]["value"].ToString()); kew.Rows.Add(dr); } ultraGridcnt.DataSource = kew; }
public void GetshopCar() { string KCDateTime = DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd"); PostServer.Getcookie = FPPcokk.ToString(); string strpayRateIndex = "https://sycm.taobao.com/mc/mq/mkt/rank/item/hotpurpose.json?dateRange=" + KCDateTime + "%7C" + KCDateTime + "&dateType=day&pageSize=50&page=1&order=desc&orderBy=cartHits&cateId=350404&device=0&sellerType=-1&indexCode=cateRankId%2CcltHits%2CcartHits%2CtradeIndex&_=1536297303197&token="; //PostServer.GetHTTPTaobao(strpayRateIndex); //string txpayRateIndex = PostServer.GetHtml; PostServer.GetHTTPTaobaoTID(strpayRateIndex, TTid); string txpayRateIndex = PostServer.GetHtml; JObject EJson = (JObject)JsonConvert.DeserializeObject(txpayRateIndex); string strJson = EJson["data"].ToString(); Etrace EtrJson = new Etrace(); string ToJson = EtrJson.stringJson(strJson); JObject json = (JObject)JsonConvert.DeserializeObject(ToJson); string zone = json["data"].ToString(); // ShowInfo(zone); JArray results = JArray.Parse(zone); for (int i = 0; i < results.Count; i++) { string citemid, ctitle, cuvIndex; citemid = results[i]["item"]["itemId"].ToString(); ctitle = results[i]["shop"]["title"].ToString(); cuvIndex = results[i]["cltHits"]["value"].ToString(); string Sql = "INSERT INTO [Dp_shopindex]([ItemID],[shopname],[uvIndex],[indexdate])VALUES('" + citemid + "','" + ctitle + "'," + Math.Ceiling(decimal.Parse(cuvIndex)) + ",'" + CDateTime + "')"; Ms.ExeSQLNonQuery(Sql); } }
public void GetshopCar(string URLA, string regURLA) { string KCDateTime = DateTime.Now.ToString("yyyy-MM-dd"); PostServer.Getcookie = FPPcokk.ToString(); PostServer.GetHTTPTaobaoTID(URLA, TTid, regURLA); string txpayRateIndex = PostServer.GetHtml; JObject EJson = (JObject)JsonConvert.DeserializeObject(txpayRateIndex); string strJson = EJson["data"].ToString(); Etrace EtrJson = new Etrace(); string ToJson = EtrJson.stringJson(strJson); JObject json = (JObject)JsonConvert.DeserializeObject(ToJson); string zone = json["data"].ToString(); JArray results = JArray.Parse(zone); for (int i = 0; i < results.Count; i++) { string citemid, ctitle, cuvIndex, cpicUrl; citemid = results[i]["itemId"].ToString(); ctitle = results[i]["shopName"].ToString(); cuvIndex = results[i]["payItmCnt"].ToString(); cpicUrl = "https:" + results[i]["picUrl"].ToString(); string Sql = "INSERT INTO [Dp_shopindex]([ItemID],[shopname],[uvIndex],[indexdate],[picUrl])VALUES('" + citemid + "','" + ctitle + "'," + Math.Ceiling(decimal.Parse(cuvIndex)) + ",'" + CDateTime + "','" + cpicUrl + "')"; Ms.ExeSQLNonQuery(Sql); string SqlB = "INSERT INTO [DayDPAllListNumber]([shopName],[HouNumber],[typeID],[ItemID],[DItemdate],[daytypeid])VALUES('" + citemid + ctitle + "'," + Math.Ceiling(decimal.Parse(cuvIndex)) + ",'昨日','" + citemid + "','" + CDateTime + "'," + 1 + ")"; Ms.ExeSQLNonQuery(SqlB); } }
/// <summary> /// 流量汇总 /// </summary> public void getallList() { int HourNumber = DateTime.Now.Hour; DataTable shoptable = new DataTable(); string Sqlshop = "SELECT [ItemID] ,[shopname],[uvIndex] ,[indexdate] FROM [Dp_shopindex] where indexdate='" + CDateTime + "'"; shoptable = Ms.runSQLDataSet(Sqlshop, "ss").Tables[0]; string Sqldels = "delete from DPrivalItem where getdate='" + CDateTime + "'"; Ms.ExeSQLNonQuery(Sqldels); foreach (DataRow keydr in shoptable.Rows) { PostServer.Getcookie = FPPcokk.ToString(); string CcateId, CItemid, CshopName; CItemid = keydr["itemid"].ToString(); CshopName = keydr["shopname"].ToString(); CcateId = "50012100"; string strpayRateIndex = "https://sycm.taobao.com/mc/rivalItem/analysis/getLiveCoreIndexes.json?dateType=today&dateRange=" + CDateTime + "%7C" + CDateTime + "&device=2&cateId=" + CcateId + "&rivalItem1Id=" + CItemid + "&_=1535966409385&token="; //PostServer.GetHTTPTaobao(strpayRateIndex); //string txpayRateIndex = PostServer.GetHtml; PostServer.GetHTTPTaobaoTID(strpayRateIndex, TTid); string txpayRateIndex = PostServer.GetHtml; JObject EJson = (JObject)JsonConvert.DeserializeObject(txpayRateIndex); string strJson = EJson["data"].ToString(); Etrace EtrJson = new Etrace(); string ToJson = EtrJson.stringJson(strJson); JObject json = (JObject)JsonConvert.DeserializeObject(ToJson); decimal cartHits = 0; decimal cltHits = 0; decimal payItemCnt = 0; decimal payRateIndex = 0; decimal seIpvUvHits = 0; decimal tradeIndex = 0; decimal uvIndex = 0; string itemid = "2342323423"; string shopName = "景宏"; cartHits = decimal.Parse(json["data"]["rivalItem1"]["cartHits"]["value"].ToString()); cltHits = decimal.Parse(json["data"]["rivalItem1"]["cltHits"]["value"].ToString()); payItemCnt = decimal.Parse(json["data"]["rivalItem1"]["payItemCnt"]["value"].ToString()); payRateIndex = decimal.Parse(json["data"]["rivalItem1"]["payRateIndex"]["value"].ToString()); seIpvUvHits = decimal.Parse(json["data"]["rivalItem1"]["seIpvUvHits"]["value"].ToString()); tradeIndex = decimal.Parse(json["data"]["rivalItem1"]["tradeIndex"]["value"].ToString()); uvIndex = decimal.Parse(json["data"]["rivalItem1"]["uvIndex"]["value"].ToString()); itemid = CItemid; shopName = CshopName; string Sqltxt = "INSERT INTO [DPrivalItem] ([cartHits] ,[cltHits] ,[payItemCnt],[payRateIndex] ,[seIpvUvHits] ,[tradeIndex] ,[uvIndex] ,[itemid] ,[shopName],[getdate])VALUES (" + cartHits + "," + cltHits + "," + payItemCnt + "," + payRateIndex + "," + seIpvUvHits + "," + tradeIndex + "," + uvIndex + ",'" + itemid + "','" + shopName + "','" + CDateTime + "')"; Ms.ExeSQLNonQuery(Sqltxt); } //string sqlU = "Select payItemCnt,itemid,shopName from DPrivalItem where getdate='" + CDateTime + "'"; //ultraGrid1.DataSource = Ms.runSQLDataSet(sqlU, "ss"); }
private void button2_Click(object sender, EventArgs e) { string strJson = this.textBox1.Text; Etrace EtrJson = new Etrace(); string ToJson = EtrJson.stringJson(strJson); textBox1.Text = ToJson; }
public void ListYY() { int HourNumber = DateTime.Now.Hour; DataTable shoptable = new DataTable(); string Sqlshop = "select itemid,shopname,IDshopName from dp_shop"; shoptable = Ms.runSQLDataSet(Sqlshop, "ss").Tables[0]; foreach (DataRow keydr in shoptable.Rows) { PostServer.Getcookie = FPPcokk.ToString(); string CcateId, CItemid, CshopName; CItemid = keydr["itemid"].ToString(); CshopName = keydr["itemid"].ToString() + keydr["shopname"].ToString(); CcateId = "50012100"; string strpayRateIndex = "https://sycm.taobao.com/mc/rivalItem/analysis/getLiveFlowSource.json?device=2&cateId=" + CcateId + "&rivalItem1Id=" + CItemid + "&dateType=today&dateRange=" + CDateTime + "%7C" + CDateTime + "&indexCode=uv&orderBy=uv&order=desc&_=1535785900902&token="; // string strpayRateIndex = "https://sycm.taobao.com/mc/rivalItem/analysis/getLiveCoreTrend.json?dateRange=" + CDateTime + "%7C" + CDateTime + "&dateType=today&device=2&sellerType=0&cateId=" + CcateId + "&itemId=" + CItemid + "&topType=flow&indexCode=uv&_=1535778429590&token="; // Thread.Sleep(10000); //PostServer.GetHTTPTaobao(strpayRateIndex); //string txpayRateIndex = PostServer.GetHtml; PostServer.GetHTTPTaobaoTID(strpayRateIndex, TTid, "https://sycm.taobao.com/mc/ci/shop/analysis?"); //PostServer.GetHTTPTaobaoTID(strpayRateIndex, TTid); string txpayRateIndex = PostServer.GetHtml; JObject EJson = (JObject)JsonConvert.DeserializeObject(txpayRateIndex); string strJson = EJson["data"].ToString(); Etrace EtrJson = new Etrace(); string ToJson = EtrJson.stringJson(strJson); JObject json = (JObject)JsonConvert.DeserializeObject(ToJson); //支付转化指数 string typeIDstr = ""; string jsonpayRateIndex = ""; jsonpayRateIndex = json["data"].ToString(); int NumberPayRate = 0; JArray payRateIndexJArray = JArray.Parse(jsonpayRateIndex); for (int i = 0; i < payRateIndexJArray.Count; i++) { typeIDstr = payRateIndexJArray[i]["pageName"]["value"].ToString(); NumberPayRate = int.Parse(payRateIndexJArray[i]["uv"]["value"].ToString()); // string Sql = "INSERT INTO [DPListNumber]([shopName],[DateHour],[HouNumber],[typeID],[ItemID],[DItemdate])VALUES('" + CshopName + "'," + i + "," + NumberPayRate + ",'" + typeIDstr + "','" + CItemid + "','" + CDateTime + "')"; string SqlA = "INSERT INTO [DPListNumber]([shopName],[DateHour],[HouNumber],[typeID],[ItemID],[DItemdate])VALUES('" + CshopName + "'," + HourNumber + "," + NumberPayRate + "-(SELECT isnull(SUM(houNumber),0) FROM dbo.DPListNumber where shopname='" + CshopName + "' and DateHour<" + HourNumber + " and typeid='" + typeIDstr + "' and ItemID='" + CItemid + "' and DItemdate='" + CDateTime + "'),'" + typeIDstr + "','" + CItemid + "','" + CDateTime + "')"; Ms.ExeSQLNonQuery(SqlA); } } }
/// <summary> /// 支付件数 /// </summary> public void PayList() { PostServer.Getcookie = FPPcokk.ToString(); string strpayRateIndex = "https://sycm.taobao.com/mc/rivalItem/analysis/getLiveCoreTrend.json?dateType=today&dateRange=" + CDateTime + "%7C" + CDateTime + "&indexCode=&device=2&cateId=" + CcateId + "&rivalItem1Id=" + CItemid + "&_=1535966409385&token="; // PostServer.GetHTTPTaobao(strpayRateIndex); // string txpayRateIndex = PostServer.GetHtml; PostServer.GetHTTPTaobaoTID(strpayRateIndex, TID, "https://sycm.taobao.com/mc/ci/item/analysis?"); string gHtml = PostServer.GetHtml; JObject EJson = (JObject)JsonConvert.DeserializeObject(gHtml); string strJson = EJson["data"].ToString(); Etrace EtrJson = new Etrace(); string ToJson = EtrJson.stringJson(strJson); JObject json = (JObject)JsonConvert.DeserializeObject(ToJson); string typeIDstr = ""; string jsonpayRateIndex = ""; jsonpayRateIndex = json["data"]["rivalItem1"]["payItemCnt"].ToString(); typeIDstr = "payItemCnt"; JArray payRateIndexJArray = JArray.Parse(jsonpayRateIndex); DataTable kew = CLPayDataTable("时间", "成交件数"); DataRow dr = null; for (int i = 0; i < payRateIndexJArray.Count; i++) { decimal NumberPayRate = 0; if (payRateIndexJArray[i].ToString() != "") { NumberPayRate = Math.Ceiling(decimal.Parse(payRateIndexJArray[i].ToString())); } else { NumberPayRate = 0; } dr = kew.NewRow(); dr["时间"] = i.ToString(); dr["成交件数"] = NumberPayRate; kew.Rows.Add(dr); } ultraGrid4.DataSource = kew; }
public void getKeywordList(string Key, string CDateTime, string CcateId, string CItemid, string CshopNameItemd) { int HourNumber = 0; PostServer.Getcookie = FPPcokk.ToString(); string KKurl = ""; if (Key == "uv") { KKurl = "https://sycm.taobao.com/mc/rivalItem/analysis/getKeywords.json?dateRange=" + CDateTime + "%7C" + CDateTime + "&dateType=day&pageSize=20&page=1&device=2&sellerType=0&cateId=" + CcateId + "&itemId=" + CItemid + "&topType=flow&indexCode=uv"; } if (Key == "tradeIndex") { KKurl = "https://sycm.taobao.com/mc/rivalItem/analysis/getKeywords.json?dateRange=" + CDateTime + "%7C" + CDateTime + "&dateType=day&pageSize=20&page=1&device=2&sellerType=0&cateId=" + CcateId + "&itemId=" + CItemid + "&topType=trade&indexCode=tradeIndex"; } PostServer.GetHTTPTaobaoTID(KKurl, TID, "https://sycm.taobao.com/mc/ci/item/analysis?"); string gHtml = PostServer.GetHtml; JObject EJson = (JObject)JsonConvert.DeserializeObject(gHtml); string strJson = EJson["data"].ToString(); Etrace EtrJson = new Etrace(); string ToJson = EtrJson.stringJson(strJson); if (ToJson.IndexOf("出错") > 0) { } else { //JObject json = (JObject)JsonConvert.DeserializeObject(ToJson); string zone = ToJson; //if (Key == "uv") //{ // zone = json["data"].ToString(); //} //if (Key == "tradeIndex") //{ // zone = json["data"].ToString(); //} JArray results = JArray.Parse(zone); for (int i = 0; i < results.Count; i++) { string shopNameID = ""; int Keynumber = 0; string Sql = ""; if (Key == "uv") { shopNameID = results[i]["keyword"]["value"].ToString();; Keynumber = int.Parse(results[i]["uv"]["value"].ToString()); Sql = "INSERT INTO [hqKeywordList]([shopName],[DateHour],[HouNumber],[ItemID],[DItemdate])VALUES('" + shopNameID + "'," + HourNumber + "," + Keynumber + ",'" + CshopNameItemd + "','" + CDateTime + "')"; } if (Key == "tradeIndex") { shopNameID = results[i]["keyword"]["value"].ToString(); decimal aa = decimal.Parse(results[i]["tradeIndex"]["value"].ToString()); decimal bb = Math.Round(aa, 0); int CC = int.Parse(bb.ToString()); Keynumber = int.Parse(bb.ToString()); int Paycn = poweint(Keynumber); Sql = "INSERT INTO [hqKeywordListCUS]([shopName],[DateHour],[HouNumber],[ItemID],[DItemdate])VALUES('" + shopNameID + "'," + CC + "," + Paycn + ",'" + CshopNameItemd + "','" + CDateTime + "')"; } Ms.ExeSQLNonQuery(Sql); } } }
/// <summary> /// 昨天流量来源 /// </summary> /// <param name="Key">访客</param> /// <param name="CDateTime">日期</param> /// <param name="CcateId">CID</param> /// <param name="CItemid">CItemid</param> /// <param name="CshopNameItemd">店铺和ID</param> public void getUVList(string Key, string CDateTime, string CcateId, string CItemid, string CshopNameItemd) { int HourNumber = 0; PostServer.Getcookie = FPPcokk.ToString(); string KKurl = ""; if (Key == "uv") { KKurl = "https://sycm.taobao.com/mc/rivalItem/analysis/getFlowSource.json?device=2&cateId=" + CcateId + "&rivalItem1Id=" + CItemid + "&dateType=day&dateRange=" + CDateTime + "%7C" + CDateTime + "&indexCode=" + Key + "&orderBy=" + Key + "&order=desc&_=1535785900902&token="; } if (Key == "payByrCntIndex") { KKurl = "https://sycm.taobao.com/mc/rivalItem/analysis/getFlowSource.json?device=2&cateId=" + CcateId + "&rivalItem1Id=" + CItemid + "&dateType=day&dateRange=" + CDateTime + "%7C" + CDateTime + "&indexCode=" + Key + "&orderBy=" + Key + "&order=desc&_=1535785900902&token="; } // PostServer.GetHTTPTaobao(KKurl); PostServer.GetHTTPTaobaoTID(KKurl, TID, "https://sycm.taobao.com/mc/ci/item/analysis?"); string gHtml = PostServer.GetHtml; JObject EJson = (JObject)JsonConvert.DeserializeObject(gHtml); string strJson = EJson["data"].ToString(); Etrace EtrJson = new Etrace(); string ToJson = EtrJson.stringJson(strJson); // JObject json = (JObject)JsonConvert.DeserializeObject(ToJson); string zone = ToJson; //if (Key == "uv") //{ // zone = json["data"].ToString(); //} //if (Key == "payByrCntIndex") //{ // zone = json["data"].ToString(); //} JArray results = JArray.Parse(zone); for (int i = 0; i < results.Count; i++) { string shopNameID = ""; int Keynumber = 50; string Sql = ""; if (Key == "uv") { shopNameID = results[i]["pageName"]["value"].ToString(); Keynumber = int.Parse(results[i]["uv"]["value"].ToString()); Sql = "INSERT INTO [hqUVList]([shopName],[DateHour],[HouNumber],[ItemID],[DItemdate])VALUES('" + shopNameID + "'," + HourNumber + "," + Keynumber + ",'" + CshopNameItemd + "','" + CDateTime + "')"; } if (Key == "payByrCntIndex") { shopNameID = results[i]["pageName"]["value"].ToString(); decimal aa = decimal.Parse(results[i]["rivalItem1PayByrCntIndex"]["value"].ToString()); decimal bb = Math.Round(aa, 0); int CC = int.Parse(bb.ToString()); Keynumber = int.Parse(bb.ToString()); int Paycn = poweint(Keynumber); Sql = "INSERT INTO [hqUVListCUS]([shopName],[DateHour],[HouNumber],[ItemID],[DItemdate])VALUES('" + shopNameID + "'," + CC + "," + Paycn + ",'" + CshopNameItemd + "','" + CDateTime + "')"; } Ms.ExeSQLNonQuery(Sql); } }
/// <summary> /// 大盘行情指数 /// </summary> public void getallList() { int HourNumber = DateTime.Now.Hour; DataTable shoptable = new DataTable(); string Sqlshop = "SELECT distinct top 70 [ItemID] ,[shopname],[uvIndex] ,[indexdate] FROM [Dp_shopindex] where indexdate='" + CDateTime + "' order by uvIndex desc"; shoptable = Ms.runSQLDataSet(Sqlshop, "ss").Tables[0]; string Sqldels = "delete from DPrivalItem where getdate='" + CDateTime + "'"; Ms.ExeSQLNonQuery(Sqldels); string SqlPE = "delete from DayDPAllListNumber where DItemdate='" + CDateTime + "' and daytypeid=" + 0 + ""; Ms.ExeSQLNonQuery(SqlPE); foreach (DataRow keydr in shoptable.Rows) { PostServer.Getcookie = FPPcokk.ToString(); string CcateId, CItemid, CshopName; CItemid = keydr["itemid"].ToString(); CshopName = keydr["shopname"].ToString(); CcateId = "50012100"; try { string strpayRateIndex = "https://sycm.taobao.com/mc/rivalItem/analysis/getLiveCoreIndexes.json?dateType=today&dateRange=" + CDateTime + "%7C" + CDateTime + "&device=2&cateId=" + CcateId + "&rivalItem1Id=" + CItemid + "&_=1535966409385&token="; PostServer.GetHTTPTaobaoTID(strpayRateIndex, TTid, "https://sycm.taobao.com/mc/ci/item/analysis?"); // PostServer.GetHTTPTaobao(strpayRateIndex); string txpayRateIndex = PostServer.GetHtml; JObject EJson = (JObject)JsonConvert.DeserializeObject(txpayRateIndex); string strJson = EJson["data"].ToString(); Etrace EtrJson = new Etrace(); string ToJson = EtrJson.stringJson(strJson); JObject json = (JObject)JsonConvert.DeserializeObject(ToJson); decimal cartHits = 0; decimal cltHits = 0; decimal payItemCnt = 0; decimal payRateIndex = 0; decimal seIpvUvHits = 0; decimal tradeIndex = 0; decimal uvIndex = 0; string itemid = "2342323423"; string shopName = "景宏"; cartHits = decimal.Parse(json["data"]["rivalItem1"]["cartHits"]["value"].ToString()); cltHits = decimal.Parse(json["data"]["rivalItem1"]["cltHits"]["value"].ToString()); payItemCnt = decimal.Parse(json["data"]["rivalItem1"]["payItemCnt"]["value"].ToString()); payRateIndex = decimal.Parse(json["data"]["rivalItem1"]["payRateIndex"]["value"].ToString()); seIpvUvHits = decimal.Parse(json["data"]["rivalItem1"]["seIpvUvHits"]["value"].ToString()); tradeIndex = decimal.Parse(json["data"]["rivalItem1"]["tradeIndex"]["value"].ToString()); uvIndex = decimal.Parse(json["data"]["rivalItem1"]["uvIndex"]["value"].ToString()); itemid = CItemid; shopName = CshopName; string SqlB = "INSERT INTO [DayDPAllListNumber]([shopName],[HouNumber],[typeID],[ItemID],[DItemdate],[daytypeid])VALUES('" + CItemid + shopName + "'," + payItemCnt + ",'今日','" + itemid + "','" + CDateTime + "'," + 0 + ")"; Ms.ExeSQLNonQuery(SqlB); string SqlC = "INSERT INTO [DayDPAllListNumber]([shopName],[HouNumber],[typeID],[ItemID],[DItemdate],[daytypeid])VALUES('" + CItemid + shopName + "'," + uvIndex + ",'流量指数','" + itemid + "','" + CDateTime + "'," + 0 + ")"; Ms.ExeSQLNonQuery(SqlC); string SqlD = "INSERT INTO [DayDPAllListNumber]([shopName],[HouNumber],[typeID],[ItemID],[DItemdate],[daytypeid])VALUES('" + CItemid + shopName + "'," + cartHits + ",'加购人气','" + itemid + "','" + CDateTime + "'," + 0 + ")"; Ms.ExeSQLNonQuery(SqlD); } catch (Exception) { label2.Text = CItemid + "-"; //MessageBox.Show(CItemid); } } }
public void DayList(int daytype) { int HourNumber = DateTime.Now.Hour; DataTable shoptable = new DataTable(); string Sqlshop = "SELECT distinct top 70 [ItemID] ,[shopname],[uvIndex] ,[indexdate] FROM [Dp_shopindex] where indexdate='" + CDateTime + "' order by uvIndex desc"; shoptable = Ms.runSQLDataSet(Sqlshop, "ss").Tables[0]; foreach (DataRow keydr in shoptable.Rows) { try { PostServer.Getcookie = FPPcokk.ToString(); string CcateId, CItemid, CshopName; CItemid = keydr["itemid"].ToString(); string SSHopNameat = keydr["shopname"].ToString(); CshopName = keydr["itemid"].ToString() + keydr["shopname"].ToString(); CcateId = "50012100"; string strpayRateIndex = ""; if (daytype == 0) { strpayRateIndex = "https://sycm.taobao.com/mc/rivalItem/analysis/getLiveFlowSource.json?device=2&cateId=" + CcateId + "&rivalItem1Id=" + CItemid + "&dateType=today&dateRange=" + CDateTime + "%7C" + CDateTime + "&indexCode=uv&orderBy=uv&order=desc&token="; } else { string Gday = DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd"); strpayRateIndex = "https://sycm.taobao.com/mc/rivalItem/analysis/getFlowSource.json?device=2&cateId=" + CcateId + "&rivalItem1Id=" + CItemid + "&dateType=day&dateRange=" + Gday + "%7C" + Gday + "&indexCode=uv&orderBy=uv&order=desc&token=;"; } PostServer.GetHTTPTaobaoTID(strpayRateIndex, TTid, "https://sycm.taobao.com/mc/ci/item/analysis?"); string txpayRateIndex = PostServer.GetHtml; JObject EJson = (JObject)JsonConvert.DeserializeObject(txpayRateIndex); string strJson = EJson["data"].ToString(); Etrace EtrJson = new Etrace(); string ToJson = EtrJson.stringJson(strJson); JObject json = (JObject)JsonConvert.DeserializeObject(ToJson); //支付转化指数 string typeIDstr = ""; string jsonpayRateIndex = ""; if (daytype == 0) { jsonpayRateIndex = json["data"].ToString(); } else { jsonpayRateIndex = json["data"].ToString(); } int NumberPayRate = 0; JArray payRateIndexJArray = JArray.Parse(jsonpayRateIndex); if (payRateIndexJArray.Count > 0) { for (int i = 0; i < 8; i++) { if (payRateIndexJArray.Count > i) { typeIDstr = payRateIndexJArray[i]["pageName"]["value"].ToString(); NumberPayRate = int.Parse(payRateIndexJArray[i]["uv"]["value"].ToString()); string SqlB = "INSERT INTO [DayDPAllListNumber]([shopName],[HouNumber],[typeID],[ItemID],[DItemdate],[daytypeid])VALUES('" + CshopName + "'," + NumberPayRate + ",'" + typeIDstr + "','" + CItemid + "','" + CDateTime + "'," + daytype + ")"; Ms.ExeSQLNonQuery(SqlB); } } } else { //this.textBox1.Text = this.textBox1.Text + CshopName; } } catch (Exception) { // throw; } } if (daytype == 0) { this.ultraGridall.DataSource = Ms.runSQLDataSet(txtSqlALLList(CDateTime, daytype).ToString(), "ss").Tables[0]; ultraGridall.DisplayLayout.Bands[0].Columns["shopname"].Header.Fixed = true; ultraGridall.DisplayLayout.Bands[0].Columns["shopname"].Header.Fixed = true; ultraGridall.DisplayLayout.Override.RowAlternateAppearance.BackColor = Color.AliceBlue; } else { } }
/// <summary> /// 成交大盘指数 /// </summary> public void Timegetai() { int HourNumber = DateTime.Now.Hour; DataTable shoptable = new DataTable(); string Sqlshop = "select itemid,shopname,IDshopName from dp_shop"; shoptable = Ms.runSQLDataSet(Sqlshop, "ss").Tables[0]; foreach (DataRow keydr in shoptable.Rows) { PostServer.Getcookie = FPPcokk.ToString(); string CcateId, CItemid, CshopName; CItemid = keydr["itemid"].ToString(); CshopName = keydr["itemid"].ToString() + keydr["shopname"].ToString(); CcateId = "50012100"; string strpayRateIndex = "https://sycm.taobao.com/mc/rivalItem/analysis/getLiveCoreTrend.json?dateType=today&dateRange=" + CDateTime + "%7C" + CDateTime + "&indexCode=&device=2&cateId=" + CcateId + "&rivalItem1Id=" + CItemid + "&_=1535966409385&token="; // string strpayRateIndex = "https://sycm.taobao.com/mc/rivalItem/analysis/getLiveCoreTrend.json?dateRange=" + CDateTime + "%7C" + CDateTime + "&dateType=today&device=2&sellerType=0&cateId=" + CcateId + "&itemId=" + CItemid + "&topType=flow&indexCode=uv&_=1535778429590&token="; // Thread.Sleep(10000); //PostServer.GetHTTPTaobao(strpayRateIndex); //string txpayRateIndex = PostServer.GetHtml; PostServer.GetHTTPTaobaoTID(strpayRateIndex, TTid); string txpayRateIndex = PostServer.GetHtml; JObject EJson = (JObject)JsonConvert.DeserializeObject(txpayRateIndex); string strJson = EJson["data"].ToString(); Etrace EtrJson = new Etrace(); string ToJson = EtrJson.stringJson(strJson); JObject json = (JObject)JsonConvert.DeserializeObject(ToJson); for (int j = 0; j <= 6; j++) { //支付转化指数 string typeIDstr = ""; string jsonpayRateIndex = ""; if (j == 0) { jsonpayRateIndex = json["data"]["rivalItem1"]["cartHits"].ToString(); typeIDstr = "cartHits"; } if (j == 1) { jsonpayRateIndex = json["data"]["rivalItem1"]["cltHits"].ToString(); typeIDstr = "cltHits"; } if (j == 2) { jsonpayRateIndex = json["data"]["rivalItem1"]["payItemCnt"].ToString(); typeIDstr = "payItemCnt"; } if (j == 3) { jsonpayRateIndex = json["data"]["rivalItem1"]["payRateIndex"].ToString(); typeIDstr = "payRateIndex"; } if (j == 4) { jsonpayRateIndex = json["data"]["rivalItem1"]["seIpvUvHits"].ToString(); typeIDstr = "seIpvUvHits"; } if (j == 5) { jsonpayRateIndex = json["data"]["rivalItem1"]["tradeIndex"].ToString(); typeIDstr = "tradeIndex"; } if (j == 6) { jsonpayRateIndex = json["data"]["rivalItem1"]["uvIndex"].ToString(); typeIDstr = "uvIndex"; } //ShowInfo(jsonpayRateIndex); JArray payRateIndexJArray = JArray.Parse(jsonpayRateIndex); for (int i = 0; i < payRateIndexJArray.Count; i++) { if (i == HourNumber) { //删除 string Sqldel = " delete from Dpnumber where ItemID='" + CItemid + "' and dateHour=" + HourNumber + " and typeid='" + typeIDstr + "'"; Ms.ExeSQLNonQuery(Sqldel); decimal NumberPayRate = 0; if (payRateIndexJArray[i].ToString() != "") { NumberPayRate = Math.Ceiling(decimal.Parse(payRateIndexJArray[i].ToString())); } else { NumberPayRate = 0; } string Sql = "INSERT INTO [DPNumber]([shopName],[DateHour],[HouNumber],[typeID],[ItemID],[DItemdate])VALUES('" + CshopName + "'," + i + "," + NumberPayRate + ",'" + typeIDstr + "','" + CItemid + "','" + CDateTime + "')"; Ms.ExeSQLNonQuery(Sql); } } } } this.ultraGridcnt.DataSource = Ms.runSQLDataSet(txtSql(CDateTime, "payItemCnt").ToString(), "ss").Tables[0]; //this.ultraGrid2.DataSource = Ms.runSQLDataSet(txtSql(CDateTime, "uvIndex").ToString(), "ss").Tables[0]; //this.ultraGrid5.DataSource = Ms.runSQLDataSet(txtSql(CDateTime, "cartHits").ToString(), "ss").Tables[0]; //this.ultraGrid3.DataSource = Ms.runSQLDataSet(txtSql(CDateTime, "payRateIndex").ToString(), "ss").Tables[0]; ultraGridcnt.DisplayLayout.Bands[0].Columns["shopname"].Header.Fixed = true; //ultraGrid2.DisplayLayout.Bands[0].Columns["shopname"].Header.Fixed = true; //ultraGrid5.DisplayLayout.Bands[0].Columns["shopname"].Header.Fixed = true; //ultraGrid3.DisplayLayout.Bands[0].Columns["shopname"].Header.Fixed = true; }
/// <summary> /// 流量 /// </summary> public void Listgetai() { int HourNumber = DateTime.Now.Hour; DataTable shoptable = new DataTable(); string Sqlshop = "select itemid,shopname,IDshopName from dp_shop"; shoptable = Ms.runSQLDataSet(Sqlshop, "ss").Tables[0]; foreach (DataRow keydr in shoptable.Rows) { try { PostServer.Getcookie = FPPcokk.ToString(); string CcateId, CItemid, CshopName; CItemid = keydr["itemid"].ToString(); CshopName = keydr["itemid"].ToString() + keydr["shopname"].ToString(); CcateId = "50012100"; string strpayRateIndex = "https://sycm.taobao.com/mc/rivalItem/analysis/getLiveFlowSource.json?device=2&cateId=" + CcateId + "&rivalItem1Id=" + CItemid + "&dateType=today&dateRange=" + CDateTime + "%7C" + CDateTime + "&indexCode=uv&orderBy=uv&order=desc&token="; // string strpayRateIndex = "https://sycm.taobao.com/mc/rivalItem/analysis/getLiveCoreTrend.json?dateRange=" + CDateTime + "%7C" + CDateTime + "&dateType=today&device=2&sellerType=0&cateId=" + CcateId + "&itemId=" + CItemid + "&topType=flow&indexCode=uv&_=1535778429590&token="; // Thread.Sleep(10000); //PostServer.GetHTTPTaobao(strpayRateIndex); //string txpayRateIndex = PostServer.GetHtml; PostServer.GetHTTPTaobaoTID(strpayRateIndex, TTid, "https://sycm.taobao.com/mc/ci/shop/analysis?"); // PostServer.GetHTTPTaobaoTID(strpayRateIndex, TTid); string txpayRateIndex = PostServer.GetHtml; JObject EJson = (JObject)JsonConvert.DeserializeObject(txpayRateIndex); string strJson = EJson["data"].ToString(); Etrace EtrJson = new Etrace(); string ToJson = EtrJson.stringJson(strJson); JObject json = (JObject)JsonConvert.DeserializeObject(ToJson); //支付转化指数 string typeIDstr = ""; string jsonpayRateIndex = ""; jsonpayRateIndex = json["data"].ToString(); int NumberPayRate = 0; //ShowInfo(jsonpayRateIndex); string Sqldel = "delete from DPListNumber where shopname='" + CshopName + "' and DateHour=" + HourNumber + " and ItemID='" + CItemid + "' and DItemdate='" + CDateTime + "'"; string SqlPE = "delete from DPAllListNumber where shopname='" + CshopName + "' and ItemID='" + CItemid + "' and DItemdate='" + CDateTime + "'"; Ms.ExeSQLNonQuery(Sqldel); Ms.ExeSQLNonQuery(SqlPE); JArray payRateIndexJArray = JArray.Parse(jsonpayRateIndex); int getPayRate = payRateIndexJArray.Count; int getPayrating = 0; if (getPayRate > 10) { getPayrating = 10; } else { getPayrating = getPayRate; } for (int i = 0; i < getPayrating; i++) { typeIDstr = payRateIndexJArray[i]["pageName"]["value"].ToString(); NumberPayRate = int.Parse(payRateIndexJArray[i]["uv"]["value"].ToString()); StringBuilder SqlBA = new StringBuilder(); SqlBA.Append("declare @bookId int "); SqlBA.Append("SELECT @bookId=isnull(SUM(houNumber),0) FROM dbo.DPListNumber where shopname='" + CshopName + "' and DateHour<" + HourNumber + " and typeid='" + typeIDstr + "' and ItemID='" + CItemid + "' and DItemdate='" + CDateTime + "'"); SqlBA.Append(" INSERT INTO [DPListNumber]([shopName],[DateHour],[HouNumber],[typeID],[ItemID],[DItemdate])VALUES('" + CshopName + "'," + HourNumber + "," + NumberPayRate + "-@bookId,'" + typeIDstr + "','" + CItemid + "','" + CDateTime + "')"); string SqlB = "INSERT INTO [DPAllListNumber]([shopName],[HouNumber],[typeID],[ItemID],[DItemdate])VALUES('" + CshopName + "'," + NumberPayRate + ",'" + typeIDstr + "','" + CItemid + "','" + CDateTime + "')"; Ms.ExeSQLNonQuery(SqlBA.ToString()); Ms.ExeSQLNonQuery(SqlB); } } catch (Exception) { // throw; } } this.ultraGrid4.DataSource = Ms.runSQLDataSet(txtSqlList(CDateTime, "直通车").ToString(), "ss").Tables[0]; this.ultraGrid7.DataSource = Ms.runSQLDataSet(txtSqlList(CDateTime, "手淘搜索").ToString(), "ss").Tables[0]; //this.ultraGridindex.DataSource = Ms.runSQLDataSet(txtSqlList(CDateTime, "手淘首页").ToString(), "ss").Tables[0]; this.ultraGrid9.DataSource = Ms.runSQLDataSet(txtSqlList(CDateTime, "购物车").ToString(), "ss").Tables[0]; //this.ultraGrid10.DataSource = Ms.runSQLDataSet(txtSqlList(CDateTime, "淘内免费其他").ToString(), "ss").Tables[0]; //this.ultraGrid11.DataSource = Ms.runSQLDataSet(txtSqlList(CDateTime, "我的淘宝").ToString(), "ss").Tables[0]; this.ultraGridall.DataSource = Ms.runSQLDataSet(txtSqlALLList(CDateTime).ToString(), "ss").Tables[0]; ultraGrid4.DisplayLayout.Bands[0].Columns["shopname"].Header.Fixed = true; ultraGrid7.DisplayLayout.Bands[0].Columns["shopname"].Header.Fixed = true; //ultraGridindex.DisplayLayout.Bands[0].Columns["shopname"].Header.Fixed = true; //ultraGrid9.DisplayLayout.Bands[0].Columns["shopname"].Header.Fixed = true; //ultraGrid10.DisplayLayout.Bands[0].Columns["shopname"].Header.Fixed = true; //ultraGrid11.DisplayLayout.Bands[0].Columns["shopname"].Header.Fixed = true; //ultraGrid4.DisplayLayout.Bands[0].Columns[HourNumber.ToString()].SortIndicator = Infragistics.Win.UltraWinGrid.SortIndicator.Descending; //ultraGrid4.DisplayLayout.Bands[0].Columns[HourNumber.ToString()].Header.Appearance.ForeColor = Color.Red; //ultraGrid7.DisplayLayout.Bands[0].Columns[HourNumber.ToString()].SortIndicator = Infragistics.Win.UltraWinGrid.SortIndicator.Descending; //ultraGrid7.DisplayLayout.Bands[0].Columns[HourNumber.ToString()].Header.Appearance.ForeColor = Color.Red; //ultraGridindex.DisplayLayout.Bands[0].Columns[HourNumber.ToString()].SortIndicator = Infragistics.Win.UltraWinGrid.SortIndicator.Descending; //ultraGridindex.DisplayLayout.Bands[0].Columns[HourNumber.ToString()].Header.Appearance.ForeColor = Color.Red; //ultraGrid9.DisplayLayout.Bands[0].Columns[HourNumber.ToString()].SortIndicator = Infragistics.Win.UltraWinGrid.SortIndicator.Descending; //ultraGrid9.DisplayLayout.Bands[0].Columns[HourNumber.ToString()].Header.Appearance.ForeColor = Color.Red; //ultraGrid10.DisplayLayout.Bands[0].Columns[HourNumber.ToString()].SortIndicator = Infragistics.Win.UltraWinGrid.SortIndicator.Descending; //ultraGrid10.DisplayLayout.Bands[0].Columns[HourNumber.ToString()].Header.Appearance.ForeColor = Color.Red; //ultraGrid11.DisplayLayout.Bands[0].Columns[HourNumber.ToString()].SortIndicator = Infragistics.Win.UltraWinGrid.SortIndicator.Descending; //ultraGrid11.DisplayLayout.Bands[0].Columns[HourNumber.ToString()].Header.Appearance.ForeColor = Color.Red; }