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

61 lines
2.1 KiB
C#

using System;
using System.Collections.Generic;
using System.Threading;
using AllBase;
using Work.ManageClass;
using System.Threading.Tasks;
namespace Work.Api
{
public class GetShopLoginInfo
{
public string Name;
public GetShopLoginInfo(string name)
{
Name = name;
}
public static List<string> ShopCat = new List<string>();
public static List<string> ShopCatTemp = new List<string>();
public static List<ShopChatBase> Shops = new List<ShopChatBase>();
public static List<ShopChatBase> ShopBak = new List<ShopChatBase>();
public static List<ShopChatBase> ShopTemp = new List<ShopChatBase>();
private Dictionary<string, string> GetCookies(ShopInfo SpIn)
{
int AgainCount = 0;
Dictionary<string, string> dicCookie = new Dictionary<string, string>();
string NewUrl = BaseClass.BuildObjString("pdd_shop_tempx&act=get_shop_cookies_list");
Again:
string Newhtml = GetHtml.PostUtf8(NewUrl, UserLogin.GetSignaturex("", "") + "&shops=" + GetHtml.UrlEncodeUtf8(Newtonsoft.Json.JsonConvert.SerializeObject(SpIn)));
if (string.IsNullOrEmpty(Newhtml) || Newhtml.Contains("Error No File"))
{
if (AgainCount < 2)
{
AgainCount++;
Thread.Sleep(50);
goto Again;
}
}
var m = BaseRegex.GetMatchRegex(ref Newhtml, @"<shop name=""([^""]+?)"">([\w\W]+?)</shop>");
for (int j = 0; m != null && j < m.Count; j++)
{
string shopName = m[j].Groups[1].Value;
string json = m[j].Groups[2].Value;
if (!string.IsNullOrEmpty(json) && !json.Contains("{}") && !json.Contains("none") && !json.Contains("noney"))
{
if (!dicCookie.ContainsKey(shopName))
{
dicCookie.Add(shopName, json);
}
}
}
return dicCookie;
}
}
}