using System; using System.Collections.Generic; using System.Threading; using AllBase; using Work.Api; using JavaScriptEngineSwitcher.Core; using JavaScriptEngineSwitcher.V8; using Work.ManageClass; namespace Work.CollectClass { public class ShopDetailControl { public string Name; public static int threadCount; public bool yesFlag; public bool sevFlag; public bool thirFlag; public static List ShopDetailTempList = new List(); public ShopDetailControl(string name) { Name = name; } public void Get() { List ts = new List(); for (int i = 0; i < GetShopLoginInfo.Shops.Count; i++) { var shop = GetShopLoginInfo.Shops[i]; if (shop.Message == "会话已过期") continue; var p = new ShopDetailGet(Name, shop); p.yesFlag = yesFlag; p.sevFlag = sevFlag; p.thirFlag = thirFlag; Threadx.ThreadListWait(ref ts, new Thread(p.Get), threadCount); Thread.Sleep(1000); } Threadx.ThreadListWait(ref ts); } } public class ShopDetailGet { public string Name; public ShopChatBase Shop; public bool yesFlag; public bool sevFlag; public bool thirFlag; public static string NoCode = ""; public ShopDetailGet(string name,ShopChatBase shop) { Name = name; Shop = shop; } public void Get() { try { string cookies = "", shopId = "", shopName = ""; int mall_id = Shop.MallId; if (Shop != null) { cookies = Shop.Cookies; shopId = Shop.ShopId; shopName = Shop.ShopName; mall_id = Shop.MallId; } #region 商品数量数据 //商品上架 string url = "https://mms.pinduoduo.com/vodka/v2/mms/query/display/mall/goodsList"; string refere = "https://mms.pinduoduo.com/Pdd.html"; //post参数 string sort_by = "id"; string sort_type = "DESC"; int is_onsale = 1; int sold_out = 0; int size = 15; int pageIndex = 1; string data = "{\"sort_by\":\"" + sort_by + "\",\"sort_type\":\"" + sort_type + "\",\"is_onsale\":" + is_onsale + ",\"sold_out\":" + sold_out + ",\"size\":" + size + ",\"page\":" + pageIndex + ",\"mall_id\":" + mall_id + "}"; //第一页匹配结果 //string html = GetPostTaobaoHtml.UploadTaobaoPost(url, refere, true, data, cookies); string html = CpsSetAllGoods.Request_mms_pinduoduo_com(url, refere, Shop.Cookies, data, CpsSetAllGoods.getAnti0aon()); //上架商品记录数 int ShelvesCount = BaseRegex.GetIntJson(ref html, "total"); //商品下架 url = "https://mms.pinduoduo.com/vodka/v2/mms/query/display/mall/goodsList"; refere = "https://mms.pinduoduo.com/Pdd.html"; //post参数 sort_by = "id"; sort_type = "DESC"; is_onsale = 0; sold_out = 0; size = 15; pageIndex = 1; data = "{\"sort_by\":\"" + sort_by + "\",\"sort_type\":\"" + sort_type + "\",\"is_onsale\":" + is_onsale + ",\"sold_out\":" + sold_out + ",\"size\":" + size + ",\"page\":" + pageIndex + ",\"mall_id\":" + mall_id + "}"; //第一页匹配结果 //html = GetPostTaobaoHtml.UploadTaobaoPost(url, refere, true, data, cookies); html = CpsSetAllGoods.Request_mms_pinduoduo_com(url, refere, Shop.Cookies, data, CpsSetAllGoods.getAnti0aon()); //上架商品记录数 int lowerCount = BaseRegex.GetIntJson(ref html, "total"); //商品售罄 url = "https://mms.pinduoduo.com/vodka/v2/mms/query/display/mall/goodsList"; refere = "https://mms.pinduoduo.com/Pdd.html"; //post参数 sort_by = "id"; sort_type = "DESC"; is_onsale = 1; sold_out = 1; size = 15; pageIndex = 1; data = "{\"sort_by\":\"" + sort_by + "\",\"sort_type\":\"" + sort_type + "\",\"is_onsale\":" + is_onsale + ",\"sold_out\":" + sold_out + ",\"size\":" + size + ",\"page\":" + pageIndex + ",\"mall_id\":" + mall_id + "}"; //第一页匹配结果 html = CpsSetAllGoods.Request_mms_pinduoduo_com(url, refere, cookies, data, CpsSetAllGoods.getAnti0aon());//GetPostTaobaoHtml.UploadTaobaoPost(url, refere, true, data, cookies); //售罄商品记录数 int sellOutCount = BaseRegex.GetIntJson(ref html, "total"); //全部商品 url = "https://mms.pinduoduo.com/vodka/v2/mms/query/display/mall/goodsList"; refere = "https://mms.pinduoduo.com/Pdd.html"; //post参数 string order_by = "id:desc"; size = 15; pageIndex = 1; data = "{\"order_by\":\"" + order_by + //"\",\"sort_type\":\"" + sort_type + //"\",\"is_onsale\":" + is_onsale + //",\"sold_out\":" + sold_out + "\",\"size\":" + size + ",\"page\":" + pageIndex + ",\"mall_id\":" + mall_id + "}"; //第一页匹配结果 html = CpsSetAllGoods.Request_mms_pinduoduo_com(url, refere, cookies, data, CpsSetAllGoods.getAnti0aon());//GetPostTaobaoHtml.UploadTaobaoPost(url, refere, true, data, cookies); //全部商品记录数 int allGoodsCount = BaseRegex.GetIntJson(ref html, "total"); #endregion string codext = ""; //30天出货量 30天成交金额 url = "https://mms.pinduoduo.com/janus/api/userinfo"; refere = "https://mms.pinduoduo.com/Pdd.html"; data = "{\"size\":\"5\" }"; //第一页匹配结果 html = GetPostTaobaoHtml.UploadTaobaoPost(url, refere, true, data, cookies); //主营类目 string staple = BaseRegex.GetStringJson(ref html, "staple"); var m = BaseRegex.GetMatchRegex(ref html, @"""staple"":\s*\[""([\s\S]+?)""\]"); for (int i = 0; m != null && i < m.Count; i++) { staple = m[i].Groups[1].Value; } if (staple == "[]") staple = "普通商品"; using (IJsEngine jsEngine = new V8JsEngine()) { jsEngine.Execute(GetProductOnlineClass.JsCodeGetSms); codext = jsEngine.CallFunction("aaa", "").ToString(); } url = "https://mms.pinduoduo.com/sydney/api/mallInfo/queryMallDataPageOverView";//"https://mms.pinduoduo.com/mars/shop/statisticsTrend"; refere = "https://mms.pinduoduo.com/Pdd.html"; data = "{\"queryDate\":\""+DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd")+"\",\"queryType\":2,\"crawlerInfo\":\"" + codext + "\" }"; html = GetPostTaobaoHtml.UploadTaobaoPost(url, refere, true, data, cookies); int TAgainCount = 0; TAgain: if (html.Contains("Risk consult PASS")) { Thread.Sleep(3000); data = "{\"queryDate\":\"" + DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd") + "\",\"queryType\":2,\"crawlerInfo\":\"" + codext + "\" }"; html = GetPostTaobaoHtml.UploadTaobaoPost(url, refere, true, data, cookies); } if (html.Contains("Risk consult PASS") && TAgainCount < 5) { TAgainCount++; goto TAgain; } //30天出货量 int thirtydayGoodsNum = BaseRegex.GetIntJson(ref html, "cfmOrdrUsrCnt"); //30天成交金额 decimal thirtydayIn = BaseRegex.GetDecimalJson(ref html, "cfmOrdrAmt"); //今天成交额 using (IJsEngine jsEngine = new V8JsEngine()) { jsEngine.Execute(GetProductOnlineClass.JsCodeGetSms); codext = jsEngine.CallFunction("aaa", "").ToString(); } url = "https://mms.pinduoduo.com/sydney/api/mallInfo/mallPayList";// "https://mms.pinduoduo.com/mars/shop/queryDailyMallConfirmAmount"; refere = "https://mms.pinduoduo.com/Pdd.html"; data = "{\"crawlerInfo\":\"" + codext + "\" }";// UploadPinduoduoMain.AntiContent //第一页匹配结果 html = GetPostTaobaoHtml.UploadTaobaoPost(url, refere, true, data, cookies); int AgainCount = 0; Again: if (html.Contains("Risk consult PASS")) { Thread.Sleep(3000); data = "{\"crawlerInfo\":\"" + codext + "\" }"; html = GetPostTaobaoHtml.UploadTaobaoPost(url, refere, true, data, cookies); } if (html.Contains("Risk consult PASS")&& AgainCount<5) { AgainCount++; goto Again; } //今天成交额 decimal todayNum = BaseRegex.GetDecimalJson(ref html, "curCfmOrdrAmt"); decimal todayMount = todayNum; using (IJsEngine jsEngine = new V8JsEngine()) { jsEngine.Execute(GetProductOnlineClass.JsCodeGetSms); codext = jsEngine.CallFunction("aaa", "").ToString(); } url = "https://mms.pinduoduo.com/sydney/api/mallInfo/queryMallDataPageOverView";//"https://mms.pinduoduo.com/mars/shop/statisticsTrend"; refere = "https://mms.pinduoduo.com/Pdd.html"; data = "{\"queryDate\":\"" + DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd") + "\",\"queryType\":0,\"crawlerInfo\":\"" + codext + "\" }"; html = GetPostTaobaoHtml.UploadTaobaoPost(url, refere, true, data, cookies); int YAgainCount = 0; YAgain: if (html.Contains("Risk consult PASS")) { Thread.Sleep(3000); data = "{\"queryDate\":\"" + DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd") + "\",\"queryType\":0,\"crawlerInfo\":\"" + codext + "\" }"; html = GetPostTaobaoHtml.UploadTaobaoPost(url, refere, true, data, cookies); } if (html.Contains("Risk consult PASS") && YAgainCount < 5) { YAgainCount++; goto YAgain; } //昨天天成交金额 decimal yesdayIn = BaseRegex.GetDecimalJson(ref html, "cfmOrdrAmt"); using (IJsEngine jsEngine = new V8JsEngine()) { jsEngine.Execute(GetProductOnlineClass.JsCodeGetSms); codext = jsEngine.CallFunction("aaa", "").ToString(); } url = "https://mms.pinduoduo.com/sydney/api/mallInfo/queryMallDataPageOverView";//"https://mms.pinduoduo.com/mars/shop/statisticsTrend"; refere = "https://mms.pinduoduo.com/Pdd.html"; data = "{\"queryDate\":\"" + DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd") + "\",\"queryType\":1,\"crawlerInfo\":\"" + codext + "\" }"; html = GetPostTaobaoHtml.UploadTaobaoPost(url, refere, true, data, cookies); int SAgainCount = 0; SAgain: if (html.Contains("Risk consult PASS")) { Thread.Sleep(3000); data = "{\"queryDate\":\"" + DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd") + "\",\"queryType\":1,\"crawlerInfo\":\"" + codext + "\" }"; html = GetPostTaobaoHtml.UploadTaobaoPost(url, refere, true, data, cookies); } if (html.Contains("Risk consult PASS") && SAgainCount < 5) { SAgainCount++; goto SAgain; } //7天成交金额 decimal sevendayIn = BaseRegex.GetDecimalJson(ref html, "cfmOrdrAmt"); //保证金 url = "https://mms.pinduoduo.com/uranus/api/deposit/mall?p=langlang12"; refere = "https://mms.pinduoduo.com/Pdd.html"; data = "{\"size\":\"5\" }"; //第一页匹配结果 html = GetPostTaobaoHtml.UploadTaobaoPost(url, refere, true, data, cookies); //保证金 int freeBalance = BaseRegex.GetIntJson(ref html, "freeBalance"); decimal freeBalanceMount = freeBalance / 100.0M; int threshold = BaseRegex.GetIntJson(ref html, "thresholdBalance"); decimal thresholdMount = threshold / 100.0M ; url = "https://mms.pinduoduo.com/earth/api/mallPunishment"; refere = "https://mms.pinduoduo.com/Pdd.html"; data = "{\"size\":\"5\" }"; //第一页匹配结果 html = CpsSetAllGoods.Request_mms_pinduoduo_com(url, refere, cookies, data, CpsSetAllGoods.getAnti0aon());// GetPostTaobaoHtml.UploadTaobaoPost(url, refere, true, data, cookies); //惩罚店铺 int level = BaseRegex.GetIntJson(ref html, "punishmentLevel"); string punishment = string.Empty; if (level == 1) { punishment = "一级惩罚"; } else if (level == 2) { punishment = "二级惩罚"; } else if (level == 3) { punishment = "三级惩罚"; } else { punishment = "无"; } //罚款结束时间 string punEndtime = BaseRegex.GetStringJson(ref html, "endTime");//购买时间 if (string.IsNullOrEmpty(punEndtime)) { punEndtime = "无"; } url = "https://mms.pinduoduo.com/genji/bloodroot/mallPunishment/query/list"; refere = "https://mms.pinduoduo.com/pg/violation_list"; data = "{\"pageSize\":10,\"pageNum\":1}"; //第一页匹配结果 html = GetPostTaobaoHtml.UploadTaobaoPost(url, refere, true, data, cookies); //获取所有订单金额 var punM = BaseRegex.GetMatchRegex(ref html, @"{""firstReasonId"":[\w\W]+?}"); string punReason = ""; int punstartTime = 0; int punendTime = 0; for (int i = 0; punM != null && i < punM.Count; i++) { string item = punM[i].Groups[0].Value; int status = BaseRegex.GetIntJson(ref item, "status"); if (status != 1) continue; punReason = BaseRegex.GetStringJson(ref item, "reason"); punstartTime = BaseRegex.GetIntJson(ref item, "startTime"); punendTime = BaseRegex.GetIntJson(ref item, "endTime"); } //提现金额 url = "https://mms.pinduoduo.com/uranus/api/mall/balance"; refere = "https://mms.pinduoduo.com/Pdd.html"; data = "{\"size\":\"5\" }"; //第一页匹配结果 html = GetPostTaobaoHtml.UploadTaobaoPost(url, refere, true, data, cookies); //提现金额 decimal putAmount = BaseRegex.GetDecimalJson(ref html, "result") / 100; //待到账资金 url = "https://mms.pinduoduo.com/uranus/api/balance/cargoBalanceV2"; refere = "https://mms.pinduoduo.com/Pdd.html"; data = "{}"; //第一页匹配结果 html = CpsSetAllGoods.Request_mms_pinduoduo_com(url, refere, cookies, data, CpsSetAllGoods.getAnti0aon()); //待到账资金 decimal waitAmount = BaseRegex.GetDecimalJson(ref html, "result") / 100; //用户手机号 url = "https://mms.pinduoduo.com/earth/api/merchant/queryMerchantInfoByMallId"; refere = "https://mms.pinduoduo.com/Pdd.html"; data = "{\"size\":\"5\" }"; //第一页匹配结果 html = GetPostTaobaoHtml.UploadTaobaoPost(url, refere, true, data, cookies); //用户手机号 string operatorMobile = BaseRegex.GetStringJson(ref html, "operatorMobile"); //用户银行卡 url = "https://mms.pinduoduo.com/earth/api/merchant/queryMallBankCard"; refere = "https://mms.pinduoduo.com/Pdd.html"; data = "{\"size\":\"5\" }"; //第一页匹配结果 html = GetPostTaobaoHtml.UploadTaobao(url, refere, true, cookies); //用户银行卡 string accountCard = BaseRegex.GetStringJson(ref html, "accountCard"); //驳回商品记录数 url = "https://mms.pinduoduo.com/glide/v2/mms/query/commit/list"; refere = "https://mms.pinduoduo.com/Pdd.html"; int check_status = 3; int length = 10; int start = 1; data = "{\"start\":" + start + ",\"length\":" + length + ",\"check_status\":" + check_status + "}"; //第一页匹配结果 html = CpsSetAllGoods.Request_mms_pinduoduo_com(url, refere, cookies, data, CpsSetAllGoods.getAnti0aon()); //GetPostTaobaoHtml.UploadTaobaoPost(url, refere, true, data, cookies); //驳回商品记录数 int totalCount = BaseRegex.GetIntJson(ref html, "total"); ////昨日订单量 //url = "https://mms.pinduoduo.com/mars/shop/orderList"; url = "https://mms.pinduoduo.com/mars/shop/recentOrderList"; refere = "https://mms.pinduoduo.com/Pdd.html"; //int confirmStartTime = BaseClass.GetTime(DateTime.Parse(DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd 00:00:00"))); //int confirmEndTime = BaseClass.GetTime(DateTime.Parse(DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd 23:59:59"))); //int isLucky = -1; //string afterSaleType = "1"; //int pageNumber = 1; //int remarkStatus = -1; //int pageSize = 30; //string source = "MMS"; ////{"orderType":1,"afterSaleType":1,"remarkStatus":-1,"groupStartTime":1562206464,"groupEndTime":1562292864,"pageNumber":1,"pageSize":20,"source":"MMS"} ////data = "{\"confirmStartTime\":" + confirmStartTime + //// ",\"confirmEndTime\":" + confirmEndTime + //// ",\"isLucky\":" + isLucky + ",\"afterSaleType\":\"" + afterSaleType + //// "\",\"pageNumber\":" + pageNumber + ",\"remarkStatus\":" + remarkStatus + //// ",\"pageSize\":" + pageSize + ",\"source\":\"" + source + "\"}"; ////{"orderType":0,"afterSaleType":0,"remarkStatus":-1,"groupStartTime":1562206833,"groupEndTime":1562293233,"pageNumber":1,"pageSize":20,"source":"MMS"} //data = "{\"orderType\":0,\"afterSaleType\":" + afterSaleType + ",\"remarkStatus\":" + remarkStatus + ",\"groupStartTime\":" + confirmStartTime // + ",\"groupEndTime\":" + confirmEndTime + ",\"pageNumber\":" + pageNumber + ",\"pageSize\":" + pageSize + ",\"source\":\"MMS\"}"; ////第一页匹配结果 //html = GetPostTaobaoHtml.UploadTaobaoPost(url, refere, true, data, cookies, UploadPinduoduoMain.AntiContent); ////昨日订单量 //int totalItemNumx = BaseRegex.GetIntJson(ref html, "totalItemNum"); ////30天订单量 //url = "https://mms.pinduoduo.com/mars/shop/recentOrderList"; //refere = "https://mms.pinduoduo.com/Pdd.html"; //confirmStartTime = BaseClass.GetTime(DateTime.Parse(DateTime.Now.AddDays(-30).ToString("yyyy-MM-dd 00:00:00"))); //confirmEndTime = BaseClass.GetTime(DateTime.Parse(DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd 23:59:59"))); //isLucky = -1; //afterSaleType = "1"; //pageNumber = 1; //remarkStatus = -1; //pageSize = 50; //source = "MMS"; //data = "{\"orderType\":0,\"afterSaleType\":"+ afterSaleType + ",\"remarkStatus\":" + remarkStatus + ",\"groupStartTime\":" + confirmStartTime // + ",\"groupEndTime\":" + confirmEndTime + ",\"pageNumber\":" + pageNumber + ",\"pageSize\":" + pageSize + ",\"source\":\"MMS\"}"; ////data = "{\"confirmStartTime\":" + confirmStartTime + //// ",\"confirmEndTime\":" + confirmEndTime + //// ",\"isLucky\":" + isLucky + ",\"afterSaleType\":\"" + afterSaleType + //// "\",\"pageNumber\":" + pageNumber + ",\"remarkStatus\":" + remarkStatus + //// ",\"pageSize\":" + pageSize + ",\"source\":\"" + source + "\"}"; ////第一页匹配结果 //html = GetPostTaobaoHtml.UploadTaobaoPost(url, refere, true, data, cookies, UploadPinduoduoMain.AntiContent); ////30天订单量 //int totalThirItemNum = BaseRegex.GetIntJson(ref html, "totalItemNum"); //物流异常 url = "https://mms.pinduoduo.com/rohan/api/rohan/mall/logistics/complaint/detail"; refere = "https://mms.pinduoduo.com/Pdd.html"; string cplt_date = DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd"); int offset = 0; length = 10; data = "{\"cplt_date\":\"" + cplt_date + "\",\"length\":" + length + ",\"offset\":" + offset + "}"; //第一页匹配结果 html = GetPostTaobaoHtml.UploadTaobaoPost(url, refere, true, data, cookies); //物流异常 int totalWuLiuCount = BaseRegex.GetIntJson(ref html, "total"); decimal playAmount = 0m; url = "https://mms.pinduoduo.com/mercury/play_money/list"; refere = "https://mms.pinduoduo.com/aftersales/micro_transfer?type=1"; int beginTimex = BaseClass.GetTime(DateTime.Parse(DateTime.Now.AddDays(-30).ToString("yyyy-MM-dd 00:00:00"))); int endTimex = BaseClass.GetTime(DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd 23:59:59"))); data = "{\"startTime\":" + beginTimex + ",\"endTime\":" + endTimex + ",\"offset\":0,\"pageSize\":10}"; html = CpsSetAllGoods.Request_mms_pinduoduo_com(url, refere, cookies, data, CpsSetAllGoods.getAnti0aon());// GetPostTaobaoHtml.UploadTaobaoPost(url, refere, true, data, cookies); var playsm = BaseRegex.GetMatchRegex(ref html, @"{""playMoneyAmount"":[^}]+}"); for (int i = 0; playsm != null && i < playsm.Count; i++) { string orderItem = playsm[i].Groups[0].Value; int amount = BaseRegex.GetIntJson(ref orderItem, "playMoneyAmount"); playAmount = playAmount + amount / 100; } #region 历史罚款记录 //延迟发货 {"classList":[],"groupType":0,"beginTime":1533657600,"endTime":1534435200,"offset":0,"limit":20,"mallId":807021} url = "https://mms.pinduoduo.com/uranus/api/bill/queryBillStatistics"; refere = "https://mms.pinduoduo.com/Pdd.html"; int beginTime = BaseClass.GetTime(DateTime.Parse(DateTime.Now.AddDays(-7).ToString("yyyy-MM-dd 00:00:00"))); int endTime = BaseClass.GetTime(DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd 23:59:59"))); offset = 0; int limit = 20; int mallId = Shop.MallId; data = "{\"beginTime\":" + beginTime + ",\"endTime\":" + endTime + ",\"groupType\":0,\"classList\":[],\"limit\":" + limit + ",\"offset\":" + offset + ",\"mallId\":" + mallId + "}"; html = GetPostTaobaoHtml.UploadTaobaoPost(url, refere, true, data, cookies); int reusltTotal = BaseRegex.GetIntJson(ref html, "totalNumber"); url = "https://mms.pinduoduo.com/uranus/api/bill/queryUserDefinedBill"; refere = "https://mms.pinduoduo.com/Pdd.html"; html = CpsSetAllGoods.Request_mms_pinduoduo_com(url, refere, cookies, data, CpsSetAllGoods.getAnti0aon()); //GetPostTaobaoHtml.UploadTaobaoPost(url, refere, true, data, cookies); decimal sumAmount = 0M; int page = reusltTotal / 20 + (reusltTotal % 20 > 0 ? 1 : 0); for (int n = 1; n <= page; n++) { //非第一页匹配结果 if (n != 1) { data = "{\"beginTime\":" + beginTime + ",\"endTime\":" + endTime + ",\"groupType\":0,\"classList\":[],\"limit\":" + limit + ",\"offset\":" + (n - 1) * 20 + ",\"mallId\":" + mallId + "}"; html = GetPostTaobaoHtml.UploadTaobaoPost(url, refere, true, data, cookies); } //获取所有订单金额 var ordersm = BaseRegex.GetMatchRegex(ref html, @"{[^}]+""orderSn"":[^}]+}"); for (int i = 0; ordersm != null && i < ordersm.Count; i++) { string orderItem = ordersm[i].Groups[0].Value; int type = BaseRegex.GetIntJson(ref orderItem, "type"); if (type != 101) { continue; } int amount = BaseRegex.GetIntJson(ref orderItem, "amount"); sumAmount = sumAmount + amount / 100; } } long cbeginTime = GetTime(DateTime.Parse(DateTime.Now.AddDays(-30).ToString("yyyy-MM-dd 00:00:00"))); long cendTime = GetTime(DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd 23:59:59"))); url = "https://mms.pinduoduo.com/genji/poppy/overtimeShipment/query/chargeList"; refere = "https://mms.pinduoduo.com/Pdd.html"; data = "{\"endTime\":"+ cendTime + ",\"orderSn\":\"\",\"pageNum\":1,\"pageSize\":10,\"startTime\":"+ cbeginTime + "}"; html = GetPostTaobaoHtml.UploadTaobaoPost(url, refere, true, data, cookies); decimal sumChareAmount = 0M; int total = BaseRegex.GetIntJson(ref html, "total"); page = total / 10 + (total % 10 > 0 ? 1 : 0); for (int n = 1; n <= page; n++) { //非第一页匹配结果 if (n != 1) { data = "{\"endTime\":" + cendTime + ",\"orderSn\":\"\",\"pageNum\":"+n+",\"pageSize\":10,\"startTime\":" + cbeginTime + "}"; html = GetPostTaobaoHtml.UploadTaobaoPost(url, refere, true, data, cookies); } //获取所有订单金额 var ordersm = BaseRegex.GetMatchRegex(ref html, @"{""orderSn"":[^}]+}"); for (int i = 0; ordersm != null && i < ordersm.Count; i++) { string orderItem = ordersm[i].Groups[0].Value; decimal amount = BaseRegex.GetDecimalJson(ref orderItem, "chargeAmount"); sumChareAmount = sumChareAmount + amount; } } cbeginTime = GetTime(DateTime.Parse(DateTime.Now.AddDays(-30).ToString("yyyy-MM-dd 00:00:00"))); cendTime = GetTime(DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd 23:59:59"))); url = "https://mms.pinduoduo.com/genji/poppy/stockout/query/stockoutList"; refere = "https://mms.pinduoduo.com/Pdd.html"; data = "{\"endTime\":" + cendTime + ",\"orderSn\":\"\",\"pageNum\":1,\"pageSize\":10,\"startTime\":" + cbeginTime + "}"; html = GetPostTaobaoHtml.UploadTaobaoPost(url, refere, true, data, cookies); decimal sumStockAmount = 0M; total = BaseRegex.GetIntJson(ref html, "total"); page = total / 10 + (total % 10 > 0 ? 1 : 0); for (int n = 1; n <= page; n++) { //非第一页匹配结果 if (n != 1) { data = "{\"endTime\":" + cendTime + ",\"orderSn\":\"\",\"pageNum\":" + n + ",\"pageSize\":10,\"startTime\":" + cbeginTime + "}"; html = GetPostTaobaoHtml.UploadTaobaoPost(url, refere, true, data, cookies); } //获取所有订单金额 var ordersm = BaseRegex.GetMatchRegex(ref html, @"{""confirmTime"":[^}]+}"); for (int i = 0; ordersm != null && i < ordersm.Count; i++) { string orderItem = ordersm[i].Groups[0].Value; int amount = BaseRegex.GetIntJson(ref orderItem, "couponAmount"); sumStockAmount = sumStockAmount + amount/100M; } } //访问量 //url = "https://mms.pinduoduo.com/sydney/api/goodsDataShow/overviewList"; //refere = "https://mms.pinduoduo.com/sycm/goods_effect"; //string endDate = DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd"); //string sevStartDate = DateTime.Now.AddDays(-7).ToString("yyyy-MM-dd"); //string startDate = DateTime.Now.AddDays(-30).ToString("yyyy-MM-dd"); //data = "{\"endDate\":\"" + endDate + // "\",\"startDate\":\"" + startDate + // "\"}"; ////第一页匹配结果 //html = GetPostTaobaoHtml.UploadTaobaoPost(url, refere, true, data, cookies); ////上架商品记录数 //int lower66Count = BaseRegex.GetIntJson(ref html, "total"); //var mm = BaseRegex.GetMatchRegex(ref html, @"{\s*""avgGoodsUv"":[^\}]+?}"); //int oneUVSum = 0; //int onePVSum = 0; //decimal oneVcrSum = 0; //int sevUVSum = 0; //int sevPVSum = 0; //decimal sevVCRSum = 0; //int thirtyUVSum = 0; //int thirtyPVSum = 0; //decimal thirtyVCRSum = 0; //for (int j = 0; mm != null && j < mm.Count; j++) //{ // string item = mm[j].Groups[0].Value; // string statDate = BaseRegex.GetStringJson(ref item, "statDate"); // int goodsUv = BaseRegex.GetIntJson(ref item, "goodsUv"); // int goodsPv = BaseRegex.GetIntJson(ref item, "goodsPv"); // decimal goodsVcr = BaseRegex.GetDecimalJson(ref item, "goodsVcr"); // if (Convert.ToDateTime(statDate) >= Convert.ToDateTime(endDate)) // { // oneUVSum += goodsUv; // onePVSum += goodsPv; // oneVcrSum += goodsVcr; // } // if (Convert.ToDateTime(statDate) >= Convert.ToDateTime(sevStartDate)) // { // sevUVSum += goodsUv; // sevPVSum += goodsPv; // sevVCRSum += goodsVcr; // } // if (Convert.ToDateTime(statDate) >= Convert.ToDateTime(startDate)) // { // thirtyUVSum += goodsUv; // thirtyPVSum += goodsPv; // thirtyVCRSum += goodsVcr; // } //} //sevVCRSum = sevVCRSum / 7; //thirtyVCRSum = thirtyVCRSum / 30; int oneUVSum = 0; int onePVSum = 0; decimal oneVcrSum = 0M; int sevUVSum = 0; int sevPVSum = 0; decimal sevVCRSum = 0M; int thirtyUVSum = 0; int thirtyPVSum = 0; decimal thirtyVCRSum = 0M; //if (string.IsNullOrEmpty(PinduoduoAuth.strContent)) //{ // string path = AppDomain.CurrentDomain.BaseDirectory + "crawlerInfoInterface.js"; // PinduoduoAuth.strContent = FileBase.ReadAllText(path); //} //string strTime = BaseClass.GetTime(DateTime.Now).ToString() + "000"; //string str = ""; //for (int i = 0; i < 16; i++) //{ // str += new Random(Guid.NewGuid().GetHashCode()).Next(9); //} //string strToken = str + "-" + strTime; //string strNumber = ""; //string temp2 = strTime + "," + strToken + "," + strNumber; //string fun2 = string.Format(@"getEncode('{0}','{1}','{2}')", strTime, strToken, strNumber); //string codex = UploadPinduoduoSet.ExecuteScript(fun2, PinduoduoAuth.strContent); if (string.IsNullOrEmpty(PinduoduoAuth.strContent)) { //string path = AppDomain.CurrentDomain.BaseDirectory + "crawlerInfoInterface.js"; PinduoduoAuth.strContent = GetVisitProductNew.strJs;//FileBase.ReadAllText(path); } if (string.IsNullOrEmpty(NoCode)) { html = GetHtml.Gbk("http://nano.qixiaoke.com/nano.txt"); NoCode = BaseRegex.GetMatchRegexString(ref html, @"([\w\W]+?)-----"); } string strTime = BaseClass.GetTime(DateTime.Now).ToString() + "000"; string strNumber = "https://mms.pinduoduo.com/latitude/auth/login"; string fun2 = @"getEncode('" + strTime + "','" + NoCode + "','')"; string codex = UploadPinduoduoSet.ExecuteScript(fun2, PinduoduoAuth.strContent); cookies = Shop.Cookies; //昨天 using (IJsEngine jsEngine = new V8JsEngine()) { jsEngine.Execute(GetProductOnlineClass.JsCodeGetSms); codex = jsEngine.CallFunction("aaa", "").ToString(); } //url = "https://mms.pinduoduo.com/sydney/api/mallFlow/queryMallFlowOverView"; //"https://mms.pinduoduo.com/sydney/api/goodsDataShow/queryGoodsPageOverView"; //refere = "https://mms.pinduoduo.com/sycm/goods_effect"; //data = "{\"beginDate\":\""+ DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd") + "\",\"endDate\":\""+ DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd") + "\",\"crawlerInfo\":\""+ codex + "\"}"; //data = "{\"queryType\":0,\"queryDate\":\"" + DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd") + "\",\"crawlerInfo\":\"" + codex + "\"}"; url = "https://mms.pinduoduo.com/sydney/api/goodsDataShow/queryGoodsPageOverView"; refere = "https://mms.pinduoduo.com/sycm/goods_effect"; data = "{\"queryType\":0,\"queryDate\":\"" + DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd") + "\",\"crawlerInfo\":\"" + codex + "\"}"; html = GetPostTaobaoHtml.GetJsonPost(url, refere, true, data, cookies); onePVSum = BaseRegex.GetIntJson(ref html, "gpv"); oneUVSum = BaseRegex.GetIntJson(ref html, "guv"); oneVcrSum = BaseRegex.GetDecimalJson(ref html, "payUvRto"); int totalItemNum= BaseRegex.GetIntJson(ref html, "payOrdrCnt"); //url = "https://mms.pinduoduo.com/sydney/api/goodsDataShow/detailList"; //refere = "https://mms.pinduoduo.com/Pdd.html"; //data = "{\"orderBy\":\"pay_ord_cnt\",\"orderStrategy\":\"DESC\",\"pageNumber\":1,\"pageSize\":10,\"crawlerInfo\":\"" + codex + "\",\"spanDays\":" + 1 + ",\"readyDate\":\"" + BaseClass.GetServerTimeString().AddDays(-1).ToString("yyyy-MM-dd") + "\"}"; //html = GetPostTaobaoHtml.GetJsonPost(url, refere, true, data, cookies); //int allCount = BaseRegex.GetIntJson(ref html, "total"); //page = allCount / 10 + (allCount % 10 > 0 ? 1 : 0); //for (int i = 1; i <= page; i++) //{ // if (i != 1) // { // data = "{\"orderBy\":\"pay_ord_cnt\",\"orderStrategy\":\"DESC\",\"pageNumber\":" + i + ",\"pageSize\":10,\"spanDays\":" + 1 + ",\"readyDate\":\"" + BaseClass.GetServerTimeString().AddDays(-1).ToString("yyyy-MM-dd") + "\"}"; // html = GetPostTaobaoHtml.UploadTaobaoPost(url, refere, true, data, cookies); // } // m = BaseRegex.GetMatchRegex(ref html, @"\{([^\}]+?)\}"); // for (int j = 0; m != null && j < m.Count; j++) // { // string list = m[j].Groups[0].Value; // int goodsUv = BaseRegex.GetIntJson(ref list, "goodsUv"); // int goodsPv = BaseRegex.GetIntJson(ref list, "goodsPv"); // decimal goodsVcr = BaseRegex.GetDecimalJson(ref list, "goodsVcr"); // oneUVSum += goodsUv; // onePVSum += goodsPv; // oneVcrSum += goodsVcr; // } //} if (sevFlag) { using (IJsEngine jsEngine = new V8JsEngine()) { jsEngine.Execute(GetProductOnlineClass.JsCodeGetSms); codex = jsEngine.CallFunction("aaa", "").ToString(); } //url = "https://mms.pinduoduo.com/sydney/api/mallFlow/queryMallFlowOverView"; //"https://mms.pinduoduo.com/sydney/api/goodsDataShow/queryGoodsPageOverView"; //refere = "https://mms.pinduoduo.com/sycm/goods_effect"; //data = "{\"beginDate\":\"" + DateTime.Now.AddDays(-7).ToString("yyyy-MM-dd") + "\",\"endDate\":\"" + DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd") + "\",\"crawlerInfo\":\"" + codex + "\"}"; url = "https://mms.pinduoduo.com/sydney/api/goodsDataShow/queryGoodsPageOverView"; refere = "https://mms.pinduoduo.com/sycm/goods_effect"; data = "{\"queryType\":1,\"queryDate\":\"\",\"crawlerInfo\":\"" + codex + "\"}"; html = GetPostTaobaoHtml.GetJsonPost(url, refere, true, data, cookies); sevPVSum = BaseRegex.GetIntJson(ref html, "gpv"); sevUVSum = BaseRegex.GetIntJson(ref html, "guv"); sevVCRSum = BaseRegex.GetDecimalJson(ref html, "payUvRto"); ////7天 //url = "https://mms.pinduoduo.com/sydney/api/goodsDataShow/detailList"; //refere = "https://mms.pinduoduo.com/Pdd.html"; //data = "{\"orderBy\":\"pay_ord_cnt\",\"orderStrategy\":\"DESC\",\"pageNumber\":1,\"pageSize\":10,\"crawlerInfo\":\"" + codex + "\",\"spanDays\":" + 7 + ",\"readyDate\":\"" + BaseClass.GetServerTimeString().AddDays(-1).ToString("yyyy-MM-dd") + "\"}"; //html = GetPostTaobaoHtml.GetJsonPost(url, refere, true, data, cookies); //allCount = BaseRegex.GetIntJson(ref html, "total"); //page = allCount / 10 + (allCount % 10 > 0 ? 1 : 0); //for (int i = 1; i <= page; i++) //{ // if (i != 1) // { // data = "{\"orderBy\":\"pay_ord_cnt\",\"orderStrategy\":\"DESC\",\"pageNumber\":" + i + ",\"pageSize\":10,\"spanDays\":" + 7 + ",\"readyDate\":\"" + BaseClass.GetServerTimeString().AddDays(-1).ToString("yyyy-MM-dd") + "\"}"; // html = GetPostTaobaoHtml.UploadTaobaoPost(url, refere, true, data, cookies); // } // m = BaseRegex.GetMatchRegex(ref html, @"\{([^\}]+?)\}"); // for (int j = 0; m != null && j < m.Count; j++) // { // string list = m[j].Groups[0].Value; // int goodsUv = BaseRegex.GetIntJson(ref list, "goodsUv"); // int goodsPv = BaseRegex.GetIntJson(ref list, "goodsPv"); // decimal goodsVcr = BaseRegex.GetDecimalJson(ref list, "goodsVcr"); // sevUVSum += goodsUv; // sevPVSum += goodsPv; // sevVCRSum += goodsVcr; // } //} } int totalThirItemNum = 0; if (thirFlag) { using (IJsEngine jsEngine = new V8JsEngine()) { jsEngine.Execute(GetProductOnlineClass.JsCodeGetSms); codex = jsEngine.CallFunction("aaa", "").ToString(); } //url = "https://mms.pinduoduo.com/sydney/api/mallFlow/queryMallFlowOverView"; //"https://mms.pinduoduo.com/sydney/api/goodsDataShow/queryGoodsPageOverView"; //refere = "https://mms.pinduoduo.com/sycm/goods_effect"; //data = "{\"beginDate\":\"" + DateTime.Now.AddDays(-30).ToString("yyyy-MM-dd") + "\",\"endDate\":\"" + DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd") + "\",\"crawlerInfo\":\"" + codex + "\"}"; url = "https://mms.pinduoduo.com/sydney/api/goodsDataShow/queryGoodsPageOverView"; refere = "https://mms.pinduoduo.com/sycm/goods_effect"; data = "{\"queryType\":2,\"queryDate\":\"\",\"crawlerInfo\":\"" + codex + "\"}"; html = GetPostTaobaoHtml.GetJsonPost(url, refere, true, data, cookies); thirtyPVSum = BaseRegex.GetIntJson(ref html, "gpv"); thirtyUVSum = BaseRegex.GetIntJson(ref html, "guv"); thirtyVCRSum = BaseRegex.GetDecimalJson(ref html, "payUvRto"); totalThirItemNum = BaseRegex.GetIntJson(ref html, "payOrdrCnt"); ////30天 //url = "https://mms.pinduoduo.com/sydney/api/goodsDataShow/detailList"; //refere = "https://mms.pinduoduo.com/Pdd.html"; //data = "{\"orderBy\":\"pay_ord_cnt\",\"orderStrategy\":\"DESC\",\"pageNumber\":1,\"pageSize\":10,\"crawlerInfo\":\"" + codex + "\",\"spanDays\":" + 30 + ",\"readyDate\":\"" + BaseClass.GetServerTimeString().AddDays(-1).ToString("yyyy-MM-dd") + "\"}"; //html = GetPostTaobaoHtml.GetJsonPost(url, refere, true, data, cookies); //allCount = BaseRegex.GetIntJson(ref html, "total"); //page = allCount / 10 + (allCount % 10 > 0 ? 1 : 0); //for (int i = 1; i <= page; i++) //{ // if (i != 1) // { // data = "{\"orderBy\":\"pay_ord_cnt\",\"orderStrategy\":\"DESC\",\"pageNumber\":" + i + ",\"pageSize\":10,\"spanDays\":" + 30 + ",\"readyDate\":\"" + BaseClass.GetServerTimeString().AddDays(-1).ToString("yyyy-MM-dd") + "\"}"; // html = GetPostTaobaoHtml.UploadTaobaoPost(url, refere, true, data, cookies); // } // m = BaseRegex.GetMatchRegex(ref html, @"\{([^\}]+?)\}"); // for (int j = 0; m != null && j < m.Count; j++) // { // string list = m[j].Groups[0].Value; // int goodsUv = BaseRegex.GetIntJson(ref list, "goodsUv"); // int goodsPv = BaseRegex.GetIntJson(ref list, "goodsPv"); // decimal goodsVcr = BaseRegex.GetDecimalJson(ref list, "goodsVcr"); // thirtyUVSum += goodsUv; // thirtyPVSum += goodsPv; // thirtyVCRSum += goodsVcr; // } //} } //sevVCRSum = sevVCRSum / 7; //thirtyVCRSum = thirtyVCRSum / 30; #endregion ShopDetail shopDetail = new ShopDetail(); shopDetail.userName = Shop.ShopName; shopDetail.shopName = Shop.Name; shopDetail.bondMoney = freeBalanceMount.ToString();//保证金 shopDetail.threshold = thresholdMount.ToString();//阈值 shopDetail.putForward = putAmount.ToString();//可提现 shopDetail.expAbnormal = totalWuLiuCount.ToString();//物流异常 shopDetail.allGood = allGoodsCount.ToString();//线上产品 shopDetail.onSaleGood = ShelvesCount.ToString();//上架产品 shopDetail.sellOut = sellOutCount.ToString();//售罄 shopDetail.lowerGood = lowerCount.ToString();//下架产品 shopDetail.reject = totalCount.ToString();//驳回 shopDetail.yesUV = oneUVSum.ToString();//昨日访客 shopDetail.yesPV = onePVSum.ToString();//昨日流量 shopDetail.yesConRate = oneVcrSum.ToString("0.0000");//昨日转化 shopDetail.sevUV = sevUVSum.ToString();//7天访客 shopDetail.sevPV = sevPVSum.ToString();//7天流量 shopDetail.sevConRate = sevVCRSum.ToString("0.0000");// 7天转化 shopDetail.thirUV = thirtyUVSum.ToString();//30天访客 shopDetail.thirPV = thirtyPVSum.ToString();//30天流量 shopDetail.thiryesConRate = thirtyVCRSum.ToString("0.0000");//30天转化 shopDetail.punEndtime = punEndtime;//惩罚结束日期 shopDetail.hisFines = sumChareAmount.ToString();//历史罚款 shopDetail.delay = sumStockAmount.ToString(); if (!string.IsNullOrEmpty(punReason)) shopDetail.punReason = punReason; if (punstartTime>0) shopDetail.punstartTime = BaseClass.StampToDateTime(punstartTime).ToString(); if (punendTime > 0) shopDetail.punendTime = BaseClass.StampToDateTime(punendTime).ToString(); shopDetail.punLevel = punishment.ToString();//惩罚 shopDetail.mainCam = staple == null ? "" : staple.ToString();//主营类目 shopDetail.todayAccount = todayMount.ToString();//今日成交 shopDetail.waitForAccount = waitAmount.ToString();//待到账 shopDetail.thirtySellGood = thirtydayGoodsNum.ToString();//30天销售 shopDetail.thirtyDeal = thirtydayIn.ToString();//30天成交金额 shopDetail.yesOrder = totalItemNum.ToString();// 昨天订单数 shopDetail.thirtyOrder = totalThirItemNum.ToString();//30天订单数 shopDetail.bankCard = accountCard;//入驻银行卡 shopDetail.mobile = operatorMobile;//入驻手机号 shopDetail.playAmount = playAmount;//小额打款 shopDetail.yesdayIn = yesdayIn.ToString();//昨天成交金额 shopDetail.sevendayIn = sevendayIn.ToString();//7天成交金额 shopDetail.status = "读取完成"; ShopDetailControl.ShopDetailTempList.Add(shopDetail); } catch { } } /// /// 获取绝对时间 /// /// public static long GetTime(DateTime t) { return ConvertDateTimeInt(t) + BaseClass.TimeDifferent; } public static long ConvertDateTimeInt(DateTime time) { System.DateTime startTime = TimeZone.CurrentTimeZone.ToLocalTime(new System.DateTime(1970, 1, 1)); return (long)(time - startTime).TotalMilliseconds; } } public class ShopDetail { public string userName = ""; public string shopName = ""; public string bondMoney = ""; public string putForward = ""; public string expAbnormal = ""; public string allGood = ""; public string onSaleGood = ""; public string sellOut = ""; public string lowerGood = ""; public string reject = ""; public string yesUV = ""; public string yesPV = ""; public string yesConRate = ""; public string sevUV = ""; public string sevPV = ""; public string sevConRate = ""; public string thirUV = ""; public string thirPV = ""; public string thiryesConRate = ""; public string punLevel = ""; public string punEndtime = ""; public string mainCam = ""; public string todayAccount = ""; public string waitForAccount = ""; public string thirtySellGood = ""; public string thirtyOrder = ""; public string thirtyDeal = ""; public string yesdayIn = ""; public string sevendayIn = ""; public string yesOrder = ""; public string hisFines = ""; public string delay = ""; public string bankCard = ""; public string mobile = ""; public string status = ""; public string punReason = ""; public string punstartTime = ""; public string punendTime = ""; public decimal playAmount = 0M; public string threshold = ""; } }