2123 lines
94 KiB
C#
2123 lines
94 KiB
C#
using AllBase;
|
|
using JavaScriptEngineSwitcher.Core;
|
|
using JavaScriptEngineSwitcher.V8;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading;
|
|
using System.Threading.Tasks;
|
|
using Work.Api;
|
|
using Work.CollectClass;
|
|
|
|
namespace Work.ManageClass
|
|
{
|
|
public class ClearProductGroup
|
|
{
|
|
public static List<TaobaoProductBase> ProductClearTemp = new List<TaobaoProductBase>();
|
|
public static List<DelGroupStatus> ClearGroupStatusList = new List<DelGroupStatus>();
|
|
public static List<ShopChatBase> ShopTemp = new List<ShopChatBase>();
|
|
public static List<ShopChatBase> InvalidShopTemp = new List<ShopChatBase>();
|
|
public static string adslName;
|
|
public static string adslPassWord;
|
|
public static bool punoff;
|
|
public static bool selTime;
|
|
public static bool selStart = true;
|
|
public static DateTime selDateTime;
|
|
/// <summary>
|
|
/// 是否理指定天数内商品
|
|
/// </summary>
|
|
public static bool IsNoDays = false;
|
|
/// <summary>
|
|
/// 不处理的天数
|
|
/// </summary>
|
|
public static int DaysCount = 0;
|
|
/// <summary>
|
|
/// 使用Api接口操作数据
|
|
/// </summary>
|
|
public static bool IsUseApi = false;
|
|
/// <summary>
|
|
/// 是否设置操作商品数量
|
|
/// </summary>
|
|
public static bool IsGoodCount = false;
|
|
/// <summary>
|
|
/// 群控清理操作的商品数
|
|
/// </summary>
|
|
public static int GoodCount = 0;
|
|
/// <summary>
|
|
/// 是否只处理在价格范围内的商品
|
|
/// </summary>
|
|
public static bool IsPrice = false;
|
|
public static int MinPrice = 0;
|
|
public static int MaxPrice = 0;
|
|
/// <summary>
|
|
/// 不包含销量
|
|
/// </summary>
|
|
public static bool IsNoSold = false;
|
|
/// <summary>
|
|
/// 不包含访客
|
|
/// </summary>
|
|
public static bool IsNoVisit = false;
|
|
/// <summary>
|
|
/// 不包含收藏
|
|
/// </summary>
|
|
public static bool IsNoColl = false;
|
|
|
|
public int DelCount = 0;
|
|
public int OffCount = 0;
|
|
public string Name;
|
|
public ShopChatBase Shop;
|
|
public bool IsOnline = false;
|
|
public string delIds;
|
|
public bool isAdsl = false;
|
|
|
|
public ClearProductGroup(string name, ShopChatBase shop)
|
|
{
|
|
Name = name;
|
|
Shop = shop;
|
|
}
|
|
|
|
public void Delete()
|
|
{
|
|
GetAllGroupOnline();
|
|
Shop.ClearNoVisitShop.goodsCount = Shop.OnOrOffProduct.Count;
|
|
ShopTemp.Add(Shop);
|
|
|
|
List<long> ids = new List<long>();
|
|
if (string.IsNullOrEmpty(PinduoduoAuth.strContent))
|
|
{
|
|
PinduoduoAuth.strContent = GetVisitProductNew.strJs;//FileBase.ReadAllText(path);
|
|
}
|
|
string NoCode = "";
|
|
string strTime = BaseClass.GetTime(DateTime.Now).ToString() + "000";
|
|
if (string.IsNullOrEmpty(NoCode))
|
|
{
|
|
string htmlx = GetHtml.Gbk("http://nano.qixiaoke.com/nano.txt");
|
|
NoCode = BaseRegex.GetMatchRegexString(ref htmlx, @"([\w\W]+?)-----");
|
|
}
|
|
string fun2 = string.Format(@"getEncode('{0}','{1}','{2}')", strTime, NoCode, "");
|
|
string codex = UploadPinduoduoSet.ExecuteScript(fun2, PinduoduoAuth.strContent);
|
|
|
|
List<long> idsx = new List<long>();
|
|
for (int j = 0; j < Shop.OnOrOffProduct.Count; j++)
|
|
{
|
|
IsOnline = !Shop.OnOrOffProduct[j].OffLine;
|
|
if (IsOnline)
|
|
{
|
|
idsx.Add(Shop.OnOrOffProduct[j].GoodsId);
|
|
OffCount++;
|
|
if (OffCount > GoodCount)
|
|
break;
|
|
if (idsx.Count >= 15)
|
|
{
|
|
string html = OffShop(idsx);
|
|
idsx.Clear();
|
|
if (html == "error")
|
|
break;
|
|
Shop.ClearNoVisitShop.offCount = OffCount;
|
|
ShopTemp.Add(Shop);
|
|
|
|
Thread.Sleep(10 * 1000);
|
|
}
|
|
}
|
|
}
|
|
if (idsx.Count > 0)
|
|
{
|
|
OffShop(idsx);
|
|
idsx.Clear();
|
|
Shop.ClearNoVisitShop.offCount = OffCount;
|
|
ShopTemp.Add(Shop);
|
|
|
|
}
|
|
for (int j = 0; j < Shop.OnOrOffProduct.Count; j++)
|
|
{
|
|
//isOnline = !Shop.OnOrOffProduct[j].OffLine;
|
|
//if (isOnline)
|
|
//{
|
|
// var api = new PinduoduoApiGetProduct(Shop);
|
|
// string html = api.SetOnline(Shop.OnOrOffProduct[j].GoodsId, false);
|
|
// Shop.OnOrOffProduct[j].Message = !isOnline ? "上架成功" : "下架成功";
|
|
// ProductClearTemp.Add(Shop.OnOrOffProduct[j]);
|
|
// LogSave.Add(Name, "在线产品 " + Shop.OnOrOffProduct[j].Titlte + Shop.OnOrOffProduct[j].Message);
|
|
//}
|
|
ids.Add(Shop.OnOrOffProduct[j].GoodsId);
|
|
DelCount++;
|
|
Shop.OnOrOffProduct[j].Message = "删除成功";
|
|
if (ids.Count >= 100)
|
|
{
|
|
string html = DelGroupIds(ids);
|
|
if (DelCount > GoodCount)
|
|
break;
|
|
if (html.Contains("您当日所删除的商品已达上限"))
|
|
{
|
|
LogSave.Add(Name, "今日删除商品已达上限:" + Shop.ShopName);
|
|
for (int i = 0; i < ids.Count; i++)
|
|
{
|
|
var p = Shop.OnOrOffProduct.Find(sp => sp.GoodsId == ids[i]);
|
|
p.Message = " ";
|
|
ProductClearTemp.Add(p);
|
|
}
|
|
return;
|
|
}
|
|
for (int i = 0; i < ids.Count; i++)
|
|
{
|
|
var p = Shop.OnOrOffProduct.Find(sp => sp.GoodsId == ids[i]);
|
|
ProductClearTemp.Add(p);
|
|
}
|
|
ids.Clear();
|
|
Shop.ClearNoVisitShop.delCount = DelCount;
|
|
ShopTemp.Add(Shop);
|
|
|
|
LogSave.Add(Name, "删除成功:" + Shop.OnOrOffProduct[j].GoodsId);
|
|
Thread.Sleep(3 * 1000);
|
|
}
|
|
}
|
|
if (ids.Count > 0)
|
|
{
|
|
string html = DelGroupIds(ids);
|
|
if (html.Contains("您当日所删除的商品已达上限"))
|
|
{
|
|
LogSave.Add(Name, "今日删除商品已达上限:" + Shop.ShopName);
|
|
for (int i = 0; i < ids.Count; i++)
|
|
{
|
|
var p = Shop.OnOrOffProduct.Find(sp => sp.GoodsId == ids[i]);
|
|
p.Message = " ";
|
|
ProductClearTemp.Add(p);
|
|
}
|
|
return;
|
|
}
|
|
for (int i = 0; i < ids.Count; i++)
|
|
{
|
|
var p = Shop.OnOrOffProduct.Find(sp => sp.GoodsId == ids[i]);
|
|
ProductClearTemp.Add(p);
|
|
}
|
|
Shop.ClearNoVisitShop.delCount = DelCount;
|
|
ShopTemp.Add(Shop);
|
|
|
|
}
|
|
Shop.ClearNoVisitShop.goodStatus = "删除完成";
|
|
ShopTemp.Add(Shop);
|
|
LogSave.Add(Name, "删除完成");
|
|
}
|
|
public void DeleteUp()
|
|
{
|
|
GetAllOnlineCount();
|
|
GetDelAllGroupOnline();
|
|
if (IsUseApi)
|
|
{
|
|
var api = new PinduoduoApiGetProduct(Shop);
|
|
for (int j = 0; j < Shop.OnOrOffProduct.Count; j++)
|
|
{
|
|
IsOnline = !Shop.OnOrOffProduct[j].OffLine;
|
|
string html = "";
|
|
if (IsOnline)
|
|
{
|
|
html = api.SetOnline(Shop.OnOrOffProduct[j].GoodsId, false);
|
|
OffCount++;
|
|
Shop.ClearNoVisitShop.goodStatus = "下架第" + OffCount + "个";
|
|
ShopTemp.Add(Shop);
|
|
}
|
|
Thread.Sleep(3 * 1000);
|
|
}
|
|
Shop.ClearNoVisitShop.goodStatus = "下架第" + OffCount + "个(完成)";
|
|
ShopTemp.Add(Shop);
|
|
LogSave.Add(Name, "下架完成");
|
|
|
|
}
|
|
else
|
|
{
|
|
if (string.IsNullOrEmpty(PinduoduoAuth.strContent))
|
|
{
|
|
PinduoduoAuth.strContent = GetVisitProductNew.strJs;//FileBase.ReadAllText(path);
|
|
}
|
|
string NoCode = "";
|
|
string strTime = BaseClass.GetTime(DateTime.Now).ToString() + "000";
|
|
if (string.IsNullOrEmpty(NoCode))
|
|
{
|
|
string htmlx = GetHtml.Gbk("http://nano.qixiaoke.com/nano.txt");
|
|
NoCode = BaseRegex.GetMatchRegexString(ref htmlx, @"([\w\W]+?)-----");
|
|
}
|
|
string fun2 = string.Format(@"getEncode('{0}','{1}','{2}')", strTime, NoCode, "");
|
|
string codex = UploadPinduoduoSet.ExecuteScript(fun2, PinduoduoAuth.strContent);
|
|
|
|
List<long> idsx = new List<long>();
|
|
for (int j = 0; j < Shop.OnOrOffProduct.Count; j++)
|
|
{
|
|
IsOnline = !Shop.OnOrOffProduct[j].OffLine;
|
|
if (IsOnline)
|
|
{
|
|
idsx.Add(Shop.OnOrOffProduct[j].GoodsId);
|
|
OffCount++;
|
|
if (IsGoodCount && OffCount >= GoodCount)
|
|
break;
|
|
if (idsx.Count >= 15)
|
|
{
|
|
string html = OffShop(idsx);
|
|
idsx.Clear();
|
|
if (!string.IsNullOrEmpty(html) && html.Contains("为了保障您的账户安全,请先进行安全验证"))
|
|
{
|
|
Shop.ClearNoVisitShop.goodStatus = "请使用API接口";
|
|
ShopTemp.Add(Shop);
|
|
return;
|
|
}
|
|
if (!string.IsNullOrEmpty(html))
|
|
{
|
|
Shop.ClearNoVisitShop.goodStatus = "请查看IP是否被限制";
|
|
ShopTemp.Add(Shop);
|
|
continue;
|
|
}
|
|
|
|
Shop.ClearNoVisitShop.goodStatus = "下架第" + OffCount + "个";
|
|
ShopTemp.Add(Shop);
|
|
|
|
Thread.Sleep(10 * 1000);
|
|
}
|
|
}
|
|
}
|
|
if (idsx.Count > 0)
|
|
{
|
|
OffShop(idsx);
|
|
idsx.Clear();
|
|
Shop.ClearNoVisitShop.goodStatus = "下架第" + OffCount + "个(完成)";
|
|
ShopTemp.Add(Shop);
|
|
}
|
|
}
|
|
List<long> ids = new List<long>();
|
|
for (int j = 0; j < Shop.OnOrOffProduct.Count; j++)
|
|
{
|
|
ids.Add(Shop.OnOrOffProduct[j].GoodsId);
|
|
DelCount++;
|
|
Shop.OnOrOffProduct[j].Message = "删除成功";
|
|
if (ids.Count >= 100)
|
|
{
|
|
if (IsGoodCount && DelCount >= GoodCount)
|
|
break;
|
|
string html = DelGroupIds(ids);
|
|
if (html.Contains("您当日所删除的商品已达上限") || html.Contains("所选商品超出当日删除量上限"))
|
|
{
|
|
List<long> delids = new List<long>();
|
|
for (int i = 0; i < ids.Count; i++)
|
|
{
|
|
delids.Add(ids[i]);
|
|
if ((i + 1) % 10 == 0)
|
|
{
|
|
html = DelGroupIds(delids);
|
|
delids.Clear();
|
|
Thread.Sleep(3 * 1000);
|
|
}
|
|
if (html.Contains("您当日所删除的商品已达上限"))
|
|
break;
|
|
|
|
}
|
|
LogSave.Add(Name, "今日删除商品已达上限:" + Shop.ShopName);
|
|
Shop.ClearNoVisitShop.goodStatus = "今日删除商品已达上限";
|
|
ShopTemp.Add(Shop);
|
|
return;
|
|
}
|
|
ids.Clear();
|
|
Shop.ClearNoVisitShop.goodStatus = "删除上架中" + DelCount + "个";
|
|
ShopTemp.Add(Shop);
|
|
|
|
LogSave.Add(Name, "删除成功:" + Shop.OnOrOffProduct[j].GoodsId);
|
|
Thread.Sleep(5 * 1000);
|
|
}
|
|
}
|
|
if (ids.Count > 0)
|
|
{
|
|
string html = DelGroupIds(ids);
|
|
if (html.Contains("您当日所删除的商品已达上限") || html.Contains("所选商品超出当日删除量上限"))
|
|
{
|
|
LogSave.Add(Name, "今日删除商品已达上限:" + Shop.ShopName);
|
|
Shop.ClearNoVisitShop.goodStatus = "今日删除商品已达上限";
|
|
ShopTemp.Add(Shop);
|
|
return;
|
|
}
|
|
Shop.ClearNoVisitShop.goodStatus = "删除上架中" + DelCount + "个(完成)";
|
|
ShopTemp.Add(Shop);
|
|
|
|
}
|
|
LogSave.Add(Name, "删除完成");
|
|
}
|
|
|
|
public void DeleteGlide()
|
|
{
|
|
GetAllOnlineCount();
|
|
Shop.OnOrOffProduct.Clear();
|
|
int mallId = Shop.MallId;
|
|
string cookies = Shop.Cookies, shopName = Shop.ShopName;
|
|
string url = "https://mms.pinduoduo.com/glide/v2/mms/query/commit/list";
|
|
string refere = "https://mms.pinduoduo.com/Pdd.html";
|
|
string data = "{\"check_status\":3,\"start\":0,\"length\":100}";
|
|
string html = CpsSetAllGoods.Request_mms_pinduoduo_com(url, refere, Shop.Cookies, data, CpsSetAllGoods.getAnti0aon());/// GetPostTaobaoHtml.UploadTaobaoPost(url, refere, true, data.Replace("#page#", "1"), cookies);
|
|
if (string.IsNullOrEmpty(html) || !html.Contains("total"))
|
|
{
|
|
Thread.Sleep(30 * 1000);
|
|
html = CpsSetAllGoods.Request_mms_pinduoduo_com(url, refere, Shop.Cookies, data, CpsSetAllGoods.getAnti0aon());
|
|
}
|
|
int allCount = BaseRegex.GetIntJson(ref html, "total");
|
|
int page = allCount / 100 + (allCount % 100 > 0 ? 1 : 0);
|
|
|
|
if (page > 1000)
|
|
{
|
|
page = 1000;
|
|
}
|
|
for (int i = 0; i < page; i++)
|
|
{
|
|
if (IsGoodCount && count >= GoodCount)
|
|
break;
|
|
if (count > 1100)
|
|
break;
|
|
if (i != 0)
|
|
{
|
|
data = "{\"check_status\":3,\"start\":"+ i * 100 + ",\"length\":100}";
|
|
html = CpsSetAllGoods.Request_mms_pinduoduo_com(url, refere, Shop.Cookies, data, CpsSetAllGoods.getAnti0aon());
|
|
if (string.IsNullOrEmpty(html) || !html.Contains("total"))
|
|
{
|
|
Thread.Sleep(30 * 1000);
|
|
html = CpsSetAllGoods.Request_mms_pinduoduo_com(url, refere, Shop.Cookies, data, CpsSetAllGoods.getAnti0aon());
|
|
}
|
|
|
|
}
|
|
var m = BaseRegex.GetMatchRegex(ref html, @"\{([\w\W]+?)\}");
|
|
for (int j = 0; m != null && j < m.Count; j++)
|
|
{
|
|
if (count > 1100)
|
|
break;
|
|
if (IsGoodCount && count >= GoodCount)
|
|
break;
|
|
|
|
string list = m[j].Groups[0].Value;
|
|
TaobaoProductBase p = new TaobaoProductBase();
|
|
p.toId= BaseRegex.GetLongJson(ref list, "id");
|
|
p.GoodsId = BaseRegex.GetLongJson(ref list, "goods_id");
|
|
p.Titlte = BaseRegex.GetStringJson(ref list, "goods_name");
|
|
p.ShopName = Shop.ShopName;
|
|
if (!Shop.OnOrOffProduct.Exists(pt => pt != null && pt.GoodsId == p.GoodsId))
|
|
Shop.OnOrOffProduct.Add(p);
|
|
count++;
|
|
}
|
|
Thread.Sleep(300);
|
|
LogSave.Add(Name, "获取在线产品 " + shopName + ",分页:" + i);
|
|
}
|
|
|
|
url = "https://mms.pinduoduo.com/glide/v2/mms/edit/commit/delete";
|
|
refere = "https://mms.pinduoduo.com/Pdd.html";
|
|
for (int j = 0; j < Shop.OnOrOffProduct.Count; j++)
|
|
{
|
|
if (IsGoodCount)
|
|
break;
|
|
data = "{\"goods_commit_id\":"+ Shop.OnOrOffProduct[j].toId+ "}";
|
|
html = CpsSetAllGoods.Request_mms_pinduoduo_com(url, refere, Shop.Cookies, data, CpsSetAllGoods.getAnti0aon());
|
|
LogSave.Add(Name, "正在删除驳回商品 " + Shop.OnOrOffProduct[j].GoodsId);
|
|
Shop.ClearNoVisitShop.goodStatus = "删除第" + (j+1) + "个(完成)";
|
|
ShopTemp.Add(Shop);
|
|
Thread.Sleep(1000);
|
|
}
|
|
LogSave.Add(Name, "删除驳回商品完成");
|
|
}
|
|
|
|
public void DeleteDown()
|
|
{
|
|
GetAllOnlineCount();
|
|
GetDelAllGroupOnline();
|
|
|
|
List<long> ids = new List<long>();
|
|
for (int j = 0; j < Shop.OnOrOffProduct.Count; j++)
|
|
{
|
|
if (IsGoodCount && DelCount >= GoodCount)
|
|
break;
|
|
ids.Add(Shop.OnOrOffProduct[j].GoodsId);
|
|
DelCount++;
|
|
Shop.OnOrOffProduct[j].Message = "删除成功";
|
|
if (ids.Count >= 100)
|
|
{
|
|
if (IsGoodCount && DelCount >= GoodCount)
|
|
break;
|
|
string html = DelGroupIds(ids);
|
|
if (html.Contains("您当日所删除的商品已达上限") || html.Contains("所选商品超出当日删除量上限"))
|
|
{
|
|
List<long> delids = new List<long>();
|
|
for (int i = 0; i < ids.Count; i++)
|
|
{
|
|
delids.Add(ids[i]);
|
|
if ((i+1)%10==0)
|
|
{
|
|
html = DelGroupIds(delids);
|
|
delids.Clear();
|
|
Thread.Sleep(3 * 1000);
|
|
}
|
|
if (html.Contains("您当日所删除的商品已达上限"))
|
|
break;
|
|
|
|
}
|
|
LogSave.Add(Name, "今日删除商品已达上限:" + Shop.ShopName);
|
|
Shop.ClearNoVisitShop.goodStatus = "今日删除商品已达上限";
|
|
ShopTemp.Add(Shop);
|
|
return;
|
|
}
|
|
ids.Clear();
|
|
Shop.ClearNoVisitShop.goodStatus = "删除下架中" + DelCount + "个";
|
|
ShopTemp.Add(Shop);
|
|
|
|
LogSave.Add(Name, "删除成功:" + Shop.OnOrOffProduct[j].GoodsId);
|
|
Thread.Sleep(5 * 1000);
|
|
}
|
|
}
|
|
if (ids.Count > 0)
|
|
{
|
|
string html = DelGroupIds(ids);
|
|
if (html.Contains("您当日所删除的商品已达上限") || html.Contains("所选商品超出当日删除量上限"))
|
|
{
|
|
LogSave.Add(Name, "今日删除商品已达上限:" + Shop.ShopName);
|
|
Shop.ClearNoVisitShop.goodStatus = "今日删除商品已达上限";
|
|
ShopTemp.Add(Shop);
|
|
return;
|
|
}
|
|
Shop.ClearNoVisitShop.goodStatus = "删除下架中" + DelCount + "个(完成)";
|
|
ShopTemp.Add(Shop);
|
|
}
|
|
LogSave.Add(Name, "删除完成");
|
|
}
|
|
|
|
public void DeleteNoSpr()
|
|
{
|
|
GetAllOnlineCount();
|
|
GetAllSprGroupOnline();
|
|
List<long> ids = new List<long>();
|
|
if (string.IsNullOrEmpty(PinduoduoAuth.strContent))
|
|
{
|
|
PinduoduoAuth.strContent = GetVisitProductNew.strJs;//FileBase.ReadAllText(path);
|
|
}
|
|
string NoCode = "";
|
|
string strTime = BaseClass.GetTime(DateTime.Now).ToString() + "000";
|
|
if (string.IsNullOrEmpty(NoCode))
|
|
{
|
|
string htmlx = GetHtml.Gbk("http://nano.qixiaoke.com/nano.txt");
|
|
NoCode = BaseRegex.GetMatchRegexString(ref htmlx, @"([\w\W]+?)-----");
|
|
}
|
|
string fun2 = string.Format(@"getEncode('{0}','{1}','{2}')", strTime, NoCode, "");
|
|
string codex = UploadPinduoduoSet.ExecuteScript(fun2, PinduoduoAuth.strContent);
|
|
|
|
List<long> idsx = new List<long>();
|
|
for (int j = 0; j < Shop.OnOrOffProduct.Count; j++)
|
|
{
|
|
IsOnline = !Shop.OnOrOffProduct[j].OffLine;
|
|
if (IsOnline)
|
|
{
|
|
idsx.Add(Shop.OnOrOffProduct[j].GoodsId);
|
|
if (idsx.Count >= 15)
|
|
{
|
|
string html = OffSprShop(idsx);
|
|
idsx.Clear();
|
|
if (html == "error")
|
|
break;
|
|
Thread.Sleep(10 * 1000);
|
|
}
|
|
}
|
|
}
|
|
if (idsx.Count > 0)
|
|
{
|
|
OffSprShop(idsx);
|
|
idsx.Clear();
|
|
}
|
|
for (int j = 0; j < Shop.OnOrOffProduct.Count; j++)
|
|
{
|
|
//isOnline = !Shop.OnOrOffProduct[j].OffLine;
|
|
//if (isOnline)
|
|
//{
|
|
// var api = new PinduoduoApiGetProduct(Shop);
|
|
// string html = api.SetOnline(Shop.OnOrOffProduct[j].GoodsId, false);
|
|
// Shop.OnOrOffProduct[j].Message = !isOnline ? "上架成功" : "下架成功";
|
|
// ProductClearTemp.Add(Shop.OnOrOffProduct[j]);
|
|
// LogSave.Add(Name, "在线产品 " + Shop.OnOrOffProduct[j].Titlte + Shop.OnOrOffProduct[j].Message);
|
|
//}
|
|
ids.Add(Shop.OnOrOffProduct[j].GoodsId);
|
|
DelCount++;
|
|
Shop.OnOrOffProduct[j].Message = "删除成功";
|
|
if (ids.Count >= 100)
|
|
{
|
|
string html = DelGroupIds(ids);
|
|
|
|
if (html.Contains("您当日所删除的商品已达上限"))
|
|
{
|
|
LogSave.Add(Name, "今日删除商品已达上限:" + Shop.ShopName);
|
|
for (int i = 0; i < ids.Count; i++)
|
|
{
|
|
var p = Shop.OnOrOffProduct.Find(sp => sp.GoodsId == ids[i]);
|
|
p.Message = " ";
|
|
//ProductClearTemp.Add(p);
|
|
JinBaoMarketing.jinBaoTempProduct.Add(p);
|
|
}
|
|
return;
|
|
}
|
|
for (int i = 0; i < ids.Count; i++)
|
|
{
|
|
var p = Shop.OnOrOffProduct.Find(sp => sp.GoodsId == ids[i]);
|
|
//ProductClearTemp.Add(p);
|
|
JinBaoMarketing.jinBaoTempProduct.Add(p);
|
|
}
|
|
ids.Clear();
|
|
DelGroupStatus delstatus = new DelGroupStatus();
|
|
delstatus.shopName = Shop.ShopName;
|
|
delstatus.count = DelCount;
|
|
ClearGroupStatusList.Add(delstatus);
|
|
LogSave.Add(Name, "删除成功:" + Shop.OnOrOffProduct[j].GoodsId);
|
|
Thread.Sleep(3 * 1000);
|
|
}
|
|
}
|
|
if (ids.Count > 0)
|
|
{
|
|
string html = DelGroupIds(ids);
|
|
if (html.Contains("您当日所删除的商品已达上限"))
|
|
{
|
|
LogSave.Add(Name, "今日删除商品已达上限:" + Shop.ShopName);
|
|
for (int i = 0; i < ids.Count; i++)
|
|
{
|
|
var p = Shop.OnOrOffProduct.Find(sp => sp.GoodsId == ids[i]);
|
|
p.Message = " ";
|
|
//ProductClearTemp.Add(p);
|
|
JinBaoMarketing.jinBaoTempProduct.Add(p);
|
|
}
|
|
return;
|
|
}
|
|
for (int i = 0; i < ids.Count; i++)
|
|
{
|
|
var p = Shop.OnOrOffProduct.Find(sp => sp.GoodsId == ids[i]);
|
|
//ProductClearTemp.Add(p);
|
|
JinBaoMarketing.jinBaoTempProduct.Add(p);
|
|
}
|
|
DelGroupStatus delstatus = new DelGroupStatus();
|
|
delstatus.shopName = Shop.ShopName;
|
|
delstatus.count = DelCount;
|
|
ClearGroupStatusList.Add(delstatus);
|
|
}
|
|
LogSave.Add(Name, "删除完成");
|
|
}
|
|
public void GetAllSprGroupOnline()
|
|
{
|
|
Shop.OnOrOffProduct.Clear();
|
|
int mallId = Shop.MallId;
|
|
string cookies = Shop.Cookies, shopName = Shop.ShopName;
|
|
string url = "https://mms.pinduoduo.com/vodka/v2/mms/query/display/mall/goodsList";
|
|
string refere = "https://mms.pinduoduo.com/Pdd.html";
|
|
string data = "{\"order_by\":\"id:asc\",\"size\":100,\"page\":#page#,\"mall_id\":" + mallId + "}";
|
|
string html = GetPostTaobaoHtml.UploadTaobaoPost(url, refere, true, data.Replace("#page#", "1"), cookies);
|
|
if (string.IsNullOrEmpty(html) || !html.Contains("total"))
|
|
{
|
|
Thread.Sleep(30 * 1000);
|
|
html = GetPostTaobaoHtml.UploadTaobaoPost(url, refere, true, data.Replace("#page#", "1"), cookies);
|
|
}
|
|
if (string.IsNullOrEmpty(html) || !html.Contains("total"))
|
|
{
|
|
Thread.Sleep(30 * 1000);
|
|
html = GetPostTaobaoHtml.UploadTaobaoPost(url, refere, true, data.Replace("#page#", "1"), cookies);
|
|
}
|
|
int allCount = BaseRegex.GetIntJson(ref html, "total");
|
|
|
|
int page = allCount / 100 + (allCount % 100 > 0 ? 1 : 0);
|
|
|
|
if (page > 1000)
|
|
{
|
|
page = 1000;
|
|
}
|
|
for (int i = 0; i < page; i++)
|
|
{
|
|
//if (goodFlag && count > goodCount)
|
|
// break;
|
|
|
|
if (i != 0)
|
|
{
|
|
html = GetPostTaobaoHtml.GetJsonPost(url, refere, true, data.Replace("#page#", (i + 1).ToString()), cookies);
|
|
if (string.IsNullOrEmpty(html) || !html.Contains("total"))
|
|
{
|
|
Thread.Sleep(30 * 1000);
|
|
html = GetPostTaobaoHtml.GetJsonPost(url, refere, true, data.Replace("#page#", (i + 1).ToString()), cookies);
|
|
}
|
|
if (string.IsNullOrEmpty(html) || !html.Contains("total"))
|
|
{
|
|
Thread.Sleep(30 * 1000);
|
|
html = GetPostTaobaoHtml.GetJsonPost(url, refere, true, data.Replace("#page#", (i + 1).ToString()), cookies);
|
|
}
|
|
}
|
|
var m = BaseRegex.GetMatchRegex(ref html, @"\{([\w\W]+?)\},[\w\W]+?\}");
|
|
for (int j = 0; m != null && j < m.Count; j++)
|
|
{
|
|
if (IsGoodCount && count > GoodCount)
|
|
break;
|
|
|
|
string list = m[j].Groups[0].Value;
|
|
TaobaoProductBase p = new TaobaoProductBase();
|
|
p.GoodsId = BaseRegex.GetLongJson(ref list, "id");
|
|
p.GoodsSn = BaseRegex.GetLongJson(ref list, "goods_sn");
|
|
p.Titlte = BaseRegex.GetStringJson(ref list, "goods_name");
|
|
p.CatId = BaseRegex.GetIntJson(ref list, "cat_id");
|
|
p.CatId = PinduoduoCatList.GetNewCat3(p.CatId);
|
|
p.SaleCount = BaseRegex.GetIntJson(ref list, "sold_quantity");
|
|
p.ShopName = Shop.ShopName;
|
|
p.UseShopName = Shop.Name;
|
|
|
|
string price = BaseRegex.GetMatchRegexString(ref list, @"""sku_group_price"":\[([\d]+),");
|
|
if (string.IsNullOrEmpty(price))
|
|
price = "1000";
|
|
p.Price = int.Parse(price) / 100m;
|
|
if (PinduoduoCatList.CatIds.ContainsKey(p.CatId))
|
|
{
|
|
var c = PinduoduoCatList.CatIds[p.CatId];
|
|
p.Cat1 = c.cat1;
|
|
p.Cat2 = c.cat2;
|
|
p.Cat3 = c.cat3;
|
|
p.Cat4 = c.cat4;
|
|
p.MainCatId = c.main_cat_id;
|
|
}
|
|
else
|
|
{
|
|
|
|
}
|
|
var mc = BaseRegex.GetMatchRegex(ref list, @"""is_onsale"":([\w\W]+?),");
|
|
if (mc == null || mc.Count <= 0) continue;
|
|
p.OffLine = !bool.Parse(mc[0].Groups[1].Value);
|
|
//if (p.SaleCount > 0)
|
|
//{
|
|
// LogSave.Add(Name, "跳过销量商品 " + p.GoodsId);
|
|
// continue;
|
|
//}
|
|
//int created_at = BaseRegex.GetIntJson(ref list, "created_at");
|
|
//DateTime dt = BaseClass.StampToDateTime(created_at);
|
|
//if (ClearProductGroup.noDays && DateTime.Now.AddDays(-ClearProductGroup.daysCount) > dt)
|
|
// continue;
|
|
if (!Shop.OnOrOffProduct.Exists(pt => pt != null && pt.GoodsId == p.GoodsId))
|
|
Shop.OnOrOffProduct.Add(p);
|
|
}
|
|
Thread.Sleep(300);
|
|
LogSave.Add(Name, "获取在线产品 " + shopName + ",分页:" + i);
|
|
}
|
|
GetNoGoods();
|
|
}
|
|
public void GetNoGoods()
|
|
{
|
|
List<TaobaoProductBase> jinbaolst = new List<TaobaoProductBase>();
|
|
int mallId = Shop.MallId;
|
|
string cookies = Shop.Cookies, shopName = Shop.ShopName;
|
|
string url = "https://mms.pinduoduo.com/cps/api/query/unitList";
|
|
string refere = "https://mms.pinduoduo.com/jinbao/promotion/index";
|
|
string data = "{\"pageSize\":100,\"pageNumber\":#page#,\"currentPage\":#page#}";
|
|
string html = GetPostTaobaoHtml.UploadTaobaoPost(url, refere, true, data.Replace("#page#", "1"), cookies);
|
|
if (string.IsNullOrEmpty(html) || !html.Contains("total"))
|
|
{
|
|
Thread.Sleep(30 * 1000);
|
|
html = GetPostTaobaoHtml.UploadTaobaoPost(url, refere, true, data.Replace("#page#", "1"), cookies);
|
|
}
|
|
if (string.IsNullOrEmpty(html) || !html.Contains("total"))
|
|
{
|
|
Thread.Sleep(30 * 1000);
|
|
html = GetPostTaobaoHtml.UploadTaobaoPost(url, refere, true, data.Replace("#page#", "1"), cookies);
|
|
}
|
|
int allCount = BaseRegex.GetIntJson(ref html, "total");
|
|
|
|
int page = allCount / 100 + (allCount % 100 > 0 ? 1 : 0);
|
|
if (page > 1000)
|
|
{
|
|
page = 1000;
|
|
}
|
|
for (int i = 0; i < page; i++)
|
|
{
|
|
if (i != 0)
|
|
{
|
|
html = GetPostTaobaoHtml.GetJsonPost(url, refere, true, data.Replace("#page#", (i + 1).ToString()), cookies);
|
|
if (string.IsNullOrEmpty(html) || !html.Contains("total"))
|
|
{
|
|
Thread.Sleep(30 * 1000);
|
|
html = GetPostTaobaoHtml.GetJsonPost(url, refere, true, data.Replace("#page#", (i + 1).ToString()), cookies);
|
|
}
|
|
if (string.IsNullOrEmpty(html) || !html.Contains("total"))
|
|
{
|
|
Thread.Sleep(30 * 1000);
|
|
html = GetPostTaobaoHtml.GetJsonPost(url, refere, true, data.Replace("#page#", (i + 1).ToString()), cookies);
|
|
}
|
|
}
|
|
var m = BaseRegex.GetMatchRegex(ref html, @"{""id"":[\w\W]+?""hasCoupon""");
|
|
for (int j = 0; m != null && j < m.Count; j++)
|
|
{
|
|
string list = m[j].Groups[0].Value;
|
|
long id = BaseRegex.GetLongJson(ref list, "goodsId");
|
|
//TaobaoProductBase p = new TaobaoProductBase();
|
|
//p.GoodsSn = BaseRegex.GetLongJson(ref list, "id");
|
|
//p.GoodsId = BaseRegex.GetLongJson(ref list, "goodsId");
|
|
////p.GoodsSn = BaseRegex.GetLongJson(ref list, "goods_sn");
|
|
//p.Titlte = BaseRegex.GetStringJson(ref list, "goodsName");
|
|
|
|
//p.ShopName = Shop.ShopName;
|
|
//p.UseShopName = Shop.Name;
|
|
//int price = BaseRegex.GetIntJson(ref list, "groupPrice");
|
|
//p.Price = price / 100m;
|
|
//p.favcnt = BaseRegex.GetIntJson(ref list, "commissionRate") / 10;
|
|
////商品已经被设置
|
|
int onSale = BaseRegex.GetIntJson(ref list, "onSale");
|
|
if (onSale == 0)
|
|
continue;
|
|
var pt = Shop.OnOrOffProduct.Find(op => op != null && op.GoodsId == id);
|
|
if (pt != null)
|
|
{
|
|
Shop.OnOrOffProduct.Remove(pt);
|
|
LogSave.Add(Name, "去掉推广商品" + pt.GoodsId);
|
|
}
|
|
}
|
|
Thread.Sleep(300);
|
|
}
|
|
LogSave.Add(Name, "获取完成");
|
|
}
|
|
/// <summary>
|
|
/// 获取店铺回收站中的商品数量
|
|
/// </summary>
|
|
public void GetRestoreProductCount()
|
|
{
|
|
string url = "https://mms.pinduoduo.com/plutus/api/plutus/bin/goods/query";
|
|
string refere = "https://mms.pinduoduo.com/goods/goods_recycle";
|
|
string data = "{\"mall_id\":" + Shop.MallId + ",\"limit\":10,\"offset\":0}";
|
|
string html = GetPostTaobaoHtml.GetJsonPost(url, refere, true, data, Shop.Cookies);
|
|
int allCount = BaseRegex.GetIntJson(ref html, "total");
|
|
Shop.ClearNoVisitShop.resCount = allCount;
|
|
ClearProductGroup.ShopTemp.Add(Shop);
|
|
}
|
|
/// <summary>
|
|
/// 获取店铺上架和下架的商品数量
|
|
/// </summary>
|
|
public void GetAllOnlineCount()
|
|
{
|
|
int mallId = Shop.MallId;
|
|
string cookies = Shop.Cookies, shopName = Shop.ShopName;
|
|
string url = "https://mms.pinduoduo.com/vodka/v2/mms/query/display/mall/goodsList";
|
|
string refere = "https://mms.pinduoduo.com/Pdd.html";
|
|
string data = "{\"order_by\":\"id:desc\",\"is_onsale\":1,\"size\":100,\"page\":#page#,\"mall_id\":" + mallId + "}";
|
|
string html=CpsSetAllGoods.Request_mms_pinduoduo_com(url, refere, Shop.Cookies, data.Replace("#page#", "1"), CpsSetAllGoods.getAnti0aon());
|
|
//string html = GetPostTaobaoHtml.UploadTaobaoPost(url, refere, true, data.Replace("#page#", "1"), cookies);
|
|
if (string.IsNullOrEmpty(html) || !html.Contains("total"))
|
|
{
|
|
Thread.Sleep(30 * 1000);
|
|
html = GetPostTaobaoHtml.UploadTaobaoPost(url, refere, true, data.Replace("#page#", "1"), cookies);
|
|
}
|
|
int allCount = BaseRegex.GetIntJson(ref html, "total");
|
|
Shop.ClearNoVisitShop.onCount = allCount;
|
|
|
|
data = "{\"order_by\":\"id:desc\",\"is_onsale\":0,\"size\":100,\"page\":#page#,\"mall_id\":" + mallId + "}";
|
|
//html = GetPostTaobaoHtml.UploadTaobaoPost(url, refere, true, data.Replace("#page#", "1"), cookies);
|
|
html = CpsSetAllGoods.Request_mms_pinduoduo_com(url, refere, Shop.Cookies, data.Replace("#page#", "1"), CpsSetAllGoods.getAnti0aon());
|
|
if (string.IsNullOrEmpty(html) || !html.Contains("total"))
|
|
{
|
|
Thread.Sleep(30 * 1000);
|
|
html = GetPostTaobaoHtml.UploadTaobaoPost(url, refere, true, data.Replace("#page#", "1"), cookies);
|
|
}
|
|
allCount = BaseRegex.GetIntJson(ref html, "total");
|
|
Shop.ClearNoVisitShop.offCount = allCount;
|
|
Shop.ClearNoVisitShop.goodsCount = Shop.ClearNoVisitShop.onCount + Shop.ClearNoVisitShop.offCount;
|
|
|
|
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()); ;
|
|
//惩罚店铺
|
|
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))
|
|
{
|
|
punishment = "无";
|
|
}
|
|
if (punishment != "无")
|
|
Shop.Message = punishment;
|
|
ShopTemp.Add(Shop);
|
|
}
|
|
public void Down()
|
|
{
|
|
string url = "https://mms.pinduoduo.com/earth/api/mallPunishment";
|
|
string refere = "https://mms.pinduoduo.com/Pdd.html";
|
|
string data = "{\"size\":\"5\" }";
|
|
//第一页匹配结果
|
|
string htmlxt = CpsSetAllGoods.Request_mms_pinduoduo_com(url, refere, Shop.Cookies, data, CpsSetAllGoods.getAnti0aon());
|
|
//惩罚店铺
|
|
int level = BaseRegex.GetIntJson(ref htmlxt, "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 htmlxt, "endTime");
|
|
if (string.IsNullOrEmpty(punEndtime))
|
|
{
|
|
punishment = "无";
|
|
}
|
|
if (punishment != "无")
|
|
{
|
|
Shop.Message = punishment;
|
|
ShopTemp.Add(Shop);
|
|
if (ClearProductGroup.punoff)
|
|
return;
|
|
}
|
|
GetAllOnlineCount();
|
|
GetAllGroupOnline();
|
|
if (IsUseApi)
|
|
{
|
|
var api = new PinduoduoApiGetProduct(Shop);
|
|
string html = "";
|
|
for (int j = 0; j < Shop.OnOrOffProduct.Count; j++)
|
|
{
|
|
IsOnline = !Shop.OnOrOffProduct[j].OffLine;
|
|
|
|
if (IsOnline)
|
|
{
|
|
if (IsGoodCount && OffCount >= GoodCount)
|
|
break;
|
|
html = api.SetOnline(Shop.OnOrOffProduct[j].GoodsId, false);
|
|
OffCount++;
|
|
Shop.ClearNoVisitShop.goodStatus = "下架第" + OffCount + "个";
|
|
if (html != null && html.Contains("error_msg") && html.Contains("使用MMS后台做此"))
|
|
{
|
|
Shop.ClearNoVisitShop.goodStatus = "平台限制,请使用店铺后台MMS操作";
|
|
ShopTemp.Add(Shop);
|
|
break;
|
|
}
|
|
ShopTemp.Add(Shop);
|
|
}
|
|
Thread.Sleep(3 * 1000);
|
|
}
|
|
if (html != null && html.Contains("error_msg") && html.Contains("使用MMS后台做此"))
|
|
{
|
|
Shop.ClearNoVisitShop.goodStatus = "平台限制,请使用店铺后台MMS操作";
|
|
ShopTemp.Add(Shop);
|
|
return;
|
|
}
|
|
Shop.ClearNoVisitShop.goodStatus = "下架第" + OffCount + "个(完成)";
|
|
ShopTemp.Add(Shop);
|
|
LogSave.Add(Name, "下架完成");
|
|
|
|
return;
|
|
}
|
|
//Shop.ClearNoVisitShop.goodsCount = Shop.OnOrOffProduct.Count;
|
|
//ShopTemp.Add(Shop);
|
|
List<long> ids = new List<long>();
|
|
if (string.IsNullOrEmpty(PinduoduoAuth.strContent))
|
|
{
|
|
PinduoduoAuth.strContent = GetVisitProductNew.strJs;//FileBase.ReadAllText(path);
|
|
}
|
|
string NoCode = "";
|
|
string strTime = BaseClass.GetTime(DateTime.Now).ToString() + "000";
|
|
if (string.IsNullOrEmpty(NoCode))
|
|
{
|
|
string htmlx = GetHtml.Gbk("http://nano.qixiaoke.com/nano.txt");
|
|
NoCode = BaseRegex.GetMatchRegexString(ref htmlx, @"([\w\W]+?)-----");
|
|
}
|
|
string fun2 = string.Format(@"getEncode('{0}','{1}','{2}')", strTime, NoCode, "");
|
|
string codex = UploadPinduoduoSet.ExecuteScript(fun2, PinduoduoAuth.strContent);
|
|
|
|
List<long> idsx = new List<long>();
|
|
for (int j = 0; j < Shop.OnOrOffProduct.Count; j++)
|
|
{
|
|
IsOnline = !Shop.OnOrOffProduct[j].OffLine;
|
|
if (IsOnline)
|
|
{
|
|
if (IsGoodCount && OffCount >= GoodCount)
|
|
break;
|
|
idsx.Add(Shop.OnOrOffProduct[j].GoodsId);
|
|
OffCount++;
|
|
if (idsx.Count >= 15)
|
|
{
|
|
string html = OffShop(idsx);
|
|
idsx.Clear();
|
|
if (!string.IsNullOrEmpty(html) && html.Contains("为了保障您的账户安全,请先进行安全验证"))
|
|
{
|
|
Shop.ClearNoVisitShop.goodStatus = "店铺后台出现图形验证,请使用API接口";
|
|
ShopTemp.Add(Shop);
|
|
return;
|
|
}
|
|
if (!string.IsNullOrEmpty(html))
|
|
{
|
|
Shop.ClearNoVisitShop.goodStatus = html + "请查看IP是否被限制";
|
|
ShopTemp.Add(Shop);
|
|
continue;
|
|
}
|
|
Shop.ClearNoVisitShop.goodStatus = "下架第" + OffCount + "个";
|
|
ShopTemp.Add(Shop);
|
|
Thread.Sleep(10 * 1000);
|
|
}
|
|
}
|
|
}
|
|
if (idsx.Count > 0)
|
|
{
|
|
OffShop(idsx);
|
|
idsx.Clear();
|
|
Shop.ClearNoVisitShop.goodStatus = "下架第" + OffCount + "个(完成)";
|
|
ShopTemp.Add(Shop);
|
|
}
|
|
LogSave.Add(Name, "下架完成");
|
|
}
|
|
public int upCount = 0;
|
|
public void Up()
|
|
{
|
|
GetAllOnlineCount();
|
|
GetAllGroupOnline();
|
|
if (IsUseApi)
|
|
{
|
|
var api = new PinduoduoApiGetProduct(Shop);
|
|
string html = "";
|
|
for (int j = 0; j < Shop.OnOrOffProduct.Count; j++)
|
|
{
|
|
IsOnline = Shop.OnOrOffProduct[j].OffLine;
|
|
|
|
if (IsOnline)
|
|
{
|
|
if (IsGoodCount && upCount >= GoodCount)
|
|
break;
|
|
html = api.SetOnline(Shop.OnOrOffProduct[j].GoodsId, true);
|
|
if (html != null && html.Contains("error_msg") && html.Contains("使用MMS后台做此"))
|
|
{
|
|
Shop.ClearNoVisitShop.goodStatus = "平台限制,请使用店铺后台MMS操作";
|
|
ShopTemp.Add(Shop);
|
|
break;
|
|
}
|
|
upCount++;
|
|
Shop.ClearNoVisitShop.goodStatus = "上架第" + upCount + "个";
|
|
ShopTemp.Add(Shop);
|
|
}
|
|
Thread.Sleep(3 * 1000);
|
|
}
|
|
if (html != null && html.Contains("error_msg") && html.Contains("使用MMS后台做此"))
|
|
{
|
|
Shop.ClearNoVisitShop.goodStatus = "平台限制,请使用店铺后台MMS操作";
|
|
ShopTemp.Add(Shop);
|
|
return;
|
|
}
|
|
Shop.ClearNoVisitShop.goodStatus = "上架第" + upCount + "个(完成)";
|
|
ShopTemp.Add(Shop);
|
|
LogSave.Add(Name, "上架完成");
|
|
return;
|
|
}
|
|
List<long> idsx = new List<long>();
|
|
for (int j = 0; j < Shop.OnOrOffProduct.Count; j++)
|
|
{
|
|
IsOnline = Shop.OnOrOffProduct[j].OffLine;
|
|
if (IsOnline)
|
|
{
|
|
if (IsGoodCount && upCount >= GoodCount)
|
|
break;
|
|
idsx.Add(Shop.OnOrOffProduct[j].GoodsId);
|
|
upCount++;
|
|
if (idsx.Count >= 15)
|
|
{
|
|
string html = UpShop(idsx);
|
|
idsx.Clear();
|
|
if (!string.IsNullOrEmpty(html) && html.Contains("为了保障您的账户安全,请先进行安全验证"))
|
|
{
|
|
Shop.ClearNoVisitShop.goodStatus = "店铺后台出现图形验证,请使用API接口";
|
|
ShopTemp.Add(Shop);
|
|
return;
|
|
}
|
|
if (!string.IsNullOrEmpty(html))
|
|
{
|
|
Shop.ClearNoVisitShop.goodStatus = "请查看IP是否被限制";
|
|
ShopTemp.Add(Shop);
|
|
continue;
|
|
}
|
|
//if (html == "error")
|
|
// return;
|
|
Shop.ClearNoVisitShop.goodStatus = "上架第" + upCount + "个";
|
|
ShopTemp.Add(Shop);
|
|
Thread.Sleep(10 * 1000);
|
|
}
|
|
}
|
|
}
|
|
if (idsx.Count > 0)
|
|
{
|
|
UpShop(idsx);
|
|
idsx.Clear();
|
|
Shop.ClearNoVisitShop.goodStatus = "上架第" + upCount + "个(完成)";
|
|
ShopTemp.Add(Shop);
|
|
}
|
|
Shop.ClearNoVisitShop.goodStatus = "上架第" + upCount + "个(完成)";
|
|
ShopTemp.Add(Shop);
|
|
LogSave.Add(Name, "上架完成");
|
|
}
|
|
|
|
public string UpShop(List<long> ids)
|
|
{
|
|
if (ids.Count == 0)
|
|
return "";
|
|
StringBuilder pids = new StringBuilder();
|
|
for (int i = 0; i < ids.Count; i++)
|
|
{
|
|
pids.Append("," + ids[i]);
|
|
}
|
|
string GoodsId = pids.ToString(1, pids.Length - 1);
|
|
|
|
string codex = "";
|
|
using (IJsEngine jsEngine = new V8JsEngine())
|
|
{
|
|
jsEngine.Execute(GetProductOnlineClass.JsCodeGetSms);
|
|
codex = jsEngine.CallFunction("aaa", "").ToString();
|
|
}
|
|
string data = "{\"goodsIds\":[" + GoodsId + "],\"crawlerInfo\":\"" + codex + "\"}";
|
|
string urlx = "https://mms.pinduoduo.com/vodka/v2/mms/batchOnSale";
|
|
string refere = "https://mms.pinduoduo.com";
|
|
string html = GetPostTaobaoHtml.UploadTaobaoPost(urlx, refere, true, data, Shop.Cookies);
|
|
if (html.Contains("{\"success\":true"))
|
|
{
|
|
string[] l = GoodsId.Split(',');
|
|
foreach (string s in l)
|
|
{
|
|
LogSave.Add(Name, "上架产品成功:" + s);
|
|
}
|
|
return "";
|
|
}
|
|
if (html.Contains("手速太快了"))
|
|
{
|
|
Thread.Sleep(2 * 1000);
|
|
html = GetPostTaobaoHtml.UploadTaobaoPost(urlx, refere, true, data, Shop.Cookies);
|
|
if (html.Contains("超时") || html.Contains("手速太快了"))
|
|
{
|
|
Thread.Sleep(15 * 1000);
|
|
html = GetPostTaobaoHtml.UploadTaobaoPost(urlx, refere, true, data, Shop.Cookies);
|
|
//if (GetProxyHtml.ips != null && GetProxyHtml.ips.Count > 0)
|
|
// html = GetProxyHtml.UploadProxyTaobaoPost(urlx, refere, true, data, Shop.Cookies);
|
|
}
|
|
if (html.Contains("超时") || html.Contains("手速太快了"))
|
|
{
|
|
Thread.Sleep(30 * 1000);
|
|
html = GetProxyHtml.UploadProxyTaobaoPost(urlx, refere, true, data, Shop.Cookies);
|
|
}
|
|
if (html.Contains("手速太快了"))
|
|
{
|
|
LogSave.Add(Name, Shop.ShopName + "手速太快了,请过段时间再操作。");
|
|
return "手速太快了";
|
|
}
|
|
if (html.Contains("\"success\":false"))
|
|
{
|
|
LogSave.Add(Name, Shop.ShopName + "接口调用频繁,请过段时间再操作。");
|
|
return "手速太快了";
|
|
}
|
|
}
|
|
if (html.Contains("\"success\":false"))
|
|
{
|
|
Thread.Sleep(2 * 1000);
|
|
html = GetProxyHtml.UploadProxyTaobaoPost(urlx, refere, true, data, Shop.Cookies);
|
|
}
|
|
if (html.Contains("\"success\":false"))
|
|
{
|
|
string error_msg = BaseRegex.GetStringJson(ref html, "errorMsg");
|
|
return error_msg;
|
|
}
|
|
return "";
|
|
}
|
|
private AdslHelper adsl = null;
|
|
private DateTime lasttime = DateTime.MinValue;
|
|
public AdslHelper GetAdsl()
|
|
{
|
|
string adslNamex = "宽带连接";//txtAdslName.Text.Trim();
|
|
string account = adslName;//055192515753
|
|
string password = adslPassWord;//382443
|
|
adsl = new AdslHelper(adslNamex, account, password);
|
|
return adsl;
|
|
}
|
|
public void ConnectAdsl()
|
|
{
|
|
TimeSpan t3 = DateTime.Now - lasttime;
|
|
if (t3.TotalMinutes < 1)
|
|
return;
|
|
try
|
|
{
|
|
GetAdsl().Disconnect();
|
|
Thread.Sleep(500);
|
|
bool result = GetAdsl().Connect();
|
|
if (result)
|
|
{
|
|
LogSave.Add(Name, "ADSL拨号连接成功");
|
|
}
|
|
else
|
|
{
|
|
LogSave.Add(Name, "ADSL拨号连接失败");
|
|
}
|
|
}
|
|
catch
|
|
{
|
|
LogSave.Add(Name, "ADSL拨号连接失败");
|
|
}
|
|
lasttime = DateTime.Now;
|
|
}
|
|
public string OffShop(List<long> ids)
|
|
{
|
|
if (ids.Count == 0)
|
|
return "";
|
|
StringBuilder pids = new StringBuilder();
|
|
for (int i = 0; i < ids.Count; i++)
|
|
{
|
|
pids.Append("," + ids[i]);
|
|
}
|
|
string GoodsId = pids.ToString(1, pids.Length - 1);
|
|
|
|
string codex = "";
|
|
using (IJsEngine jsEngine = new V8JsEngine())
|
|
{
|
|
jsEngine.Execute(GetProductOnlineClass.JsCodeGetSms);
|
|
codex = jsEngine.CallFunction("aaa", "").ToString();
|
|
}
|
|
string data = "{\"goodsIds\":[" + GoodsId + "],\"crawlerInfo\":\"" + codex + "\"}";
|
|
string urlx = "https://mms.pinduoduo.com/vodka/v2/mms/batchOffSale";
|
|
string refere = "https://mms.pinduoduo.com";
|
|
string html = CpsSetAllGoods.Request_mms_pinduoduo_com(urlx, refere, Shop.Cookies, data.Replace("#page#", "1"), CpsSetAllGoods.getAnti0aon());
|
|
//GetPostTaobaoHtml.UploadTaobaoPost(urlx, refere, true, data, Shop.Cookies);
|
|
if (html.Contains("{\"success\":true"))
|
|
{
|
|
string[] l = GoodsId.Split(',');
|
|
foreach (string s in l)
|
|
{
|
|
var good = Shop.OnOrOffProduct.Find(p => p.GoodsId == long.Parse(s));
|
|
good.Message = "下架成功";
|
|
ProductClearTemp.Add(good);
|
|
LogSave.Add(Name, "下架产品成功:" + s);
|
|
}
|
|
return "";
|
|
}
|
|
if (html.Contains("手速太快了"))
|
|
{
|
|
Thread.Sleep(2 * 1000);
|
|
html = GetPostTaobaoHtml.UploadTaobaoPost(urlx, refere, true, data, Shop.Cookies);
|
|
if (html.Contains("超时") || html.Contains("手速太快了"))
|
|
{
|
|
Thread.Sleep(15 * 1000);
|
|
html = GetPostTaobaoHtml.UploadTaobaoPost(urlx, refere, true, data, Shop.Cookies);
|
|
//if (GetProxyHtml.ips != null && GetProxyHtml.ips.Count > 0)
|
|
// html = GetProxyHtml.UploadProxyTaobaoPost(urlx, refere, true, data, Shop.Cookies);
|
|
}
|
|
if (html.Contains("超时") || html.Contains("手速太快了"))
|
|
{
|
|
Thread.Sleep(30 * 1000);
|
|
html = GetPostTaobaoHtml.UploadTaobaoPost(urlx, refere, true, data, Shop.Cookies);
|
|
}
|
|
if (html.Contains("手速太快了"))
|
|
{
|
|
LogSave.Add(Name, Shop.ShopName + "手速太快了,请过段时间再操作。");
|
|
return "手速太快了";
|
|
}
|
|
if (html.Contains("\"success\":false"))
|
|
{
|
|
LogSave.Add(Name, Shop.ShopName + "接口调用频繁,请过段时间再操作。");
|
|
return "手速太快了";
|
|
}
|
|
}
|
|
//if (html.Contains("\"success\":false"))
|
|
//{
|
|
// Thread.Sleep(2 * 1000);
|
|
// html = GetProxyHtml.UploadProxyTaobaoPost(urlx, refere, true, data, Shop.Cookies);
|
|
//}
|
|
if (!string.IsNullOrEmpty(html) && html.Contains("为了保障您的账户安全,请先进行安全验证"))
|
|
{
|
|
if (!string.IsNullOrEmpty(adslName))
|
|
{
|
|
ConnectAdsl();
|
|
Thread.Sleep(2000);
|
|
html = GetPostTaobaoHtml.UploadTaobaoPost(urlx, refere, true, data, Shop.Cookies);
|
|
}
|
|
}
|
|
if (html.Contains("\"success\":false"))
|
|
{
|
|
string error_msg = BaseRegex.GetStringJson(ref html, "errorMsg");
|
|
return error_msg;
|
|
}
|
|
return "";
|
|
}
|
|
|
|
public string OffSprShop(List<long> ids)
|
|
{
|
|
if (ids.Count == 0)
|
|
return "";
|
|
StringBuilder pids = new StringBuilder();
|
|
for (int i = 0; i < ids.Count; i++)
|
|
{
|
|
pids.Append("," + ids[i]);
|
|
}
|
|
string GoodsId = pids.ToString(1, pids.Length - 1);
|
|
|
|
string codex = "";
|
|
using (IJsEngine jsEngine = new V8JsEngine())
|
|
{
|
|
jsEngine.Execute(GetProductOnlineClass.JsCodeGetSms);
|
|
codex = jsEngine.CallFunction("aaa", "").ToString();
|
|
}
|
|
string data = "{\"goodsIds\":[" + GoodsId + "],\"crawlerInfo\":\"" + codex + "\"}";
|
|
string urlx = "https://mms.pinduoduo.com/vodka/v2/mms/batchOffSale";
|
|
string refere = "https://mms.pinduoduo.com";
|
|
string html = GetPostTaobaoHtml.UploadTaobaoPost(urlx, refere, true, data, Shop.Cookies);
|
|
if (html.Contains("{\"success\":true"))
|
|
{
|
|
string[] l = GoodsId.Split(',');
|
|
foreach (string s in l)
|
|
{
|
|
var good = Shop.OnOrOffProduct.Find(p => p.GoodsId == long.Parse(s));
|
|
good.Message = "下架成功";
|
|
JinBaoMarketing.jinBaoTempProduct.Add(good);
|
|
LogSave.Add(Name, "下架产品成功:" + s);
|
|
}
|
|
return "";
|
|
}
|
|
if (html.Contains("手速太快了"))
|
|
{
|
|
LogSave.Add(Name, Shop.ShopName + "接口调用频繁,请过段时间再操作。");
|
|
return "error";
|
|
}
|
|
return "";
|
|
}
|
|
|
|
public string DelGroupIds(List<long> ids)
|
|
{
|
|
if (ids.Count == 0)
|
|
return "";
|
|
StringBuilder pids = new StringBuilder();
|
|
for (int i = 0; i < ids.Count; i++)
|
|
{
|
|
pids.Append("," + ids[i]);
|
|
}
|
|
var d = new DownUpProductExploder("", false, pids.ToString(1, pids.Length - 1));
|
|
d.Cookies = Shop.Cookies;
|
|
d.Name = Name;
|
|
d.Shop = Shop;
|
|
string html = d.Delete();
|
|
return html;
|
|
}
|
|
int count = 0;
|
|
long minPid = 0;
|
|
public void GetAllGroupOnline()
|
|
{
|
|
DelGetGroup();
|
|
DelOrder();
|
|
bool visflag = true;
|
|
if (IsNoVisit)
|
|
visflag = GetOnOrOff();
|
|
if (!visflag)
|
|
{
|
|
LogSave.Add(Name, "流量数据读取失败");
|
|
Thread.Sleep(3000);
|
|
return;
|
|
}
|
|
count = 0;
|
|
if (IsNoDays)
|
|
minPid = retCheckDaysPid();
|
|
Shop.OnOrOffProduct.Clear();
|
|
int mallId = Shop.MallId;
|
|
string cookies = Shop.Cookies, shopName = Shop.ShopName;
|
|
string url = "https://mms.pinduoduo.com/vodka/v2/mms/query/display/mall/goodsList";
|
|
string refere = "https://mms.pinduoduo.com/Pdd.html";
|
|
string data = "{\"order_by\":\"id:asc\",\"is_onsale\":" + (IsOnline ? 1 : 0) + ",\"size\":100,\"page\":#page#,\"mall_id\":" + mallId + "}";
|
|
if (MinPrice < 0)
|
|
MinPrice = 0;
|
|
if (MinPrice >= 0 && IsPrice)
|
|
{
|
|
if (MaxPrice == 0)
|
|
MaxPrice = 1000000000;
|
|
data = "{\"order_by\":\"id:asc\",\"is_onsale\":" + (IsOnline ? 1 : 0) + ",\"sku_price_range\":[" + MinPrice * 100 + "," + MaxPrice * 100 + "],\"size\":100,\"page\":#page#,\"mall_id\":" + mallId + "}";
|
|
}
|
|
string html = CpsSetAllGoods.Request_mms_pinduoduo_com(url, refere, Shop.Cookies, data.Replace("#page#", "1"), CpsSetAllGoods.getAnti0aon());// GetPostTaobaoHtml.UploadTaobaoPost(url, refere, true, data.Replace("#page#", "1"), cookies);
|
|
if (string.IsNullOrEmpty(html) || !html.Contains("total"))
|
|
{
|
|
Thread.Sleep(30 * 1000);
|
|
html = CpsSetAllGoods.Request_mms_pinduoduo_com(url, refere, Shop.Cookies, data.Replace("#page#", "1"), CpsSetAllGoods.getAnti0aon());
|
|
}
|
|
if (string.IsNullOrEmpty(html) || !html.Contains("total"))
|
|
{
|
|
Thread.Sleep(30 * 1000);
|
|
html = CpsSetAllGoods.Request_mms_pinduoduo_com(url, refere, Shop.Cookies, data.Replace("#page#", "1"), CpsSetAllGoods.getAnti0aon());
|
|
}
|
|
int allCount = BaseRegex.GetIntJson(ref html, "total");
|
|
|
|
|
|
int page = allCount / 100 + (allCount % 100 > 0 ? 1 : 0);
|
|
|
|
if (page > 1000)
|
|
{
|
|
page = 1000;
|
|
}
|
|
for (int i = 0; i < page; i++)
|
|
{
|
|
if (IsGoodCount && count >= GoodCount)
|
|
break;
|
|
if (i != 0)
|
|
{
|
|
html = CpsSetAllGoods.Request_mms_pinduoduo_com(url, refere, Shop.Cookies, data.Replace("#page#", (i + 1).ToString()), CpsSetAllGoods.getAnti0aon());
|
|
//GetPostTaobaoHtml.GetJsonPost(url, refere, true, data.Replace("#page#", (i + 1).ToString()), cookies);
|
|
if (string.IsNullOrEmpty(html) || !html.Contains("total"))
|
|
{
|
|
Thread.Sleep(30 * 1000);
|
|
html = CpsSetAllGoods.Request_mms_pinduoduo_com(url, refere, Shop.Cookies, data.Replace("#page#", (i + 1).ToString()), CpsSetAllGoods.getAnti0aon());
|
|
//html = GetPostTaobaoHtml.GetJsonPost(url, refere, true, data.Replace("#page#", (i + 1).ToString()), cookies);
|
|
}
|
|
if (string.IsNullOrEmpty(html) || !html.Contains("total"))
|
|
{
|
|
Thread.Sleep(30 * 1000);
|
|
html = CpsSetAllGoods.Request_mms_pinduoduo_com(url, refere, Shop.Cookies, data.Replace("#page#", (i + 1).ToString()), CpsSetAllGoods.getAnti0aon());
|
|
//html = GetPostTaobaoHtml.GetJsonPost(url, refere, true, data.Replace("#page#", (i + 1).ToString()), cookies);
|
|
}
|
|
}
|
|
var m = BaseRegex.GetMatchRegex(ref html, @"\{([\w\W]+?)\},[\w\W]+?\}");
|
|
for (int j = 0; m != null && j < m.Count; j++)
|
|
{
|
|
if (IsGoodCount && count >= GoodCount)
|
|
break;
|
|
|
|
string list = m[j].Groups[0].Value;
|
|
TaobaoProductBase p = new TaobaoProductBase();
|
|
p.GoodsId = BaseRegex.GetLongJson(ref list, "id");
|
|
p.GoodsSn = BaseRegex.GetLongJson(ref list, "goods_sn");
|
|
p.Titlte = BaseRegex.GetStringJson(ref list, "goods_name");
|
|
p.CatId = BaseRegex.GetIntJson(ref list, "cat_id");
|
|
p.CatId = PinduoduoCatList.GetNewCat3(p.CatId);
|
|
p.SaleCount = BaseRegex.GetIntJson(ref list, "sold_quantity");
|
|
p.ShopName = Shop.ShopName;
|
|
int fav_cnt = BaseRegex.GetIntJson(ref list, "fav_cnt");
|
|
string price = BaseRegex.GetMatchRegexString(ref list, @"""sku_group_price"":\[([\d]+),");
|
|
if (string.IsNullOrEmpty(price))
|
|
price = "1000";
|
|
p.Price = int.Parse(price) / 100m;
|
|
if (PinduoduoCatList.CatIds.ContainsKey(p.CatId))
|
|
{
|
|
var c = PinduoduoCatList.CatIds[p.CatId];
|
|
p.Cat1 = c.cat1;
|
|
p.Cat2 = c.cat2;
|
|
p.Cat3 = c.cat3;
|
|
p.Cat4 = c.cat4;
|
|
p.MainCatId = c.main_cat_id;
|
|
}
|
|
else
|
|
{
|
|
|
|
}
|
|
var mc = BaseRegex.GetMatchRegex(ref list, @"""is_onsale"":([\w\W]+?),");
|
|
if (mc == null || mc.Count <= 0) continue;
|
|
p.OffLine = !bool.Parse(mc[0].Groups[1].Value);
|
|
if (ClearProductGroup.selTime)
|
|
{
|
|
DateTime create = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1)).AddSeconds(BaseRegex.GetIntJson(ref list, "created_at"));
|
|
string createTime = create.ToString("yyyy-MM-dd 00:00:00");
|
|
System.TimeSpan t3 = ClearProductGroup.selDateTime - Convert.ToDateTime(createTime);
|
|
double getDay = t3.TotalDays;
|
|
if (ClearProductGroup.selStart&&getDay < 0)
|
|
continue;
|
|
if (!ClearProductGroup.selStart && getDay >= 0)
|
|
continue;
|
|
}
|
|
if (IsNoSold && p.SaleCount > 0)
|
|
{
|
|
// 跳过有销量商品
|
|
LogSave.Add(Name, "跳过销量商品 " + p.GoodsId);
|
|
continue;
|
|
}
|
|
if (IsNoColl && fav_cnt > 0)
|
|
{
|
|
// 跳过收藏商品
|
|
LogSave.Add(Name, "跳过收藏商品 " + p.GoodsId);
|
|
continue;
|
|
}
|
|
int created_at = BaseRegex.GetIntJson(ref list, "created_at");
|
|
DateTime dt = BaseClass.StampToDateTime(created_at);
|
|
//if (IsNoDays && p.GoodsId > minPid)
|
|
// continue;
|
|
if (IsNoDays && DateTime.Now.AddDays(-DaysCount) < dt)
|
|
{
|
|
// 跳过指定日期内商品
|
|
continue;
|
|
}
|
|
var pid = pidList.Find(id => id == p.GoodsId);
|
|
if (pid > 0)
|
|
{
|
|
// 跳过有访客商品
|
|
continue;
|
|
}
|
|
|
|
if (!Shop.OnOrOffProduct.Exists(pt => pt != null && pt.GoodsId == p.GoodsId))
|
|
Shop.OnOrOffProduct.Add(p);
|
|
count++;
|
|
}
|
|
Thread.Sleep(300);
|
|
LogSave.Add(Name, "获取在线产品 " + shopName + ",分页:" + i);
|
|
}
|
|
//DelGetGroup();
|
|
//DelOrder();
|
|
//if (NoVisit)
|
|
// GetOnOrOff();
|
|
}
|
|
public void GetDelAllGroupOnline()
|
|
{
|
|
DelGetGroup();
|
|
DelOrder();
|
|
bool visflag = true;
|
|
if (IsNoVisit)
|
|
visflag = GetOnOrOff();
|
|
if (!visflag)
|
|
{
|
|
LogSave.Add(Name, "如果流量读取失败,则不清理无流量, 提示流量数据读取失败");
|
|
return;
|
|
}
|
|
count = 0;
|
|
if (IsNoDays)
|
|
minPid = retCheckDaysPid();
|
|
Shop.OnOrOffProduct.Clear();
|
|
int mallId = Shop.MallId;
|
|
string cookies = Shop.Cookies, shopName = Shop.ShopName;
|
|
string url = "https://mms.pinduoduo.com/vodka/v2/mms/query/display/mall/goodsList";
|
|
string refere = "https://mms.pinduoduo.com/Pdd.html";
|
|
string data = "{\"order_by\":\"id:asc\",\"is_onsale\":" + (IsOnline ? 1 : 0) + ",\"size\":100,\"page\":#page#,\"mall_id\":" + mallId + "}";
|
|
if (MinPrice > 0 && IsPrice)
|
|
{
|
|
if (MaxPrice == 0)
|
|
MaxPrice = 1000000000;
|
|
data = "{\"order_by\":\"id:asc\",\"is_onsale\":" + (IsOnline ? 1 : 0) + ",\"sku_price_range\":[" + MinPrice * 100 + "," + MaxPrice * 100 + "],\"size\":100,\"page\":#page#,\"mall_id\":" + mallId + "}";
|
|
}
|
|
string html = CpsSetAllGoods.Request_mms_pinduoduo_com(url, refere, Shop.Cookies, data.Replace("#page#", "1"), CpsSetAllGoods.getAnti0aon());/// GetPostTaobaoHtml.UploadTaobaoPost(url, refere, true, data.Replace("#page#", "1"), cookies);
|
|
if (string.IsNullOrEmpty(html) || !html.Contains("total"))
|
|
{
|
|
Thread.Sleep(30 * 1000);
|
|
html = CpsSetAllGoods.Request_mms_pinduoduo_com(url, refere, Shop.Cookies, data.Replace("#page#", "1"), CpsSetAllGoods.getAnti0aon());
|
|
}
|
|
if (string.IsNullOrEmpty(html) || !html.Contains("total"))
|
|
{
|
|
Thread.Sleep(30 * 1000);
|
|
html = CpsSetAllGoods.Request_mms_pinduoduo_com(url, refere, Shop.Cookies, data.Replace("#page#", "1"), CpsSetAllGoods.getAnti0aon());
|
|
}
|
|
int allCount = BaseRegex.GetIntJson(ref html, "total");
|
|
|
|
|
|
int page = allCount / 100 + (allCount % 100 > 0 ? 1 : 0);
|
|
|
|
if (page > 1000)
|
|
{
|
|
page = 1000;
|
|
}
|
|
for (int i = 0; i < page; i++)
|
|
{
|
|
if (IsGoodCount && count >= GoodCount)
|
|
break;
|
|
if (count > 1100)
|
|
break;
|
|
if (i != 0)
|
|
{
|
|
html = CpsSetAllGoods.Request_mms_pinduoduo_com(url, refere, Shop.Cookies, data.Replace("#page#", (i + 1).ToString()), CpsSetAllGoods.getAnti0aon());
|
|
if (string.IsNullOrEmpty(html) || !html.Contains("total"))
|
|
{
|
|
Thread.Sleep(30 * 1000);
|
|
html = CpsSetAllGoods.Request_mms_pinduoduo_com(url, refere, Shop.Cookies, data.Replace("#page#", (i + 1).ToString()), CpsSetAllGoods.getAnti0aon());
|
|
}
|
|
if (string.IsNullOrEmpty(html) || !html.Contains("total"))
|
|
{
|
|
Thread.Sleep(30 * 1000);
|
|
html = CpsSetAllGoods.Request_mms_pinduoduo_com(url, refere, Shop.Cookies, data.Replace("#page#", (i + 1).ToString()), CpsSetAllGoods.getAnti0aon());
|
|
}
|
|
}
|
|
var m = BaseRegex.GetMatchRegex(ref html, @"\{([\w\W]+?)\},[\w\W]+?\}");
|
|
for (int j = 0; m != null && j < m.Count; j++)
|
|
{
|
|
if (count > 1100)
|
|
break;
|
|
if (IsGoodCount && count >= GoodCount)
|
|
break;
|
|
|
|
string list = m[j].Groups[0].Value;
|
|
TaobaoProductBase p = new TaobaoProductBase();
|
|
p.GoodsId = BaseRegex.GetLongJson(ref list, "id");
|
|
p.GoodsSn = BaseRegex.GetLongJson(ref list, "goods_sn");
|
|
p.Titlte = BaseRegex.GetStringJson(ref list, "goods_name");
|
|
p.CatId = BaseRegex.GetIntJson(ref list, "cat_id");
|
|
p.CatId = PinduoduoCatList.GetNewCat3(p.CatId);
|
|
p.SaleCount = BaseRegex.GetIntJson(ref list, "sold_quantity");
|
|
p.ShopName = Shop.ShopName;
|
|
|
|
string price = BaseRegex.GetMatchRegexString(ref list, @"""sku_group_price"":\[([\d]+),");
|
|
if (string.IsNullOrEmpty(price))
|
|
price = "1000";
|
|
p.Price = int.Parse(price) / 100m;
|
|
if (PinduoduoCatList.CatIds.ContainsKey(p.CatId))
|
|
{
|
|
var c = PinduoduoCatList.CatIds[p.CatId];
|
|
p.Cat1 = c.cat1;
|
|
p.Cat2 = c.cat2;
|
|
p.Cat3 = c.cat3;
|
|
p.Cat4 = c.cat4;
|
|
p.MainCatId = c.main_cat_id;
|
|
}
|
|
else
|
|
{
|
|
|
|
}
|
|
var mc = BaseRegex.GetMatchRegex(ref list, @"""is_onsale"":([\w\W]+?),");
|
|
if (mc == null || mc.Count <= 0) continue;
|
|
p.OffLine = !bool.Parse(mc[0].Groups[1].Value);
|
|
if (ClearProductGroup.selTime)
|
|
{
|
|
DateTime create = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1)).AddSeconds(BaseRegex.GetIntJson(ref list, "created_at"));
|
|
string createTime = create.ToString("yyyy-MM-dd 00:00:00");
|
|
System.TimeSpan t3 = ClearProductGroup.selDateTime - Convert.ToDateTime(createTime);
|
|
double getDay = t3.TotalDays;
|
|
if (ClearProductGroup.selStart && getDay < 0)
|
|
continue;
|
|
if (!ClearProductGroup.selStart && getDay >= 0)
|
|
continue;
|
|
}
|
|
if (IsNoSold && p.SaleCount > 0)
|
|
{
|
|
// 跳过有销量商品
|
|
LogSave.Add(Name, "跳过销量商品 " + p.GoodsId);
|
|
continue;
|
|
}
|
|
int created_at = BaseRegex.GetIntJson(ref list, "created_at");
|
|
DateTime dt = BaseClass.StampToDateTime(created_at);
|
|
//if (IsNoDays && p.GoodsId > minPid)
|
|
// continue;
|
|
if (IsNoDays && DateTime.Now.AddDays(-DaysCount) < dt)
|
|
{
|
|
// 跳过指定日期内商品
|
|
continue;
|
|
}
|
|
var pid = pidList.Find(id => id == p.GoodsId);
|
|
if (pid > 0)
|
|
{
|
|
// 跳过有访客商品
|
|
continue;
|
|
}
|
|
|
|
if (!Shop.OnOrOffProduct.Exists(pt => pt != null && pt.GoodsId == p.GoodsId))
|
|
Shop.OnOrOffProduct.Add(p);
|
|
count++;
|
|
}
|
|
Thread.Sleep(300);
|
|
LogSave.Add(Name, "获取在线产品 " + shopName + ",分页:" + i);
|
|
}
|
|
//DelGetGroup();
|
|
//DelOrder();
|
|
//if (NoVisit)
|
|
// GetOnOrOff();
|
|
}
|
|
public long retCheckDaysPid()
|
|
{
|
|
string url = BaseClass.LoginApiUrl + "?obj=upshopid/upid&act=get_days_id";
|
|
string data = "days=" + ClearProductGroup.DaysCount + "&" + UserLogin.GetSignaturex();
|
|
string html = GetHtml.PostUtf8(url, data);
|
|
long id = 0;
|
|
long.TryParse(html, out id);
|
|
return id;
|
|
}
|
|
public void DelGetGroup()
|
|
{
|
|
GetGroupOrder();
|
|
GetGroupOrderWait();
|
|
}
|
|
|
|
public List<long> pidList = new List<long>();
|
|
#region 获取待拼单的订单
|
|
/// <summary>
|
|
/// 获取待拼单的订单
|
|
/// </summary>
|
|
public void GetGroupOrder()
|
|
{
|
|
string url = "https://mms.pinduoduo.com/mars/shop/queryMallWaitGroupOrders";// "https://mms.pinduoduo.com/mars/shop/queryMallExpiredSoonOrders";
|
|
string refere = "https://mms.pinduoduo.com/Pdd.html";
|
|
string data = "{\"pageNo\":1,\"pageSize\":10,\"sort\":\"asc\"}";
|
|
string html = GetPostTaobaoHtml.UploadTaobaoPost(url, refere, true, data, Shop.Cookies);
|
|
if (string.IsNullOrEmpty(html) || !html.Contains("\"success\":true"))
|
|
return;
|
|
|
|
var m = BaseRegex.GetMatchRegex(ref html, @"\{([^\}]+?)\}");
|
|
|
|
for (int i = 0; i < m.Count; i++)
|
|
{
|
|
string list = m[i].Groups[0].Value;
|
|
if (!list.Contains("goods_id"))
|
|
continue;
|
|
long Id = BaseRegex.GetLongJson(ref list, "goods_id");
|
|
if (!pidList.Contains(Id))
|
|
{
|
|
pidList.Add(Id);
|
|
LogSave.Add(Name, "订单 " + Id);
|
|
}
|
|
|
|
//var pt = Shop.OnOrOffProduct.Find(op => op != null && op.GoodsId == Id);
|
|
//if (pt != null)
|
|
//{
|
|
// Shop.OnOrOffProduct.Remove(pt);
|
|
// LogSave.Add(Name, "移除有订单 " + pt.GoodsId);
|
|
//}
|
|
Thread.Sleep(100);
|
|
}
|
|
}
|
|
|
|
public void GetGroupOrderWait()
|
|
{
|
|
string Cookies = Shop.Cookies;
|
|
string url = "https://mms.pinduoduo.com/chats/ungroupOrders?pageNo=1&pageSize=20";
|
|
string refere = "https://mms.pinduoduo.com/assets/chats/dist/indexMain.html";
|
|
string html = GetPostTaobaoHtml.UploadTaobao(url, refere, true, Cookies);
|
|
if (string.IsNullOrEmpty(html) || !html.Contains("\"orders\""))
|
|
return;
|
|
int all = BaseRegex.GetIntJson(ref html, "total");
|
|
int page = all / 20 + (all % 20 > 0 ? 1 : 0);
|
|
|
|
for (int j = 0; j < page; j++)
|
|
{
|
|
if (j != 0)
|
|
{
|
|
string urlx = url.Replace("pageNo=1", "pageNo=" + (j + 1));
|
|
html = GetPostTaobaoHtml.UploadTaobao(urlx, refere, true, Cookies);
|
|
if (string.IsNullOrEmpty(html) || !html.Contains("\"orders\""))
|
|
return;
|
|
}
|
|
var m = BaseRegex.GetMatchRegex(ref html, @"\{.*?\}([^\}]+?)\}");
|
|
for (int i = 0; i < m.Count; i++)
|
|
{
|
|
string list = m[i].Groups[0].Value;
|
|
if (!list.Contains("goodsId"))
|
|
continue;
|
|
long Id = BaseRegex.GetLongJson(ref list, "goodsId");
|
|
if (!pidList.Contains(Id))
|
|
{
|
|
pidList.Add(Id);
|
|
LogSave.Add(Name, "订单 " + Id);
|
|
}
|
|
//var pt = Shop.OnOrOffProduct.Find(op => op != null && op.GoodsId == Id);
|
|
//if (pt != null)
|
|
//{
|
|
// Shop.OnOrOffProduct.Remove(pt);
|
|
// LogSave.Add(Name, "移除有订单 " + pt.GoodsId);
|
|
//}
|
|
Thread.Sleep(100);
|
|
}
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
public void DelOrder()
|
|
{
|
|
//30天订单量
|
|
string url = "https://mms.pinduoduo.com/mars/shop/recentOrderList";
|
|
string refere = "https://mms.pinduoduo.com/Pdd.html";
|
|
|
|
int confirmStartTime = BaseClass.GetTime(DateTime.Parse(DateTime.Now.AddDays(-30).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 = 50;
|
|
string source = "MMS";
|
|
string 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 + "\"}";
|
|
|
|
//第一页匹配结果
|
|
string html = CpsSetAllGoods.Request_mms_pinduoduo_com(url, refere, Shop.Cookies, data.Replace("#page#", "1"), CpsSetAllGoods.getAnti0aon());//GetPostTaobaoHtml.UploadTaobaoPost(url, refere, true, data, Shop.Cookies);
|
|
//30天订单量
|
|
int allCount = BaseRegex.GetIntJson(ref html, "totalItemNum");
|
|
|
|
int page = allCount / 50 + (allCount % 50 > 0 ? 1 : 0);
|
|
for (int i = 0; i < page; i++)
|
|
{
|
|
if (i != 0)
|
|
{
|
|
html = CpsSetAllGoods.Request_mms_pinduoduo_com(url, refere, Shop.Cookies, data.Replace("#pageNumber#", (i + 1).ToString()), CpsSetAllGoods.getAnti0aon());
|
|
//GetPostTaobaoHtml.GetJsonPost(url, refere, true, data.Replace("#pageNumber#", (i + 1).ToString()), Shop.Cookies);
|
|
}
|
|
var m = BaseRegex.GetMatchRegex(ref html, @"\{([\w\W]+?)\}");
|
|
for (int j = 0; m != null && j < m.Count; j++)
|
|
{
|
|
string list = m[j].Groups[0].Value;
|
|
long Id = BaseRegex.GetLongJson(ref list, "goods_id");
|
|
var pt = Shop.OnOrOffProduct.Find(op => op != null && op.GoodsId == Id);
|
|
if (pt != null)
|
|
{
|
|
Shop.OnOrOffProduct.Remove(pt);
|
|
LogSave.Add(Name, "移除有订单 " + pt.GoodsId);
|
|
}
|
|
Thread.Sleep(100);
|
|
}
|
|
}
|
|
}
|
|
public bool GetOnOrOff()
|
|
{
|
|
if (string.IsNullOrEmpty(PinduoduoAuth.strContent))
|
|
{
|
|
PinduoduoAuth.strContent = GetVisitProductNew.strJs;//FileBase.ReadAllText(path);
|
|
}
|
|
string NoCode = "";
|
|
string strTime = BaseClass.GetTime(DateTime.Now).ToString() + "000";
|
|
if (string.IsNullOrEmpty(NoCode))
|
|
{
|
|
string htmlx = GetHtml.Gbk("http://nano.qixiaoke.com/nano.txt");
|
|
NoCode = BaseRegex.GetMatchRegexString(ref htmlx, @"([\w\W]+?)-----");
|
|
}
|
|
string fun2 = string.Format(@"getEncode('{0}','{1}','{2}')", strTime, NoCode, "");
|
|
string codex = UploadPinduoduoSet.ExecuteScript(fun2, PinduoduoAuth.strContent);
|
|
string cookies = Shop.Cookies;
|
|
string url = "https://mms.pinduoduo.com/sydney/api/goodsDataShow/queryGoodsDetailVOList";
|
|
string refere = "https://mms.pinduoduo.com/sycm/goods_effect";
|
|
string data = "{\"goodsId\":\"\",\"cate1Id\":\"\",\"cate2Id\":\"\",\"cate3Id\":\"\",\"startDate\":\"" + BaseClass.GetServerTimeString().AddDays(-30).ToString("yyyy-MM-dd") + "\",\"endDate\":\"" + BaseClass.GetServerTimeString().AddDays(-1).ToString("yyyy-MM-dd") + "\",\"queryType\":2,\"sortCol\":0,\"sortType\":1,\"pageNum\":1,\"pageSize\":50,\"crawlerInfo\":\"" + codex + "\"}";
|
|
string html = GetPostTaobaoHtml.GetJsonPost(url, refere, true, data, cookies);
|
|
if (!html.Contains("\"success\":true"))
|
|
return false;
|
|
int allCount = BaseRegex.GetIntJson(ref html, "totalNum");
|
|
int page = allCount / 50 + (allCount % 50 > 0 ? 1 : 0);
|
|
|
|
for (int i = 1; i <= page; i++)
|
|
{
|
|
strTime = BaseClass.GetTime(DateTime.Now).ToString() + "000";
|
|
if (string.IsNullOrEmpty(NoCode))
|
|
{
|
|
string htmlx = GetHtml.Gbk("http://nano.qixiaoke.com/nano.txt");
|
|
NoCode = BaseRegex.GetMatchRegexString(ref htmlx, @"([\w\W]+?)-----");
|
|
}
|
|
fun2 = string.Format(@"getEncode('{0}','{1}','{2}')", strTime, NoCode, "");
|
|
codex = UploadPinduoduoSet.ExecuteScript(fun2, PinduoduoAuth.strContent);
|
|
|
|
if (i != 1)
|
|
{
|
|
data = "{\"goodsId\":\"\",\"cate1Id\":\"\",\"cate2Id\":\"\",\"cate3Id\":\"\",\"startDate\":\"" + BaseClass.GetServerTimeString().AddDays(-30).ToString("yyyy-MM-dd") + "\",\"endDate\":\"" + BaseClass.GetServerTimeString().AddDays(-1).ToString("yyyy-MM-dd") + "\",\"queryType\":2,\"sortCol\":0,\"sortType\":1,\"pageNum\":" + i + ",\"pageSize\":50,\"crawlerInfo\":\"" + codex + "\"}";
|
|
html = GetPostTaobaoHtml.UploadTaobaoPost(url, refere, true, data, cookies);
|
|
}
|
|
var m = BaseRegex.GetMatchRegex(ref html, @"\{([^\}]+?)\}");
|
|
for (int j = 0; m != null && j < m.Count; j++)
|
|
{
|
|
string list = m[j].Groups[0].Value;
|
|
long Id = BaseRegex.GetLongJson(ref list, "goodsId");
|
|
if (!pidList.Contains(Id))
|
|
{
|
|
pidList.Add(Id);
|
|
LogSave.Add(Name, "流量" + Id);
|
|
}
|
|
|
|
//var pt = Shop.OnOrOffProduct.Find(op => op != null && op.GoodsId == Id);
|
|
//if (pt != null)
|
|
//{
|
|
// Shop.OnOrOffProduct.Remove(pt);
|
|
// LogSave.Add(Name, "移除有流量 " + pt.GoodsId);
|
|
//}
|
|
|
|
}
|
|
LogSave.Add(Name, "获取 " + Shop.ShopName + " 流量:" + i);
|
|
Thread.Sleep(100);
|
|
}
|
|
return true;
|
|
}
|
|
|
|
public void DownInvalid()
|
|
{
|
|
PinduoduoApiGetProduct api = new PinduoduoApiGetProduct(Shop);
|
|
api.GetInvalidProductList();
|
|
string[] ids=null;
|
|
if (!string.IsNullOrEmpty(delIds))
|
|
{
|
|
ids = delIds.Split(new string[] { "\r", "\n", "," }, StringSplitOptions.RemoveEmptyEntries);
|
|
}
|
|
if (PinduoduoApiGetProduct.Product.ContainsKey(Shop.ShopName))
|
|
{
|
|
List<ProductBase> ps = PinduoduoApiGetProduct.Product[Shop.ShopName];
|
|
for (int i = 0; i < ps.Count; i++)
|
|
{
|
|
if (ids!=null&&ids.Length > 0)
|
|
{
|
|
bool ishas = false;
|
|
for (int j = 0; j < ids.Length; j++)
|
|
{
|
|
if (ids[j]==ps[i].Id.ToString())
|
|
{
|
|
ishas = true;
|
|
break;
|
|
}
|
|
}
|
|
if (!ishas)
|
|
continue;
|
|
}
|
|
TaobaoProductBase pro = new TaobaoProductBase();
|
|
pro.GoodsId = ps[i].Id;
|
|
pro.Titlte = ps[i].Title;
|
|
pro.FromId = ps[i].UpId;
|
|
pro.Price = ps[i].Price;
|
|
pro.CatId = ps[i].CatId;
|
|
pro.MainCatId = ps[i].MainCatId;
|
|
pro.SaleCount = ps[i].SoldCount;
|
|
Shop.OnOrOffProduct.Add(pro);
|
|
}
|
|
Shop.ClearNoVisitShop.goodsCount = ps.Count;
|
|
}
|
|
|
|
string html = "";
|
|
for (int j = 0; j < Shop.OnOrOffProduct.Count; j++)
|
|
{
|
|
IsOnline = !Shop.OnOrOffProduct[j].OffLine;
|
|
if (IsOnline)
|
|
{
|
|
if (IsGoodCount && OffCount >= GoodCount)
|
|
break;
|
|
html = api.SetOnline(Shop.OnOrOffProduct[j].GoodsId, false);
|
|
OffCount++;
|
|
Shop.ClearNoVisitShop.offCount = OffCount;
|
|
Shop.ClearNoVisitShop.goodStatus = "下架第" + OffCount + "个";
|
|
LogSave.Add(Name, "下架第" + OffCount + "个商品"+ Shop.OnOrOffProduct[j].GoodsId);
|
|
if (html != null && html.Contains("error_msg") && html.Contains("使用MMS后台做此"))
|
|
{
|
|
Shop.ClearNoVisitShop.goodStatus = "平台限制,请使用店铺后台MMS操作";
|
|
InvalidShopTemp.Add(Shop);
|
|
break;
|
|
}
|
|
InvalidShopTemp.Add(Shop);
|
|
}
|
|
Thread.Sleep(3 * 1000);
|
|
}
|
|
if (html != null && html.Contains("error_msg") && html.Contains("使用MMS后台做此"))
|
|
{
|
|
Shop.ClearNoVisitShop.goodStatus = "平台限制,请使用店铺后台MMS操作";
|
|
InvalidShopTemp.Add(Shop);
|
|
return;
|
|
}
|
|
Shop.ClearNoVisitShop.goodStatus = "下架第" + OffCount + "个(完成)";
|
|
InvalidShopTemp.Add(Shop);
|
|
LogSave.Add(Name, "下架完成");
|
|
return;
|
|
}
|
|
}
|
|
public class ClearProductControl
|
|
{
|
|
public string Name;
|
|
public ShopChatBase Shop;
|
|
public int ShopThreadCount = 5;
|
|
public static bool isOnline = false;
|
|
public string delTitle;
|
|
public string delIds;
|
|
public ClearProductControl(string name)
|
|
{
|
|
Name = name;
|
|
}
|
|
public void GetDelGroupProduct()
|
|
{
|
|
List<Thread> ts = new List<Thread>();
|
|
for (int i = 0; i < GetShopLoginInfo.Shops.Count; i++)
|
|
{
|
|
var shop = GetShopLoginInfo.Shops[i];
|
|
if (!shop.SelectClearDown || !shop.Showed)
|
|
continue;
|
|
var p = new ClearProductGroup(Name, shop);
|
|
p.IsOnline = isOnline;
|
|
Threadx.ThreadListWait(ref ts, new Thread(p.Delete), ShopThreadCount);
|
|
Thread.Sleep(100);
|
|
}
|
|
Threadx.ThreadListWait(ref ts);
|
|
|
|
}
|
|
public void GetDelUpProduct()
|
|
{
|
|
List<Thread> ts = new List<Thread>();
|
|
for (int i = 0; i < GetShopLoginInfo.Shops.Count; i++)
|
|
{
|
|
var shop = GetShopLoginInfo.Shops[i];
|
|
if (!shop.SelectClearDown || !shop.Showed)
|
|
continue;
|
|
var p = new ClearProductGroup(Name, shop);
|
|
p.IsOnline = true;
|
|
Threadx.ThreadListWait(ref ts, new Thread(p.DeleteUp), ShopThreadCount);
|
|
Thread.Sleep(100);
|
|
}
|
|
Threadx.ThreadListWait(ref ts);
|
|
|
|
}
|
|
|
|
public void GetDelGlideProduct()
|
|
{
|
|
List<Thread> ts = new List<Thread>();
|
|
for (int i = 0; i < GetShopLoginInfo.Shops.Count; i++)
|
|
{
|
|
var shop = GetShopLoginInfo.Shops[i];
|
|
if (!shop.SelectClearDown || !shop.Showed)
|
|
continue;
|
|
var p = new ClearProductGroup(Name, shop);
|
|
p.IsOnline = true;
|
|
Threadx.ThreadListWait(ref ts, new Thread(p.DeleteGlide), ShopThreadCount);
|
|
Thread.Sleep(100);
|
|
}
|
|
Threadx.ThreadListWait(ref ts);
|
|
|
|
}
|
|
|
|
|
|
public void GetDelDownProduct()
|
|
{
|
|
List<Thread> ts = new List<Thread>();
|
|
for (int i = 0; i < GetShopLoginInfo.Shops.Count; i++)
|
|
{
|
|
var shop = GetShopLoginInfo.Shops[i];
|
|
if (!shop.SelectClearDown || !shop.Showed)
|
|
continue;
|
|
var p = new ClearProductGroup(Name, shop);
|
|
p.IsOnline = false;
|
|
Threadx.ThreadListWait(ref ts, new Thread(p.DeleteDown), ShopThreadCount);
|
|
Thread.Sleep(100);
|
|
}
|
|
Threadx.ThreadListWait(ref ts);
|
|
|
|
}
|
|
public void GetRestoreGoodProduct()
|
|
{
|
|
List<Thread> ts = new List<Thread>();
|
|
for (int i = 0; i < GetShopLoginInfo.Shops.Count; i++)
|
|
{
|
|
var shop = GetShopLoginInfo.Shops[i];
|
|
if (!shop.SelectClearDown || !shop.Showed)
|
|
continue;
|
|
var p = new GetProductOnlineClass(Name, shop);
|
|
p.ReplaceModel = true;
|
|
p.isOnline = true;
|
|
Threadx.ThreadListWait(ref ts, new Thread(p.GetRestoreProduct), ShopThreadCount);
|
|
Thread.Sleep(100);
|
|
}
|
|
Threadx.ThreadListWait(ref ts);
|
|
}
|
|
public void GetDelKeyWordGoodOnline()
|
|
{
|
|
List<Thread> ts = new List<Thread>();
|
|
for (int i = 0; i < GetShopLoginInfo.Shops.Count; i++)
|
|
{
|
|
var shop = GetShopLoginInfo.Shops[i];
|
|
if (!shop.SelectClearDown || !shop.Showed)
|
|
continue;
|
|
var p = new GetProductOnlineClass(Name, shop);
|
|
p.ReplaceModel = true;
|
|
p.isOnline = true;
|
|
p.delTitle = delTitle;
|
|
Threadx.ThreadListWait(ref ts, new Thread(p.GetDelKeyWordDel), ShopThreadCount);
|
|
Thread.Sleep(100);
|
|
}
|
|
Threadx.ThreadListWait(ref ts);
|
|
|
|
}
|
|
|
|
public void GetDelNoSprProduct()
|
|
{
|
|
List<Thread> ts = new List<Thread>();
|
|
for (int i = 0; i < GetShopLoginInfo.Shops.Count; i++)
|
|
{
|
|
var shop = GetShopLoginInfo.Shops[i];
|
|
if (!shop.SelectPayOrder || !shop.Showed)
|
|
continue;
|
|
var p = new ClearProductGroup(Name, shop);
|
|
Threadx.ThreadListWait(ref ts, new Thread(p.DeleteNoSpr), ShopThreadCount);
|
|
Thread.Sleep(100);
|
|
}
|
|
Threadx.ThreadListWait(ref ts);
|
|
|
|
}
|
|
public void GetDelGroupOffProduct()
|
|
{
|
|
List<Thread> ts = new List<Thread>();
|
|
for (int i = 0; i < GetShopLoginInfo.Shops.Count; i++)
|
|
{
|
|
var shop = GetShopLoginInfo.Shops[i];
|
|
if (!shop.SelectClearDown || !shop.Showed)
|
|
continue;
|
|
var p = new ClearProductGroup(Name, shop);
|
|
p.IsOnline = true;
|
|
Threadx.ThreadListWait(ref ts, new Thread(p.Down), ShopThreadCount);
|
|
Thread.Sleep(100);
|
|
}
|
|
Threadx.ThreadListWait(ref ts);
|
|
}
|
|
public void GetOffProduct()
|
|
{
|
|
List<Thread> ts = new List<Thread>();
|
|
for (int i = 0; i < GetShopLoginInfo.Shops.Count; i++)
|
|
{
|
|
var shop = GetShopLoginInfo.Shops[i];
|
|
if (!shop.SelectClearDown || !shop.Showed)
|
|
continue;
|
|
var p = new ClearProductGroup(Name, shop);
|
|
p.IsOnline = true;
|
|
Threadx.ThreadListWait(ref ts, new Thread(p.Down), ShopThreadCount);
|
|
Thread.Sleep(100);
|
|
}
|
|
Threadx.ThreadListWait(ref ts);
|
|
}
|
|
public void GetInvaildOffProduct()
|
|
{
|
|
List<Thread> ts = new List<Thread>();
|
|
for (int i = 0; i < GetShopLoginInfo.Shops.Count; i++)
|
|
{
|
|
var shop = GetShopLoginInfo.Shops[i];
|
|
if (!shop.SelectClearDown || shop.Showed)
|
|
continue;
|
|
var p = new ClearProductGroup(Name, shop);
|
|
p.IsOnline = true;
|
|
p.delIds = delIds;
|
|
Threadx.ThreadListWait(ref ts, new Thread(p.DownInvalid), ShopThreadCount);
|
|
Thread.Sleep(100);
|
|
}
|
|
Threadx.ThreadListWait(ref ts);
|
|
}
|
|
public void GetOnProduct()
|
|
{
|
|
List<Thread> ts = new List<Thread>();
|
|
for (int i = 0; i < GetShopLoginInfo.Shops.Count; i++)
|
|
{
|
|
var shop = GetShopLoginInfo.Shops[i];
|
|
if (!shop.SelectClearDown || !shop.Showed)
|
|
continue;
|
|
var p = new ClearProductGroup(Name, shop);
|
|
p.IsOnline = false;
|
|
Threadx.ThreadListWait(ref ts, new Thread(p.Up), ShopThreadCount);
|
|
Thread.Sleep(100);
|
|
}
|
|
Threadx.ThreadListWait(ref ts);
|
|
}
|
|
public void GetShopProductCount()
|
|
{
|
|
LogSave.Add(Name, "开始获取店铺商品数量");
|
|
List<Thread> ts = new List<Thread>();
|
|
for (int i = 0; i < GetShopLoginInfo.Shops.Count; i++)
|
|
{
|
|
var shop = GetShopLoginInfo.Shops[i];
|
|
if (!shop.SelectClearDown || !shop.Showed)
|
|
continue;
|
|
var p = new ClearProductGroup(Name, shop);
|
|
Threadx.ThreadListWait(ref ts, new Thread(p.GetAllOnlineCount), ShopThreadCount);
|
|
Thread.Sleep(500);
|
|
Threadx.ThreadListWait(ref ts, new Thread(p.GetRestoreProductCount), ShopThreadCount);
|
|
Thread.Sleep(500);
|
|
}
|
|
Threadx.ThreadListWait(ref ts);
|
|
LogSave.Add(Name, "店铺商品数量获取完成");
|
|
}
|
|
}
|
|
} |