1调整拼多多工作台cookie时的cef user-agent,防止掉线

2优化商品删除逻辑,修复bug
3查找pdd版本长时间运行程序卡死原因并尝试修复
4pdd上货记住主要上货选项避免每次都重新选择
This commit is contained in:
wule committed 2025-10-08 18:23:00 +08:00
1 parent 61264a5a99
commit 5e9bdd1700
19 files changed
+612 -557

No files matched your search

+14 -127
View File
@@ -32,7 +32,7 @@ namespace TemuKJD
{
InitOem();
InitProxy();
GlobalConfig.ProductWords = NaiBa.Util.Helper.ConfigHelper.LoadConfig<TemuProductWords>("product_words");
if (GlobalConfig.ProductWords == null)
GlobalConfig.ProductWords = new TemuProductWords();
@@ -70,23 +70,11 @@ namespace TemuKJD
#region 店铺登录信息
Task.Run((Action)(() =>
{
//while (string.IsNullOrEmpty(BaseClass.CompanyName))
while (!BaseClass.IsLoginSuccess)
Thread.Sleep(100);
Thread.Sleep(200);
KJDForms.ShopForms.ShopListForm.UpdateShop();
IsShopInit = true;
//while (true)
//{
// var needRefresh = GlobalConfig.DouShopLoginList.Where(s => s.LastRefreshDate != DateTime.Now.ToString("yyyyMMdd"));
// if (LittleRabbitForms.ShopForms.ShopListForm.Instance == null)
// LittleRabbitForms.ShopForms.ShopListForm.Instance = new LittleRabbitForms.ShopForms.ShopListForm();
// LittleRabbitForms.ShopForms.ShopListForm.Instance.CheckShopListLogin(needRefresh.Select(r => r.ShopAccount).ToArray(), false);
// IsShopInit = true;
// Thread.Sleep(1000 * 3600 * 24); // 每天刷新下验证,如果没关闭软件的话
//}
}));
#endregion
@@ -113,130 +101,25 @@ namespace TemuKJD
GlobalConfig.SameProductCheckParamList = new List<SameProductCheckParam>();
#endregion
#region 读取店铺历史铺货
#region 跨境达读取库存信息
Task.Run(() =>
{
while (!IsShopInit)
{
Thread.Sleep(100);
Thread.Sleep(1000);
}
//List<Task> tList = new List<Task>();
//var tick = BaseClass.DateTimeToTimestampSeconds(new DateTime(2022, 4, 25));
//while (true)
//{
// if (GlobalConfig.ShopLoginList.All(shop => shop.ApiAuthStatus != "授权成功"
// || GlobalConfig.SameProductCheckParamList.Any(sp => sp.ShopId == shop.ShopId && sp.IsGetSuccess)))
// {
// Thread.Sleep(1000);
// continue;
// }
//
// tList.Clear();
// foreach (var shop in GlobalConfig.ShopLoginList)
// {
// if (GlobalConfig.SameProductCheckParamList.Any(sp => sp.ShopId == shop.ShopId && sp.IsGetSuccess))
// continue;
//
// if (shop.ApiAuthStatus != "授权成功")
// continue;
//
// var t = Task.Run(() =>
// {
// var shopTemp = shop;
// try
// {
// var sameProductCheckParam = GlobalConfig.SameProductCheckParamList.FirstOrDefault(sp => sp.ShopId == shop.ShopId);
// if (sameProductCheckParam == null)
// {
// sameProductCheckParam = new SameProductCheckParam()
// {
// ShopId = shopTemp.ShopId,
// ShopName = shopTemp.ShopAccount,
// ShopSamePrpductItemList = new List<ShopOurterProductItemParam>(),
// };
// }
// for (int i = 1; i <= 500; i++)
// {
// if (sameProductCheckParam.ShopSamePrpductItemList != null && sameProductCheckParam.ShopSamePrpductItemList.Count > 0)
// tick = sameProductCheckParam.ShopSamePrpductItemList.Min(it => it.create_time).ParseToInt() - 1;
//
// DouyinApi douApi = new DouyinApi(shopTemp);
// douApi.JsonData["page"] = "1";
// douApi.JsonData["size"] = "100";
// douApi.JsonData["end_time"] = tick.ToString();
// // check_status 指定审核状态返回商品列表:1未提审 2审核中 3审核通过 4审核驳回 5封禁 7审核通过,待上架状态
// //douApi.JsonData["check_status"] = "3";
// //douApi.JsonData["check_status"] = "1";
// //douApi.JsonData["status"] = "0";
// var resultOnline = douApi.GetProductList();
// if (resultOnline.Contains("已过期"))
// {
// shopTemp.ApiAuthStatus = "未授权";
// return;
// }
// while (!resultOnline.Contains("\"code\":10000"))
// {
// Thread.Sleep(Randomx.GetId(500, 1000) * tList.Count);
// resultOnline = douApi.GetProductList();
// }
// if (resultOnline != null && resultOnline.Contains("\"data\":[]"))
// {
// sameProductCheckParam.IsGetSuccess = true;
// break;
// }
//
// Newtonsoft.Json.Linq.JObject jObj = JsonHelper.JObjectParse(resultOnline);
// var itemList = JsonHelper.DeserializeJsonToList<ShopOurterProductItemParam>(jObj["data"]?["data"]?.ToString());
// sameProductCheckParam.ShopSamePrpductItemList.AddRange(itemList);
//
// if (i % 10 == 9)
// {
// if (!GlobalConfig.SameProductCheckParamList.Contains(sameProductCheckParam))
// GlobalConfig.SameProductCheckParamList.Add(sameProductCheckParam);
// sameProductCheckParam.ShopSamePrpductItemList = sameProductCheckParam.ShopSamePrpductItemList.DistinctBy(it => it.product_id).ToList();
// NaiBa.Util.Helper.ConfigHelper.SaveConfig<List<SameProductCheckParam>>("same_product_check_list", GlobalConfig.SameProductCheckParamList);
// }
//
// Thread.Sleep(Randomx.GetId(500, 1000) * tList.Count);
// }
// if (!GlobalConfig.SameProductCheckParamList.Contains(sameProductCheckParam))
// GlobalConfig.SameProductCheckParamList.Add(sameProductCheckParam);
// sameProductCheckParam.ShopSamePrpductItemList = sameProductCheckParam.ShopSamePrpductItemList.DistinctBy(it => it.product_id).ToList();
// NaiBa.Util.Helper.ConfigHelper.SaveConfig<List<SameProductCheckParam>>("same_product_check_list", GlobalConfig.SameProductCheckParamList);
// }
// catch (Exception ex)
// {
// }
// });
// tList.Add(t);
// }
// Task.WaitAll(tList.ToArray());
//
// Thread.Sleep(10000);
//}
});
#endregion
#region 读取库存信息
Task.Run(() =>
{
if (BaseClass.MainPath != "kuajingda")
if (BaseClass.MainPath != "kuajingda") // 跨境达才读取库存
return;
while (!IsShopInit)
{
Thread.Sleep(100);
}
ReturnPackageDetailForm retrunPackageForm = new ReturnPackageDetailForm(null);
retrunPackageForm.Show();
retrunPackageForm.Hide();
Dictionary<ShopLoginInfo, string> dicUpReturn = new Dictionary<ShopLoginInfo, string>();
while(true)
while (true)
{
foreach(var shop in GlobalConfig.ShopLoginList)
foreach (var shop in GlobalConfig.ShopLoginList)
{
if (string.IsNullOrEmpty(shop.ShopId))
continue;
@@ -250,10 +133,14 @@ namespace TemuKJD
dicUpReturn[shop] = DateTime.Now.ToString("yyyyMMdd");
}
}
for (int i = 0; i< 3600; i++)
#if DEBUG
for (int i = 0; i < 3600; i++)
{
Thread.Sleep(1000);
}
#else
Thread.Sleep(1000 * 3600);
#endif
}
});
#endregion
@@ -274,7 +161,7 @@ namespace TemuKJD
/// </summary>
public static void InitOem()
{
#region 代理版本获取代理码
#region 代理版本获取代理码
if (FileBase.Exists("locales/ig.pak"))
{
BaseClass.AgentCode = FileBase.ReadAllText("locales/ig.pak");
@@ -445,7 +332,7 @@ namespace TemuKJD
//}
}
}
#endregion
#endregion
}
public static void SaveFissionSettingParam()