1活动逻辑调整 2拼多多买手号存储

This commit is contained in:
wule committed 2026-04-09 21:58:20 +08:00
1 parent 2df3769153
commit fa96cc1444
22 files changed
+3251 -1167

No files matched your search

@@ -32,16 +32,19 @@ namespace TemuKJD.PDDForms.ProductForms.ActivityForms
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
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();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle16 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle();
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();
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.ucGroupBoxEx2 = new TemuKJD.UserComponent.UcGroupBoxEx(this.components);
this.label5 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.txtSleepTime = new System.Windows.Forms.TextBox();
this.chk23456 = new TemuKJD.UserComponent.UcCheckBox(this.components);
this.chk23730 = new TemuKJD.UserComponent.UcCheckBox(this.components);
this.chkDownNoPrice = new TemuKJD.UserComponent.UcCheckBox(this.components);
@@ -103,6 +106,7 @@ namespace TemuKJD.PDDForms.ProductForms.ActivityForms
this.colCanUse = new System.Windows.Forms.DataGridViewCheckBoxColumn();
this.colRemaining = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colMessage = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.chk23513 = new TemuKJD.UserComponent.UcCheckBox(this.components);
this.chk15996 = new TemuKJD.UserComponent.UcCheckBox(this.components);
this.txtTest20981 = new System.Windows.Forms.TextBox();
this.btnTest20981 = new DevComponents.DotNetBar.PanelEx();
@@ -185,6 +189,9 @@ namespace TemuKJD.PDDForms.ProductForms.ActivityForms
| System.Windows.Forms.AnchorStyles.Right)));
this.ucGroupBoxEx2.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.ucGroupBoxEx2.BorderStyle = TemuKJD.UserComponent.UcGroupBoxEx.GroupBoxBorderStyle.ROUND;
this.ucGroupBoxEx2.Controls.Add(this.label5);
this.ucGroupBoxEx2.Controls.Add(this.label3);
this.ucGroupBoxEx2.Controls.Add(this.txtSleepTime);
this.ucGroupBoxEx2.Controls.Add(this.chk23456);
this.ucGroupBoxEx2.Controls.Add(this.chk23730);
this.ucGroupBoxEx2.Controls.Add(this.chkDownNoPrice);
@@ -220,6 +227,38 @@ namespace TemuKJD.PDDForms.ProductForms.ActivityForms
this.ucGroupBoxEx2.TabStop = false;
this.ucGroupBoxEx2.Text = "活动价格配置";
//
// label5
//
this.label5.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(831, 18);
this.label5.Margin = new System.Windows.Forms.Padding(6, 0, 0, 0);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(20, 17);
this.label5.TabIndex = 893;
this.label5.Text = "秒";
//
// label3
//
this.label3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(713, 18);
this.label3.Margin = new System.Windows.Forms.Padding(6, 0, 0, 0);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(80, 17);
this.label3.TabIndex = 892;
this.label3.Text = "报名休眠间隔";
//
// txtSleepTime
//
this.txtSleepTime.Location = new System.Drawing.Point(793, 15);
this.txtSleepTime.Margin = new System.Windows.Forms.Padding(0, 2, 0, 2);
this.txtSleepTime.Name = "txtSleepTime";
this.txtSleepTime.Size = new System.Drawing.Size(38, 23);
this.txtSleepTime.TabIndex = 891;
this.txtSleepTime.Text = "5";
this.txtSleepTime.TextChanged += new System.EventHandler(this.txtSleepTime_TextChanged);
//
// chk23456
//
this.chk23456.AutoSize = true;
@@ -947,6 +986,7 @@ namespace TemuKJD.PDDForms.ProductForms.ActivityForms
//
// splitContainer2.Panel2
//
this.splitContainer2.Panel2.Controls.Add(this.chk23513);
this.splitContainer2.Panel2.Controls.Add(this.chk15996);
this.splitContainer2.Panel2.Controls.Add(this.txtTest20981);
this.splitContainer2.Panel2.Controls.Add(this.btnTest20981);
@@ -974,19 +1014,19 @@ namespace TemuKJD.PDDForms.ProductForms.ActivityForms
//
this.dgvShop.AllowUserToAddRows = false;
this.dgvShop.AllowUserToDeleteRows = false;
dataGridViewCellStyle9.BackColor = System.Drawing.Color.WhiteSmoke;
this.dgvShop.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle9;
dataGridViewCellStyle1.BackColor = System.Drawing.Color.WhiteSmoke;
this.dgvShop.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1;
this.dgvShop.AutoRowNumber = true;
this.dgvShop.BackgroundColor = System.Drawing.Color.White;
this.dgvShop.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
dataGridViewCellStyle10.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle10.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle10.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle10.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle10.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle10.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle10.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
this.dgvShop.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle10;
dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle2.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle2.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle2.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle2.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle2.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
this.dgvShop.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle2;
this.dgvShop.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dgvShop.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.colSelect,
@@ -1100,6 +1140,18 @@ namespace TemuKJD.PDDForms.ProductForms.ActivityForms
this.colMessage.Name = "colMessage";
this.colMessage.ReadOnly = true;
//
// chk23513
//
this.chk23513.AutoSize = true;
this.chk23513.Location = new System.Drawing.Point(234, 38);
this.chk23513.Name = "chk23513";
this.chk23513.Size = new System.Drawing.Size(62, 21);
this.chk23513.TabIndex = 891;
this.chk23513.Text = "23513";
this.chk23513.UseVisualStyleBackColor = true;
this.chk23513.Visible = false;
this.chk23513.CheckedChanged += new System.EventHandler(this.chkActivityDetail_CheckedChanged);
//
// chk15996
//
this.chk15996.AutoSize = true;
@@ -1179,19 +1231,19 @@ namespace TemuKJD.PDDForms.ProductForms.ActivityForms
//
this.dgvActProduct.AllowUserToAddRows = false;
this.dgvActProduct.AllowUserToDeleteRows = false;
dataGridViewCellStyle11.BackColor = System.Drawing.Color.WhiteSmoke;
this.dgvActProduct.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle11;
dataGridViewCellStyle3.BackColor = System.Drawing.Color.WhiteSmoke;
this.dgvActProduct.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle3;
this.dgvActProduct.AutoRowNumber = true;
this.dgvActProduct.BackgroundColor = System.Drawing.Color.White;
this.dgvActProduct.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
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.dgvActProduct.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle12;
dataGridViewCellStyle4.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle4.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle4.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle4.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle4.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle4.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle4.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
this.dgvActProduct.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle4;
this.dgvActProduct.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dgvActProduct.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.colCheck,
@@ -1240,8 +1292,8 @@ namespace TemuKJD.PDDForms.ProductForms.ActivityForms
//
// colSupplierName
//
dataGridViewCellStyle13.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.colSupplierName.DefaultCellStyle = dataGridViewCellStyle13;
dataGridViewCellStyle5.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.colSupplierName.DefaultCellStyle = dataGridViewCellStyle5;
this.colSupplierName.Frozen = true;
this.colSupplierName.HeaderText = "店铺名称";
this.colSupplierName.Name = "colSupplierName";
@@ -1296,8 +1348,8 @@ namespace TemuKJD.PDDForms.ProductForms.ActivityForms
//
// colProductName
//
dataGridViewCellStyle14.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.colProductName.DefaultCellStyle = dataGridViewCellStyle14;
dataGridViewCellStyle6.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.colProductName.DefaultCellStyle = dataGridViewCellStyle6;
this.colProductName.HeaderText = "商品标题";
this.colProductName.Name = "colProductName";
this.colProductName.ReadOnly = true;
@@ -1324,8 +1376,8 @@ namespace TemuKJD.PDDForms.ProductForms.ActivityForms
//
// colUpdateTime
//
dataGridViewCellStyle15.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.colUpdateTime.DefaultCellStyle = dataGridViewCellStyle15;
dataGridViewCellStyle7.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.colUpdateTime.DefaultCellStyle = dataGridViewCellStyle7;
this.colUpdateTime.FillWeight = 80F;
this.colUpdateTime.HeaderText = "上架时间";
this.colUpdateTime.Name = "colUpdateTime";
@@ -1341,8 +1393,8 @@ namespace TemuKJD.PDDForms.ProductForms.ActivityForms
//
// colOpResult
//
dataGridViewCellStyle16.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.colOpResult.DefaultCellStyle = dataGridViewCellStyle16;
dataGridViewCellStyle8.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.colOpResult.DefaultCellStyle = dataGridViewCellStyle8;
this.colOpResult.HeaderText = "操作结果";
this.colOpResult.Name = "colOpResult";
this.colOpResult.ReadOnly = true;
@@ -1580,5 +1632,9 @@ namespace TemuKJD.PDDForms.ProductForms.ActivityForms
private System.Windows.Forms.DataGridViewTextBoxColumn colOpResult;
private UserComponent.UcCheckBox chk23730;
private UserComponent.UcCheckBox chk23456;
private UserComponent.UcCheckBox chk23513;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.TextBox txtSleepTime;
}
}
@@ -39,7 +39,6 @@ namespace TemuKJD.PDDForms.ProductForms.ActivityForms
public bool IsLoadComplate { get; set; } = false;
bool isInit = false;
bool isChanceApi = true;
bool isStepAddPrice = false;
CheckBox chkSelectAll = null;
Dictionary<ShopLoginInfo, int> dicShopGetCount = new Dictionary<ShopLoginInfo, int>();
@@ -116,10 +115,11 @@ namespace TemuKJD.PDDForms.ProductForms.ActivityForms
pddActivityRule = NaiBa.Util.Helper.ConfigHelper.LoadConfig<PddAddActivityRule>("pdd_add_activity_rule");
if (pddActivityRule == null)
pddActivityRule = new PddAddActivityRule();
this.chk20981.Checked = pddActivityRule.sign20981;
this.chk15996.Checked = pddActivityRule.sign15996;
this.chk21365.Checked = pddActivityRule.sign21365;
this.chk22347.Checked = pddActivityRule.sign22347;
this.chk20981.Checked = pddActivityRule.sign20981;
this.chk21365.Checked = pddActivityRule.sign21365;
this.chk15996.Checked = pddActivityRule.sign15996;
this.chk23513.Checked = pddActivityRule.sign23513;
this.chk23730.Checked = pddActivityRule.sign23730;
this.chk23456.Checked = pddActivityRule.sign23456;
this.chkUseExtCodePrice.Checked = pddActivityRule.IsUseExtCodePrice;
@@ -376,8 +376,8 @@ namespace TemuKJD.PDDForms.ProductForms.ActivityForms
/// <param name="shop"></param>
/// <param name="prodParam"></param>
/// <returns></returns>
public string SignActivity(ShopLoginInfo shop, PDDProductUploadParam prodParam, bool sign22347 = true, bool sign20981 = true, bool sign21365 = true, bool sign15996 = true,
bool sign23730 = true, bool sign23456 = true)
public string SignActivity(ShopLoginInfo shop, PDDProductUploadParam prodParam, bool sign22347 = true, bool sign20981 = true, bool sign21365 = true,
bool sign15996 = true, bool sign23513 = true, bool sign23730 = true, bool sign23456 = true)
{
string activityErr = "";
@@ -405,6 +405,12 @@ namespace TemuKJD.PDDForms.ProductForms.ActivityForms
activityErr += SignActivity22347(shop, prodParam);
}
// 23513 补贴多人团频道 需要设置营销电话,暂时作废
if (1==2 && sign23513)
{
activityErr += SignActivity23513(shop, prodParam);
}
// 超级晚8 单件折扣
if (1 == 1 && sign23730)
{
@@ -436,10 +442,16 @@ namespace TemuKJD.PDDForms.ProductForms.ActivityForms
{
string activityErr = "";
var activityRst2 = activity_goods_price_rule(shop, prodParam.goods_id.ParseToString(), 21365, 27);
Thread.Sleep(Randomx.GetId(500, 1500));
Thread.Sleep(Randomx.GetId(500, 1500));
Thread.Sleep((moreSleepTime * 1000).ParseToInt());
for (int i = 0; i < 5 && !activityRst2.Contains("\"success\":true"); i++)
{
Thread.Sleep(Randomx.GetId(1000, 2000));
activity_goods_price_rule(shop, prodParam.goods_id.ParseToString(), 21365, 27);
Thread.Sleep(Randomx.GetId(1000, 2000));
Thread.Sleep(Randomx.GetId(1000, 2000));
Thread.Sleep(Randomx.GetId(1000, 2000));
Thread.Sleep((moreSleepTime * 1000).ParseToInt());
}
if (!activityRst2.Contains("\"success\":true"))
{
@@ -553,12 +565,14 @@ namespace TemuKJD.PDDForms.ProductForms.ActivityForms
string CheckActivity20981(ShopLoginInfo shop, PDDProductUploadParam prodParam)
{
string activityErr = "";
Thread.Sleep(Randomx.GetId(500, 1500));
var activityRst1 = activity_goods_info(shop, prodParam.goods_id.ParseToString(), "20981");
Thread.Sleep(Randomx.GetId(500, 1500));
Thread.Sleep((moreSleepTime * 1000).ParseToInt());
for (int i = 0; i < 5 && !activityRst1.Contains("\"success\":true"); i++)
{
Thread.Sleep(Randomx.GetId(1000, 2000));
activityRst1 = activity_goods_info(shop, prodParam.goods_id.ParseToString(), "20981");
Thread.Sleep(Randomx.GetId(1000, 2000));
Thread.Sleep((moreSleepTime * 1000).ParseToInt());
}
if (!activityRst1.Contains("\"success\":true"))
{
@@ -619,12 +633,14 @@ namespace TemuKJD.PDDForms.ProductForms.ActivityForms
string SignActivity20981(ShopLoginInfo shop, PDDProductUploadParam prodParam)
{
string activityErr = "";
Thread.Sleep(Randomx.GetId(500, 1500));
var activityRst1 = activity_goods_info(shop, prodParam.goods_id.ParseToString(), "20981");
Thread.Sleep(Randomx.GetId(500, 1500));
Thread.Sleep((moreSleepTime * 1000).ParseToInt());
for (int i = 0; i < 5 && !activityRst1.Contains("\"success\":true"); i++)
{
Thread.Sleep(Randomx.GetId(1000, 2000));
activityRst1 = activity_goods_info(shop, prodParam.goods_id.ParseToString(), "20981");
Thread.Sleep(Randomx.GetId(1000, 2000));
Thread.Sleep((moreSleepTime * 1000).ParseToInt());
}
if (!activityRst1.Contains("\"success\":true"))
{
@@ -731,6 +747,7 @@ namespace TemuKJD.PDDForms.ProductForms.ActivityForms
Thread.Sleep(Randomx.GetId(2000, 5000));
addActivityRst = add_activity_goods(shop, actSubmitParam, prodParam.goods_id.ParseToString(), 20981, 27);
}
err_msg = BaseRegex.GetStringJson(ref addActivityRst, "error_msg");
if (!addActivityRst.Contains("\"success\":true") || !string.IsNullOrEmpty(err_msg))
{
var error = BaseRegex.GetStringJson(ref addActivityRst, "error_msg");
@@ -758,8 +775,9 @@ namespace TemuKJD.PDDForms.ProductForms.ActivityForms
string SignActivity15996(ShopLoginInfo shop, PDDProductUploadParam prodParam)
{
string activityErr = "";
Thread.Sleep(Randomx.GetId(500, 1500));
var activityRst3 = activity_goods_price_rule(shop, prodParam.goods_id.ParseToString(), 15996, 18);
Thread.Sleep(Randomx.GetId(500, 1500));
Thread.Sleep((moreSleepTime * 1000).ParseToInt());
if (!activityRst3.Contains("\"success\":true"))
{
var error = BaseRegex.GetStringJson(ref activityRst3, "error_msg");
@@ -861,12 +879,17 @@ namespace TemuKJD.PDDForms.ProductForms.ActivityForms
string SignActivity22347(ShopLoginInfo shop, PDDProductUploadParam prodParam)
{
string activityErr = "";
Thread.Sleep(Randomx.GetId(500, 1500));
var activityRst2 = activity_goods_price_rule(shop, prodParam.goods_id.ParseToString(), 22347, 27);
Thread.Sleep(Randomx.GetId(500, 1500));
Thread.Sleep(Randomx.GetId(500, 1500));
Thread.Sleep((moreSleepTime * 1000).ParseToInt());
if (!activityRst2.Contains("\"success\":true"))
{
Thread.Sleep(Randomx.GetId(1000, 2000));
activity_goods_price_rule(shop, prodParam.goods_id.ParseToString(), 22347, 27);
Thread.Sleep(Randomx.GetId(1000, 2000));
Thread.Sleep(Randomx.GetId(1000, 2000));
Thread.Sleep(Randomx.GetId(1000, 2000));
Thread.Sleep((moreSleepTime * 1000).ParseToInt());
}
if (!activityRst2.Contains("\"success\":true"))
{
@@ -968,6 +991,7 @@ namespace TemuKJD.PDDForms.ProductForms.ActivityForms
Thread.Sleep(Randomx.GetId(2000, 5000));
addActivityRst = add_activity_goods(shop, actSubmitParam, prodParam.goods_id.ParseToString(), 22347, 27);
}
err_msg = BaseRegex.GetStringJson(ref addActivityRst, "error_msg");
if (!addActivityRst.Contains("\"success\":true") || !string.IsNullOrEmpty(err_msg))
{
var error = BaseRegex.GetStringJson(ref addActivityRst, "error_msg");
@@ -992,18 +1016,166 @@ namespace TemuKJD.PDDForms.ProductForms.ActivityForms
return activityErr;
}
string SignActivity23513(ShopLoginInfo shop, PDDProductUploadParam prodParam)
{
string activityErr = "";
var activityRst2 = activity_goods_price_rule(shop, prodParam.goods_id.ParseToString(), 23513, 414);
Thread.Sleep(Randomx.GetId(500, 1500));
Thread.Sleep((moreSleepTime * 1000).ParseToInt());
if (!activityRst2.Contains("\"success\":true"))
{
activity_goods_price_rule(shop, prodParam.goods_id.ParseToString(), 23513, 414);
Thread.Sleep(Randomx.GetId(1000, 2000));
Thread.Sleep((moreSleepTime * 1000).ParseToInt());
}
if (!activityRst2.Contains("\"success\":true"))
{
var error = BaseRegex.GetStringJson(ref activityRst2, "error_msg");
if (string.IsNullOrEmpty(error))
error = activityRst2;
activityErr += "\r\n报名错误 513查询失败 " + error;
if (BaseClass.SaLevel != 1 && 1 != 1)
activityErr = "报名错误";
//goto restoreSkuImg1;
return activityErr;
}
try
{
var jObj = JObject.Parse(activityRst2);
var jStr = JsonHelper.SerializeObject(jObj["result"]);
var pddActivitiPriceInfo = JsonHelper.DeserializeJsonToObject<PDDActivitySuggestPriceInfo>(jStr);
var pddActivitiPriceProd = pddActivitiPriceInfo.enroll_goods_rule_vos.FirstOrDefault();
if (pddActivitiPriceProd == null)
{
activityErr += "\r\n报名错误 513查询/新建失败 商品未提交成功或不满足参加活动条件";
if (BaseClass.SaLevel != 1 && 1 != 1)
activityErr = "报名错误";
//goto restoreSkuImg1;
return activityErr;
}
foreach (var activitySkuInfo in pddActivitiPriceProd.enroll_rule_param.enroll_goods_resource_price.sku_info_list)
{
//var sku = prodParam.skus.FirstOrDefault(s => s.sku_id == activitySku.sku_id);
var sku = prodParam.skus.FirstOrDefault(sk => string.Join(",", sk.spec.Select(s => s.spec_name)) == activitySkuInfo.spec_info_str);
if (sku == null || sku.multi_price > activitySkuInfo.require_price)
{
activityErr += "\r\n报名错误 513价格低于产品价 " + activitySkuInfo.require_price + " < " + sku.multi_price;
if (BaseClass.SaLevel != 1 && 1 != 1)
activityErr = "报名错误";
//goto restoreSkuImg1;
return activityErr;
}
}
PDDActivitySubmitParam actSubmitParam = new PDDActivitySubmitParam();
actSubmitParam.activity_id = pddActivitiPriceInfo.activity_id;
actSubmitParam.enroll_source_ctx.enroll_type = 3;
actSubmitParam.enroll_source_ctx.scene_full_coverage = "mmsActBatchEnrollV1";
actSubmitParam.enroll_source_ctx.source_type = null;
actSubmitParam.enroll_source_ctx.scene_type = null;
var goods_vo_item = new goods_vo_param();
goods_vo_item.goods_id = prodParam.goods_id;
var skuSamePrice = prodParam.skus.Max(s => s.multi_price);
foreach (var activitySkuInfo in pddActivitiPriceProd.enroll_rule_param.enroll_goods_resource_price.sku_info_list)
{
//var sku = prodParam.skus.FirstOrDefault(s => s.sku_id == activitySku.sku_id);
var sku = prodParam.skus.FirstOrDefault(sk => string.Join(",", sk.spec.Select(s => s.spec_name)) == activitySkuInfo.spec_info_str);
if (sku == null)
{
activityErr += "\r\n报名错误 513价格sku未找到";
if (BaseClass.SaLevel != 1 && 1 != 1)
activityErr = "报名错误";
//goto restoreSkuImg1;
return activityErr;
}
create_sku_vo_param sku_vo_item = new create_sku_vo_param();
sku_vo_item.sku_id = activitySkuInfo.sku_id;
sku_vo_item.sku_activity_price = sku.multi_price; //skuSamePrice; //sku.multi_price; //activitySku.suggest_price;
sku_vo_item.sku_front_ctx_vo = new sku_front_ctx_vo_param()
{
filling_sku_price = sku.multi_price,
gear_rule = activitySkuInfo.gear_rule,
require_price = sku.multi_price,
filling_sku_price_gear_rule = activitySkuInfo.filling_sku_price_gear_rule,
};
goods_vo_item.create_activity_price_vo.create_sku_vos.Add(sku_vo_item);
}
actSubmitParam.goods_volist.Add(goods_vo_item);
// 设置活动库存
goods_vo_item.create_activity_price_vo.create_quantity_vo.goods_activity_quantity =
pddActivitiPriceInfo.enroll_goods_rule_vos.FirstOrDefault().enroll_rule_param.enroll_goods_resource_price.goods_on_sale_quantity;
// 活动列表图
goods_vo_item.create_material_vo.create_goods_image_vo.raw_activity_image_url = prodParam.gallery.FirstOrDefault(g => g.type == 1).url;
actSubmitParam.create_protocol_vo.need_create_cost_template = true;
//if (pddActivitiInfo.need_goods_activity_price == true)
actSubmitParam.goods_volist.FirstOrDefault().view_confirmed_goods_protocol_vo.confirm_hit_cut_price = true;
var addActivityRst = add_activity_goods(shop, actSubmitParam, prodParam.goods_id.ParseToString(), 23513, 414);
var err_msg = BaseRegex.GetStringJson(ref addActivityRst, "error_msg");
if (err_msg.ParseToString().Contains("报名该活动需要签署降价补差协议,立即前往链接签署"))
{
Invoke(new Action(() =>
{
PDDShopLoginForm loginForm = new PDDShopLoginForm(shop);
loginForm.openType = EnumOpenType.manage;
loginForm.InitUrl = err_msg.Substring(err_msg.IndexOf("https://")); //"https://mms.pinduoduo.com/mallcenter/signProtocol/21";
loginForm.ShowDialog();
}));
addActivityRst = add_activity_goods(shop, actSubmitParam, prodParam.goods_id.ParseToString(), 23513, 414);
err_msg = BaseRegex.GetStringJson(ref addActivityRst, "error_msg");
}
for (int i = 0; i < 3 && !addActivityRst.Contains("\"success\":true"); i++)
{
Thread.Sleep(Randomx.GetId(2000, 5000));
addActivityRst = add_activity_goods(shop, actSubmitParam, prodParam.goods_id.ParseToString(), 23513, 414);
}
err_msg = BaseRegex.GetStringJson(ref addActivityRst, "error_msg");
if (!addActivityRst.Contains("\"success\":true") || !string.IsNullOrEmpty(err_msg))
{
var error = BaseRegex.GetStringJson(ref addActivityRst, "error_msg");
if (string.IsNullOrEmpty(error))
error = addActivityRst;
activityErr += "\r\n报名错误 513新建失败 " + error;
if (BaseClass.SaLevel != 1 && 1 != 1)
activityErr = "报名错误";
//goto restoreSkuImg1;
return activityErr;
}
} // 活动1
catch (Exception ex)
{
activityErr += "\r\n报名错误 513查询/新建失败 " + ex.Message;
if (BaseClass.SaLevel != 1 && 1 != 1)
activityErr = "报名错误";
//goto restoreSkuImg1;
return activityErr;
}
activityErr = "\r\n513报名成功";
return activityErr;
}
/// <summary>
/// 超级晚8 单件折扣
/// </summary>
string SignActivity23730(ShopLoginInfo shop, PDDProductUploadParam prodParam)
{
string activityErr = "";
Thread.Sleep(Randomx.GetId(500, 1500));
var activityRst3 = activity_goods_price_rule3(shop, prodParam.goods_id.ParseToString(), 23730, 424);
if (!activityRst3.Contains("\"success\":true"))
Thread.Sleep(Randomx.GetId(500, 1500));
Thread.Sleep(Randomx.GetId(500, 1500));
Thread.Sleep((moreSleepTime * 1000).ParseToInt());
for (int i = 0; i < 5 && activityRst3.Contains("频繁"); i++)
{
Thread.Sleep(Randomx.GetId(1000, 2000));
activity_goods_price_rule3(shop, prodParam.goods_id.ParseToString(), 23730, 424);
Thread.Sleep(Randomx.GetId(1000, 2000));
Thread.Sleep(Randomx.GetId(1000, 2000));
Thread.Sleep(Randomx.GetId(1000, 2000));
Thread.Sleep((moreSleepTime * 1000).ParseToInt());
}
if (!activityRst3.Contains("\"success\":true"))
{
@@ -1037,7 +1209,7 @@ namespace TemuKJD.PDDForms.ProductForms.ActivityForms
if (mmsEnrollParamsInfo.max_discount_threshold.ParseToInt() < 98)
{
activityErr += "\r\n放弃报名 730最大折扣 " + mmsEnrollParamsInfo.max_discount_threshold + " 折低于 98 折 ";
activityErr += "\r\n放弃报名 730 最大折扣 " + mmsEnrollParamsInfo.max_discount_threshold + " 折低于 98 折 ";
if (BaseClass.SaLevel != 1 && 1 != 1)
activityErr = "报名错误";
return activityErr;
@@ -1086,7 +1258,8 @@ namespace TemuKJD.PDDForms.ProductForms.ActivityForms
Thread.Sleep(Randomx.GetId(2000, 5000));
addActivityRst = add_activity_goods(shop, actSubmitParamV2, prodParam.goods_id.ParseToString(), 23730, 424);
}
if (!addActivityRst.Contains("\"success\":true"))
var err_msg = BaseRegex.GetStringJson(ref addActivityRst, "error_msg");
if (!addActivityRst.Contains("\"success\":true") || !string.IsNullOrEmpty(err_msg))
{
var error = BaseRegex.GetStringJson(ref addActivityRst, "error_msg");
if (string.IsNullOrEmpty(error))
@@ -1117,12 +1290,17 @@ namespace TemuKJD.PDDForms.ProductForms.ActivityForms
string SignActivity23456(ShopLoginInfo shop, PDDProductUploadParam prodParam)
{
string activityErr = "";
Thread.Sleep(Randomx.GetId(500, 1500));
var activityRst3 = activity_goods_price_rule3(shop, prodParam.goods_id.ParseToString(), 23456, 422);
if (!activityRst3.Contains("\"success\":true"))
Thread.Sleep(Randomx.GetId(500, 1500));
Thread.Sleep(Randomx.GetId(500, 1500));
Thread.Sleep((moreSleepTime * 1000).ParseToInt());
for (int i = 1; i < 5 && activityRst3.Contains("频繁"); i++)
{
Thread.Sleep(Randomx.GetId(1000, 2000));
activity_goods_price_rule3(shop, prodParam.goods_id.ParseToString(), 23456, 422);
Thread.Sleep(Randomx.GetId(1000, 2000));
Thread.Sleep(Randomx.GetId(1000, 2000));
Thread.Sleep(Randomx.GetId(1000, 2000));
Thread.Sleep((moreSleepTime * 1000).ParseToInt());
}
if (!activityRst3.Contains("\"success\":true"))
{
@@ -1205,7 +1383,8 @@ namespace TemuKJD.PDDForms.ProductForms.ActivityForms
Thread.Sleep(Randomx.GetId(2000, 5000));
addActivityRst = add_activity_goods(shop, actSubmitParamV2, prodParam.goods_id.ParseToString(), 23456, 422);
}
if (!addActivityRst.Contains("\"success\":true"))
var err_msg = BaseRegex.GetStringJson(ref addActivityRst, "error_msg");
if (!addActivityRst.Contains("\"success\":true") || !string.IsNullOrEmpty(err_msg))
{
var error = BaseRegex.GetStringJson(ref addActivityRst, "error_msg");
if (string.IsNullOrEmpty(error))
@@ -2155,10 +2334,11 @@ namespace TemuKJD.PDDForms.ProductForms.ActivityForms
// chkActivity.Checked = false;
if (IsLoadComplate)
{
pddActivityRule.sign20981 = chk20981.Checked;
pddActivityRule.sign15996 = chk15996.Checked;
pddActivityRule.sign21365 = chk21365.Checked;
pddActivityRule.sign22347 = chk22347.Checked;
pddActivityRule.sign20981 = chk20981.Checked;
pddActivityRule.sign21365 = chk21365.Checked;
pddActivityRule.sign15996 = chk15996.Checked;
pddActivityRule.sign23513 = chk23513.Checked;
pddActivityRule.sign23730 = chk23730.Checked;
pddActivityRule.sign23456 = chk23456.Checked;
NaiBa.Util.Helper.ConfigHelper.SaveConfig("pdd_add_activity_rule", pddActivityRule);
@@ -2301,6 +2481,7 @@ namespace TemuKJD.PDDForms.ProductForms.ActivityForms
try
{
prodInfo = JsonHelper.DeserializeJsonToObject<PDDProductInfo>(dbProd.product_json);
actProd.productInfo = prodInfo;
}
catch (Exception ex)
{
@@ -2482,6 +2663,7 @@ namespace TemuKJD.PDDForms.ProductForms.ActivityForms
PDDProductUploadParam prodParam = new PDDProductUploadParam();
prodParam.goods_id = actProd.goods_id;
prodParam.gallery = JsonHelper.DeserializeJsonToList<gallery_param>(JsonHelper.SerializeObject(actProd.productInfo.detail.galleries));
// 生成正常加价的sku列表
int index = -1;
@@ -2520,14 +2702,15 @@ namespace TemuKJD.PDDForms.ProductForms.ActivityForms
prodParam.skus.Add(skuParam);
}
bool sign20981 = chk20981.Checked && chk20981.Visible;
bool sign22347 = chk22347.Checked && chk22347.Visible;
bool sign15996 = chk15996.Checked && chk15996.Visible;
bool sign20981 = chk20981.Checked && chk20981.Visible;
bool sign21365 = chk21365.Checked && chk21365.Visible;
bool sign15996 = chk15996.Checked && chk15996.Visible;
bool sign23513 = chk23513.Checked && chk23513.Visible;
bool sign23730 = chk23730.Checked && chk23730.Visible;
bool sign23456 = chk23456.Checked && chk23456.Visible;
if ((sign20981 || sign22347 || sign15996 || sign21365 || sign23730 || sign23456) == false)
if ((sign22347 || sign20981 || sign21365 || sign15996 || sign23513 || sign23730 || sign23456) == false)
{
Invoke(new Action(() =>
{
@@ -2620,10 +2803,20 @@ namespace TemuKJD.PDDForms.ProductForms.ActivityForms
}
}
string activityErr = SignActivity(shop, prodParam, sign22347, sign20981, sign21365, sign15996, sign23730, sign23456);
string activityRsts = SignActivity(shop, prodParam, sign22347, sign20981, sign21365, sign15996, sign23513, sign23730, sign23456);
var activityRstArr = activityRsts.Split(new string[] { "\r", "\n" }, StringSplitOptions.RemoveEmptyEntries);
var actSuccessStr = "";
var actFailStr = "";
foreach (var actRst in activityRstArr)
{
if (actRst.Contains("报名成功"))
actSuccessStr += " " + actRst;
else
actFailStr += "\r\n" + actRst;
}
Invoke(new Action(() =>
{
row.Cells["colOpResult"].Value = activityErr.Trim('\r', '\n');
row.Cells["colOpResult"].Value = (actSuccessStr + actFailStr).Trim('\r', '\n', ' ');
}));
}
catch (Exception ex)
@@ -2730,6 +2923,14 @@ namespace TemuKJD.PDDForms.ProductForms.ActivityForms
}
}
}
public decimal moreSleepTime = 5;
private void txtSleepTime_TextChanged(object sender, EventArgs e)
{
moreSleepTime = txtSleepTime.Text.Trim().ParseToDecimal();
if (moreSleepTime < 5)
moreSleepTime = 5;
}
}
public class PddAddActivityRule
@@ -2746,11 +2947,19 @@ namespace TemuKJD.PDDForms.ProductForms.ActivityForms
public bool IsUseExtCodePrice { get; set; }
public bool sign20981 { get; set; }
public bool sign22347 { get; set; }
public bool sign15996 { get; set; }
public bool sign20981 { get; set; }
public bool sign21365 { get; set; }
public bool sign15996 { get; set; }
public bool sign23513 { get; set; }
/// <summary>
/// 折扣活动1
/// </summary>
public bool sign23730 { get; set; }
/// <summary>
/// 折扣活动2
/// </summary>
public bool sign23456 { get; set; }
}
}
@@ -0,0 +1,172 @@
using AllBase;
using AllBase.Helper;
using AllBase.Model.Result;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using TemuKJD.BLL;
using TemuKJD.WXForms.ProductForms;
using Work;
namespace TemuKJD.PDDForms.ProductForms
{
public class WXProdViolationManage
{
public static void GetShopProdViolation()
{
Task.Run(() =>
{
if (!Directory.Exists("wxProdViolation"))
Directory.CreateDirectory("wxProdViolation");
while (true)
{
//break;
foreach (var shop in GlobalConfig.ShopLoginList)
{
if (shop.LoginStatus != "登录成功")
continue;
Thread.Sleep(Randomx.GetId(500, 1500));
WXProdViolationGetInfo info = new WXProdViolationGetInfo() { shopId = shop.ShopId, updateDay = DateTime.Now.ToString("yyMMdd") };
try
{
info = NaiBa.Util.Helper.ConfigHelper.LoadConfig<WXProdViolationGetInfo>("wxProdViolation\\" + shop.ShopId);
if (info == null)
info = new WXProdViolationGetInfo() { shopId = shop.ShopId, updateDay = DateTime.MinValue.ToString("yyMMdd") };
if (info.updateDay == DateTime.Now.ToString("yyMMdd"))
{
// 今日同步过,跳过
continue;
}
info.failReason = "";
var result = getShopiolationProd(shop);
Thread.Sleep(Randomx.GetId(1000, 2000));
if (!result.Contains("\"code\":0"))
{
WXForms.ShopForms.WXShopListForm.CheckShopLogin(shop);
info.failReason = "读取失败";
NaiBa.Util.Helper.ConfigHelper.SaveConfig("wxProdViolation\\" + shop.ShopId, info);
continue;
}
JObject recordObj = JsonHelper.JObjectParse(result)["record"] as JObject;
JArray jArr = JsonHelper.JObjectParse(result)["record"]["items"] as JArray;
if (recordObj != null && jArr == null)
{
jArr = new JArray();
}
foreach(var jObj in jArr)
{
string sVioInfo = JsonHelper.SerializeObject(jObj);
var punishUuid = BaseRegex.GetStringJson(ref sVioInfo, "punishUuid");
var punishReason = BaseRegex.GetStringJson(ref sVioInfo, "punishReason");
var productId = BaseRegex.GetStringJson(ref sVioInfo, "productId");
var productDesc = BaseRegex.GetStringJson(ref sVioInfo, "productDesc");
//相似同款低质商品 品牌资质问题 不当使用他人权利
if (!punishReason.Contains("发布违禁信息") && !punishReason.Contains("材质夸大宣传") &&
!punishReason.Contains("价格违规") && !punishReason.Contains("售假"))
continue;
if (!string.IsNullOrWhiteSpace(productDesc) && !string.IsNullOrWhiteSpace(productId))
{
var url = BaseClass.BuildPDDObjString("product/mdy_violation_prod");
var data = UserLogin.GetSignaturex();
data += "&wx_safe_status=违规商品";
data += "&notes=" + ("违规轮询-" + shop.ShopId + "-" + punishUuid + "-" + punishReason).Trim();
data += "&product_name=" + productDesc;
var html = GetHtml.PostUtf8(url, data);
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
html = GetHtml.PostUtf8(url, data);
if (!html.Contains("\"code\":200"))
{
info.failReason = "更新商品状态失败";
break;
}
if(html.Contains("商品不存在"))
{
var getProdRst = WXUpload.searchProductWithTitle(shop, GetHtml.UrlEncodeUtf8(productDesc));
var spuCode = BaseRegex.GetStringJson(ref getProdRst, "spuCode");
var secrec_spu_id = "";
var spu_id = "";
if (string.IsNullOrEmpty(spuCode) || spuCode.Length < 10)
{
continue;
}
if (spuCode.StartsWith("EC1") && spuCode.EndsWith("A"))
{
spu_id = spuCode.Substring(3, spuCode.Length - 4);
}
else
{
secrec_spu_id = spuCode;
}
url = BaseClass.BuildPDDObjString("product/mdy_violation_prod");
data = UserLogin.GetSignaturex();
data += "&wx_safe_status=违规商品";
data += "&notes=" + ("违规轮询-" + shop.ShopId + "-" + punishUuid + "-" + punishReason).Trim();
data += "&secret_spu_id=" + secrec_spu_id;
data += "&spu_id=" + spu_id;
html = GetHtml.PostUtf8(url, data);
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
html = GetHtml.PostUtf8(url, data);
if (!html.Contains("\"code\":200"))
{
info.failReason = "更新商品状态失败";
break;
}
}
}
}
if (string.IsNullOrEmpty(info.failReason))
info.updateDay = DateTime.Now.ToString("yyMMdd");
NaiBa.Util.Helper.ConfigHelper.SaveConfig("wxProdViolation\\" + shop.ShopId, info);
Thread.Sleep(5000);
}
catch (Exception ex)
{
try
{
if (info == null)
info = new WXProdViolationGetInfo() { shopId = shop.ShopId, updateDay = DateTime.Now.ToString("yyMMdd") };
info.failReason = ex.Message;
NaiBa.Util.Helper.ConfigHelper.SaveConfig("wxProdViolation\\" + shop.ShopId, info);
}
catch { }
}
}
// 休眠一小时
Thread.Sleep(1000 * 60 * 60);
}
});
}
public static string getShopiolationProd(ShopLoginInfo shop)
{
string url = "https://store.weixin.qq.com/shop-faas/mmecnodeviolationsec/violation/cgi/get?token=&lang=zh_CN&violationType=finder&shopId=";
string referer = "https://store.weixin.qq.com/shop/violation/home";
var result = WXHttpResponseBLL.WeiXinGetResponse(shop, url, referer);
return result;
}
}
public class WXProdViolationGetInfo
{
public string shopId { get; set; }
public string updateDay { get; set; } // yyMMdd
public string failReason { get; set; } // "", "掉线"...
}
}
@@ -30,13 +30,14 @@ namespace TemuKJD.PDDForms.ProductSelectForms
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle43 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle44 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle45 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle46 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle47 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle48 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle49 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle();
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();
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.ucGroupBoxEx2 = new TemuKJD.UserComponent.UcGroupBoxEx(this.components);
this.chkChance = new TemuKJD.UserComponent.UcCheckBox(this.components);
@@ -109,7 +110,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
this.txtIdFilter = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.cmbCateFilter1 = new TemuKJD.UserComponent.UcComboBoxMutiSelect();
this.panelEx2 = new DevComponents.DotNetBar.PanelEx();
this.btnRandomAdd = new DevComponents.DotNetBar.PanelEx();
this.label2 = new System.Windows.Forms.Label();
this.cmbGroupFilter = new System.Windows.Forms.ComboBox();
this.label20 = new System.Windows.Forms.Label();
@@ -1041,7 +1042,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
this.ucGroupBoxEx4.Controls.Add(this.txtIdFilter);
this.ucGroupBoxEx4.Controls.Add(this.label1);
this.ucGroupBoxEx4.Controls.Add(this.cmbCateFilter1);
this.ucGroupBoxEx4.Controls.Add(this.panelEx2);
this.ucGroupBoxEx4.Controls.Add(this.btnRandomAdd);
this.ucGroupBoxEx4.Controls.Add(this.label2);
this.ucGroupBoxEx4.Controls.Add(this.cmbGroupFilter);
this.ucGroupBoxEx4.Controls.Add(this.label20);
@@ -1253,30 +1254,30 @@ namespace TemuKJD.PDDForms.ProductSelectForms
this.cmbCateFilter1.SelectedIndexChanged += new System.EventHandler(this.cmbCateFilter1_SelectedIndexChanged);
this.cmbCateFilter1.TextChanged += new System.EventHandler(this.cmbCateFilter1_TextChanged);
//
// panelEx2
// btnRandomAdd
//
this.panelEx2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.panelEx2.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
this.panelEx2.Cursor = System.Windows.Forms.Cursors.Hand;
this.panelEx2.DisabledBackColor = System.Drawing.Color.Empty;
this.panelEx2.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.panelEx2.Location = new System.Drawing.Point(274, 105);
this.panelEx2.Name = "panelEx2";
this.panelEx2.Size = new System.Drawing.Size(62, 23);
this.panelEx2.Style.Alignment = System.Drawing.StringAlignment.Center;
this.panelEx2.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.panelEx2.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.panelEx2.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder;
this.panelEx2.Style.BorderDashStyle = System.Drawing.Drawing2D.DashStyle.Dash;
this.panelEx2.Style.BorderSide = DevComponents.DotNetBar.eBorderSide.None;
this.panelEx2.Style.ForeColor.Color = System.Drawing.Color.White;
this.panelEx2.Style.GradientAngle = 90;
this.panelEx2.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center;
this.panelEx2.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255)))));
this.panelEx2.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255)))));
this.panelEx2.TabIndex = 431;
this.panelEx2.Text = "随机添加";
this.panelEx2.Click += new System.EventHandler(this.btnRandomAdd_Click);
this.btnRandomAdd.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnRandomAdd.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
this.btnRandomAdd.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnRandomAdd.DisabledBackColor = System.Drawing.Color.Empty;
this.btnRandomAdd.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnRandomAdd.Location = new System.Drawing.Point(274, 105);
this.btnRandomAdd.Name = "btnRandomAdd";
this.btnRandomAdd.Size = new System.Drawing.Size(62, 23);
this.btnRandomAdd.Style.Alignment = System.Drawing.StringAlignment.Center;
this.btnRandomAdd.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.btnRandomAdd.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.btnRandomAdd.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder;
this.btnRandomAdd.Style.BorderDashStyle = System.Drawing.Drawing2D.DashStyle.Dash;
this.btnRandomAdd.Style.BorderSide = DevComponents.DotNetBar.eBorderSide.None;
this.btnRandomAdd.Style.ForeColor.Color = System.Drawing.Color.White;
this.btnRandomAdd.Style.GradientAngle = 90;
this.btnRandomAdd.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center;
this.btnRandomAdd.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255)))));
this.btnRandomAdd.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255)))));
this.btnRandomAdd.TabIndex = 431;
this.btnRandomAdd.Text = "随机添加";
this.btnRandomAdd.Click += new System.EventHandler(this.btnRandomAdd_Click);
//
// label2
//
@@ -1597,19 +1598,19 @@ namespace TemuKJD.PDDForms.ProductSelectForms
//
this.dgvShop.AllowUserToAddRows = false;
this.dgvShop.AllowUserToDeleteRows = false;
dataGridViewCellStyle43.BackColor = System.Drawing.Color.WhiteSmoke;
this.dgvShop.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle43;
dataGridViewCellStyle1.BackColor = System.Drawing.Color.WhiteSmoke;
this.dgvShop.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1;
this.dgvShop.AutoRowNumber = true;
this.dgvShop.BackgroundColor = System.Drawing.Color.White;
this.dgvShop.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
dataGridViewCellStyle44.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle44.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle44.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle44.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle44.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle44.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle44.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
this.dgvShop.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle44;
dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle2.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle2.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle2.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle2.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle2.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
this.dgvShop.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle2;
this.dgvShop.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dgvShop.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.colSelect,
@@ -1835,19 +1836,19 @@ namespace TemuKJD.PDDForms.ProductSelectForms
//
this.dgvSelectProduct.AllowUserToAddRows = false;
this.dgvSelectProduct.AllowUserToDeleteRows = false;
dataGridViewCellStyle45.BackColor = System.Drawing.Color.WhiteSmoke;
this.dgvSelectProduct.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle45;
dataGridViewCellStyle3.BackColor = System.Drawing.Color.WhiteSmoke;
this.dgvSelectProduct.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle3;
this.dgvSelectProduct.AutoRowNumber = true;
this.dgvSelectProduct.BackgroundColor = System.Drawing.Color.White;
this.dgvSelectProduct.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
dataGridViewCellStyle46.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle46.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle46.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle46.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle46.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle46.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle46.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
this.dgvSelectProduct.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle46;
dataGridViewCellStyle4.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle4.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle4.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle4.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle4.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle4.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle4.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
this.dgvSelectProduct.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle4;
this.dgvSelectProduct.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dgvSelectProduct.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.colCheck,
@@ -1909,8 +1910,8 @@ namespace TemuKJD.PDDForms.ProductSelectForms
//
// colSupplierName
//
dataGridViewCellStyle47.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.colSupplierName.DefaultCellStyle = dataGridViewCellStyle47;
dataGridViewCellStyle5.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.colSupplierName.DefaultCellStyle = dataGridViewCellStyle5;
this.colSupplierName.Frozen = true;
this.colSupplierName.HeaderText = "店铺名称";
this.colSupplierName.Name = "colSupplierName";
@@ -1988,8 +1989,8 @@ namespace TemuKJD.PDDForms.ProductSelectForms
//
// colProductName
//
dataGridViewCellStyle48.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.colProductName.DefaultCellStyle = dataGridViewCellStyle48;
dataGridViewCellStyle6.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.colProductName.DefaultCellStyle = dataGridViewCellStyle6;
this.colProductName.HeaderText = "商品标题";
this.colProductName.Name = "colProductName";
this.colProductName.ReadOnly = true;
@@ -2049,8 +2050,8 @@ namespace TemuKJD.PDDForms.ProductSelectForms
//
// colAddTime
//
dataGridViewCellStyle49.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.colAddTime.DefaultCellStyle = dataGridViewCellStyle49;
dataGridViewCellStyle7.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.colAddTime.DefaultCellStyle = dataGridViewCellStyle7;
this.colAddTime.FillWeight = 80F;
this.colAddTime.HeaderText = "上传时间";
this.colAddTime.Name = "colAddTime";
@@ -2058,6 +2059,8 @@ namespace TemuKJD.PDDForms.ProductSelectForms
//
// colOpResult
//
dataGridViewCellStyle8.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.colOpResult.DefaultCellStyle = dataGridViewCellStyle8;
this.colOpResult.HeaderText = "操作结果";
this.colOpResult.Name = "colOpResult";
this.colOpResult.ReadOnly = true;
@@ -2229,7 +2232,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
private System.Windows.Forms.Label label4;
private DevComponents.DotNetBar.PanelEx btnStop;
private UserComponent.UcCheckBox chkChance;
private DevComponents.DotNetBar.PanelEx panelEx2;
private DevComponents.DotNetBar.PanelEx btnRandomAdd;
private System.Windows.Forms.TextBox txtAddCount;
private System.Windows.Forms.Label lblGoodsCount;
private DevComponents.DotNetBar.PanelEx btnClearUpload;
@@ -2293,28 +2296,6 @@ namespace TemuKJD.PDDForms.ProductSelectForms
private UserComponent.UcCheckBox chkSkipQualification;
private DevComponents.DotNetBar.PanelEx btnApiUpload;
private DevComponents.DotNetBar.PanelEx btnRefreshApi;
private System.Windows.Forms.DataGridViewCheckBoxColumn colCheck;
private System.Windows.Forms.DataGridViewTextBoxColumn colSelectId;
private System.Windows.Forms.DataGridViewTextBoxColumn colSupplierId;
private System.Windows.Forms.DataGridViewTextBoxColumn colSupplierName;
private System.Windows.Forms.DataGridViewLinkColumn colLogin;
private System.Windows.Forms.DataGridViewLinkColumn colInShop;
private System.Windows.Forms.DataGridViewLinkColumn colSpuId;
private System.Windows.Forms.DataGridViewLinkColumn colSkcId;
private System.Windows.Forms.DataGridViewTextBoxColumn colImgUrl;
private System.Windows.Forms.DataGridViewImageColumn colProductSkcPic;
private System.Windows.Forms.DataGridViewTextBoxColumn colSkuFakeImgUrl;
private System.Windows.Forms.DataGridViewImageColumn colSkuFakeImg;
private System.Windows.Forms.DataGridViewTextBoxColumn colProductName;
private System.Windows.Forms.DataGridViewTextBoxColumn colProductCat;
private System.Windows.Forms.DataGridViewTextBoxColumn colExtCode;
private System.Windows.Forms.DataGridViewTextBoxColumn colMsg;
private System.Windows.Forms.DataGridViewTextBoxColumn colDraftId;
private System.Windows.Forms.DataGridViewTextBoxColumn colNotes;
private System.Windows.Forms.DataGridViewLinkColumn colUserNotes;
private System.Windows.Forms.DataGridViewLinkColumn ColDelete;
private System.Windows.Forms.DataGridViewTextBoxColumn colAddTime;
private System.Windows.Forms.DataGridViewTextBoxColumn colOpResult;
private System.Windows.Forms.TextBox txtAddShippingFeeTimes;
private System.Windows.Forms.Label label12;
private System.Windows.Forms.PictureBox pbShopLoading;
@@ -2349,5 +2330,27 @@ namespace TemuKJD.PDDForms.ProductSelectForms
private UserComponent.UcComboBoxMutiSelect cmbCateFilter1;
private UserComponent.UcComboBoxMutiSelect cmbCateFilter3;
private UserComponent.UcComboBoxMutiSelect cmbCateFilter2;
private System.Windows.Forms.DataGridViewCheckBoxColumn colCheck;
private System.Windows.Forms.DataGridViewTextBoxColumn colSelectId;
private System.Windows.Forms.DataGridViewTextBoxColumn colSupplierId;
private System.Windows.Forms.DataGridViewTextBoxColumn colSupplierName;
private System.Windows.Forms.DataGridViewLinkColumn colLogin;
private System.Windows.Forms.DataGridViewLinkColumn colInShop;
private System.Windows.Forms.DataGridViewLinkColumn colSpuId;
private System.Windows.Forms.DataGridViewLinkColumn colSkcId;
private System.Windows.Forms.DataGridViewTextBoxColumn colImgUrl;
private System.Windows.Forms.DataGridViewImageColumn colProductSkcPic;
private System.Windows.Forms.DataGridViewTextBoxColumn colSkuFakeImgUrl;
private System.Windows.Forms.DataGridViewImageColumn colSkuFakeImg;
private System.Windows.Forms.DataGridViewTextBoxColumn colProductName;
private System.Windows.Forms.DataGridViewTextBoxColumn colProductCat;
private System.Windows.Forms.DataGridViewTextBoxColumn colExtCode;
private System.Windows.Forms.DataGridViewTextBoxColumn colMsg;
private System.Windows.Forms.DataGridViewTextBoxColumn colDraftId;
private System.Windows.Forms.DataGridViewTextBoxColumn colNotes;
private System.Windows.Forms.DataGridViewLinkColumn colUserNotes;
private System.Windows.Forms.DataGridViewLinkColumn ColDelete;
private System.Windows.Forms.DataGridViewTextBoxColumn colAddTime;
private System.Windows.Forms.DataGridViewTextBoxColumn colOpResult;
}
}
@@ -46,7 +46,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
"跑步鞋", "棉鞋", "高帮休闲鞋", "网面鞋", "勃肯鞋/软木鞋", "包头拖", "足部磨砂", "老爹鞋", "工装鞋", "豆豆鞋", "汉服鞋", "雨鞋" };
public CancellationTokenSource cancellationTokenSource { get; set; } = null;
public CancellationTokenSource cancelAddProd { get; set; } = null;
public CancellationTokenSource getProdTokenSource { get; set; } = null;
public bool IsLoadComplate { get; set; } = false;
bool isInit = false;
@@ -5912,38 +5912,66 @@ Content-Type: image/jpeg
private void btnRandomAdd_Click(object sender, EventArgs e)
{
int addCount = txtAddCount.Text.Trim().ParseToInt();
pictureBox1.Visible = true;
if (cancelAddProd != null)
cancelAddProd.Cancel();
cancelAddProd = new CancellationTokenSource();
btnRandomAdd.Enabled = false;
Task.Run(() =>
{
int prodCount = 0;
List<KJDDBProduct> list = new List<KJDDBProduct>();
Thread.Sleep(5000);
Invoke(new Action(() =>
{
btnRandomAdd.Enabled = true;
}));
});
pictureBox1.Visible = true;
int addCount = txtAddCount.Text.Trim().ParseToInt();
if (getProdTokenSource != null)
getProdTokenSource.Cancel();
getProdTokenSource = new CancellationTokenSource();
Task.Run(() =>
{
List<KJDDBProduct> prodLst = new List<KJDDBProduct>();
int index = 0;
int pageSize = 50;
int prodCount = 99999999;
while (addCount > 0)
{
if (cancelAddProd.IsCancellationRequested)
if (getProdTokenSource.IsCancellationRequested)
break;
// 等于50说明还有更多,不足50就不用再查了
if (list.Count == 0 || list.Count == 50)
index++;
// 如果产品数量在0到50之间,说明数据库商品数量不足,无需再重复筛选,直接随机打乱
if (prodLst.Count == 0 || prodCount > pageSize)
{
list = GetRandomProductList(out prodCount, 1, 50);
Thread.Sleep(Randomx.GetId(50,100));
if (prodCount != 99999999)
{
//不重复筛选
prodLst = GetRandomProductList(out prodCount, 1, Math.Min(pageSize, addCount), true, prodCount);
}
else
{
prodLst = GetRandomProductList(out prodCount, 1, Math.Min(pageSize, addCount));
}
//Thread.Sleep(Randomx.GetId(50, 100));
Thread.Sleep(Randomx.GetId(250, 500));
}
else
{
prodLst = prodLst.OrderBy(x => Guid.NewGuid()).ToList();
Thread.Sleep(Randomx.GetId(10, 30));
}
if (list.Count == 0) // 等于0要么库里没数据要么出错了,跳出
break;
Invoke(new Action(() =>
{
lblGoodsCount.Text = "产品库 " + prodCount + " 件";
}));
foreach (var prod in list)
if (prodLst.Count == 0) // 等于0要么库里没数据要么出错了,跳出
break;
foreach (var prod in prodLst)
{
var selectProd = JsonHelper.DeserializeJsonToObject<TemuDBProductSelect>(JsonHelper.SerializeObject(prod));
selectProd.out_product_Id = prod.id.ToString();
selectProd.id = 1;
if (lstTemuDBProductSelect.Count > 0)
selectProd.id = lstTemuDBProductSelect.Max(p => p.id).ParseToInt() + 1;
selectProd.id = lstTemuDBProductSelect.Max(p => p.id) + 1;
this.lstTemuDBProductSelect.Add(selectProd);
Invoke(new Action(() =>
@@ -5957,10 +5985,10 @@ Content-Type: image/jpeg
NaiBa.Util.Helper.ConfigHelper.SaveConfig("pdd_db_prod_upload_list", this.lstTemuDBProductSelect);
}
Invoke(new Action(() => { pictureBox1.Visible = false; }));
}, cancelAddProd.Token);
}, getProdTokenSource.Token);
}
public List<KJDDBProduct> GetRandomProductList(out int totalCount, int page = 1, int pageSize = 50)
public List<KJDDBProduct> GetRandomProductList(out int totalCount, int page = 1, int pageSize = 50, bool isNotCount = false, int totalProdCount = 0)
{
var lstShopId = dgvShop.Rows.Cast<DataGridViewRow>().Where(row
=> row.Cells["colSelect"]?.Value.ParseToBool() == true).Select(r => r.Cells["colShopId"]?.Value.ToString()).ToList();
@@ -5980,36 +6008,32 @@ Content-Type: image/jpeg
data += "&in_spu_ids=" + txtIdFilter.Text;
data += "&in_groups=" + cmbGroupFilter.Text;
var selectCate1 = GlobalConfig.WxCatList.Where(c => c.level == 1 && (";" + cmbCateFilter1.Text.Trim() + ";").Contains(";" + c.name + ";")).ToList();
var cates2 = GlobalConfig.WxCatList.Where(c => selectCate1.Any(c1 => c.f_cat_id == c1.cat_id)).ToList();
var selectCate2 = cates2.Where(c => c.level == 2 && (";" + cmbCateFilter2.Text.Trim() + ";").Contains(";" + c.name + ";")).ToList();
var cates3 = GlobalConfig.WxCatList.Where(c => selectCate2.Any(c2 => c.f_cat_id == c2.cat_id)).ToList();
var selectCate3 = cates3.Where(c => c.level == 3 && (";" + cmbCateFilter3.Text.Trim() + ";").Contains(";" + c.name + ";")).ToList();
if (cmbSourceType.Text != "厂商直采" && cmbSourceType.Text != "1688厂家" && cmbSourceType.Text != "微信店采" && cmbSourceType.Text != "微信小店")
{
data += "&in_cates=" + (cmbCateFilter1.Text == "全部" ? "" : cmbCateFilter1.Text);
}
else
{
var selectCate1 = GlobalConfig.WxCatList.Where(c => c.level == 1 && (";" + cmbCateFilter1.Text.Trim() + ";").Contains(";" + c.name + ";")).ToList();
var cates2 = GlobalConfig.WxCatList.Where(c => selectCate1.Any(c1 => c.f_cat_id == c1.cat_id)).ToList();
var selectCate2 = cates2.Where(c => c.level == 2 && (";" + cmbCateFilter2.Text.Trim() + ";").Contains(";" + c.name + ";")).ToList();
var cates3 = GlobalConfig.WxCatList.Where(c => selectCate2.Any(c2 => c.f_cat_id == c2.cat_id)).ToList();
var selectCate3 = cates3.Where(c => c.level == 3 && (";" + cmbCateFilter3.Text.Trim() + ";").Contains(";" + c.name + ";")).ToList();
if (selectCate1?.Count == 0 && chkSkipQualification.Checked)
{
// 厂商直采普通店铺不要随特殊商品
data += "&wx_cat_1=" + string.Join(",", GlobalConfig.WxCatList.Where(c => c.level == 1 && !(c.name == "图书" || c.name == "食品饮料" || c.name == "成人用品"))
.Select(c => c.cat_id));
}
if (!string.IsNullOrEmpty(cmbCateFilter1.Text) && selectCate1?.Count > 0)
data += "&wx_cat_1=" + string.Join(",", selectCate1.Select(c => c.cat_id).ToList());
//else if (chkSkipQualification.Checked)
//{
// // 厂商直采普通店铺不要随特殊商品
// data += "&wx_cat_1=" + string.Join(",", GlobalConfig.WxCatList.Where(c => c.level == 1 && !(c.name == "图书" || c.name == "食品饮料" || c.name == "成人用品"))
// .Select(c => c.cat_id));
//}
if (!string.IsNullOrEmpty(cmbCateFilter2.Text) && selectCate2?.Count > 0)
data += "&wx_cat_2=" + string.Join(",", selectCate2.Select(c => c.cat_id).ToList());
if (!string.IsNullOrEmpty(cmbCateFilter3.Text) && selectCate3?.Count > 0)
data += "&wx_cat_3=" + string.Join(",", selectCate3.Select(c => c.cat_id).ToList());
}
if (selectCate1.Count == 0 && cmbSourceType.Text == "厂商直采" && chkSkipQualification.Checked)
{
// 厂商直采普通店铺不要随特殊商品
data += "&wx_cat_1=" + string.Join(",", GlobalConfig.WxCatList.Where(c => c.level == 1 && !(c.name == "图书" || c.name == "食品饮料" || c.name == "成人用品"))
.Select(c => c.cat_id));
}
data += "&product_get_type=" + cmbSourceType.Text.Trim();
if (cmbSourceType.Text.Trim() == "厂商直采")
@@ -6438,8 +6462,8 @@ Content-Type: image/jpeg
private void pictureBox1_Click(object sender, EventArgs e)
{
if (cancelAddProd != null)
cancelAddProd.Cancel();
if (getProdTokenSource != null)
getProdTokenSource.Cancel();
}
private void btnTest20981_Click(object sender, EventArgs e)