1 temu 商品主图顺序更改 2 pdd商品结构导出功能

This commit is contained in:
wule committed 2025-12-20 17:48:24 +08:00
1 parent 4fd2a4d579
commit 91b1ea7dbc
19 files changed
+823 -62

No files matched your search

@@ -58,6 +58,8 @@ namespace TemuKJD.PDDForms.ProductSelectForms
Task.Run(() =>
{
if (DbProd != null)
DbProdDetail = DbProd;
if (string.IsNullOrWhiteSpace(DbProdDetail?.product_json))
DbProdDetail = PDDDBProdUserSelectForm.GetProductDetail(DbProd.id.ParseToString());
if (DbProdDetail == null)
return;
@@ -46,9 +46,15 @@ namespace TemuKJD.PDDForms.ProductSelectForms
this.txtHeadWords.Text = dbProd.head_words;
this.txtEndWords.Text = dbProd.end_words;
var prodTmp = GetProductDetail(dbProd.id.ToString());
dbProd.sku_img_replace_base64 = prodTmp.sku_img_replace_base64;
dbProd.sku_img_replace_url = prodTmp.sku_img_replace_url;
if(string.IsNullOrWhiteSpace(dbProd?.product_json))
{
var prodTmp = GetProductDetail(dbProd.id.ToString());
if (prodTmp != null)
dbProd = prodTmp;
}
//var prodTmp = GetProductDetail(dbProd.id.ToString());
//dbProd.sku_img_replace_base64 = prodTmp.sku_img_replace_base64;
//dbProd.sku_img_replace_url = prodTmp.sku_img_replace_url;
if (!string.IsNullOrWhiteSpace(dbProd.sku_img_replace_url))
this.pictureBox2.ImageLocation = dbProd.sku_img_replace_url;
else if (!string.IsNullOrWhiteSpace(dbProd.sku_img_replace_base64))
@@ -38,6 +38,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle7 = new System.Windows.Forms.DataGridViewCellStyle();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(PDDDBProdListForm));
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.btnExportTxt = new DevComponents.DotNetBar.PanelEx();
this.cmbGroupFilter = new System.Windows.Forms.ComboBox();
this.btnSelect = new DevComponents.DotNetBar.PanelEx();
this.btnDelSelect = new DevComponents.DotNetBar.PanelEx();
@@ -70,8 +71,6 @@ namespace TemuKJD.PDDForms.ProductSelectForms
this.txtSKC = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.dgvDbProduct = new TemuKJD.UserComponent.DataGridViewEx();
this.ucSplitPage1 = new TemuKJD.UserControls.UcSplitPage();
this.statusBar = new TemuKJD.UserControls.StatusBarUserControl();
this.colSelect = new System.Windows.Forms.DataGridViewCheckBoxColumn();
this.col_db_id = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colFromShopId = new System.Windows.Forms.DataGridViewTextBoxColumn();
@@ -99,6 +98,8 @@ namespace TemuKJD.PDDForms.ProductSelectForms
this.col_edit = new System.Windows.Forms.DataGridViewLinkColumn();
this.col_delete = new System.Windows.Forms.DataGridViewLinkColumn();
this.col_select_product = new System.Windows.Forms.DataGridViewLinkColumn();
this.ucSplitPage1 = new TemuKJD.UserControls.UcSplitPage();
this.statusBar = new TemuKJD.UserControls.StatusBarUserControl();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
@@ -124,6 +125,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
//
// splitContainer1.Panel1
//
this.splitContainer1.Panel1.Controls.Add(this.btnExportTxt);
this.splitContainer1.Panel1.Controls.Add(this.cmbGroupFilter);
this.splitContainer1.Panel1.Controls.Add(this.btnSelect);
this.splitContainer1.Panel1.Controls.Add(this.btnDelSelect);
@@ -148,10 +150,35 @@ namespace TemuKJD.PDDForms.ProductSelectForms
// splitContainer1.Panel2
//
this.splitContainer1.Panel2.Controls.Add(this.splitContainer2);
this.splitContainer1.Size = new System.Drawing.Size(1364, 686);
this.splitContainer1.Size = new System.Drawing.Size(1438, 686);
this.splitContainer1.SplitterDistance = 53;
this.splitContainer1.TabIndex = 1;
//
// btnExportTxt
//
this.btnExportTxt.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnExportTxt.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
this.btnExportTxt.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnExportTxt.DisabledBackColor = System.Drawing.Color.Empty;
this.btnExportTxt.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnExportTxt.Location = new System.Drawing.Point(1345, 15);
this.btnExportTxt.Name = "btnExportTxt";
this.btnExportTxt.Size = new System.Drawing.Size(84, 25);
this.btnExportTxt.Style.Alignment = System.Drawing.StringAlignment.Center;
this.btnExportTxt.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.btnExportTxt.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.btnExportTxt.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder;
this.btnExportTxt.Style.BorderDashStyle = System.Drawing.Drawing2D.DashStyle.Dash;
this.btnExportTxt.Style.BorderSide = DevComponents.DotNetBar.eBorderSide.None;
this.btnExportTxt.Style.ForeColor.Color = System.Drawing.Color.White;
this.btnExportTxt.Style.GradientAngle = 90;
this.btnExportTxt.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center;
this.btnExportTxt.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255)))));
this.btnExportTxt.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255)))));
this.btnExportTxt.TabIndex = 672;
this.btnExportTxt.Text = "批量导出";
this.btnExportTxt.Click += new System.EventHandler(this.btnExportTxt_Click);
//
// cmbGroupFilter
//
this.cmbGroupFilter.FormattingEnabled = true;
@@ -419,7 +446,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
//
this.splitContainer2.Panel2.Controls.Add(this.ucSplitPage1);
this.splitContainer2.Panel2.Controls.Add(this.statusBar);
this.splitContainer2.Size = new System.Drawing.Size(1364, 629);
this.splitContainer2.Size = new System.Drawing.Size(1438, 629);
this.splitContainer2.SplitterDistance = 600;
this.splitContainer2.TabIndex = 0;
//
@@ -430,7 +457,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
this.pnlEditExtCodePrice.Controls.Add(this.lblExtCode);
this.pnlEditExtCodePrice.Controls.Add(this.panel2);
this.pnlEditExtCodePrice.Controls.Add(this.lblExtCodePrice);
this.pnlEditExtCodePrice.Location = new System.Drawing.Point(445, 96);
this.pnlEditExtCodePrice.Location = new System.Drawing.Point(482, 96);
this.pnlEditExtCodePrice.Name = "pnlEditExtCodePrice";
this.pnlEditExtCodePrice.Size = new System.Drawing.Size(474, 146);
this.pnlEditExtCodePrice.TabIndex = 434;
@@ -525,7 +552,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
//
this.pbLoading.Anchor = System.Windows.Forms.AnchorStyles.None;
this.pbLoading.Image = global::TemuKJD.Properties.Resources.loading_blue;
this.pbLoading.Location = new System.Drawing.Point(657, 275);
this.pbLoading.Location = new System.Drawing.Point(694, 275);
this.pbLoading.Name = "pbLoading";
this.pbLoading.Size = new System.Drawing.Size(50, 50);
this.pbLoading.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
@@ -602,36 +629,11 @@ namespace TemuKJD.PDDForms.ProductSelectForms
this.dgvDbProduct.Name = "dgvDbProduct";
this.dgvDbProduct.ReadOnly = true;
this.dgvDbProduct.RowTemplate.Height = 23;
this.dgvDbProduct.Size = new System.Drawing.Size(1356, 600);
this.dgvDbProduct.Size = new System.Drawing.Size(1430, 600);
this.dgvDbProduct.TabIndex = 6;
this.dgvDbProduct.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgvDbProduct_CellContentClick);
this.dgvDbProduct.Scroll += new System.Windows.Forms.ScrollEventHandler(this.dgvDbProduct_Scroll);
//
// ucSplitPage1
//
this.ucSplitPage1.CurrentPage = 1;
this.ucSplitPage1.Dock = System.Windows.Forms.DockStyle.Right;
this.ucSplitPage1.IsShowPageSize = false;
this.ucSplitPage1.Location = new System.Drawing.Point(1002, 0);
this.ucSplitPage1.Margin = new System.Windows.Forms.Padding(0);
this.ucSplitPage1.Name = "ucSplitPage1";
this.ucSplitPage1.Padding = new System.Windows.Forms.Padding(0, 0, 1, 0);
this.ucSplitPage1.PageSize = 50;
this.ucSplitPage1.Size = new System.Drawing.Size(362, 25);
this.ucSplitPage1.TabIndex = 6;
this.ucSplitPage1.TotalPage = 1;
//
// statusBar
//
this.statusBar.BackColor = System.Drawing.Color.White;
this.statusBar.Dock = System.Windows.Forms.DockStyle.Fill;
this.statusBar.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.statusBar.Location = new System.Drawing.Point(0, 0);
this.statusBar.Margin = new System.Windows.Forms.Padding(0);
this.statusBar.Name = "statusBar";
this.statusBar.Size = new System.Drawing.Size(1364, 25);
this.statusBar.TabIndex = 5;
//
// colSelect
//
this.colSelect.FillWeight = 26F;
@@ -843,10 +845,35 @@ namespace TemuKJD.PDDForms.ProductSelectForms
this.col_select_product.Resizable = System.Windows.Forms.DataGridViewTriState.True;
this.col_select_product.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
//
// ucSplitPage1
//
this.ucSplitPage1.CurrentPage = 1;
this.ucSplitPage1.Dock = System.Windows.Forms.DockStyle.Right;
this.ucSplitPage1.IsShowPageSize = true;
this.ucSplitPage1.Location = new System.Drawing.Point(1024, 0);
this.ucSplitPage1.Margin = new System.Windows.Forms.Padding(0);
this.ucSplitPage1.Name = "ucSplitPage1";
this.ucSplitPage1.Padding = new System.Windows.Forms.Padding(0, 0, 1, 0);
this.ucSplitPage1.PageSize = 50;
this.ucSplitPage1.Size = new System.Drawing.Size(414, 25);
this.ucSplitPage1.TabIndex = 6;
this.ucSplitPage1.TotalPage = 1;
//
// statusBar
//
this.statusBar.BackColor = System.Drawing.Color.White;
this.statusBar.Dock = System.Windows.Forms.DockStyle.Fill;
this.statusBar.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.statusBar.Location = new System.Drawing.Point(0, 0);
this.statusBar.Margin = new System.Windows.Forms.Padding(0);
this.statusBar.Name = "statusBar";
this.statusBar.Size = new System.Drawing.Size(1438, 25);
this.statusBar.TabIndex = 5;
//
// PDDDBProdListForm
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.ClientSize = new System.Drawing.Size(1366, 720);
this.ClientSize = new System.Drawing.Size(1440, 720);
this.Controls.Add(this.splitContainer1);
this.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
@@ -940,5 +967,6 @@ namespace TemuKJD.PDDForms.ProductSelectForms
private System.Windows.Forms.DataGridViewLinkColumn col_edit;
private System.Windows.Forms.DataGridViewLinkColumn col_delete;
private System.Windows.Forms.DataGridViewLinkColumn col_select_product;
private DevComponents.DotNetBar.PanelEx btnExportTxt;
}
}
@@ -12,6 +12,7 @@ using System.Linq;
using System.Net;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
using TemuKJD.BaseForms;
@@ -127,7 +128,9 @@ namespace TemuKJD.PDDForms.ProductSelectForms
Task.Run(() =>
{
int pageCount;
var list = GetProductList(out pageCount, page);
int pageSize = 50;
Invoke(new Action(() => { pageSize = this.ucSplitPage1.PageSize; }));
var list = GetProductList(out pageCount, page, pageSize);
lstTemuDbProduct.AddRange(list);
this.ucSplitPage1.TotalPage = pageCount;
@@ -721,5 +724,50 @@ namespace TemuKJD.PDDForms.ProductSelectForms
{
this.pnlEditExtCodePrice.Visible = false;
}
private void btnExportTxt_Click(object sender, EventArgs e)
{
var lstProdId = dgvDbProduct.Rows.Cast<DataGridViewRow>().Where(row
=> row.Cells["colSelect"]?.Value.ParseToBool() == true).Select(r => r.Cells["col_spu_id"]?.Value.ToString()).ToList();
//var prodList = this.lstTemuDbProduct.Where(p => lstProdId.Contains(p.spu_id)).ToArray();
FolderBrowserDialog fd = new FolderBrowserDialog();
if (fd.ShowDialog() == DialogResult.OK)
{
var path = fd.SelectedPath;
this.pbLoading.Visible = true;
this.statusBar.pgbTaskProgress.Maximum = lstProdId.Count;
this.statusBar.UpdateProgressBar(0);
Task.Run(() =>
{
foreach (var pId in lstProdId)
{
var prod = this.lstTemuDbProduct.FirstOrDefault(p => p.spu_id == pId);
if (string.IsNullOrEmpty(prod.product_json))
{
prod = PDDDBProdUserSelectForm.GetProductDetail(prod.id.ParseToString());
Thread.Sleep(200);
}
StreamWriter sw = new StreamWriter(Path.Combine(path, prod.spu_id + ".txt"), true, Encoding.UTF8);
sw.Write(prod.product_json);
sw.Close();
Invoke(new Action(() =>
{
this.statusBar.UpdateProgressBar(this.statusBar.pgbTaskProgress.Value + 1);
this.statusBar.lblTaskStatus.Text = "正在导出";
}));
}
Invoke(new Action(() =>
{
pbLoading.Visible = false;
this.statusBar.lblTaskStatus.Text = "导出完成";
BaseMsgForm.ShowInfo("导出完成!");
}));
});
}
}
}
}
@@ -3625,8 +3625,6 @@ Content-Disposition: form-data; name=""pic_operations""
data = UserLogin.GetSignaturex() + "&search_db_ids=" + prodDbId;
var html = GetHtml.PostUtf8(url, data);
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
html = GetHtml.PostUtf8(url, data);
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
html = GetHtml.PostUtf8(url, data);
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))