Files
KJD_WebService/Work/CollectClass/ShopAccountControl.cs
T
2025-06-29 19:38:31 +08:00

92 lines
3.5 KiB
C#

using AllBase;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Work.Api;
namespace Work.CollectClass
{
public class ShopAccountControl
{
public string Name;
public static int threadCount=5;
public static List<ShopAccountDetail> ShopAccountDetailList = new List<ShopAccountDetail>();
public ShopAccountControl(string name)
{
Name = name;
}
public void Get()
{
List<Thread> ts = new List<Thread>();
for (int i = 0; i < GetShopLoginInfo.Shops.Count; i++)
{
var shop = GetShopLoginInfo.Shops[i];
if (shop.Message == "会话已过期")
continue;
var p = new ShopAccountDetailLogic(Name, shop);
Threadx.ThreadListWait(ref ts, new Thread(p.Get), threadCount);
Thread.Sleep(1000);
}
Threadx.ThreadListWait(ref ts);
}
}
public class ShopAccountDetailLogic
{
public string Name;
public ShopChatBase Shop;
public ShopAccountDetailLogic(string Name,ShopChatBase Shop)
{
this.Name = Name;
this.Shop = Shop;
}
public void Get()
{
string url = " https://mms.pinduoduo.com/earth/api/mallInfo/queryFinalCredentialNew";
string refere = "https://mms.pinduoduo.com/mallcenter/info/basic";
string data = "{}";
//第一页匹配结果
string html = GetPostTaobaoHtml.UploadTaobaoPost(url, refere, true, data, Shop.Cookies);
string categoryName = BaseRegex.GetMatchRegexString(html, @"""staple"":\[""([^<]+)""\]");//主营类目
int mallType = BaseRegex.GetIntJson(ref html, "mallType");//店铺类型
string mallAuth = "个人店铺";
if (mallType != 2)
mallAuth = "企业店铺";
string companyName = BaseRegex.GetStringJson(ref html, "companyName");//公司名称
string socialCreditUnicode = BaseRegex.GetStringJson(ref html, "socialCreditUnicode");//信用代码
string operatorName= BaseRegex.GetStringJson(ref html, "operatorName");//管理员姓名
string legalRepresentativeName = BaseRegex.GetStringJson(ref html, "legalRepresentativeName");//管理员姓名
ShopAccountDetail account = new ShopAccountDetail();
account.ShopId = Shop.ShopId;
account.ShopName = Shop.ShopName;
account.ShopNumer = Shop.Name;
account.CategroyName = categoryName;
account.MallAuth = mallAuth;
account.CompanyName = companyName;
account.SocialCreditUnicode = socialCreditUnicode;
account.OperatorName = operatorName;
account.LegalRepresentativeName = legalRepresentativeName;
ShopAccountControl.ShopAccountDetailList.Add(account);
LogSave.Add(Name, "正在读取店铺 " + Shop.ShopName + "数据");
}
}
public class ShopAccountDetail
{
public string ShopId = "";
public string ShopName = "";
public string ShopNumer = "";
public string CategroyName = "";
public string MallAuth = "";
public string CompanyName = "";
public string SocialCreditUnicode = "";
public string OperatorName = "";
public string LegalRepresentativeName = "";
}
}