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

@@ -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;
}
}