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

+2 -1
View File
@@ -27,7 +27,7 @@ namespace AllBase
/// <summary>
/// 版本ID
/// </summary>
public static int VersionCount = 616;
public static int VersionCount = 619;
//public static int VersionCount = 613;
/// <summary>
@@ -42,6 +42,7 @@ namespace AllBase
public static Image LogoImage = null;
public static Icon Ico = null;
public static string MainPath = "kuajingda";
public static bool UsePddWorkbanch = true;
public static bool NoRegedit = false;
public static bool IsPinduoduo = false;
public static bool UserApi = true;
@@ -180,7 +180,7 @@ namespace KJD_Web.BLL.BXX
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "select count(id) from bxx.product p where 1=1";
string sql = "select count(id) from bxx.product p where p.is_del=0";
string where = "";
if (!string.IsNullOrWhiteSpace(search_spu))
@@ -211,15 +211,15 @@ namespace KJD_Web.BLL.BXX
else
{
if (isDetail)
sql = "select p.*,s.img_base64,s.img_url from bxx.product p left join bxx.sku_img_replace s ON p.sku_img_replace_id=s.id where 1=1";
sql = "select p.*,s.img_base64,s.img_url from bxx.product p left join bxx.sku_img_replace s ON p.sku_img_replace_id=s.id where p.is_del=0";
else if (string.IsNullOrEmpty(get_select_count))
sql = "select p.id,p.from_shop_id,p.spu_id,p.skc_id,p.main_cat_id,p.main_cat_name,p.cat_id,p.cat_name,p.price_text,p.ext_code,p.product_name,p.main_img,p.notes," +
"p.add_time,p.mdy_time,p.select_total_count,p.fission_words,p.head_words,p.end_words,p.sku_img_replace_id,p.group from bxx.product p where 1=1";
"p.add_time,p.mdy_time,p.select_total_count,p.fission_words,p.head_words,p.end_words,p.sku_img_replace_id,p.group from bxx.product p where p.is_del=0";
else
sql = "SELECT p.id,p.from_shop_id,p.spu_id,p.skc_id,p.main_cat_id,p.main_cat_name,p.cat_id,p.cat_name,p.price_text,p.ext_code,p.product_name,p.main_img,p.notes," +
"p.add_time,p.mdy_time,p.select_total_count,p.fission_words,p.head_words,p.end_words,p.sku_img_replace_id,p.group,COUNT(s.id) AS select_count " +
"FROM bxx.product p LEFT JOIN bxx.product_select s ON p.id=s.out_product_id AND s.shop_id='" + select_shop_id + "' " +
"WHERE 1=1";
"WHERE p.is_del=0";
//where子句
sql += where;
@@ -316,7 +316,7 @@ namespace KJD_Web.BLL.BXX
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "SELECT DISTINCT p.group FROM `bxx`.`product` p";
string sql = "SELECT DISTINCT p.group FROM `bxx`.`product` p where p.is_del=0";
string where = "";
sql += where;
@@ -459,7 +459,7 @@ namespace KJD_Web.BLL.BXX
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "select count(id) from bxx.product p where 1=1";
string sql = "select count(id) from bxx.product p where p.is_del=0";
string where = "";
if (!string.IsNullOrEmpty(in_ext_codes))
@@ -491,7 +491,7 @@ namespace KJD_Web.BLL.BXX
{
sql = "select p.id,p.from_shop_id,p.spu_id,p.skc_id,p.main_cat_id,p.main_cat_name,p.cat_id,p.cat_name,p.price_text,p.ext_code," +
"p.product_name,p.main_img,p.group,p.notes,p.add_time,p.mdy_time,p.select_total_count," +
"p.fission_words,p.head_words,p.end_words from bxx.product p where 1=1";
"p.fission_words,p.head_words,p.end_words from bxx.product p where p.is_del=0";
//where子句
sql += where;
@@ -575,7 +575,8 @@ namespace KJD_Web.BLL.BXX
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "delete from bxx.product where id='" + id + "'";
//string sql = "delete from bxx.product where id='" + id + "'";
string sql = "update bxx.product set is_del=1 where id='" + id + "'";
var rst = mySql.ExecuteNonQuery(sql);
mySql.Close();
@@ -1004,6 +1005,8 @@ namespace KJD_Web.BLL.BXX
}
if (!string.IsNullOrWhiteSpace(search_user_notes))
where += " and s.user_notes like '%" + search_user_notes + "%'";
where += " and p.id_del=0";
if (!string.IsNullOrWhiteSpace(search_spu))
where += " and p.spu_id like '%" + search_spu + "%'";
if (!string.IsNullOrWhiteSpace(search_skc))
@@ -91,7 +91,7 @@ namespace KJD_Web.BLL
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "select count(id) from kjd.product p where 1=1";
string sql = "select count(id) from kjd.product p where p.is_del=0";
string where = "";
if (!string.IsNullOrWhiteSpace(search_spu))
@@ -120,15 +120,15 @@ namespace KJD_Web.BLL
else
{
if (isDetail)
sql = "select * from kjd.product p where 1=1";
sql = "select * from kjd.product p where p.is_del=0";
else if (string.IsNullOrEmpty(get_select_count))
sql = "select p.id,p.spu_id,p.skc_id,p.cat_id,p.cat_name,p.ext_code,p.product_name,p.main_img,p.notes," +
"p.add_time,p.mdy_time,p.select_total_count,p.fission_words,p.head_words,p.end_words from kjd.product p where 1=1";
"p.add_time,p.mdy_time,p.select_total_count,p.fission_words,p.head_words,p.end_words from kjd.product p where p.is_del=0";
else
sql = "SELECT p.id,p.spu_id,p.skc_id,p.cat_id,p.cat_name,p.ext_code,p.product_name,p.main_img,p.notes," +
"p.add_time,p.mdy_time,p.select_total_count,p.fission_words,p.head_words,p.end_words,COUNT(s.id) AS select_count " +
"FROM kjd.product p LEFT JOIN kjd.product_select s ON p.id=s.out_product_id AND s.shop_id='" + select_shop_id + "' " +
"WHERE 1=1";
"WHERE p.is_del=0";
//where子句
sql += where;
@@ -212,8 +212,8 @@ namespace KJD_Web.BLL
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "delete from kjd.product where id='"
+ id + "'";
//string sql = "delete from kjd.product where id='" + id + "'";
string sql = "update kjd.product set is_del=1 where id='" + id + "'";
var rst = mySql.ExecuteNonQuery(sql);
mySql.Close();
@@ -525,6 +525,8 @@ namespace KJD_Web.BLL
}
if (!string.IsNullOrWhiteSpace(search_user_notes))
where += " and s.user_notes like '%" + search_user_notes + "%'";
where += " and p.is_del=0";
if (!string.IsNullOrWhiteSpace(search_spu))
where += " and p.spu_id like '%" + search_spu + "%'";
if (!string.IsNullOrWhiteSpace(search_skc))
+159 -68
View File
@@ -1,5 +1,6 @@
using AllBase;
using AllBase.Model.Result;
using NaiBa.Util.Extension;
using System;
using System.Collections.Generic;
using System.IO;
@@ -26,9 +27,10 @@ namespace TemuKJD.BLL
request.Headers.Set(HttpRequestHeader.CacheControl, "max-age=0");
request.Headers.Add("Anti-Content", @"0aqAfqFyXcGvBgd9Q0HiJJ7kvWcKK7muUHnJ6oMAdmem0tmm_enmX1DBr-nJNxmoki33dqHTkZU18BU2p8P72Cg2uEZ_acOOBCxGmIs-Gym4EtKpTdZ6kWRCSClS9L6maLm0imx0GIjodHtLnwpx4ayHnhzNnCXEFecZSC8lBRHb9WCAoyY79kMLIWxBMZZSZrR2_LYUJ5UXzf-82ob455f7OvJa6s895N4wiMGR4vbVH8gFN2VuCxS27RpXDa2WCQQQd6XsJPw7amSUaob6oZ2MXuYb9K3ZqoCX5-nJimNZDR0rNCLB13sYgWq9jy0Q3gjnsFY2dJQDh3ewXS2vvf2DN9IAEzInwWTY31Fn0B6-s8DqwIm61OlXsfYt1AYOOyNMLzkw5llaDaqK21f7vspAuXwnJdAdKXJXSyyEimvTyF_AYLp1gkNqBqN1_ik_jc6cKTDJtGUgFjRojR4g4zM7Ww3wfW63WQrJftYhiTIJiS1tZcsceZht3Zu3MsvyxpAbx4bxFrvL0A6OFx752XsVi04Tm6HDhgt7MmpsrTO5WD_KjgjxNX8VNoGndD0OmriAYVn6kwmZXE6Y_khGedxumIGy4sOQI36__CeiuiPIvB8itfOqd7eyqyeCIaEODrh9dSLBQz8AxQ2xt60OTn4HSiPmlwo1J0TFtjUw2DUZB68tdrINb7ugulMsaIwMKr8S0bilSKW6JuYw3oAsmK3daQfJWy3mzVowY1UwPQfTB4Ibz6uRQxHkvhsRTXkrAygGeZIc9S");
request.Headers.Add("sec-ch-ua-platform", @"""Windows""");
request.UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36";
request.UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36";
request.Headers.Add("mallid", shop.ShopId);
request.Headers.Add("sec-ch-ua", @"""Google Chrome"";v=""137"", ""Chromium"";v=""137"", ""Not/A)Brand"";v=""24""");
//request.Headers.Add("sec-ch-ua", @"""Google Chrome"";v=""137"", ""Chromium"";v=""137"", ""Not/A)Brand"";v=""24""");
request.Headers.Add("sec-ch-ua", @"""Not)A;Brand"";v=""8"", ""Chromium"";v=""138""");
request.ContentType = "application/json";
request.Headers.Add("sec-ch-ua-mobile", @"?0");
request.Accept = "*/*";
@@ -104,10 +106,11 @@ namespace TemuKJD.BLL
request.Headers.Set(HttpRequestHeader.CacheControl, "max-age=0");
request.Headers.Add("Anti-Content", @"0aqWfxid0jQ8y99ATT_XGgVxsfy4jtTaQmZlRu9wW2g__9Zt4t2lsnyOevFqnSSUyXZMpPqVZUDOdlErZ7OEmhxNBhLjtyetvpWiGLBc30pcnYGHrW-JahQSJXHSVaz3_sGqB4FzfTWB9eAO-4-p957LPKscrKS9qQPTVDizDQXbx3zEPk64Cn3aUxjMeU5ovt737YczpQRmqtpc7Riil2boSIvCGPfPppc9UscZP5f4SVEsH2sgGTTc4shYwJJ3R-p-dr3nnmhksQlh20daGKfN-yWRSt_VoXlVtkh6KfXOngZhGQwnS45_G9hBY_bXH2zy4ym32OSSWmk0Z2NYg4nW7l30uIUw9mXV2mwYmN9mE1ngv3WMWCAtf5LupF71ciYOdouvE3uTYzqQMjT1i_4nRszBLSRRQbi7wMPIsxJOwR6OUiYv7DfcoerokcZMsplG-PORulS0avRh-BlkZCUGIir2GAmFjtAAt1rYH2evGrbSQo_7vRxiIHi9778FABRQwR8v");
request.Headers.Add("sec-ch-ua-platform", @"""Windows""");
request.UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36";
request.UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36";
request.Headers.Add("mallid", shop.ShopId);
//request.Headers.Add("sec-ch-ua", @"""Google Chrome"";v=""137"", ""Chromium"";v=""137"", ""Not/A)Brand"";v=""24""");
request.Headers.Add("sec-ch-ua", @"""Not;A=Brand"";v=""99"", ""Google Chrome"";v=""139"", ""Chromium"";v=""139""");
//request.Headers.Add("sec-ch-ua", @"""Not;A=Brand"";v=""99"", ""Google Chrome"";v=""139"", ""Chromium"";v=""139""");
request.Headers.Add("sec-ch-ua", @"""Not)A;Brand"";v=""8"", ""Chromium"";v=""138""");
request.ContentType = "application/json";
request.Headers.Add("sec-ch-ua-mobile", @"?0");
request.Accept = "*/*";
@@ -181,9 +184,10 @@ namespace TemuKJD.BLL
request.KeepAlive = true;
request.Headers.Add("sec-ch-ua-platform", @"""Windows""");
request.UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36";
request.UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36";
//request.Headers.Add("mallid", shop.ShopId);
request.Headers.Add("sec-ch-ua", @"""Not)A;Brand"";v=""8"", ""Chromium"";v=""138"", ""Google Chrome"";v=""138""");
//request.Headers.Add("sec-ch-ua", @"""Not)A;Brand"";v=""8"", ""Chromium"";v=""138"", ""Google Chrome"";v=""138""");
request.Headers.Add("sec-ch-ua", @"""Not)A;Brand"";v=""8"", ""Chromium"";v=""138""");
request.ContentType = "multipart/form-data; boundary=" + boundary;
request.Headers.Add("sec-ch-ua-mobile", @"?0");
request.Accept = "*/*";
@@ -263,11 +267,12 @@ namespace TemuKJD.BLL
request.KeepAlive = true;
//request.Headers.Set(HttpRequestHeader.CacheControl, "max-age=0");
//request.Headers.Add("Anti-Content", @"0aqAfqFyXcGvBgd9Q0HiJJ7kvWcKK7muUHnJ6oMAdmem0tmm_enmX1DBr-nJNxmoki33dqHTkZU18BU2p8P72Cg2uEZ_acOOBCxGmIs-Gym4EtKpTdZ6kWRCSClS9L6maLm0imx0GIjodHtLnwpx4ayHnhzNnCXEFecZSC8lBRHb9WCAoyY79kMLIWxBMZZSZrR2_LYUJ5UXzf-82ob455f7OvJa6s895N4wiMGR4vbVH8gFN2VuCxS27RpXDa2WCQQQd6XsJPw7amSUaob6oZ2MXuYb9K3ZqoCX5-nJimNZDR0rNCLB13sYgWq9jy0Q3gjnsFY2dJQDh3ewXS2vvf2DN9IAEzInwWTY31Fn0B6-s8DqwIm61OlXsfYt1AYOOyNMLzkw5llaDaqK21f7vspAuXwnJdAdKXJXSyyEimvTyF_AYLp1gkNqBqN1_ik_jc6cKTDJtGUgFjRojR4g4zM7Ww3wfW63WQrJftYhiTIJiS1tZcsceZht3Zu3MsvyxpAbx4bxFrvL0A6OFx752XsVi04Tm6HDhgt7MmpsrTO5WD_KjgjxNX8VNoGndD0OmriAYVn6kwmZXE6Y_khGedxumIGy4sOQI36__CeiuiPIvB8itfOqd7eyqyeCIaEODrh9dSLBQz8AxQ2xt60OTn4HSiPmlwo1J0TFtjUw2DUZB68tdrINb7ugulMsaIwMKr8S0bilSKW6JuYw3oAsmK3daQfJWy3mzVowY1UwPQfTB4Ibz6uRQxHkvhsRTXkrAygGeZIc9S");
request.Headers.Add("sec-ch-ua", @"""Google Chrome"";v=""137"", ""Chromium"";v=""137"", ""Not/A)Brand"";v=""24""");
//request.Headers.Add("sec-ch-ua", @"""Google Chrome"";v=""137"", ""Chromium"";v=""137"", ""Not/A)Brand"";v=""24""");
request.Headers.Add("sec-ch-ua", @"""Not)A;Brand"";v=""8"", ""Chromium"";v=""138""");
request.Headers.Add("sec-ch-ua-mobile", @"?0");
request.Headers.Add("sec-ch-ua-platform", @"""Windows""");
request.Headers.Add("Upgrade-Insecure-Requests", @"1");
request.UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36";
request.UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36";
request.Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7";
request.Headers.Add("Sec-Fetch-Site", @"same-origin");
request.Headers.Add("Sec-Fetch-Mode", @"navigate");
@@ -326,31 +331,48 @@ namespace TemuKJD.BLL
string url = _url;
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
request.KeepAlive = true;
request.Headers.Set(HttpRequestHeader.CacheControl, "max-age=0");
request.Headers.Add("Anti-Content", AntiContent);
request.Headers.Add("sec-ch-ua-platform", @"""Windows""");
request.UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36";
if (cookies.Contains("PASS_ID=windows") && !string.IsNullOrEmpty(shop.pddid))
if (cookies.Contains("PASS_ID=windows_1") /*&& !string.IsNullOrEmpty(shop.pddid)*/)
{
request.UserAgent = "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.5.40.8 Safari/537.36 PddWorkbench-Online PddBrowser pdd_windows_version/3.0.3.12";
//request.UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36 PddWorkbench-Online PddBrowser pdd_windows_version/3.0.3.12";
//request.Headers.Add("pddid", @"zULm8bXS");
request.Headers.Add("pddid", shop.pddid);
if (!url.Contains("https://mms.pinduoduo.com/draco-ms/mms/template/property/sub-property/v4"))
request.KeepAlive = true;
request.Headers.Set(HttpRequestHeader.CacheControl, "max-age=0");
request.Accept = "*/*";
request.Headers.Add("Anti-Content", AntiContent);
request.Headers.Set(HttpRequestHeader.Cookie, cookies);
request.Headers.Add("ETag", rckk);
request.UserAgent = "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.5.40.8 Safari/537.36 PddWorkbench-Online PddBrowser pdd_windows_version/3.0.3.12";
request.ContentType = "application/json";
request.Headers.Add("pddid", shop.pddid.ParseToString());
request.Headers.Add("Sec-Fetch-Site", @"same-origin");
request.Headers.Add("Sec-Fetch-Mode", @"cors");
request.Headers.Add("Sec-Fetch-Dest", @"empty");
request.Referer = referer;
request.Headers.Set(HttpRequestHeader.AcceptEncoding, "gzip, deflate, br");
}
else
{
request.KeepAlive = true;
request.Headers.Set(HttpRequestHeader.CacheControl, "max-age=0");
request.Headers.Add("Anti-Content", AntiContent);
request.Headers.Add("sec-ch-ua-platform", @"""Windows""");
request.UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36";
request.Headers.Add("ETag", rckk);
//request.Headers.Add("sec-ch-ua", @"""Not;A=Brand"";v=""99"", ""Google Chrome"";v=""139"", ""Chromium"";v=""139""");
request.Headers.Add("sec-ch-ua", @"""Not)A;Brand"";v=""8"", ""Chromium"";v=""138""");
request.ContentType = "application/json";
request.Headers.Add("sec-ch-ua-mobile", @"?0");
request.Accept = "*/*";
request.Headers.Add("Origin", @"https://mms.pinduoduo.com");
request.Headers.Add("Sec-Fetch-Site", @"same-origin");
request.Headers.Add("Sec-Fetch-Mode", @"cors");
request.Headers.Add("Sec-Fetch-Dest", @"empty");
request.Referer = referer;
request.Headers.Set(HttpRequestHeader.AcceptEncoding, "gzip, deflate, br, zstd");
request.Headers.Set(HttpRequestHeader.AcceptLanguage, "zh-CN,zh;q=0.9");
request.Headers.Set(HttpRequestHeader.Cookie, cookies);
}
request.Headers.Add("ETag", rckk);
request.Headers.Add("sec-ch-ua", @"""Not;A=Brand"";v=""99"", ""Google Chrome"";v=""139"", ""Chromium"";v=""139""");
request.ContentType = "application/json";
request.Headers.Add("sec-ch-ua-mobile", @"?0");
request.Accept = "*/*";
request.Headers.Add("Origin", @"https://mms.pinduoduo.com");
request.Headers.Add("Sec-Fetch-Site", @"same-origin");
request.Headers.Add("Sec-Fetch-Mode", @"cors");
request.Headers.Add("Sec-Fetch-Dest", @"empty");
request.Referer = referer;
request.Headers.Set(HttpRequestHeader.AcceptEncoding, "gzip, deflate, br, zstd");
request.Headers.Set(HttpRequestHeader.AcceptLanguage, "zh-CN,zh;q=0.9");
request.Headers.Set(HttpRequestHeader.Cookie, cookies);
request.Method = "POST";
request.ServicePoint.Expect100Continue = false;
@@ -380,6 +402,16 @@ namespace TemuKJD.BLL
return e.Message;
}
result = GetProxyHtml.ReadResponse(response);
if (result.Contains("会话已过期") /*&& !_url.StartsWith("https://mms.pinduoduo.com/draco-ms/mms/template/property/sub-property/v4")*/)
{
var url = _url;
//https://mms.pinduoduo.com/draco-ms/mms/template/property/sub-property/v4
//https://mms.pinduoduo.com/draco-ms/mms/template/property/sub-property/v4
//https://mms.pinduoduo.com/opportunity-goods/chance-goods/quick_release
//https://mms.pinduoduo.com/cabernet/mms/sizespec/action/post
//https://mms.pinduoduo.com/gorse/mms/goods/decoration/commit/save
}
return result;
}
@@ -412,28 +444,72 @@ namespace TemuKJD.BLL
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
request.KeepAlive = true;
request.Headers.Set(HttpRequestHeader.CacheControl, "max-age=0");
request.Headers.Add("Anti-Content", AntiContent);
request.Headers.Add("sec-ch-ua-platform", @"""Windows""");
request.UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36";
if (cookies.Contains("PASS_ID=windows") && !string.IsNullOrEmpty(shop.pddid))
if (cookies.Contains("PASS_ID=windows_1") /*&& !string.IsNullOrEmpty(shop.pddid)*/)
{
request.UserAgent = "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.5.40.8 Safari/537.36 PddWorkbench-Online PddBrowser pdd_windows_version/3.0.3.12";
//request.UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36 PddWorkbench-Online PddBrowser pdd_windows_version/3.0.3.12";
//request.Headers.Add("pddid", @"zULm8bXS");
request.Headers.Add("pddid", shop.pddid);
if (url.Contains("https://mms.pinduoduo.com/draco-ms/mms/template/mall"))
{
request.Headers.Set(HttpRequestHeader.CacheControl, "max-age=0");
request.Headers.Add("Anti-Content", AntiContent);
request.Headers.Add("ETag", rckk);
request.UserAgent = "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.5.40.8 Safari/537.36 PddWorkbench-Online PddBrowser pdd_windows_version/3.0.3.12";
request.Accept = "*/*";
request.Headers.Set(HttpRequestHeader.Cookie, cookies);
request.Headers.Add("Sec-Fetch-Site", @"same-origin");
request.Headers.Add("Sec-Fetch-Mode", @"cors");
request.Headers.Add("Sec-Fetch-Dest", @"empty");
request.Referer = referer;
request.Headers.Set(HttpRequestHeader.AcceptEncoding, "gzip, deflate, br");
}
else if (url.Contains("https://mms.pinduoduo.com/goods/goods_add/index?type=add&from=chance"))
{
request.Headers.Add("Upgrade-Insecure-Requests", @"1");
request.UserAgent = "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.5.40.8 Safari/537.36 PddWorkbench-Online PddBrowser pdd_windows_version/3.0.3.12";
request.Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9";
request.Headers.Set(HttpRequestHeader.Cookie, cookies);
request.Headers.Add("Sec-Fetch-Site", @"none");
request.Headers.Add("Sec-Fetch-Mode", @"navigate");
request.Headers.Add("Sec-Fetch-User", @"?1");
request.Headers.Add("Sec-Fetch-Dest", @"document");
request.Headers.Set(HttpRequestHeader.AcceptEncoding, "gzip, deflate, br");
}
else
{
request.Headers.Set(HttpRequestHeader.CacheControl, "max-age=0");
request.Headers.Add("Anti-Content", AntiContent);
request.Headers.Add("ETag", rckk);
request.UserAgent = "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.5.40.8 Safari/537.36 PddWorkbench-Online PddBrowser pdd_windows_version/3.0.3.12";
request.Headers.Add("pddid", shop.pddid.ParseToString());
request.Accept = "*/*";
request.Headers.Set(HttpRequestHeader.Cookie, cookies);
request.Headers.Add("Sec-Fetch-Site", @"same-origin");
request.Headers.Add("Sec-Fetch-Mode", @"cors");
request.Headers.Add("Sec-Fetch-Dest", @"empty");
request.Referer = referer;
request.Headers.Set(HttpRequestHeader.AcceptEncoding, "gzip, deflate, br");
}
}
else
{
request.Headers.Set(HttpRequestHeader.CacheControl, "max-age=0");
request.Headers.Add("Anti-Content", AntiContent);
request.Headers.Add("sec-ch-ua-platform", @"""Windows""");
request.UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36";
request.Headers.Add("ETag", rckk);
//request.Headers.Add("sec-ch-ua", @"""Not;A=Brand"";v=""99"", ""Google Chrome"";v=""139"", ""Chromium"";v=""139""");
request.Headers.Add("sec-ch-ua", @"""Not)A;Brand"";v=""8"", ""Chromium"";v=""138""");
request.Headers.Add("sec-ch-ua-mobile", @"?0");
request.Accept = "*/*";
request.Headers.Add("Sec-Fetch-Site", @"same-origin");
request.Headers.Add("Sec-Fetch-Mode", @"cors");
request.Headers.Add("Sec-Fetch-Dest", @"empty");
request.Referer = referer;
request.Headers.Set(HttpRequestHeader.AcceptEncoding, "gzip, deflate, br, zstd");
request.Headers.Set(HttpRequestHeader.AcceptLanguage, "zh-CN,zh;q=0.9");
request.Headers.Set(HttpRequestHeader.Cookie, cookies);
}
request.Headers.Add("ETag", rckk);
request.Headers.Add("sec-ch-ua", @"""Not;A=Brand"";v=""99"", ""Google Chrome"";v=""139"", ""Chromium"";v=""139""");
request.Headers.Add("sec-ch-ua-mobile", @"?0");
request.Accept = "*/*";
request.Headers.Add("Sec-Fetch-Site", @"same-origin");
request.Headers.Add("Sec-Fetch-Mode", @"cors");
request.Headers.Add("Sec-Fetch-Dest", @"empty");
request.Referer = referer;
request.Headers.Set(HttpRequestHeader.AcceptEncoding, "gzip, deflate, br, zstd");
request.Headers.Set(HttpRequestHeader.AcceptLanguage, "zh-CN,zh;q=0.9");
request.Headers.Set(HttpRequestHeader.Cookie, cookies);
response = (HttpWebResponse)request.GetResponse();
}
@@ -485,28 +561,43 @@ namespace TemuKJD.BLL
request.KeepAlive = true;
request.Headers.Set(HttpRequestHeader.CacheControl, "max-age=0");
request.Headers.Add("sec-ch-ua-platform", @"""Windows""");
request.UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36";
if (cookies.Contains("PASS_ID=windows") && !string.IsNullOrEmpty(shop.pddid))
if (cookies.Contains("PASS_ID=windows_1")/* && !string.IsNullOrEmpty(shop.pddid)*/)
{
request.UserAgent = "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.5.40.8 Safari/537.36 PddWorkbench-Online PddBrowser pdd_windows_version/3.0.3.12";
//request.UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36 PddWorkbench-Online PddBrowser pdd_windows_version/3.0.3.12";
//request.Headers.Add("pddid", @"zULm8bXS");
request.Headers.Add("pddid", shop.pddid);
request.Accept = "*/*";
request.ContentType = "multipart/form-data; boundary=" + boundary;
request.Headers.Set(HttpRequestHeader.Cookie, cookies);
request.Headers.Add("ETag", rckk);
request.Headers.Add("Origin", @"https://mms.pinduoduo.com");
request.UserAgent = "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.5.40.8 Safari/537.36 PddWorkbench-Online PddBrowser pdd_windows_version/3.0.3.12";
request.Headers.Add("pddid", shop.pddid.ParseToString());
request.Headers.Add("Sec-Fetch-Site", @"same-site");
request.Headers.Add("Sec-Fetch-Mode", @"cors");
request.Headers.Add("Sec-Fetch-Dest", @"empty");
request.Referer = referer;
request.Headers.Set(HttpRequestHeader.AcceptEncoding, "gzip, deflate, br");
}
else
{
request.Headers.Add("sec-ch-ua-platform", @"""Windows""");
request.UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36";
request.Headers.Add("ETag", rckk);
//request.Headers.Add("sec-ch-ua", @"""Not;A=Brand"";v=""99"", ""Google Chrome"";v=""139"", ""Chromium"";v=""139""");
request.Headers.Add("sec-ch-ua", @"""Not)A;Brand"";v=""8"", ""Chromium"";v=""138""");
request.ContentType = "multipart/form-data; boundary=" + boundary;
request.Headers.Add("sec-ch-ua-mobile", @"?0");
request.Accept = "*/*";
request.Headers.Add("Origin", @"https://mms.pinduoduo.com");
request.Headers.Set(HttpRequestHeader.Cookie, cookies);
request.Headers.Add("Sec-Fetch-Site", @"same-site");
request.Headers.Add("Sec-Fetch-Mode", @"cors");
request.Headers.Add("Sec-Fetch-Dest", @"empty");
request.Referer = referer;
request.Headers.Set(HttpRequestHeader.AcceptEncoding, "gzip, deflate, br, zstd");
request.Headers.Set(HttpRequestHeader.AcceptLanguage, "zh-CN,zh;q=0.9");
}
request.Headers.Add("ETag", rckk);
request.Headers.Add("sec-ch-ua", @"""Not;A=Brand"";v=""99"", ""Google Chrome"";v=""139"", ""Chromium"";v=""139""");
request.ContentType = "multipart/form-data; boundary=" + boundary;
request.Headers.Add("sec-ch-ua-mobile", @"?0");
request.Accept = "*/*";
request.Headers.Add("Origin", @"https://mms.pinduoduo.com");
request.Headers.Set(HttpRequestHeader.Cookie, cookies);
request.Headers.Add("Sec-Fetch-Site", @"same-site");
request.Headers.Add("Sec-Fetch-Mode", @"cors");
request.Headers.Add("Sec-Fetch-Dest", @"empty");
request.Referer = referer;
request.Headers.Set(HttpRequestHeader.AcceptEncoding, "gzip, deflate, br, zstd");
request.Headers.Set(HttpRequestHeader.AcceptLanguage, "zh-CN,zh;q=0.9");
request.Method = "POST";
request.ServicePoint.Expect100Continue = false;
+27
View File
@@ -17,6 +17,21 @@
<Deterministic>true</Deterministic>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
@@ -1164,6 +1179,18 @@
<ItemGroup>
<Folder Include="KJDForms\ProductForms\ProductResponse\" />
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include=".NETFramework,Version=v4.6.2">
<Visible>False</Visible>
<ProductName>Microsoft .NET Framework 4.6.2 %28x86 和 x64%29</ProductName>
<Install>true</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>false</Install>
</BootstrapperPackage>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
+8
View File
@@ -2,5 +2,13 @@
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectView>ProjectFiles</ProjectView>
<PublishUrlHistory>publish\</PublishUrlHistory>
<InstallUrlHistory />
<SupportUrlHistory />
<UpdateUrlHistory />
<BootstrapperUrlHistory />
<ErrorReportUrlHistory />
<FallbackCulture>zh-CN</FallbackCulture>
<VerifyUploadedFiles>false</VerifyUploadedFiles>
</PropertyGroup>
</Project>
+21 -155
View File
@@ -145,14 +145,23 @@ namespace TemuKJD
LoginType = loginType;
if (loginType == "Pdd")
{
BaseClass.MainPath = "binxixi";
}
instance = this;
this.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
CefInit();
}
public static void CefInit()
{
var usePddWorkbanch = NaiBa.Util.Helper.ConfigHelper.LoadConfig<bool?>("use_pdd_workbanch");
if (usePddWorkbanch == null)
usePddWorkbanch = true;
BaseClass.UsePddWorkbanch = usePddWorkbanch.Value;
//CefSharpSettings.LegacyJavascriptBindingEnabled = true;//cef 79 84以后:“CefSharpSettings”未包含“LegacyJavascriptBindingEnabled”的定义
CefSharpSettings.WcfEnabled = false;
@@ -160,7 +169,10 @@ namespace TemuKJD
//settings.UserAgent = "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.79 Safari/537.36";
//settings.UserAgent = "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36";
//settings.UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.67 Safari/537.36";
//settings.UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36";
settings.UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36";
if (BaseClass.MainPath == "binxixi" && BaseClass.UsePddWorkbanch)
settings.UserAgent = "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.5.40.8 Safari/537.36 PddWorkbench-Online PddBrowser pdd_windows_version/3.0.3.12";
settings.CefCommandLineArgs.Add("disable-gpu", "1"); // 禁止显卡加速
settings.IgnoreCertificateErrors = true;
settings.Locale = "zh-CN";
@@ -169,7 +181,7 @@ namespace TemuKJD
var pName = Process.GetCurrentProcess().ProcessName;
var pCount = Process.GetProcesses().Count(p => p.ProcessName == pName);
//138版cef自己不会分缓存,会因占用导致报错,手动分缓存
settings.CachePath = Path.Combine(Environment.CurrentDirectory, "Cache\\" + pCount);
settings.CachePath = Path.Combine(Environment.CurrentDirectory, "Cache\\" + pCount);
//settings.CachePath = null; //禁止缓存
//settings.CefCommandLineArgs.Add("enable-javascript", "1");
//settings.CefCommandLineArgs.Add("disable-features", "NetworkService,NetworkServiceInProcess");
@@ -234,17 +246,16 @@ namespace TemuKJD
p.BackgroundImage = p.Style.BackgroundImage;
new Thread(Auto).Start();
new Thread(OpenWebBrower).Start();
new Thread(AutoGC).Start();
var backgroundScheduler = TaskScheduler.Default;
var uiScheduler = TaskScheduler.FromCurrentSynchronizationContext();
Task.Run(() => { DelCookies(); })
//Task.Run(() => { DelCookies(); })
//.ContinueWith(delegate { new UploadPinduoduoMain("").LoadStock(); }, backgroundScheduler)
.ContinueWith(delegate { loadToken(); }, backgroundScheduler)
//.ContinueWith(delegate { loadToken(); }, backgroundScheduler)
//.ContinueWith(delegate { LoadUserAgent(); }, backgroundScheduler)
//.ContinueWith(delegate { refreshPassId(); }, backgroundScheduler)
;
//;
// 是否显示联系客服按钮
//if (FileBase.Exists("locales/ig.pak") || FileBase.Exists("locales/wl.pak"))
@@ -252,12 +263,12 @@ namespace TemuKJD
//else
// lblContactSupport.Visible = true;
Task.Run(() =>
{
//Task.Run(() =>
//{
//抖音获取违规信息
//ViolateManageForm.GetAllViolateRuleName();
//GetShopViolation();
});
//});
}
public void SetTitle()
@@ -278,7 +289,8 @@ namespace TemuKJD
DateTime lastClear = DateTime.Now;
while (true)
{
if (lastClear.AddSeconds(30) < DateTime.Now)
//if (lastClear.AddSeconds(30) < DateTime.Now)
if (lastClear.AddSeconds(60) < DateTime.Now)
{
lastClear = DateTime.Now;
ClearMemory();
@@ -444,32 +456,6 @@ namespace TemuKJD
bodyPanel.Visible = true;
}
private void OpenWebBrower()
{
int count = 0;
while (false)
{
Thread.Sleep(30);
if (count == 1000)
{
count = 0;
}
count++;
if (string.IsNullOrEmpty(BaseClass.WebbrowerUrl))
continue;
Invoke(new delegateView(OpenUrl));
}
}
/// <summary>
/// 自动打开IE窗口
/// </summary>
private void OpenUrl()
{
IeForm i = new IeForm(BaseClass.WebbrowerUrl);
i.Show();
BaseClass.WebbrowerUrl = "";
}
private void Auto()
{
Thread.Sleep(200);
@@ -1006,126 +992,6 @@ namespace TemuKJD
cd.GetProduct();
}
#region 隐蔽获取店铺违规信息第一页填充违规库
ChromiumWebBrowser webBrowser = null;
private void GetShopViolation()
{
while (StartUp.IsShopInit == false || this.Visible == false)
{
Thread.Sleep(1000);
}
dicLastGetFullViolateTime = NaiBa.Util.Helper.ConfigHelper.LoadConfig<Dictionary<string, DateTime>>("last_get_full_violate_time");
if (dicLastGetFullViolateTime == null)
dicLastGetFullViolateTime = new Dictionary<string, DateTime>();
// 加载最后一次违规记录
vioDic = NaiBa.Util.Helper.ConfigHelper.LoadConfig<Dictionary<string, List<ViolateInfo>>>("dou_violate_info");
if (vioDic == null)
vioDic = new Dictionary<string, List<ViolateInfo>>();
if (webBrowser == null)
{
Invoke(new Action(() =>
{
webBrowser = CEFBrowser.CreateChromiumWebBrowser("about:blank", false);
webBrowser.KeyboardHandler = new KeyboardHandler();
webBrowser.Dock = DockStyle.Fill;
Helper.CustomResourceRequestHandlerLocal resourceRequestHandler = new Helper.CustomResourceRequestHandlerLocal();
resourceRequestHandler.ResourceLoadCompleteEvent += RequestHandler_ResourceLoadCompleteEvent;
webBrowser.RequestHandler = new CustomRequestHandler(resourceRequestHandler);
webBrowser.BringToFront();
//webBrowser.SendToBack();
this.bodyPanel.Controls.Add(webBrowser);
}));
while (!webBrowser.IsBrowserInitialized || webBrowser.IsLoading)
{
Thread.Sleep(500);
}
}
// 加载一个cef以在后台完成某些任务(原后台违规获取现在作废删除)
}
Dictionary<string, DateTime> dicLastGetFullViolateTime = new Dictionary<string, DateTime>();
Dictionary<string, List<ViolateInfo>> vioDic = new Dictionary<string, List<ViolateInfo>>();
private void RequestHandler_ResourceLoadCompleteEvent(object sender, string url, string postData, string responseData, CefSharp.IRequest iRequest)
{
if (url.Contains("https://fxg.jinritemai.com/shopuser/govern/bff/api/query_penalize_tickets?csrf=&&msToken="))
{
var _data = responseData;
var _url = url;
var _postData = postData;
var _request = iRequest;
Task.Run(() =>
{
// biz_id_type 1.订单类违规 2.商品类违规
if (!string.IsNullOrEmpty(_data) && _data.Contains("\"data\"") && _data.Contains("\"biz_id_type\":2") && !_data.Contains("\"data\":[]"))
{
var jObj = JObject.Parse(_data);
var dataStr = JsonHelper.SerializeObject(jObj["data"]);
List<ViolateInfo> violateList = JsonHelper.DeserializeJsonToList<ViolateInfo>(dataStr);
List<ViolateInfo> violateListTemp = new List<ViolateInfo>();
foreach (var violateInfo in violateList)
{
// 如果是同一条违规,则跳过不再去写缓存
if (vioDic.ContainsKey(violateInfo.shop_id) && vioDic[violateInfo.shop_id] != null && vioDic[violateInfo.shop_id].Any(v => v.penalize_id == violateInfo.penalize_id))
{
var violateInfoOld = vioDic[violateInfo.shop_id].FirstOrDefault(v => v.penalize_id == violateInfo.penalize_id);
if (violateInfoOld != null && violateInfo.rule_name == violateInfoOld.rule_name)
{
violateInfo.up_product_id = violateInfoOld.up_product_id;
violateInfo.up_product_id_number = violateInfoOld.up_product_id_number;
continue;
}
}
if (!ViolateRuleParam.LstViolateRuleName.Contains(violateInfo?.rule_name?.Trim()))
{
//ViolateManageForm.UpdateViolateRuleNameList(violateInfo);
}
if (string.IsNullOrEmpty(violateInfo.up_product_id))
{
// 获取违规商品的上家ID
//ViolateManageForm.GetViolateUpId(violateInfo);
}
if (violateInfo.up_product_id_number > 0)
violateListTemp.Add(violateInfo);
}
foreach (var violateInfo in violateListTemp)
{
// 将上家商品违规信息保存到服务端
//ViolateManageForm.AddViolateToServer(violateInfo);
}
if (violateList.Count > 0)
{
vioDic[violateList.FirstOrDefault()?.shop_id] = violateList;
// 保存店铺违规记录第一页
NaiBa.Util.Helper.ConfigHelper.SaveConfig<Dictionary<string, List<ViolateInfo>>>("dou_violate_info", vioDic);
}
}
});
}
}
private void lblVersionName_Click(object sender, EventArgs e)
{
#if DEBUG
if (this.webBrowser != null)
{
if (webBrowser.Tag == null)
{
webBrowser.BringToFront();
webBrowser.Tag = 1;
}
else
{
webBrowser.SendToBack();
webBrowser.Tag = null;
}
}
#endif
}
#endregion
private void lblContactSupport_Click(object sender, EventArgs e)
{
SupportQrCodeForm qrForm = new SupportQrCodeForm();
@@ -353,12 +353,13 @@ namespace TemuKJD.PDDForms.AdminForms
splitContainer1.Panel1.Controls.Add(cefWebBrowser);
//cefWebBrowser.Load(shopMainUrl);
}));
// cef138必须init后方可设置或删除cookie
while (!cefWebBrowser.IsBrowserInitialized || !cefWebBrowser.GetBrowser().MainFrame.IsValid)
Thread.Sleep(20);
CEFBrowser.DeleteCookie(cefWebBrowser.GetCookieManager(null));
if (cookieLst.Any(c => c.Name == "PddBrowser") && cookieLst.Any(c => c.Value.StartsWith("windows")) && !string.IsNullOrEmpty(shop.pddid))
cefWebBrowser.ExecuteScriptAsync("navigator.__defineGetter__('userAgent', function() { return 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.5.40.8 Safari/537.36 PddWorkbench-Online PddBrowser pdd_windows_version/3.0.3.12'; });");
//if (cookieLst.Any(c => c.Value.StartsWith("windows_1")))
// cefWebBrowser.ExecuteScriptAsync("navigator.__defineGetter__('userAgent', function() { return 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.5.40.8 Safari/537.36 PddWorkbench-Online PddBrowser pdd_windows_version/3.0.3.12'; });");
//cef 138 如果没有设置RequestContext 可能为空,直接getCookieManager
//if (this.openType != EnumOpenType.login)
@@ -500,21 +501,26 @@ namespace TemuKJD.PDDForms.AdminForms
//public Func<object, string, string, request, bool> BeforeResourceLoadEvent; // sender, requestUrl, postData, request, true(表示取消执行)
private bool RequestHandler_BeforeResourceLoad(object sender, string url, string postData, IRequest request)
{
if (shop.Cookies.Contains("windows") && shop.Cookies.Contains("PddBrowser") && !string.IsNullOrEmpty(shop.pddid))
if (BaseClass.MainPath == "binxixi" && BaseClass.UsePddWorkbanch && !shop.Cookies.Contains("windows_1"))
{
var ua = "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.5.40.8 Safari/537.36 PddWorkbench-Online PddBrowser pdd_windows_version/3.0.3.12";
var ua = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36";
//ua = "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.5.40.8 Safari/537.36";
request.SetHeaderByName("User-Agent", ua, true);
request.SetHeaderByName("pddid", shop.pddid, true);
request.SetHeaderByName("Accept-Encoding", "gzip, deflate, br", true);
var headers = request.Headers;
headers.Remove("sec-ch-ua");
headers.Remove("sec-ch-ua-mobile");
headers.Remove("sec-ch-ua-platform");
headers.Remove("Accept-Language");
headers.Remove("Origin");
//headers["User-Agent"] = ua;
//headers["Accept-Encoding"] = "gzip, deflate, br";
request.Headers = headers;
//var ua = "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.5.40.8 Safari/537.36 PddWorkbench-Online PddBrowser pdd_windows_version/3.0.3.12";
//request.SetHeaderByName("User-Agent", ua, true);
////if (request.Method == "POST")
//request.SetHeaderByName("pddid", shop.pddid, true);
//request.SetHeaderByName("Accept-Encoding", "gzip, deflate, br", true);
//var headers = request.Headers;
//headers.Remove("sec-ch-ua");
//headers.Remove("sec-ch-ua-mobile");
//headers.Remove("sec-ch-ua-platform");
//headers.Remove("Accept-Language");
//headers.Remove("Origin");
////headers["User-Agent"] = ua;
////headers["Accept-Encoding"] = "gzip, deflate, br";
//request.Headers = headers;
}
return false;
@@ -528,9 +534,9 @@ namespace TemuKJD.PDDForms.AdminForms
{
GetAntiContentsTimes++;
shop.AntiContents.Add(antiContent);
while (shop.AntiContents.Count > 50)
while (shop.AntiContents.Count > 100)
shop.AntiContents.RemoveAt(0);
if (!string.IsNullOrEmpty(shop.ShopId) && GetAntiContentsTimes > 50)
if (!string.IsNullOrEmpty(shop.ShopId) && GetAntiContentsTimes > 500)
{
GetAntiContentsTimes = 0;
Task.Run(() =>
@@ -594,7 +594,7 @@ namespace TemuKJD.PDDForms.ProductForms
for (int i = 0; i < 3 && result.Contains("http error:500"); i++)
{
Thread.Sleep(Randomx.GetId(6000, 15000));
result = up_goods(shop, ids);
result = down_goods(shop, ids);
}
if (result.Contains("会话已过期"))
{
@@ -877,10 +877,10 @@ namespace TemuKJD.PDDForms.ProductForms
if (shopProdLstTmp.Any(p => p.is_onsale == true))
{
result = down_goods(shop, ids);
for (int i = 0; i < 3 && result.Contains("http error:500"); i++)
for (int i = 0; i < 3 && (result.Contains("http error:500") || result.Contains("请求method,argument,body错误")); i++)
{
Thread.Sleep(Randomx.GetId(6000, 15000));
result = up_goods(shop, ids);
result = down_goods(shop, ids);
}
if (result.Contains("会话已过期"))
{
@@ -898,7 +898,7 @@ namespace TemuKJD.PDDForms.ProductForms
if (!result.Contains("\"success\":true"))
{
var errMsg = BaseRegex.GetStringJson(ref result, "error_msg");
if (string.IsNullOrEmpty(errMsg))
if (string.IsNullOrEmpty(errMsg) || errMsg.Length <= 2)
errMsg = result;
Invoke(new Action(() =>
@@ -917,7 +917,7 @@ namespace TemuKJD.PDDForms.ProductForms
for (int i = 0; i < 3 && result.Contains("http error:500"); i++)
{
Thread.Sleep(Randomx.GetId(6000, 15000));
result = up_goods(shop, ids);
result = del_goods(shop, ids);
}
if (result.Contains("会话已过期"))
{
@@ -934,8 +934,9 @@ namespace TemuKJD.PDDForms.ProductForms
}
if (!result.Contains("\"success\":true"))
{
result = GetHtml.Unicode2String(result);
var errMsg = BaseRegex.GetStringJson(ref result, "error_msg");
if (string.IsNullOrEmpty(errMsg))
if (string.IsNullOrEmpty(errMsg) || errMsg.Length <= 2)
errMsg = result;
Invoke(new Action(() =>
@@ -30,11 +30,11 @@ namespace TemuKJD.PDDForms.ProductSelectForms
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle6 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle7 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle8 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle9 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle10 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle11 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle12 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle13 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle14 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle15 = new System.Windows.Forms.DataGridViewCellStyle();
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.ucGroupBoxEx2 = new TemuKJD.UserComponent.UcGroupBoxEx(this.components);
this.chkKeepChanceGoodsImg = new TemuKJD.UserComponent.UcCheckBox(this.components);
@@ -46,7 +46,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
this.txtAddTimesFake = new System.Windows.Forms.TextBox();
this.chkActivity = new TemuKJD.UserComponent.UcCheckBox(this.components);
this.label17 = new System.Windows.Forms.Label();
this.chkSizeSpec = new TemuKJD.UserComponent.UcCheckBox(this.components);
this.chkUpperSizeSpec = new TemuKJD.UserComponent.UcCheckBox(this.components);
this.chkAddMorePriceFirst = new TemuKJD.UserComponent.UcCheckBox(this.components);
this.btnClearDgv = new DevComponents.DotNetBar.PanelEx();
this.label14 = new System.Windows.Forms.Label();
@@ -72,6 +72,8 @@ namespace TemuKJD.PDDForms.ProductSelectForms
this.chkLowPriceSku = new TemuKJD.UserComponent.UcCheckBox(this.components);
this.lblLowPriceSkuImg = new System.Windows.Forms.Label();
this.ucGroupBoxEx4 = new TemuKJD.UserComponent.UcGroupBoxEx(this.components);
this.txtIdFilter = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.cmbGroupFilter = new System.Windows.Forms.ComboBox();
this.label20 = new System.Windows.Forms.Label();
this.panelEx3 = new DevComponents.DotNetBar.PanelEx();
@@ -126,8 +128,6 @@ namespace TemuKJD.PDDForms.ProductSelectForms
this.statusBar = new TemuKJD.UserControls.StatusBarUserControl();
this.btnClear = new DevComponents.DotNetBar.PanelEx();
this.panelEx1 = new DevComponents.DotNetBar.PanelEx();
this.label1 = new System.Windows.Forms.Label();
this.txtIdFilter = new System.Windows.Forms.TextBox();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
@@ -193,7 +193,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
this.ucGroupBoxEx2.Controls.Add(this.txtAddTimesFake);
this.ucGroupBoxEx2.Controls.Add(this.chkActivity);
this.ucGroupBoxEx2.Controls.Add(this.label17);
this.ucGroupBoxEx2.Controls.Add(this.chkSizeSpec);
this.ucGroupBoxEx2.Controls.Add(this.chkUpperSizeSpec);
this.ucGroupBoxEx2.Controls.Add(this.chkAddMorePriceFirst);
this.ucGroupBoxEx2.Controls.Add(this.btnClearDgv);
this.ucGroupBoxEx2.Controls.Add(this.label14);
@@ -264,6 +264,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
this.txtLowPriceSkuPrice.Size = new System.Drawing.Size(32, 23);
this.txtLowPriceSkuPrice.TabIndex = 658;
this.txtLowPriceSkuPrice.Text = "5";
this.txtLowPriceSkuPrice.TextChanged += new System.EventHandler(this.txtLowPriceSkuPrice_TextChanged);
//
// txtLowPriceSkuName
//
@@ -274,6 +275,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
this.txtLowPriceSkuName.Size = new System.Drawing.Size(50, 23);
this.txtLowPriceSkuName.TabIndex = 662;
this.txtLowPriceSkuName.Text = "福利款";
this.txtLowPriceSkuName.TextChanged += new System.EventHandler(this.txtLowPriceSkuName_TextChanged);
//
// label18
//
@@ -295,6 +297,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
this.txtAddTimesFake.Size = new System.Drawing.Size(32, 23);
this.txtAddTimesFake.TabIndex = 645;
this.txtAddTimesFake.Text = "3";
this.txtAddTimesFake.TextChanged += new System.EventHandler(this.txtAddTimesFake_TextChanged);
//
// chkActivity
//
@@ -320,18 +323,18 @@ namespace TemuKJD.PDDForms.ProductSelectForms
this.label17.TabIndex = 647;
this.label17.Text = "倍";
//
// chkSizeSpec
// chkUpperSizeSpec
//
this.chkSizeSpec.AutoSize = true;
this.chkSizeSpec.Checked = true;
this.chkSizeSpec.CheckState = System.Windows.Forms.CheckState.Checked;
this.chkSizeSpec.Location = new System.Drawing.Point(535, 42);
this.chkSizeSpec.Name = "chkSizeSpec";
this.chkSizeSpec.Size = new System.Drawing.Size(111, 21);
this.chkSizeSpec.TabIndex = 635;
this.chkSizeSpec.Text = "使用上家尺码表";
this.chkSizeSpec.UseVisualStyleBackColor = true;
this.chkSizeSpec.CheckedChanged += new System.EventHandler(this.chkSizeSpec_CheckedChanged);
this.chkUpperSizeSpec.AutoSize = true;
this.chkUpperSizeSpec.Checked = true;
this.chkUpperSizeSpec.CheckState = System.Windows.Forms.CheckState.Checked;
this.chkUpperSizeSpec.Location = new System.Drawing.Point(535, 42);
this.chkUpperSizeSpec.Name = "chkUpperSizeSpec";
this.chkUpperSizeSpec.Size = new System.Drawing.Size(111, 21);
this.chkUpperSizeSpec.TabIndex = 635;
this.chkUpperSizeSpec.Text = "使用上家尺码表";
this.chkUpperSizeSpec.UseVisualStyleBackColor = true;
this.chkUpperSizeSpec.CheckedChanged += new System.EventHandler(this.chkUpperSizeSpec_CheckedChanged);
//
// chkAddMorePriceFirst
//
@@ -342,7 +345,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
this.chkAddMorePriceFirst.TabIndex = 625;
this.chkAddMorePriceFirst.Text = "加价时先加再乘";
this.chkAddMorePriceFirst.UseVisualStyleBackColor = true;
this.chkAddMorePriceFirst.CheckedChanged += new System.EventHandler(this.chkAddFirst_CheckedChanged);
this.chkAddMorePriceFirst.CheckedChanged += new System.EventHandler(this.chkAddMorePriceFirst_CheckedChanged);
//
// btnClearDgv
//
@@ -630,6 +633,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
this.txtStockNum.Size = new System.Drawing.Size(32, 23);
this.txtStockNum.TabIndex = 530;
this.txtStockNum.Text = "99";
this.txtStockNum.TextChanged += new System.EventHandler(this.txtAddPrice_TextChanged);
//
// label4
//
@@ -728,6 +732,26 @@ namespace TemuKJD.PDDForms.ProductSelectForms
this.ucGroupBoxEx4.TabStop = false;
this.ucGroupBoxEx4.Text = "待传商品";
//
// txtIdFilter
//
this.txtIdFilter.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.txtIdFilter.Location = new System.Drawing.Point(213, 20);
this.txtIdFilter.Margin = new System.Windows.Forms.Padding(0, 2, 0, 2);
this.txtIdFilter.Name = "txtIdFilter";
this.txtIdFilter.Size = new System.Drawing.Size(96, 23);
this.txtIdFilter.TabIndex = 652;
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(170, 23);
this.label1.Margin = new System.Windows.Forms.Padding(6, 0, 0, 0);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(45, 17);
this.label1.TabIndex = 651;
this.label1.Text = "筛选ID";
//
// cmbGroupFilter
//
this.cmbGroupFilter.FormattingEnabled = true;
@@ -960,18 +984,18 @@ namespace TemuKJD.PDDForms.ProductSelectForms
//
this.dgvShop.AllowUserToAddRows = false;
this.dgvShop.AllowUserToDeleteRows = false;
dataGridViewCellStyle6.BackColor = System.Drawing.Color.WhiteSmoke;
this.dgvShop.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle6;
dataGridViewCellStyle11.BackColor = System.Drawing.Color.WhiteSmoke;
this.dgvShop.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle11;
this.dgvShop.BackgroundColor = System.Drawing.Color.White;
this.dgvShop.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
dataGridViewCellStyle7.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle7.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle7.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle7.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle7.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle7.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle7.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
this.dgvShop.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle7;
dataGridViewCellStyle12.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle12.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle12.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle12.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle12.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle12.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle12.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
this.dgvShop.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle12;
this.dgvShop.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dgvShop.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.colSelect,
@@ -1103,18 +1127,18 @@ namespace TemuKJD.PDDForms.ProductSelectForms
//
this.dgvSelectProduct.AllowUserToAddRows = false;
this.dgvSelectProduct.AllowUserToDeleteRows = false;
dataGridViewCellStyle8.BackColor = System.Drawing.Color.WhiteSmoke;
this.dgvSelectProduct.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle8;
dataGridViewCellStyle13.BackColor = System.Drawing.Color.WhiteSmoke;
this.dgvSelectProduct.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle13;
this.dgvSelectProduct.BackgroundColor = System.Drawing.Color.White;
this.dgvSelectProduct.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
dataGridViewCellStyle9.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle9.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle9.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle9.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle9.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle9.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle9.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
this.dgvSelectProduct.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle9;
dataGridViewCellStyle14.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle14.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle14.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle14.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle14.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle14.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle14.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
this.dgvSelectProduct.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle14;
this.dgvSelectProduct.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dgvSelectProduct.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.colCheck,
@@ -1254,8 +1278,8 @@ namespace TemuKJD.PDDForms.ProductSelectForms
//
// colProductName
//
dataGridViewCellStyle10.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.colProductName.DefaultCellStyle = dataGridViewCellStyle10;
dataGridViewCellStyle15.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.colProductName.DefaultCellStyle = dataGridViewCellStyle15;
this.colProductName.HeaderText = "商品标题";
this.colProductName.Name = "colProductName";
this.colProductName.ReadOnly = true;
@@ -1407,26 +1431,6 @@ namespace TemuKJD.PDDForms.ProductSelectForms
this.panelEx1.Text = "停止当前操作";
this.panelEx1.Visible = false;
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(170, 23);
this.label1.Margin = new System.Windows.Forms.Padding(6, 0, 0, 0);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(45, 17);
this.label1.TabIndex = 651;
this.label1.Text = "筛选ID";
//
// txtIdFilter
//
this.txtIdFilter.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.txtIdFilter.Location = new System.Drawing.Point(213, 20);
this.txtIdFilter.Margin = new System.Windows.Forms.Padding(0, 2, 0, 2);
this.txtIdFilter.Name = "txtIdFilter";
this.txtIdFilter.Size = new System.Drawing.Size(96, 23);
this.txtIdFilter.TabIndex = 652;
//
// PDDDBProdUserSelectForm
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
@@ -1522,7 +1526,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
private System.Windows.Forms.FlowLayoutPanel fPnlPriceRule;
private UcAddPrice ucAddPrice1;
private UcAddPrice ucAddPrice3;
private UserComponent.UcCheckBox chkSizeSpec;
private UserComponent.UcCheckBox chkUpperSizeSpec;
private System.Windows.Forms.Label label17;
private System.Windows.Forms.TextBox txtAddTimesFake;
private System.Windows.Forms.Label label10;
@@ -31,6 +31,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
public partial class PDDDBProdUserSelectForm : BaseForm
{
public CancellationTokenSource cancellationTokenSource { get; set; } = null;
public bool IsLoadComplate { get; set; } = false;
bool isInit = false;
bool isActivityFake = true;
@@ -44,7 +45,8 @@ namespace TemuKJD.PDDForms.ProductSelectForms
Dictionary<ShopLoginInfo, int> dicShopGetCount = new Dictionary<ShopLoginInfo, int>();
NaiBa.Util.ConcurrentList<TemuDBProductSelect> lstTemuDBProductSelect = new NaiBa.Util.ConcurrentList<TemuDBProductSelect>();
NaiBa.Util.ConcurrentList<AddPriceRule> lstAddPriceRule = new NaiBa.Util.ConcurrentList<AddPriceRule>();
AddPriceRule defaultAddPriceRule = new AddPriceRule();
AddPriceRule defaultAddPriceRule = null;
PddUploadRule pddUploadRule = null;
public PDDDBProdUserSelectForm()
{
InitializeComponent();
@@ -94,6 +96,20 @@ namespace TemuKJD.PDDForms.ProductSelectForms
this.txtAddTimes.Text = defaultAddPriceRule.AddPriceTimes.ToString();
this.txtAddMorePrice.Text = defaultAddPriceRule.AddMorePrice.ToString();
this.txtSinglePriceAdd.Text = defaultAddPriceRule.SinglePriceAdd.ToString();
this.txtStockNum.Text = defaultAddPriceRule.StockNum.ToString();
this.chkAddMorePriceFirst.Checked = defaultAddPriceRule.AddMorePriceFirst;
pddUploadRule = NaiBa.Util.Helper.ConfigHelper.LoadConfig<PddUploadRule>("pdd_upload_rule");
if (pddUploadRule == null)
pddUploadRule = new PddUploadRule();
this.chkUpperSizeSpec.Checked = pddUploadRule.IsUseUpperSizeSpec;
this.chkKeepChanceGoodsImg.Checked = pddUploadRule.IsKeepChanceGoodImg;
this.chkActivity.Checked = pddUploadRule.IsSignActivity;
this.txtAddTimesFake.Text = pddUploadRule.ActivityAddPriceTimes.ParseToString();
this.chkLowPriceSku.Checked = pddUploadRule.IsLowPriceSku;
this.txtLowPriceSkuName.Text = pddUploadRule.LowPriceSkuName;
this.txtLowPriceSkuPrice.Text = pddUploadRule.LowPriceSkuLowestPrice.ParseToString();
this.lblWaitToUp.Text = "待上传商品 " + lstTemuDBProductSelect.Count + " 件";
@@ -125,6 +141,8 @@ namespace TemuKJD.PDDForms.ProductSelectForms
dgvSelectProduct.Columns["colSkuFakeImg"].Visible = true;
}
#endif
IsLoadComplate = true;
}
private void chkSelectAll_CheckedChanged(object sender, EventArgs e)
@@ -574,7 +592,8 @@ namespace TemuKJD.PDDForms.ProductSelectForms
if (cancellationTokenSource.IsCancellationRequested)
break;
}
var randomShopLst = GlobalConfig.ShopLoginList.Where(s => shopIdLst.Contains(s.ShopId) && s.LoginStatus == "登录成功").ToList();
var randomShopLst = new NaiBa.Util.ConcurrentList<ShopLoginInfo>();
randomShopLst.AddRange(GlobalConfig.ShopLoginList.Where(s => shopIdLst.Contains(s.ShopId) && s.LoginStatus == "登录成功"));
while (randomShopLst.Count <= 0)
{
Thread.Sleep(1000);
@@ -588,7 +607,8 @@ namespace TemuKJD.PDDForms.ProductSelectForms
Invoke(new Action(() =>
{
this.statusBar.lblTaskStatus.Text = "所有店铺都已掉线,请登录店铺";
randomShopLst = GlobalConfig.ShopLoginList.Where(s => shopIdLst.Contains(s.ShopId) && s.LoginStatus == "登录成功").ToList();
randomShopLst.Clear();
randomShopLst.AddRange(GlobalConfig.ShopLoginList.Where(s => shopIdLst.Contains(s.ShopId) && s.LoginStatus == "登录成功"));
}));
if (cancellationTokenSource.IsCancellationRequested)
break;
@@ -596,24 +616,33 @@ namespace TemuKJD.PDDForms.ProductSelectForms
if (cancellationTokenSource.IsCancellationRequested)
break;
var randomShop = randomShopLst[Randomx.GetId(randomShopLst.Count)];
while(currentShopList.Count >= 5) // 最多5店同传
while (currentShopList.Count >= 5) // 最多5店同传
{
Thread.Sleep(100);
}
while(currentShopList.Contains(randomShop))
while(currentShopList.Any(s => s.ShopId == randomShop.ShopId))
{
Thread.Sleep(100);
Thread.Sleep(100);
randomShop = randomShopLst[Randomx.GetId(randomShopLst.Count)];
}
currentShopList.Add(randomShop);
if (lstTemuDBProductSelect.Count <= 0)
{
currentShopList.Remove(randomShop);
break;
}
var prod = lstTemuDBProductSelect[0];
if (randomShop != null)
{
prod.shop_id = randomShop.ShopId;
prod.shop_account = randomShop.ShopAccount = randomShop.ShopAccount;
}
else
{
currentShopList.Remove(randomShop);
continue;
}
lstTemuDBProductSelect.RemoveAt(0);
NaiBa.Util.Helper.ConfigHelper.SaveConfig("pdd_db_prod_upload_list", this.lstTemuDBProductSelect);
@@ -635,6 +664,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
{
BaseMsgForm.ShowError("商品为空,将为您跳过该商品!");
}));
currentShopList.Remove(randomShop);
continue;
}
@@ -680,7 +710,6 @@ namespace TemuKJD.PDDForms.ProductSelectForms
this.pbLoading.Visible = false;
}));
currentShopList.Add(randomShop);
Task.Run(() =>
{
DateTime startTime = DateTime.Now;
@@ -727,18 +756,6 @@ namespace TemuKJD.PDDForms.ProductSelectForms
continue;
}
if (shop.LoginStatus != "登录成功")
{
Invoke(new Action(() =>
{
if (row.Index >= 0)
{
row.Cells["colOpResult"].Value = "店铺掉线";
}
}));
continue;
}
int sleepTime = 0;
int sleepTimeTotal = 0;
var result = "";
@@ -748,19 +765,25 @@ namespace TemuKJD.PDDForms.ProductSelectForms
dicShopGetCount[shop] = 100;
else
dicShopGetCount[shop]++;
if (dicShopGetCount[shop] > 5)
if (dicShopGetCount[shop] > 0)
{
dicShopGetCount[shop] = 0;
while (PDDShopLoginForm.shopLoginInstance != null && !PDDShopLoginForm.shopLoginInstance.IsDisposed)
{
Thread.Sleep(500);
}
//while (PDDShopLoginForm.shopLoginInstance != null && !PDDShopLoginForm.shopLoginInstance.IsDisposed)
//{
// Thread.Sleep(500);
//}
//Thread.Sleep(Randomx.GetId(250, 500));
//while (PDDShopLoginForm.shopLoginInstance != null && !PDDShopLoginForm.shopLoginInstance.IsDisposed)
//{
// Thread.Sleep(500);
//}
PDDShopLoginForm loginForm = null;
Invoke(new Action(() =>
{
this.panel1.SendToBack();
PDDShopLoginForm loginForm = new PDDShopLoginForm(shop);
loginForm = new PDDShopLoginForm(shop);
loginForm.TopLevel = false;
loginForm.openType = EnumOpenType.manage;
loginForm.WindowState = FormWindowState.Maximized;
@@ -769,17 +792,32 @@ namespace TemuKJD.PDDForms.ProductSelectForms
this.panel1.Controls.Add(loginForm);
loginForm.Show();
}));
sleepTime = Randomx.GetId(2000, 5000);
sleepTime = Randomx.GetId(4000, 8000);
sleepTimeTotal += sleepTime;
Thread.Sleep(sleepTime);
Invoke(new Action(() =>
{
if (PDDShopLoginForm.shopLoginInstance != null)
PDDShopLoginForm.shopLoginInstance.Dispose();
//if (PDDShopLoginForm.shopLoginInstance != null)
// PDDShopLoginForm.shopLoginInstance.Close();
if (loginForm != null)
loginForm.Close();
}));
}
PDDShopListForm.Instance.CheckShopLogin(new string[] { shop.LoginName }, false);
if (shop.LoginStatus != "登录成功")
{
Invoke(new Action(() =>
{
if (row.Index >= 0)
{
row.Cells["colOpResult"].Value = "店铺掉线";
}
}));
continue;
}
//var prodDetailJson = GetHtml.UrlDecode(kjdDbProd.product_json);
result = UploadProduct(shop, kjdDbProd, prod, row.Cells["colOpResult"]); //将商品上传
Invoke(new Action(() =>
@@ -814,6 +852,13 @@ namespace TemuKJD.PDDForms.ProductSelectForms
DateTime endTime = DateTime.Now;
var timeSpan = endTime - startTime;
duration = timeSpan.TotalSeconds;
while (duration < 20)
{
Thread.Sleep(Randomx.GetId(5000, 15000));
endTime = DateTime.Now;
timeSpan = endTime - startTime;
duration = timeSpan.TotalSeconds;
}
var error = BaseRegex.GetStringJson(ref result, "errMsg");
if (!result.Contains("\"success\":true") && !result.Contains("上传成功"))
{
@@ -922,7 +967,8 @@ namespace TemuKJD.PDDForms.ProductSelectForms
JObject obj = JObject.Parse(rst);
var chanceGoodJArr = obj["result"]["list"];
var chanceGoodsString = JsonHelper.SerializeObject(chanceGoodJArr);
var chanceGoodLst = JsonHelper.DeserializeJsonToList<PDDChanceProductInfo>(chanceGoodsString);
var chanceGoodLst = new NaiBa.Util.ConcurrentList<PDDChanceProductInfo>();
chanceGoodLst.AddRange(JsonHelper.DeserializeJsonToList<PDDChanceProductInfo>(chanceGoodsString));
var chanceGood = chanceGoodLst.FirstOrDefault(g => g.cat_id_3 == prodInfo.detail.cat_id || g.cat_id_2 == prodInfo.detail.cat_id);
if (chanceGood != null)
chance_id = chanceGood.chance_id;
@@ -2109,7 +2155,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
saveProdRst = save_goods_edit(shop, prodParam, prodParam.goods_id.ParseToString(), prodParam.goods_commit_id, isChanceApi);
for (int i = 0; i < 3 && saveProdRst.Contains("http error:500"); i++)
{
Thread.Sleep(Randomx.GetId(25000 * (i+1), 35000 * (i + 1)));
Thread.Sleep(Randomx.GetId(2500 * (i+1), 3500 * (i + 1)));
if (isActivityFake)
saveProdRst = save_goods_edit(shop, prodParamHighPriceFakeSkuImg, prodParamHighPriceFakeSkuImg.goods_id.ParseToString(), prodParamHighPriceFakeSkuImg.goods_commit_id, isChanceApi);
else
@@ -2147,6 +2193,10 @@ namespace TemuKJD.PDDForms.ProductSelectForms
return "提交失败 " + error;
}
if(!isActivityFake)
{
//Thread.Sleep(Randomx.GetId(5000, 20000));
}
//如果是活动报高价
if (isActivityFake)
{
@@ -4004,10 +4054,14 @@ Content-Disposition: form-data; name=""pic_operations""
private void txtAddPrice_TextChanged(object sender, EventArgs e)
{
defaultAddPriceRule.AddPriceTimes = txtAddTimes.Text.Trim().ParseToDecimal();
defaultAddPriceRule.AddMorePrice = txtAddMorePrice.Text.Trim().ParseToDecimal();
defaultAddPriceRule.SinglePriceAdd = txtSinglePriceAdd.Text.Trim().ParseToDecimal();
NaiBa.Util.Helper.ConfigHelper.SaveConfig<AddPriceRule>("pdd_default_add_price_rule", defaultAddPriceRule);
if (IsLoadComplate)
{
defaultAddPriceRule.AddPriceTimes = txtAddTimes.Text.Trim().ParseToDecimal();
defaultAddPriceRule.AddMorePrice = txtAddMorePrice.Text.Trim().ParseToDecimal();
defaultAddPriceRule.SinglePriceAdd = txtSinglePriceAdd.Text.Trim().ParseToDecimal();
defaultAddPriceRule.StockNum = txtStockNum.Text.Trim().ParseToInt();
NaiBa.Util.Helper.ConfigHelper.SaveConfig<AddPriceRule>("pdd_default_add_price_rule", defaultAddPriceRule);
}
}
private void chkStepAddPrice_CheckedChanged(object sender, EventArgs e)
@@ -4026,19 +4080,35 @@ Content-Disposition: form-data; name=""pic_operations""
}
}
private void chkAddFirst_CheckedChanged(object sender, EventArgs e)
private void chkAddMorePriceFirst_CheckedChanged(object sender, EventArgs e)
{
isAddMorePriceFirst = chkAddMorePriceFirst.Checked;
if (IsLoadComplate)
{
defaultAddPriceRule.AddMorePriceFirst = chkAddMorePriceFirst.Checked;
NaiBa.Util.Helper.ConfigHelper.SaveConfig("pdd_default_add_price_rule", defaultAddPriceRule);
}
}
private void chkSizeSpec_CheckedChanged(object sender, EventArgs e)
private void chkUpperSizeSpec_CheckedChanged(object sender, EventArgs e)
{
isUseUpperSizeSpec = chkSizeSpec.Checked;
isUseUpperSizeSpec = chkUpperSizeSpec.Checked;
if (IsLoadComplate)
{
pddUploadRule.IsUseUpperSizeSpec = chkUpperSizeSpec.Checked;
NaiBa.Util.Helper.ConfigHelper.SaveConfig("pdd_upload_rule", pddUploadRule);
}
}
private void chkActivity_CheckedChanged(object sender, EventArgs e)
{
isActivityFake = chkActivity.Checked;
if (IsLoadComplate)
{
pddUploadRule.IsSignActivity = chkActivity.Checked;
NaiBa.Util.Helper.ConfigHelper.SaveConfig("pdd_upload_rule", pddUploadRule);
}
}
private void lblGoodsCount_Click(object sender, EventArgs e)
@@ -4105,11 +4175,48 @@ Content-Disposition: form-data; name=""pic_operations""
private void chkKeepChanceGoodsImg_CheckedChanged(object sender, EventArgs e)
{
isKeepChanceGoodsImg = chkKeepChanceGoodsImg.Checked;
if (IsLoadComplate)
{
pddUploadRule.IsKeepChanceGoodImg = chkKeepChanceGoodsImg.Checked;
NaiBa.Util.Helper.ConfigHelper.SaveConfig("pdd_upload_rule", pddUploadRule);
}
}
private void chkLowPriceSku_CheckedChanged(object sender, EventArgs e)
{
isLowPriceSku = chkLowPriceSku.Checked;
if (IsLoadComplate)
{
pddUploadRule.IsLowPriceSku = chkLowPriceSku.Checked;
NaiBa.Util.Helper.ConfigHelper.SaveConfig("pdd_upload_rule", pddUploadRule);
}
}
private void txtAddTimesFake_TextChanged(object sender, EventArgs e)
{
if (IsLoadComplate)
{
pddUploadRule.ActivityAddPriceTimes = txtAddTimesFake.Text.Trim().ParseToDecimal();
NaiBa.Util.Helper.ConfigHelper.SaveConfig("pdd_upload_rule", pddUploadRule);
}
}
private void txtLowPriceSkuName_TextChanged(object sender, EventArgs e)
{
if (IsLoadComplate)
{
pddUploadRule.LowPriceSkuName = txtLowPriceSkuName.Text.Trim();
NaiBa.Util.Helper.ConfigHelper.SaveConfig("pdd_upload_rule", pddUploadRule);
}
}
private void txtLowPriceSkuPrice_TextChanged(object sender, EventArgs e)
{
if (IsLoadComplate)
{
pddUploadRule.LowPriceSkuLowestPrice = txtLowPriceSkuPrice.Text.Trim().ParseToDecimal();
NaiBa.Util.Helper.ConfigHelper.SaveConfig("pdd_upload_rule", pddUploadRule);
}
}
}
@@ -4135,5 +4242,27 @@ Content-Disposition: form-data; name=""pic_operations""
/// 单买加价
/// </summary>
public decimal SinglePriceAdd { get; set; }
/// <summary>
/// 先加后乘
/// </summary>
public bool AddMorePriceFirst { get; set; } = false;
/// <summary>
/// 上货库存量设置
/// </summary>
public int StockNum { get; set; } = 0;
}
public class PddUploadRule
{
public bool IsUseUpperSizeSpec { get; set; } = true;
public bool IsKeepChanceGoodImg { get; set; } = true;
public bool IsSignActivity { get; set; } = true;
/// <summary>
/// 准备报名活动的商品原价加价倍率
/// </summary>
public decimal ActivityAddPriceTimes { get; set; } = 3m;
public bool IsLowPriceSku { get; set; } = true;
public string LowPriceSkuName { get; set; } = "福利款";
public decimal LowPriceSkuLowestPrice { get; set; } = 5m;
}
}
@@ -323,7 +323,7 @@ namespace TemuKJD.PDDForms.ShopForms
//OnInfoReceived("选品商品保存成功!" + success_err_msg);
MainForm.instance.Invoke(new Action(() =>
{
BaseMsgForm.ShowError("选品商品保存成功!" + success_err_msg);
BaseMsgForm.ShowInfo("选品商品保存成功!" + success_err_msg);
}));
}
+51 -35
View File
@@ -28,6 +28,7 @@
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
this.label1 = new System.Windows.Forms.Label();
@@ -38,6 +39,7 @@
this.btnLoginSelect = new TemuKJD.UserControls.ButtonEx();
this.btnCheck = new TemuKJD.UserControls.ButtonEx();
this.panel4 = new System.Windows.Forms.Panel();
this.chkUsePddWorkbanch = new TemuKJD.UserComponent.UcCheckBox(this.components);
this.cmbNotes = new System.Windows.Forms.ComboBox();
this.pnlEmpty = new DevComponents.DotNetBar.PanelEx();
this.btnSearch = new TemuKJD.UserControls.ButtonEx();
@@ -52,8 +54,6 @@
this.btnRefreshAuth = new TemuKJD.UserControls.ButtonEx();
this.pbLoading = new System.Windows.Forms.PictureBox();
this.dgvShop = new TemuKJD.UserComponent.DataGridViewEx();
this.chkAutoDrag = new System.Windows.Forms.CheckBox();
this.statusBar = new TemuKJD.UserControls.StatusBarUserControl();
this.colSelect = new System.Windows.Forms.DataGridViewCheckBoxColumn();
this.colLoginName = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colShopId = new System.Windows.Forms.DataGridViewTextBoxColumn();
@@ -77,6 +77,8 @@
this.colCopyCookies = new System.Windows.Forms.DataGridViewLinkColumn();
this.colEdit = new System.Windows.Forms.DataGridViewLinkColumn();
this.colDelete = new System.Windows.Forms.DataGridViewLinkColumn();
this.chkAutoDrag = new System.Windows.Forms.CheckBox();
this.statusBar = new TemuKJD.UserControls.StatusBarUserControl();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
@@ -197,6 +199,7 @@
//
// panel4
//
this.panel4.Controls.Add(this.chkUsePddWorkbanch);
this.panel4.Controls.Add(this.cmbNotes);
this.panel4.Controls.Add(this.pnlEmpty);
this.panel4.Controls.Add(this.btnSearch);
@@ -213,10 +216,22 @@
this.panel4.Size = new System.Drawing.Size(1023, 40);
this.panel4.TabIndex = 0;
//
// chkUsePddWorkbanch
//
this.chkUsePddWorkbanch.AutoSize = true;
this.chkUsePddWorkbanch.Location = new System.Drawing.Point(897, 11);
this.chkUsePddWorkbanch.Name = "chkUsePddWorkbanch";
this.chkUsePddWorkbanch.Size = new System.Drawing.Size(128, 21);
this.chkUsePddWorkbanch.TabIndex = 417;
this.chkUsePddWorkbanch.Text = "使用工作台Cookie";
this.chkUsePddWorkbanch.UseVisualStyleBackColor = true;
this.chkUsePddWorkbanch.Visible = false;
this.chkUsePddWorkbanch.CheckedChanged += new System.EventHandler(this.chkUsePddWorkbanch_CheckedChanged);
//
// cmbNotes
//
this.cmbNotes.FormattingEnabled = true;
this.cmbNotes.Location = new System.Drawing.Point(597, 10);
this.cmbNotes.Location = new System.Drawing.Point(584, 10);
this.cmbNotes.Name = "cmbNotes";
this.cmbNotes.Size = new System.Drawing.Size(120, 25);
this.cmbNotes.TabIndex = 413;
@@ -227,7 +242,7 @@
this.pnlEmpty.CanvasColor = System.Drawing.SystemColors.Control;
this.pnlEmpty.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
this.pnlEmpty.DisabledBackColor = System.Drawing.Color.Empty;
this.pnlEmpty.Location = new System.Drawing.Point(799, 9);
this.pnlEmpty.Location = new System.Drawing.Point(786, 9);
this.pnlEmpty.Name = "pnlEmpty";
this.pnlEmpty.Size = new System.Drawing.Size(66, 26);
this.pnlEmpty.Style.Alignment = System.Drawing.StringAlignment.Center;
@@ -253,7 +268,7 @@
this.btnSearch.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnSearch.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnSearch.ForeColor = System.Drawing.Color.White;
this.btnSearch.Location = new System.Drawing.Point(728, 9);
this.btnSearch.Location = new System.Drawing.Point(715, 9);
this.btnSearch.Margin = new System.Windows.Forms.Padding(2);
this.btnSearch.Name = "btnSearch";
this.btnSearch.Size = new System.Drawing.Size(66, 26);
@@ -265,7 +280,7 @@
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(538, 14);
this.label4.Location = new System.Drawing.Point(525, 14);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(68, 17);
this.label4.TabIndex = 377;
@@ -273,7 +288,7 @@
//
// txtShopName
//
this.txtShopName.Location = new System.Drawing.Point(415, 11);
this.txtShopName.Location = new System.Drawing.Point(402, 11);
this.txtShopName.Name = "txtShopName";
this.txtShopName.Size = new System.Drawing.Size(110, 23);
this.txtShopName.TabIndex = 374;
@@ -281,7 +296,7 @@
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(367, 14);
this.label3.Location = new System.Drawing.Point(354, 14);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(56, 17);
this.label3.TabIndex = 375;
@@ -289,7 +304,7 @@
//
// txtShopId
//
this.txtShopId.Location = new System.Drawing.Point(245, 11);
this.txtShopId.Location = new System.Drawing.Point(232, 11);
this.txtShopId.Name = "txtShopId";
this.txtShopId.Size = new System.Drawing.Size(110, 23);
this.txtShopId.TabIndex = 372;
@@ -297,7 +312,7 @@
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(197, 14);
this.label2.Location = new System.Drawing.Point(184, 14);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(55, 17);
this.label2.TabIndex = 373;
@@ -438,31 +453,6 @@
this.dgvShop.TabIndex = 5;
this.dgvShop.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgvShop_CellContentClick);
//
// chkAutoDrag
//
this.chkAutoDrag.Anchor = System.Windows.Forms.AnchorStyles.Right;
this.chkAutoDrag.AutoSize = true;
this.chkAutoDrag.BackColor = System.Drawing.Color.White;
this.chkAutoDrag.Location = new System.Drawing.Point(1108, 2);
this.chkAutoDrag.Name = "chkAutoDrag";
this.chkAutoDrag.Size = new System.Drawing.Size(159, 21);
this.chkAutoDrag.TabIndex = 3;
this.chkAutoDrag.Text = "登录时自动滑动拼图验证";
this.chkAutoDrag.UseVisualStyleBackColor = false;
this.chkAutoDrag.Visible = false;
this.chkAutoDrag.Click += new System.EventHandler(this.chkAutoDrag_Click);
//
// statusBar
//
this.statusBar.BackColor = System.Drawing.Color.White;
this.statusBar.Dock = System.Windows.Forms.DockStyle.Bottom;
this.statusBar.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.statusBar.Location = new System.Drawing.Point(0, -1);
this.statusBar.Margin = new System.Windows.Forms.Padding(0);
this.statusBar.Name = "statusBar";
this.statusBar.Size = new System.Drawing.Size(1264, 29);
this.statusBar.TabIndex = 1;
//
// colSelect
//
this.colSelect.FillWeight = 26F;
@@ -651,6 +641,31 @@
this.colDelete.Name = "colDelete";
this.colDelete.ReadOnly = true;
//
// chkAutoDrag
//
this.chkAutoDrag.Anchor = System.Windows.Forms.AnchorStyles.Right;
this.chkAutoDrag.AutoSize = true;
this.chkAutoDrag.BackColor = System.Drawing.Color.White;
this.chkAutoDrag.Location = new System.Drawing.Point(1108, 2);
this.chkAutoDrag.Name = "chkAutoDrag";
this.chkAutoDrag.Size = new System.Drawing.Size(159, 21);
this.chkAutoDrag.TabIndex = 3;
this.chkAutoDrag.Text = "登录时自动滑动拼图验证";
this.chkAutoDrag.UseVisualStyleBackColor = false;
this.chkAutoDrag.Visible = false;
this.chkAutoDrag.Click += new System.EventHandler(this.chkAutoDrag_Click);
//
// statusBar
//
this.statusBar.BackColor = System.Drawing.Color.White;
this.statusBar.Dock = System.Windows.Forms.DockStyle.Bottom;
this.statusBar.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.statusBar.Location = new System.Drawing.Point(0, -1);
this.statusBar.Margin = new System.Windows.Forms.Padding(0);
this.statusBar.Name = "statusBar";
this.statusBar.Size = new System.Drawing.Size(1264, 29);
this.statusBar.TabIndex = 1;
//
// PDDShopListForm
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
@@ -733,5 +748,6 @@
private System.Windows.Forms.DataGridViewLinkColumn colCopyCookies;
private System.Windows.Forms.DataGridViewLinkColumn colEdit;
private System.Windows.Forms.DataGridViewLinkColumn colDelete;
private UserComponent.UcCheckBox chkUsePddWorkbanch;
}
}
+10 -1
View File
@@ -578,7 +578,7 @@ namespace TemuKJD.PDDForms.ShopForms
if (shop != null)
{
var loginResult = CheckShopLogin(shop);
if (!loginResult.Contains("\"success\":true") || !loginResult.Contains("\"login\":true"))
if (loginResult.Contains("\"success\":true") && !loginResult.Contains("\"login\":true"))
{
shop.Cookies = "empty=true;";
foreach (var sc in campanys)
@@ -661,6 +661,10 @@ namespace TemuKJD.PDDForms.ShopForms
private void ShopListForm_Load(object sender, EventArgs e)
{
chkUsePddWorkbanch.CheckedChanged -= chkUsePddWorkbanch_CheckedChanged;
chkUsePddWorkbanch.Checked = BaseClass.UsePddWorkbanch;
chkUsePddWorkbanch.CheckedChanged += chkUsePddWorkbanch_CheckedChanged;
if (BaseClass.GroupId != 3)
{
this.dgvShop.Columns["ColEdit"].Visible = false;
@@ -1144,5 +1148,10 @@ function setCookie(name, value, daysToLive, path, domain, secure, httpOnly, same
document.cookie = cookie;
}";
private void chkUsePddWorkbanch_CheckedChanged(object sender, EventArgs e)
{
BaseMsgForm.ShowInfo("您已切换Cookie来源,请重启软件生效!");
NaiBa.Util.Helper.ConfigHelper.SaveConfig("use_pdd_workbanch", chkUsePddWorkbanch.Checked);
}
}
}
+32 -27
View File
@@ -59,10 +59,10 @@ namespace TemuKJD.PDDForms.ShopForms
public PDDShopLoginForm(ShopLoginInfo shopInfo)
{
if (shopLoginInstance != null && !shopLoginInstance.IsDisposed)
{
shopLoginInstance.Dispose();
}
//if (shopLoginInstance != null && !shopLoginInstance.IsDisposed)
//{
// shopLoginInstance.Dispose();
//}
shopLoginInstance = this;
InitializeComponent();
@@ -146,7 +146,7 @@ namespace TemuKJD.PDDForms.ShopForms
cookieListNew.Add(cookie);
}
if (cookieListNew.Any(c => c.Name == "PASS_ID" && c.Value.StartsWith("windows")) &&
if (cookieListNew.Any(c => c.Name == "PASS_ID" && c.Value.StartsWith("windows_1")) &&
!cookieListNew.Any(c => c.Name == "PddBrowser"))
{
cookieList.Add(new Cookie() { Domain = ".pinduoduo.com", Name = "PddBrowser", Value = "1", Expires = DateTime.Now.AddYears(1), });
@@ -351,9 +351,9 @@ namespace TemuKJD.PDDForms.ShopForms
{
//cefWebBrowser = CEFBrowser.CreateChromiumWebBrowser("about:blank", false);
if (!string.IsNullOrEmpty(InitUrl)) //temu国际版不支持无痕模式多开,此处改为true,每次创建cefwebbrowser时删除cookie
cefWebBrowser = CEFBrowser.CreateChromiumWebBrowser(InitUrl, true);
cefWebBrowser = CEFBrowser.CreateChromiumWebBrowser(InitUrl, false);
else
cefWebBrowser = CEFBrowser.CreateChromiumWebBrowser(shopMainUrl, true);
cefWebBrowser = CEFBrowser.CreateChromiumWebBrowser(shopMainUrl, false);
CustomResourceRequestHandlerLocal resourceRequestHandler = new CustomResourceRequestHandlerLocal();
resourceRequestHandler.ResourceLoadCompleteEvent += RequestHandler_ResourceLoadComplete;
resourceRequestHandler.BeforeResourceLoadEvent += RequestHandler_BeforeResourceLoad;
@@ -408,8 +408,8 @@ namespace TemuKJD.PDDForms.ShopForms
Thread.Sleep(20);
CEFBrowser.DeleteCookie(cefWebBrowser.GetCookieManager(null));
if (cookieLst.Any(c=>c.Name == "PddBrowser") && cookieLst.Any(c => c.Value.StartsWith ("windows")) && !string.IsNullOrEmpty(shop.pddid))
cefWebBrowser.ExecuteScriptAsync("navigator.__defineGetter__('userAgent', function() { return 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.5.40.8 Safari/537.36 PddWorkbench-Online PddBrowser pdd_windows_version/3.0.3.12'; });");
//if (cookieLst.Any(c => c.Value.StartsWith("windows_1")))
// cefWebBrowser.ExecuteScriptAsync("navigator.__defineGetter__('userAgent', function() { return 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.5.40.8 Safari/537.36 PddWorkbench-Online PddBrowser pdd_windows_version/3.0.3.12'; });");
//cef 138 如果没有设置RequestContext 可能为空,直接getCookieManager
//if (this.openType != EnumOpenType.login)
@@ -490,7 +490,7 @@ namespace TemuKJD.PDDForms.ShopForms
private void CefWebBrowser_AddressChanged(object sender, CefSharp.AddressChangedEventArgs e)
{
if (this.Created && !this.IsDisposed)
if (this.Created && !this.Disposing && !this.IsDisposed)
Invoke(new Action(() =>
{
currentUrl = e.Address;
@@ -552,21 +552,26 @@ namespace TemuKJD.PDDForms.ShopForms
//public Func<object, string, string, request, bool> BeforeResourceLoadEvent; // sender, requestUrl, postData, request, true(表示取消执行)
private bool RequestHandler_BeforeResourceLoad(object sender, string url, string postData, IRequest request)
{
if (shop.Cookies.Contains("windows") && shop.Cookies.Contains("PddBrowser") && !string.IsNullOrEmpty(shop.pddid))
if (BaseClass.MainPath == "binxixi" && BaseClass.UsePddWorkbanch && !shop.Cookies.Contains("windows_1"))
{
var ua = "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.5.40.8 Safari/537.36 PddWorkbench-Online PddBrowser pdd_windows_version/3.0.3.12";
var ua = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36";
//ua = "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.5.40.8 Safari/537.36";
request.SetHeaderByName("User-Agent", ua, true);
request.SetHeaderByName("pddid", shop.pddid, true);
request.SetHeaderByName("Accept-Encoding", "gzip, deflate, br", true);
var headers = request.Headers;
headers.Remove("sec-ch-ua");
headers.Remove("sec-ch-ua-mobile");
headers.Remove("sec-ch-ua-platform");
headers.Remove("Accept-Language");
headers.Remove("Origin");
//headers["User-Agent"] = ua;
//headers["Accept-Encoding"] = "gzip, deflate, br";
request.Headers = headers;
//var ua = "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.5.40.8 Safari/537.36 PddWorkbench-Online PddBrowser pdd_windows_version/3.0.3.12";
//request.SetHeaderByName("User-Agent", ua, true);
////if (request.Method == "POST")
//request.SetHeaderByName("pddid", shop.pddid, true);
//request.SetHeaderByName("Accept-Encoding", "gzip, deflate, br", true);
//var headers = request.Headers;
//headers.Remove("sec-ch-ua");
//headers.Remove("sec-ch-ua-mobile");
//headers.Remove("sec-ch-ua-platform");
//headers.Remove("Accept-Language");
//headers.Remove("Origin");
////headers["User-Agent"] = ua;
////headers["Accept-Encoding"] = "gzip, deflate, br";
//request.Headers = headers;
}
return false;
@@ -576,18 +581,18 @@ namespace TemuKJD.PDDForms.ShopForms
private void RequestHandler_ResourceLoadComplete(object sender, string url, string postData, string responseData, IRequest request)
{
var antiContent = request.Headers.AllKeys.Contains("Anti-Content") ? request.Headers["Anti-Content"] : "";
if (shop != null && !url.StartsWith("https://mms.pinduoduo.com/janus/api/userinfo") && !string.IsNullOrEmpty(antiContent))
if (shop != null && !url.StartsWith("https://mms.pinduoduo.com/janus/api/userinfo") && !string.IsNullOrEmpty(antiContent) && request.Method == "POST")
{
Task.Run(() =>
{
GetAntiContentsTimes++;
if (this.Created && !this.IsDisposed)
if (this.Created && !this.Disposing && !this.IsDisposed)
Invoke(new Action(() =>
{
try { this.TitleText = "店铺登录 - " + GetAntiContentsTimes; } catch { return; }
}));
shop.AntiContents.Add(antiContent);
while (shop.AntiContents.Count > 50)
while (shop.AntiContents.Count > 100)
shop.AntiContents.RemoveAt(0);
if (!string.IsNullOrEmpty(shop.ShopId) && GetAntiContentsTimes > 500)
{
@@ -996,7 +1001,7 @@ function fireKeyEvent(el, evtType, keyCode) {
//OnSaveComplete(shop);
Task.Run(() => {
Thread.Sleep(500);
if (!this.IsDisposed)
if (!this.Disposing && !this.IsDisposed)
{
MainForm.instance.Invoke(new Action(() => { this.Dispose(); }));
}
@@ -179,7 +179,7 @@ namespace TemuKJD.PDDForms.ShopForms
cookieList.Add(new Cookie() { Domain = "mms.pinduoduo.com", Name = "webp", Value = webp, Expires = DateTime.Now.AddDays(14), Path= "/home" });
if (!string.IsNullOrEmpty(x_visit_time))
cookieList.Add(new Cookie() { Domain = "mms.pinduoduo.com", Name = "x-visit-time", Value = x_visit_time, Expires = DateTime.Now.AddDays(100), });
if (PASS_ID.StartsWith("windows") && !cookieList.Any(c => c.Name == "PddBrowser"))
if (PASS_ID.StartsWith("windows_1") && !cookieList.Any(c => c.Name == "PddBrowser"))
cookieList.Add(new Cookie() { Domain = ".pinduoduo.com", Name = "PddBrowser", Value = "1", Expires = DateTime.Now.AddYears(1), });
cookie = JsonHelper.SerializeObject(cookieList);
@@ -45,7 +45,7 @@ namespace TemuKJD.PDDForms.ShopForms
while (true)
{
i++;
string txt = "Cookie获取中,请稍候";
string txt = "店铺 " + shop.ShopAccount + " Cookie获取中,请稍候";
for (int j = 0; j < i % 3 + 1; j++)
{
txt += ".";
@@ -173,7 +173,7 @@ namespace TemuKJD.PDDForms.ShopForms
cookieList.Add(new Cookie() { Domain = "mms.pinduoduo.com", Name = "webp", Value = webp, Expires = DateTime.Now.AddDays(14), Path = "/home" });
if (!string.IsNullOrEmpty(x_visit_time))
cookieList.Add(new Cookie() { Domain = "mms.pinduoduo.com", Name = "x-visit-time", Value = x_visit_time, Expires = DateTime.Now.AddDays(100), });
if (PASS_ID.StartsWith("windows") && !cookieList.Any(c => c.Name == "PddBrowser"))
if (PASS_ID.StartsWith("windows_1") && !cookieList.Any(c => c.Name == "PddBrowser"))
cookieList.Add(new Cookie() { Domain = ".pinduoduo.com", Name = "PddBrowser", Value = "1", Expires = DateTime.Now.AddYears(1), });
headerCookie = JsonHelper.SerializeObject(cookieList);
+1 -1
View File
@@ -17,7 +17,7 @@ namespace TemuKJD
[STAThread]
static void Main()
{
MainForm.CefInit();
//MainForm.CefInit();
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
+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()