1调整拼多多工作台cookie时的cef user-agent,防止掉线
2优化商品删除逻辑,修复bug 3查找pdd版本长时间运行程序卡死原因并尝试修复 4pdd上货记住主要上货选项避免每次都重新选择
This commit is contained in:
1 parent
61264a5a99
commit
5e9bdd1700
19 files changed
+612
-557
No files matched your search
@@ -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
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
|
||||
|
||||
Reference in new issue
Block a user