微店模拟接口 其他一些功能优化

This commit is contained in:
wule_5900x committed 2026-04-12 11:12:27 +08:00
1 parent dc6f981a34
commit cafdbbd95d
20 files changed
+2343 -103

No files matched your search

@@ -379,7 +379,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
List<string> fileNameLst = new List<string>();
string tempImgPath = Path.GetTempPath().Trim('\\') + "\\" + Randomx.GetWordNumber(8).ToLower();
string tempImgPath = Path.GetTempPath().Trim('\\') + "\\" + Randomx.GetWordWithNumber(8).ToLower();
if (!Directory.Exists(tempImgPath))
Directory.CreateDirectory(tempImgPath);
var imgUrlLst = this.txtImgUrl.Text.Split(new string[] { "\r", "\n", ";", " " }, StringSplitOptions.RemoveEmptyEntries);
@@ -30,15 +30,16 @@ namespace TemuKJD.PDDForms.ProductSelectForms
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle15 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle16 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle17 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle18 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle19 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle20 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle21 = 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();
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.ucGroupBoxEx1 = new TemuKJD.UserComponent.UcGroupBoxEx(this.components);
this.btnSelectNotGetDetail = new DevComponents.DotNetBar.PanelEx();
this.cmbFilterType = new System.Windows.Forms.ComboBox();
this.btnFilter = new DevComponents.DotNetBar.PanelEx();
this.txtFilter = new System.Windows.Forms.TextBox();
@@ -105,7 +106,6 @@ namespace TemuKJD.PDDForms.ProductSelectForms
this.chk = new TemuKJD.UserComponent.UcCheckBox(this.components);
this.statusBar = new TemuKJD.UserControls.StatusBarUserControl();
this.ucSplitPage1 = new TemuKJD.UserControls.UcSplitPage();
this.btnSelectNotGetDetail = new DevComponents.DotNetBar.PanelEx();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
@@ -197,17 +197,42 @@ namespace TemuKJD.PDDForms.ProductSelectForms
this.ucGroupBoxEx1.TabStop = false;
this.ucGroupBoxEx1.Text = "操作";
//
// btnSelectNotGetDetail
//
this.btnSelectNotGetDetail.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnSelectNotGetDetail.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
this.btnSelectNotGetDetail.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnSelectNotGetDetail.DisabledBackColor = System.Drawing.Color.Empty;
this.btnSelectNotGetDetail.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnSelectNotGetDetail.Location = new System.Drawing.Point(1125, 30);
this.btnSelectNotGetDetail.Name = "btnSelectNotGetDetail";
this.btnSelectNotGetDetail.Size = new System.Drawing.Size(153, 25);
this.btnSelectNotGetDetail.Style.Alignment = System.Drawing.StringAlignment.Center;
this.btnSelectNotGetDetail.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.btnSelectNotGetDetail.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.btnSelectNotGetDetail.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder;
this.btnSelectNotGetDetail.Style.BorderDashStyle = System.Drawing.Drawing2D.DashStyle.Dash;
this.btnSelectNotGetDetail.Style.BorderSide = DevComponents.DotNetBar.eBorderSide.None;
this.btnSelectNotGetDetail.Style.ForeColor.Color = System.Drawing.Color.White;
this.btnSelectNotGetDetail.Style.GradientAngle = 90;
this.btnSelectNotGetDetail.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center;
this.btnSelectNotGetDetail.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255)))));
this.btnSelectNotGetDetail.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255)))));
this.btnSelectNotGetDetail.TabIndex = 790;
this.btnSelectNotGetDetail.Text = "一键勾选未采集详情商品";
this.btnSelectNotGetDetail.Click += new System.EventHandler(this.btnSelectNotGetDetail_Click);
//
// cmbFilterType
//
this.cmbFilterType.FormattingEnabled = true;
this.cmbFilterType.Items.AddRange(new object[] {
"过滤所有字段",
"过滤标题+SKU",
"过滤标题"});
this.cmbFilterType.Location = new System.Drawing.Point(987, 58);
this.cmbFilterType.Name = "cmbFilterType";
this.cmbFilterType.Size = new System.Drawing.Size(102, 25);
this.cmbFilterType.Size = new System.Drawing.Size(108, 25);
this.cmbFilterType.TabIndex = 1012;
this.cmbFilterType.Text = "过滤所有字段";
this.cmbFilterType.Text = "过滤标题+SKU";
//
// btnFilter
//
@@ -217,7 +242,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
this.btnFilter.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnFilter.Location = new System.Drawing.Point(987, 30);
this.btnFilter.Name = "btnFilter";
this.btnFilter.Size = new System.Drawing.Size(102, 25);
this.btnFilter.Size = new System.Drawing.Size(108, 25);
this.btnFilter.Style.Alignment = System.Drawing.StringAlignment.Center;
this.btnFilter.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.btnFilter.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
@@ -761,19 +786,19 @@ namespace TemuKJD.PDDForms.ProductSelectForms
//
this.dgvShop.AllowUserToAddRows = false;
this.dgvShop.AllowUserToDeleteRows = false;
dataGridViewCellStyle15.BackColor = System.Drawing.Color.WhiteSmoke;
this.dgvShop.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle15;
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)))));
dataGridViewCellStyle16.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle16.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle16.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle16.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle16.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle16.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle16.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
this.dgvShop.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle16;
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,
@@ -894,20 +919,20 @@ namespace TemuKJD.PDDForms.ProductSelectForms
//
this.dgvChanceProduct.AllowUserToAddRows = false;
this.dgvChanceProduct.AllowUserToDeleteRows = false;
dataGridViewCellStyle17.BackColor = System.Drawing.Color.WhiteSmoke;
this.dgvChanceProduct.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle17;
dataGridViewCellStyle3.BackColor = System.Drawing.Color.WhiteSmoke;
this.dgvChanceProduct.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle3;
this.dgvChanceProduct.AutoRowNumber = true;
this.dgvChanceProduct.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
this.dgvChanceProduct.BackgroundColor = System.Drawing.Color.White;
this.dgvChanceProduct.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
dataGridViewCellStyle18.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle18.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle18.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle18.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle18.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle18.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle18.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
this.dgvChanceProduct.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle18;
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.dgvChanceProduct.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle4;
this.dgvChanceProduct.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dgvChanceProduct.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.colCheck,
@@ -966,8 +991,8 @@ namespace TemuKJD.PDDForms.ProductSelectForms
//
// colGoodsName
//
dataGridViewCellStyle19.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.colGoodsName.DefaultCellStyle = dataGridViewCellStyle19;
dataGridViewCellStyle5.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.colGoodsName.DefaultCellStyle = dataGridViewCellStyle5;
this.colGoodsName.FillWeight = 120F;
this.colGoodsName.HeaderText = "商品名称";
this.colGoodsName.Name = "colGoodsName";
@@ -988,8 +1013,8 @@ namespace TemuKJD.PDDForms.ProductSelectForms
//
// colPrice
//
dataGridViewCellStyle20.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.colPrice.DefaultCellStyle = dataGridViewCellStyle20;
dataGridViewCellStyle6.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.colPrice.DefaultCellStyle = dataGridViewCellStyle6;
this.colPrice.FillWeight = 70F;
this.colPrice.HeaderText = "价格";
this.colPrice.Name = "colPrice";
@@ -1004,8 +1029,8 @@ namespace TemuKJD.PDDForms.ProductSelectForms
//
// colMsg
//
dataGridViewCellStyle21.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.colMsg.DefaultCellStyle = dataGridViewCellStyle21;
dataGridViewCellStyle7.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.colMsg.DefaultCellStyle = dataGridViewCellStyle7;
this.colMsg.FillWeight = 200F;
this.colMsg.HeaderText = "操作结果";
this.colMsg.Name = "colMsg";
@@ -1051,31 +1076,6 @@ namespace TemuKJD.PDDForms.ProductSelectForms
this.ucSplitPage1.TotalPage = 1;
this.ucSplitPage1.PageChange += new System.Action<object>(this.ucSplitPage1_PageChange);
//
// btnSelectNotGetDetail
//
this.btnSelectNotGetDetail.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnSelectNotGetDetail.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
this.btnSelectNotGetDetail.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnSelectNotGetDetail.DisabledBackColor = System.Drawing.Color.Empty;
this.btnSelectNotGetDetail.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnSelectNotGetDetail.Location = new System.Drawing.Point(1125, 30);
this.btnSelectNotGetDetail.Name = "btnSelectNotGetDetail";
this.btnSelectNotGetDetail.Size = new System.Drawing.Size(153, 25);
this.btnSelectNotGetDetail.Style.Alignment = System.Drawing.StringAlignment.Center;
this.btnSelectNotGetDetail.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.btnSelectNotGetDetail.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.btnSelectNotGetDetail.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder;
this.btnSelectNotGetDetail.Style.BorderDashStyle = System.Drawing.Drawing2D.DashStyle.Dash;
this.btnSelectNotGetDetail.Style.BorderSide = DevComponents.DotNetBar.eBorderSide.None;
this.btnSelectNotGetDetail.Style.ForeColor.Color = System.Drawing.Color.White;
this.btnSelectNotGetDetail.Style.GradientAngle = 90;
this.btnSelectNotGetDetail.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center;
this.btnSelectNotGetDetail.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255)))));
this.btnSelectNotGetDetail.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255)))));
this.btnSelectNotGetDetail.TabIndex = 790;
this.btnSelectNotGetDetail.Text = "一键勾选未采集详情商品";
this.btnSelectNotGetDetail.Click += new System.EventHandler(this.btnSelectNotGetDetail_Click);
//
// PDDGetChanceProdForm
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
@@ -1026,23 +1026,79 @@ namespace TemuKJD.PDDForms.ProductSelectForms
private void btnFilter_Click(object sender, EventArgs e)
{
var filters = txtFilter.Text.Trim().Split(new string[] { ",", ",", " ", "\r", "\n" }, StringSplitOptions.RemoveEmptyEntries);
var filters = txtFilter.Text.Trim().Split(new string[] { ",", ",", "\r", "\n" }, StringSplitOptions.RemoveEmptyEntries);
// 含敏感词商品
List<ChanceProductResult> filterChanceProdLst = null;
List<ChanceProductResult> filterChanceProdLst = new List<ChanceProductResult>();
if (cmbFilterType.Text.Trim() == "过滤标题")
filterChanceProdLst = lstChanceProductResult.Where(p => filters
.Any(f => (p?.dbProduct?.product_name).ParseToString().Contains(f) || (p?.keywords).ParseToString().Contains(f))).ToList();
{
foreach(var chance in lstChanceProductResult)
{
if (filters.Any(f => chance.keywords.Contains(f)))
filterChanceProdLst.Add(chance);
if (filters.Any(f => (chance?.dbProduct?.product_name).ParseToString().Contains(f)))
filterChanceProdLst.Add(chance);
var prodInfo = JsonHelper.DeserializeJsonToObjectNullable<PDDProductInfo>(chance?.dbProduct?.product_json);
if (prodInfo == null)
continue;
try
{
if (filters.Any(f => prodInfo.detail.tiny_name.ParseToString().Contains(f)))
filterChanceProdLst.Add(chance);
if (filters.Any(f => prodInfo.detail.goods_desc.ParseToString().Contains(f)))
filterChanceProdLst.Add(chance);
if (filters.Any(f => prodInfo.detail.share_desc.ParseToString().Contains(f)))
filterChanceProdLst.Add(chance);
}
catch
{
}
}
}
else
filterChanceProdLst = lstChanceProductResult.Where(p => filters.Any(f => JsonHelper.SerializeObject(p).Contains(f))).ToList();
{
foreach (var chance in lstChanceProductResult)
{
if (filters.Any(f => chance.keywords.Contains(f)))
filterChanceProdLst.Add(chance);
if (filters.Any(f => (chance?.dbProduct?.product_name).ParseToString().Contains(f)))
filterChanceProdLst.Add(chance);
var prodInfo = JsonHelper.DeserializeJsonToObjectNullable<PDDProductInfo>(chance?.dbProduct?.product_json);
if (prodInfo == null)
continue;
try
{
if (filters.Any(f => prodInfo.detail.tiny_name.ParseToString().Contains(f)))
filterChanceProdLst.Add(chance);
if (filters.Any(f => prodInfo.detail.goods_desc.ParseToString().Contains(f)))
filterChanceProdLst.Add(chance);
if (filters.Any(f => prodInfo.detail.share_desc.ParseToString().Contains(f)))
filterChanceProdLst.Add(chance);
foreach (var skuInfo in prodInfo.detail.sku)
{
foreach(var specInfo in skuInfo.spec)
{
if (filters.Any(f => specInfo.spec_name.ParseToString().Contains(f)))
filterChanceProdLst.Add(chance);
}
}
}
catch
{
}
}
}
foreach (var chanceProd in filterChanceProdLst)
{
var row = dgvChanceProduct.Rows.Cast<DataGridViewRow>().ToList().FirstOrDefault(r => r.Cells["colChanceId"].Value.ParseToString() == chanceProd.chance_id);
lstChanceProductResult.Remove(chanceProd);
dgvChanceProduct.Rows.Remove(row);
var row = dgvChanceProduct.Rows.Cast<DataGridViewRow>().ToList().FirstOrDefault(r => r.Cells["colChanceId"].Value.ParseToString() == chanceProd.chance_id);
if (row != null)
dgvChanceProduct.Rows.Remove(row);
}
NaiBa.Util.Helper.ConfigHelper.SaveConfig("pdd_chance_product_list_" + MainForm.ProcessCount, lstChanceProductResult);
//NaiBa.Util.Helper.ConfigHelper.SaveConfig("pdd_chance_product_list_" + MainForm.ProcessCount, lstChanceProductResult);
}
private void btnSelectNotGetDetail_Click(object sender, EventArgs e)