厂商采集拼多多采集及入库

This commit is contained in:
wule_5900x committed 2026-01-25 23:31:56 +08:00
1 parent 1b15eda63c
commit 3996dcce09
16 files changed
+1723 -569

No files matched your search

+526 -34
View File
@@ -29,28 +29,67 @@ namespace TemuKJD.ToolForms
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
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();
this.tabControl1 = new System.Windows.Forms.TabControl();
this.tabPage1 = new System.Windows.Forms.TabPage();
this.splitContainer2 = new System.Windows.Forms.SplitContainer();
this.btnNext = new System.Windows.Forms.Button();
this.btnPrev = new System.Windows.Forms.Button();
this.txtAddress = new System.Windows.Forms.TextBox();
this.tabPage2 = new System.Windows.Forms.TabPage();
this.pbLoading = new System.Windows.Forms.PictureBox();
this.dgvProduct = new TemuKJD.UserComponent.DataGridViewEx();
this.colCheck = new System.Windows.Forms.DataGridViewCheckBoxColumn();
this.colProductId = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colImgUrl = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colImg = new System.Windows.Forms.DataGridViewImageColumn();
this.colGoodsName = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colHotValue = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colSales30 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colCate = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colPrice = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colDel = new System.Windows.Forms.DataGridViewLinkColumn();
this.colMsg = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.pnlMultiLogin = new System.Windows.Forms.Panel();
this.cmbMultiCookieName = new DevComponents.DotNetBar.Controls.ComboBoxEx();
this.btnMultiLogin = new DevComponents.DotNetBar.PanelEx();
this.btnDel = new DevComponents.DotNetBar.PanelEx();
this.chkSkip = new TemuKJD.UserComponent.UcCheckBox(this.components);
this.chkOverride = new TemuKJD.UserComponent.UcCheckBox(this.components);
this.label1 = new System.Windows.Forms.Label();
this.cmbPlatformType = new System.Windows.Forms.ComboBox();
this.cmbSaleCount = new System.Windows.Forms.ComboBox();
this.btnStopStop = new DevComponents.DotNetBar.PanelEx();
this.btnSaveDb = new DevComponents.DotNetBar.PanelEx();
this.btnGetDetail = new DevComponents.DotNetBar.PanelEx();
this.statusBar = new TemuKJD.UserControls.StatusBarUserControl();
this.label4 = new System.Windows.Forms.Label();
this.txtPageEnd = new System.Windows.Forms.TextBox();
this.txtPageStart = new System.Windows.Forms.TextBox();
this.label3 = new System.Windows.Forms.Label();
this.btnCollect = new DevComponents.DotNetBar.PanelEx();
this.line1 = new DevComponents.DotNetBar.Controls.Line();
this.txtSupplierName = new System.Windows.Forms.TextBox();
this.txtFilterSaleCount = new System.Windows.Forms.TextBox();
this.btnRefreshCookie = new DevComponents.DotNetBar.PanelEx();
this.txtCookie = new System.Windows.Forms.TextBox();
this.btnSaveCookie = new DevComponents.DotNetBar.PanelEx();
this.btnImportCookie = new DevComponents.DotNetBar.PanelEx();
this.tabPage2 = new System.Windows.Forms.TabPage();
this.label2 = new System.Windows.Forms.Label();
this.tabControl1.SuspendLayout();
this.tabPage1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).BeginInit();
this.splitContainer2.Panel1.SuspendLayout();
this.splitContainer2.Panel2.SuspendLayout();
this.splitContainer2.SuspendLayout();
this.tabPage2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pbLoading)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.dgvProduct)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
@@ -63,21 +102,24 @@ namespace TemuKJD.ToolForms
this.tabControl1.Controls.Add(this.tabPage1);
this.tabControl1.Controls.Add(this.tabPage2);
this.tabControl1.Dock = System.Windows.Forms.DockStyle.Fill;
this.tabControl1.ItemSize = new System.Drawing.Size(80, 24);
this.tabControl1.Location = new System.Drawing.Point(0, 0);
this.tabControl1.Multiline = true;
this.tabControl1.Name = "tabControl1";
this.tabControl1.SelectedIndex = 0;
this.tabControl1.Size = new System.Drawing.Size(1109, 558);
this.tabControl1.Size = new System.Drawing.Size(1904, 469);
this.tabControl1.TabIndex = 0;
//
// tabPage1
//
this.tabPage1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.tabPage1.Controls.Add(this.splitContainer2);
this.tabPage1.Location = new System.Drawing.Point(4, 26);
this.tabPage1.Location = new System.Drawing.Point(4, 28);
this.tabPage1.Name = "tabPage1";
this.tabPage1.Padding = new System.Windows.Forms.Padding(3);
this.tabPage1.Size = new System.Drawing.Size(1101, 528);
this.tabPage1.Size = new System.Drawing.Size(1896, 437);
this.tabPage1.TabIndex = 0;
this.tabPage1.Text = "商品页面";
this.tabPage1.Text = " 商品页面 ";
this.tabPage1.UseVisualStyleBackColor = true;
//
// splitContainer2
@@ -94,41 +136,192 @@ namespace TemuKJD.ToolForms
this.splitContainer2.Panel1.Controls.Add(this.btnNext);
this.splitContainer2.Panel1.Controls.Add(this.btnPrev);
this.splitContainer2.Panel1.Controls.Add(this.txtAddress);
//
// splitContainer2.Panel2
//
this.splitContainer2.Panel2.Controls.Add(this.splitContainer1);
this.splitContainer2.Size = new System.Drawing.Size(1095, 522);
this.splitContainer2.Size = new System.Drawing.Size(1888, 429);
this.splitContainer2.SplitterDistance = 26;
this.splitContainer2.TabIndex = 6;
//
// btnNext
//
this.btnNext.Location = new System.Drawing.Point(35, 3);
this.btnNext.Location = new System.Drawing.Point(31, 3);
this.btnNext.Name = "btnNext";
this.btnNext.Size = new System.Drawing.Size(32, 23);
this.btnNext.TabIndex = 9;
this.btnNext.Text = "→";
this.btnNext.UseVisualStyleBackColor = true;
this.btnNext.Click += new System.EventHandler(this.btnNext_Click);
//
// btnPrev
//
this.btnPrev.Location = new System.Drawing.Point(3, 3);
this.btnPrev.Location = new System.Drawing.Point(-1, 3);
this.btnPrev.Name = "btnPrev";
this.btnPrev.Size = new System.Drawing.Size(32, 23);
this.btnPrev.TabIndex = 8;
this.btnPrev.Text = "←";
this.btnPrev.UseVisualStyleBackColor = true;
this.btnPrev.Click += new System.EventHandler(this.btnPrev_Click);
//
// txtAddress
//
this.txtAddress.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.txtAddress.Location = new System.Drawing.Point(68, 3);
this.txtAddress.Location = new System.Drawing.Point(64, 3);
this.txtAddress.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.txtAddress.Name = "txtAddress";
this.txtAddress.Size = new System.Drawing.Size(1024, 23);
this.txtAddress.Size = new System.Drawing.Size(1824, 23);
this.txtAddress.TabIndex = 7;
this.txtAddress.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txtAddress_KeyDown);
//
// tabPage2
//
this.tabPage2.Controls.Add(this.pbLoading);
this.tabPage2.Controls.Add(this.dgvProduct);
this.tabPage2.Location = new System.Drawing.Point(4, 28);
this.tabPage2.Name = "tabPage2";
this.tabPage2.Padding = new System.Windows.Forms.Padding(3);
this.tabPage2.Size = new System.Drawing.Size(1896, 437);
this.tabPage2.TabIndex = 1;
this.tabPage2.Text = " 商品列表 ";
this.tabPage2.UseVisualStyleBackColor = true;
//
// pbLoading
//
this.pbLoading.Anchor = System.Windows.Forms.AnchorStyles.None;
this.pbLoading.Image = global::TemuKJD.Properties.Resources.loading_blue;
this.pbLoading.Location = new System.Drawing.Point(923, 196);
this.pbLoading.Name = "pbLoading";
this.pbLoading.Size = new System.Drawing.Size(50, 50);
this.pbLoading.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
this.pbLoading.TabIndex = 8;
this.pbLoading.TabStop = false;
this.pbLoading.Visible = false;
//
// dgvProduct
//
this.dgvProduct.AllowUserToAddRows = false;
this.dgvProduct.AllowUserToDeleteRows = false;
dataGridViewCellStyle1.BackColor = System.Drawing.Color.WhiteSmoke;
this.dgvProduct.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1;
this.dgvProduct.AutoRowNumber = true;
this.dgvProduct.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
this.dgvProduct.BackgroundColor = System.Drawing.Color.White;
this.dgvProduct.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
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.dgvProduct.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle2;
this.dgvProduct.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dgvProduct.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.colCheck,
this.colProductId,
this.colImgUrl,
this.colImg,
this.colGoodsName,
this.colHotValue,
this.colSales30,
this.colCate,
this.colPrice,
this.colDel,
this.colMsg});
this.dgvProduct.Dock = System.Windows.Forms.DockStyle.Fill;
this.dgvProduct.Location = new System.Drawing.Point(3, 3);
this.dgvProduct.Name = "dgvProduct";
this.dgvProduct.ReadOnly = true;
this.dgvProduct.RowTemplate.Height = 23;
this.dgvProduct.Size = new System.Drawing.Size(1890, 431);
this.dgvProduct.TabIndex = 7;
this.dgvProduct.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgvProduct_CellContentClick);
//
// colCheck
//
this.colCheck.FillWeight = 26F;
this.colCheck.HeaderText = "选";
this.colCheck.Name = "colCheck";
this.colCheck.ReadOnly = true;
this.colCheck.Resizable = System.Windows.Forms.DataGridViewTriState.True;
this.colCheck.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
//
// colProductId
//
this.colProductId.FillWeight = 50F;
this.colProductId.HeaderText = "商品Id";
this.colProductId.Name = "colProductId";
this.colProductId.ReadOnly = true;
//
// colImgUrl
//
this.colImgUrl.FillWeight = 300F;
this.colImgUrl.HeaderText = "图片路径";
this.colImgUrl.Name = "colImgUrl";
this.colImgUrl.ReadOnly = true;
this.colImgUrl.Visible = false;
//
// colImg
//
this.colImg.FillWeight = 40F;
this.colImg.HeaderText = "图片";
this.colImg.ImageLayout = System.Windows.Forms.DataGridViewImageCellLayout.Zoom;
this.colImg.Name = "colImg";
this.colImg.ReadOnly = true;
this.colImg.Resizable = System.Windows.Forms.DataGridViewTriState.True;
this.colImg.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
//
// colGoodsName
//
dataGridViewCellStyle3.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.colGoodsName.DefaultCellStyle = dataGridViewCellStyle3;
this.colGoodsName.FillWeight = 120F;
this.colGoodsName.HeaderText = "商品名称";
this.colGoodsName.Name = "colGoodsName";
this.colGoodsName.ReadOnly = true;
//
// colHotValue
//
this.colHotValue.FillWeight = 60F;
this.colHotValue.HeaderText = "7日销量";
this.colHotValue.Name = "colHotValue";
this.colHotValue.ReadOnly = true;
//
// colSales30
//
this.colSales30.FillWeight = 60F;
this.colSales30.HeaderText = "30日销量";
this.colSales30.Name = "colSales30";
this.colSales30.ReadOnly = true;
//
// colCate
//
this.colCate.HeaderText = "类目";
this.colCate.Name = "colCate";
this.colCate.ReadOnly = true;
//
// colPrice
//
dataGridViewCellStyle4.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.colPrice.DefaultCellStyle = dataGridViewCellStyle4;
this.colPrice.FillWeight = 70F;
this.colPrice.HeaderText = "价格";
this.colPrice.Name = "colPrice";
this.colPrice.ReadOnly = true;
//
// colDel
//
this.colDel.FillWeight = 35F;
this.colDel.HeaderText = "删除";
this.colDel.Name = "colDel";
this.colDel.ReadOnly = true;
//
// colMsg
//
dataGridViewCellStyle5.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.colMsg.DefaultCellStyle = dataGridViewCellStyle5;
this.colMsg.FillWeight = 200F;
this.colMsg.HeaderText = "操作结果";
this.colMsg.Name = "colMsg";
this.colMsg.ReadOnly = true;
//
// splitContainer1
//
@@ -143,16 +336,35 @@ namespace TemuKJD.ToolForms
// splitContainer1.Panel1
//
this.splitContainer1.Panel1.Controls.Add(this.pnlMultiLogin);
this.splitContainer1.Panel1.Controls.Add(this.tabControl1);
//
// splitContainer1.Panel2
//
this.splitContainer1.Panel2.BackColor = System.Drawing.Color.White;
this.splitContainer1.Panel2.Controls.Add(this.chkSkip);
this.splitContainer1.Panel2.Controls.Add(this.chkOverride);
this.splitContainer1.Panel2.Controls.Add(this.label1);
this.splitContainer1.Panel2.Controls.Add(this.cmbPlatformType);
this.splitContainer1.Panel2.Controls.Add(this.cmbSaleCount);
this.splitContainer1.Panel2.Controls.Add(this.btnStopStop);
this.splitContainer1.Panel2.Controls.Add(this.btnSaveDb);
this.splitContainer1.Panel2.Controls.Add(this.btnGetDetail);
this.splitContainer1.Panel2.Controls.Add(this.statusBar);
this.splitContainer1.Panel2.Controls.Add(this.label4);
this.splitContainer1.Panel2.Controls.Add(this.txtPageEnd);
this.splitContainer1.Panel2.Controls.Add(this.txtPageStart);
this.splitContainer1.Panel2.Controls.Add(this.label3);
this.splitContainer1.Panel2.Controls.Add(this.btnCollect);
this.splitContainer1.Panel2.Controls.Add(this.line1);
this.splitContainer1.Panel2.Controls.Add(this.txtSupplierName);
this.splitContainer1.Panel2.Controls.Add(this.txtFilterSaleCount);
this.splitContainer1.Panel2.Controls.Add(this.btnRefreshCookie);
this.splitContainer1.Panel2.Controls.Add(this.txtCookie);
this.splitContainer1.Panel2.Controls.Add(this.btnSaveCookie);
this.splitContainer1.Panel2.Controls.Add(this.btnImportCookie);
this.splitContainer1.Size = new System.Drawing.Size(1095, 492);
this.splitContainer1.SplitterDistance = 400;
this.splitContainer1.Panel2.Controls.Add(this.label2);
this.splitContainer1.Size = new System.Drawing.Size(1904, 561);
this.splitContainer1.SplitterDistance = 469;
this.splitContainer1.SplitterWidth = 3;
this.splitContainer1.TabIndex = 4;
//
@@ -228,6 +440,252 @@ namespace TemuKJD.ToolForms
this.btnDel.TabIndex = 409;
this.btnDel.Text = "删";
//
// chkSkip
//
this.chkSkip.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.chkSkip.AutoSize = true;
this.chkSkip.Checked = true;
this.chkSkip.CheckState = System.Windows.Forms.CheckState.Checked;
this.chkSkip.Location = new System.Drawing.Point(1560, 33);
this.chkSkip.Name = "chkSkip";
this.chkSkip.Size = new System.Drawing.Size(171, 21);
this.chkSkip.TabIndex = 942;
this.chkSkip.Text = "采集时跳过库中已存在商品";
this.chkSkip.UseVisualStyleBackColor = true;
//
// chkOverride
//
this.chkOverride.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.chkOverride.AutoSize = true;
this.chkOverride.Location = new System.Drawing.Point(1736, 33);
this.chkOverride.Name = "chkOverride";
this.chkOverride.Size = new System.Drawing.Size(171, 21);
this.chkOverride.TabIndex = 920;
this.chkOverride.Text = "入库时覆盖库中已存在商品";
this.chkOverride.UseVisualStyleBackColor = true;
//
// label1
//
this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(817, 8);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(32, 17);
this.label1.TabIndex = 898;
this.label1.Text = "平台";
//
// cmbPlatformType
//
this.cmbPlatformType.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.cmbPlatformType.FormattingEnabled = true;
this.cmbPlatformType.Items.AddRange(new object[] {
"拼多多",
"抖音",
"淘宝",
"微信"});
this.cmbPlatformType.Location = new System.Drawing.Point(849, 4);
this.cmbPlatformType.Name = "cmbPlatformType";
this.cmbPlatformType.Size = new System.Drawing.Size(67, 25);
this.cmbPlatformType.TabIndex = 897;
this.cmbPlatformType.Text = "拼多多";
this.cmbPlatformType.SelectedIndexChanged += new System.EventHandler(this.cmbPlatformType_SelectedIndexChanged);
//
// cmbSaleCount
//
this.cmbSaleCount.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.cmbSaleCount.FormattingEnabled = true;
this.cmbSaleCount.Items.AddRange(new object[] {
"7日销量≥",
"30日销量≥"});
this.cmbSaleCount.Location = new System.Drawing.Point(1120, 4);
this.cmbSaleCount.Name = "cmbSaleCount";
this.cmbSaleCount.Size = new System.Drawing.Size(76, 25);
this.cmbSaleCount.TabIndex = 875;
this.cmbSaleCount.Text = "7日销量≥";
this.cmbSaleCount.SelectedIndexChanged += new System.EventHandler(this.cmbSaleCount_SelectedIndexChanged);
this.cmbSaleCount.TextChanged += new System.EventHandler(this.cmbSaleCount_TextChanged);
//
// btnStopStop
//
this.btnStopStop.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnStopStop.CanvasColor = System.Drawing.SystemColors.Control;
this.btnStopStop.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
this.btnStopStop.DisabledBackColor = System.Drawing.Color.Empty;
this.btnStopStop.Location = new System.Drawing.Point(1559, 58);
this.btnStopStop.Name = "btnStopStop";
this.btnStopStop.Size = new System.Drawing.Size(83, 23);
this.btnStopStop.Style.Alignment = System.Drawing.StringAlignment.Center;
this.btnStopStop.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(185)))), ((int)(((byte)(215)))), ((int)(((byte)(255)))));
this.btnStopStop.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(185)))), ((int)(((byte)(215)))), ((int)(((byte)(255)))));
this.btnStopStop.Style.Border = DevComponents.DotNetBar.eBorderType.SingleLine;
this.btnStopStop.Style.BorderColor.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.btnStopStop.Style.ForeColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelText;
this.btnStopStop.Style.GradientAngle = 90;
this.btnStopStop.StyleMouseDown.Alignment = System.Drawing.StringAlignment.Center;
this.btnStopStop.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center;
this.btnStopStop.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.btnStopStop.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.btnStopStop.StyleMouseOver.ForeColor.Color = System.Drawing.Color.White;
this.btnStopStop.TabIndex = 853;
this.btnStopStop.Text = "停止查询";
this.btnStopStop.Click += new System.EventHandler(this.btnStopStop_Click);
//
// btnSaveDb
//
this.btnSaveDb.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnSaveDb.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
this.btnSaveDb.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnSaveDb.DisabledBackColor = System.Drawing.Color.Empty;
this.btnSaveDb.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnSaveDb.Location = new System.Drawing.Point(1814, 58);
this.btnSaveDb.Name = "btnSaveDb";
this.btnSaveDb.Size = new System.Drawing.Size(83, 23);
this.btnSaveDb.Style.Alignment = System.Drawing.StringAlignment.Center;
this.btnSaveDb.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.btnSaveDb.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.btnSaveDb.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder;
this.btnSaveDb.Style.BorderDashStyle = System.Drawing.Drawing2D.DashStyle.Dash;
this.btnSaveDb.Style.BorderSide = DevComponents.DotNetBar.eBorderSide.None;
this.btnSaveDb.Style.ForeColor.Color = System.Drawing.Color.White;
this.btnSaveDb.Style.GradientAngle = 90;
this.btnSaveDb.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center;
this.btnSaveDb.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255)))));
this.btnSaveDb.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255)))));
this.btnSaveDb.TabIndex = 831;
this.btnSaveDb.Text = "详情入库";
this.btnSaveDb.Click += new System.EventHandler(this.btnSaveDb_Click);
//
// btnGetDetail
//
this.btnGetDetail.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnGetDetail.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
this.btnGetDetail.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnGetDetail.DisabledBackColor = System.Drawing.Color.Empty;
this.btnGetDetail.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnGetDetail.Location = new System.Drawing.Point(1729, 58);
this.btnGetDetail.Name = "btnGetDetail";
this.btnGetDetail.Size = new System.Drawing.Size(83, 23);
this.btnGetDetail.Style.Alignment = System.Drawing.StringAlignment.Center;
this.btnGetDetail.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.btnGetDetail.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.btnGetDetail.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder;
this.btnGetDetail.Style.BorderDashStyle = System.Drawing.Drawing2D.DashStyle.Dash;
this.btnGetDetail.Style.BorderSide = DevComponents.DotNetBar.eBorderSide.None;
this.btnGetDetail.Style.ForeColor.Color = System.Drawing.Color.White;
this.btnGetDetail.Style.GradientAngle = 90;
this.btnGetDetail.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center;
this.btnGetDetail.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255)))));
this.btnGetDetail.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255)))));
this.btnGetDetail.TabIndex = 827;
this.btnGetDetail.Text = "采集详情";
this.btnGetDetail.Click += new System.EventHandler(this.btnGetDetail_Click);
//
// statusBar
//
this.statusBar.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.statusBar.BackColor = System.Drawing.Color.White;
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(817, 60);
this.statusBar.Margin = new System.Windows.Forms.Padding(0);
this.statusBar.Name = "statusBar";
this.statusBar.Size = new System.Drawing.Size(740, 25);
this.statusBar.TabIndex = 823;
//
// label4
//
this.label4.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(1015, 8);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(44, 17);
this.label4.TabIndex = 810;
this.label4.Text = "结束页";
//
// txtPageEnd
//
this.txtPageEnd.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.txtPageEnd.Location = new System.Drawing.Point(1059, 5);
this.txtPageEnd.Name = "txtPageEnd";
this.txtPageEnd.Size = new System.Drawing.Size(43, 23);
this.txtPageEnd.TabIndex = 809;
this.txtPageEnd.Text = "9999";
this.txtPageEnd.TextChanged += new System.EventHandler(this.txtPageEnd_TextChanged);
//
// txtPageStart
//
this.txtPageStart.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.txtPageStart.Location = new System.Drawing.Point(966, 5);
this.txtPageStart.Name = "txtPageStart";
this.txtPageStart.Size = new System.Drawing.Size(43, 23);
this.txtPageStart.TabIndex = 808;
this.txtPageStart.Text = "1";
this.txtPageStart.TextChanged += new System.EventHandler(this.txtPageStart_TextChanged);
//
// label3
//
this.label3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(922, 8);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(44, 17);
this.label3.TabIndex = 807;
this.label3.Text = "起始页";
//
// btnCollect
//
this.btnCollect.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnCollect.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
this.btnCollect.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnCollect.DisabledBackColor = System.Drawing.Color.Empty;
this.btnCollect.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnCollect.Location = new System.Drawing.Point(1644, 58);
this.btnCollect.Name = "btnCollect";
this.btnCollect.Size = new System.Drawing.Size(83, 23);
this.btnCollect.Style.Alignment = System.Drawing.StringAlignment.Center;
this.btnCollect.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.btnCollect.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.btnCollect.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder;
this.btnCollect.Style.BorderDashStyle = System.Drawing.Drawing2D.DashStyle.Dash;
this.btnCollect.Style.BorderSide = DevComponents.DotNetBar.eBorderSide.None;
this.btnCollect.Style.ForeColor.Color = System.Drawing.Color.White;
this.btnCollect.Style.GradientAngle = 90;
this.btnCollect.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center;
this.btnCollect.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255)))));
this.btnCollect.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255)))));
this.btnCollect.TabIndex = 794;
this.btnCollect.Text = "采集列表";
this.btnCollect.Click += new System.EventHandler(this.btnCollect_Click);
//
// line1
//
this.line1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.line1.ForeColor = System.Drawing.SystemColors.AppWorkspace;
this.line1.Location = new System.Drawing.Point(796, 7);
this.line1.Name = "line1";
this.line1.Size = new System.Drawing.Size(25, 74);
this.line1.TabIndex = 790;
this.line1.Text = "line1";
this.line1.VerticalLine = true;
//
// txtSupplierName
//
this.txtSupplierName.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.txtSupplierName.Location = new System.Drawing.Point(1292, 5);
this.txtSupplierName.Name = "txtSupplierName";
this.txtSupplierName.ReadOnly = true;
this.txtSupplierName.Size = new System.Drawing.Size(605, 23);
this.txtSupplierName.TabIndex = 788;
//
// txtFilterSaleCount
//
this.txtFilterSaleCount.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.txtFilterSaleCount.Location = new System.Drawing.Point(1199, 5);
this.txtFilterSaleCount.Name = "txtFilterSaleCount";
this.txtFilterSaleCount.Size = new System.Drawing.Size(43, 23);
this.txtFilterSaleCount.TabIndex = 787;
this.txtFilterSaleCount.Text = "100";
this.txtFilterSaleCount.TextChanged += new System.EventHandler(this.txtFilterSaleCount_TextChanged);
//
// btnRefreshCookie
//
this.btnRefreshCookie.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
@@ -235,7 +693,7 @@ namespace TemuKJD.ToolForms
this.btnRefreshCookie.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnRefreshCookie.DisabledBackColor = System.Drawing.Color.Empty;
this.btnRefreshCookie.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnRefreshCookie.Location = new System.Drawing.Point(970, 3);
this.btnRefreshCookie.Location = new System.Drawing.Point(671, 57);
this.btnRefreshCookie.Name = "btnRefreshCookie";
this.btnRefreshCookie.Size = new System.Drawing.Size(125, 25);
this.btnRefreshCookie.Style.Alignment = System.Drawing.StringAlignment.Center;
@@ -250,19 +708,20 @@ namespace TemuKJD.ToolForms
this.btnRefreshCookie.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255)))));
this.btnRefreshCookie.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255)))));
this.btnRefreshCookie.TabIndex = 776;
this.btnRefreshCookie.Text = "刷新cookie";
this.btnRefreshCookie.Text = "更新网页cookie";
this.btnRefreshCookie.Click += new System.EventHandler(this.btnRefreshCookie_Click);
//
// txtCookie
//
this.txtCookie.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.txtCookie.Location = new System.Drawing.Point(0, 4);
this.txtCookie.Location = new System.Drawing.Point(4, 4);
this.txtCookie.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.txtCookie.Multiline = true;
this.txtCookie.Name = "txtCookie";
this.txtCookie.Size = new System.Drawing.Size(711, 104);
this.txtCookie.Size = new System.Drawing.Size(664, 78);
this.txtCookie.TabIndex = 766;
this.txtCookie.Text = "填写cookie后点击导入cookie并刷新";
//
// btnSaveCookie
//
@@ -271,7 +730,7 @@ namespace TemuKJD.ToolForms
this.btnSaveCookie.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnSaveCookie.DisabledBackColor = System.Drawing.Color.Empty;
this.btnSaveCookie.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnSaveCookie.Location = new System.Drawing.Point(842, 3);
this.btnSaveCookie.Location = new System.Drawing.Point(671, 30);
this.btnSaveCookie.Name = "btnSaveCookie";
this.btnSaveCookie.Size = new System.Drawing.Size(125, 25);
this.btnSaveCookie.Style.Alignment = System.Drawing.StringAlignment.Center;
@@ -296,7 +755,7 @@ namespace TemuKJD.ToolForms
this.btnImportCookie.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnImportCookie.DisabledBackColor = System.Drawing.Color.Empty;
this.btnImportCookie.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnImportCookie.Location = new System.Drawing.Point(714, 3);
this.btnImportCookie.Location = new System.Drawing.Point(671, 3);
this.btnImportCookie.Name = "btnImportCookie";
this.btnImportCookie.Size = new System.Drawing.Size(125, 25);
this.btnImportCookie.Style.Alignment = System.Drawing.StringAlignment.Center;
@@ -314,21 +773,21 @@ namespace TemuKJD.ToolForms
this.btnImportCookie.Text = "导入cookie并刷新";
this.btnImportCookie.Click += new System.EventHandler(this.btnImportCookie_Click);
//
// tabPage2
// label2
//
this.tabPage2.Location = new System.Drawing.Point(4, 22);
this.tabPage2.Name = "tabPage2";
this.tabPage2.Padding = new System.Windows.Forms.Padding(3);
this.tabPage2.Size = new System.Drawing.Size(1101, 532);
this.tabPage2.TabIndex = 1;
this.tabPage2.Text = "商品列表";
this.tabPage2.UseVisualStyleBackColor = true;
this.label2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(1248, 8);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(44, 17);
this.label2.TabIndex = 789;
this.label2.Text = "供应商";
//
// GetJuShuitanProdForm
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.ClientSize = new System.Drawing.Size(1109, 558);
this.Controls.Add(this.tabControl1);
this.ClientSize = new System.Drawing.Size(1904, 561);
this.Controls.Add(this.splitContainer1);
this.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.Name = "GetJuShuitanProdForm";
this.Text = "获取厂商产品";
@@ -337,9 +796,11 @@ namespace TemuKJD.ToolForms
this.tabPage1.ResumeLayout(false);
this.splitContainer2.Panel1.ResumeLayout(false);
this.splitContainer2.Panel1.PerformLayout();
this.splitContainer2.Panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).EndInit();
this.splitContainer2.ResumeLayout(false);
this.tabPage2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.pbLoading)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.dgvProduct)).EndInit();
this.splitContainer1.Panel1.ResumeLayout(false);
this.splitContainer1.Panel2.ResumeLayout(false);
this.splitContainer1.Panel2.PerformLayout();
@@ -368,5 +829,36 @@ namespace TemuKJD.ToolForms
private DevComponents.DotNetBar.PanelEx btnSaveCookie;
private DevComponents.DotNetBar.PanelEx btnImportCookie;
private DevComponents.DotNetBar.PanelEx btnRefreshCookie;
private System.Windows.Forms.TextBox txtFilterSaleCount;
private System.Windows.Forms.TextBox txtSupplierName;
private System.Windows.Forms.Label label2;
private DevComponents.DotNetBar.PanelEx btnCollect;
private DevComponents.DotNetBar.Controls.Line line1;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.TextBox txtPageEnd;
private System.Windows.Forms.TextBox txtPageStart;
private System.Windows.Forms.Label label3;
private UserComponent.DataGridViewEx dgvProduct;
private System.Windows.Forms.PictureBox pbLoading;
private DevComponents.DotNetBar.PanelEx btnSaveDb;
private DevComponents.DotNetBar.PanelEx btnGetDetail;
private UserControls.StatusBarUserControl statusBar;
private DevComponents.DotNetBar.PanelEx btnStopStop;
private System.Windows.Forms.ComboBox cmbSaleCount;
private System.Windows.Forms.DataGridViewCheckBoxColumn colCheck;
private System.Windows.Forms.DataGridViewTextBoxColumn colProductId;
private System.Windows.Forms.DataGridViewTextBoxColumn colImgUrl;
private System.Windows.Forms.DataGridViewImageColumn colImg;
private System.Windows.Forms.DataGridViewTextBoxColumn colGoodsName;
private System.Windows.Forms.DataGridViewTextBoxColumn colHotValue;
private System.Windows.Forms.DataGridViewTextBoxColumn colSales30;
private System.Windows.Forms.DataGridViewTextBoxColumn colCate;
private System.Windows.Forms.DataGridViewTextBoxColumn colPrice;
private System.Windows.Forms.DataGridViewLinkColumn colDel;
private System.Windows.Forms.DataGridViewTextBoxColumn colMsg;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.ComboBox cmbPlatformType;
private UserComponent.UcCheckBox chkOverride;
private UserComponent.UcCheckBox chkSkip;
}
}
+730 -2
View File
@@ -1,8 +1,11 @@
using AllBase;
using AllBase.Model.Result;
using CefSharp;
using CefSharp.WinForms;
using NaiBa.CefHelper;
using NaiBa.CefHelper.Handler;
using NaiBa.Util;
using NaiBa.Util.Extension;
using System;
using System.Collections.Generic;
using System.ComponentModel;
@@ -14,6 +17,8 @@ using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
using TemuKJD.BaseForms;
using TemuKJD.BLL;
using TemuKJD.Extension;
using TemuKJD.Helper;
using Work;
@@ -21,9 +26,20 @@ namespace TemuKJD.ToolForms
{
public partial class GetJuShuitanProdForm : BaseForms.BaseForm
{
public CancellationTokenSource cancellationTokenSource { get; set; } = null;
string InitUrl = "https://sc.scm121.com/suppliersManage/suppliersList/onlineSuppliers";
public ChromiumWebBrowser cefWebBrowser = null;
private string currentUrl = "";
private string currentGetListData = "";
private string currentSupplierName = "";
private string appVersion = "";
private string currentSupplierId = "";
int pageStart = 1;
int pageEnd = 9999;
int filterSaleCountDays = 7;
int filterSaleCount = 100;
string platformType = "Pinduoduo";
ConcurrentList<JSTListProductInfo> lstJSTListProductInfo = new ConcurrentList<JSTListProductInfo>();
public GetJuShuitanProdForm()
{
@@ -32,6 +48,56 @@ namespace TemuKJD.ToolForms
private void GetJuShuitanProdForm_Load(object sender, EventArgs e)
{
this.splitContainer1.SplitterDistance = 472;
this.dgvProduct.AddSelectorColumn("colCheck");
this.dgvProduct.AddImgColumn("colImg", "colImgUrl");
var tmpProductLst = NaiBa.Util.Helper.ConfigHelper.LoadConfig<List<JSTListProductInfo>>("supplier_product_list_" + MainForm.ProcessCount);
if (tmpProductLst == null)
tmpProductLst = new List<JSTListProductInfo>();
lstJSTListProductInfo.AddRange(tmpProductLst);
pbLoading.Visible = true;
Task.Run(() =>
{
int id = 0;
foreach (var prod in lstJSTListProductInfo)
{
id++;
if (id % 50 == 0)
Thread.Sleep(1);
Invoke(new Action(() =>
{
var rowId = this.dgvProduct.Rows.Add(
true,
prod.id,
(prod.itemMainImage?.FirstOrDefault()).ParseToString().Replace("https://", "http://"),
DataGridViewExtension.defaultBitmap,
prod.itemName,
prod.saleSeven,
prod.saleThirty,
prod.categoryName.IsNullOrEmpty() ? prod?.dbProduct?.cat_id : prod.categoryName,
(prod?.dbProduct?.price_text).IsNullOrEmpty() ? "预估:" + prod.minSalesPrice + " 采集详情后显示实际值" : prod.dbProduct.price_text,
"删除",
prod.getProductMsg
);
dgvProduct.Rows[rowId].Height = 60;
//if (chanceProductResult.dbProduct != null)
//{
// var dbProd = chanceProductResult.dbProduct;
// var row = dgvChanceProduct.Rows[rowId];
// row.Cells["colGoodsName"].Value = dbProd.product_name;
// row.Cells["colCate"].Value = dbProd.cat_name;
// row.Cells["colPrice"].Value = dbProd.price_text;
//}
}));
}
Invoke(new Action(() =>
{
pbLoading.Visible = false;
}));
});
InitCef();
}
@@ -56,7 +122,7 @@ namespace TemuKJD.ToolForms
Invoke(new Action(() =>
{
splitContainer1.Panel1.Controls.Add(cefWebBrowser);
splitContainer2.Panel2.Controls.Add(cefWebBrowser);
//cefWebBrowser.Load(shopMainUrl);
}));
}
@@ -107,6 +173,23 @@ namespace TemuKJD.ToolForms
private void RequestHandler_ResourceLoadComplete(object sender, string url, string postData, string responseData, IRequest request)
{
if (url.Contains("api/goods/buyer/supplier/goods/list"))
{
if (request.Headers.AllKeys.Contains("App-Version"))
appVersion = request.Headers["App-Version"];
Task.Run(() => { GetCurrentSearchData(postData, responseData, request); });
}
}
void GetCurrentSearchData(string postData, string responseData, IRequest request)
{
currentGetListData = postData;
currentSupplierId = BaseRegex.GetStringJson(ref postData, "supplierId");
currentSupplierName = BaseRegex.GetStringJson(ref responseData, "supplierName");
Invoke(new Action(() => {
txtSupplierName.Text = currentSupplierName;
}));
}
private bool RequestHandler_BeforeResourceLoad(object sender, string url, string postData, IRequest request)
@@ -156,7 +239,652 @@ namespace TemuKJD.ToolForms
private void btnRefreshCookie_Click(object sender, EventArgs e)
{
//var result = GetHtml.PostUtf8("https://api.weixin.qq.com/shop/ec/basics/img/upload?access_token=100_Kn3u6mev0uip-WUPSgxXWHrHldjOP0Ewjw8n18LmGcq2pWbjn4BJukPkGZt0gzgJ1Hd6bRM2TXUDTEhwM7VULSl_P-pVHSVPHlE6ZvdXfD6djB1f2WEibY7jWaZLaD24cBUxLM-mSGxjR7i7IBBeAHDOHH&upload_type=http://img.alicdn.com/imgextra/i2/2215107627344/O1CN01eM6hZu247bV94MWKH_!!2215107627344.jpg&resp_type=1", "");
//
InitCef();
}
private void btnPrev_Click(object sender, EventArgs e)
{
cefWebBrowser.Back();
}
private void btnNext_Click(object sender, EventArgs e)
{
cefWebBrowser.Forward();
}
private void txtAddress_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter)
{
if (cefWebBrowser != null)
{
cefWebBrowser.Load(txtAddress.Text);
}
}
}
private void dgvProduct_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
if (e.ColumnIndex < 0 || e.RowIndex < 0)
return;
string headerText = dgvProduct.Columns[e.ColumnIndex].HeaderText;
var prodId = dgvProduct.Rows[e.RowIndex].Cells["colProductId"].Value.ParseToString();
var prod = lstJSTListProductInfo.FirstOrDefault(p => p.id == prodId);
var row = dgvProduct.Rows[e.RowIndex];
switch (headerText)
{
case "删除":
//if (BaseMsgForm.ShowConfirm("确定删除商品吗?删除后不可恢复!").DialogResult == DialogResult.Cancel)
// return;
//DeleteProduct(dbId);
dgvProduct.Rows.Remove(row);
lstJSTListProductInfo.Remove(prod);
NaiBa.Util.Helper.ConfigHelper.SaveConfig("supplier_product_list_" + MainForm.ProcessCount, lstJSTListProductInfo);
break;
case "图片":
var imgUrl = dgvProduct.Rows[e.RowIndex].Cells["colImgUrl"].Value.ParseToString().Replace("?imageView2/2/w/90/h/90", "");
Dictionary<string, string> dic = new Dictionary<string, string>();
dic[imgUrl] = imgUrl;
foreach (var imgPath in prod.itemMainImage)
{
dic[imgPath.Replace("https", "http")] = imgPath.Replace("https", "http");
}
ShowImgForm imgFrom = new ShowImgForm(imgUrl, dic);
imgFrom.ShowDialog();
break;
case "":
dgvProduct.Rows[e.RowIndex].Cells["colCheck"].Value = !(bool)dgvProduct.Rows[e.RowIndex].Cells["colCheck"].Value;
break;
default:
break;
}
}
private void btnCollect_Click(object sender, EventArgs e)
{
if (string.IsNullOrEmpty(currentGetListData))
{
BaseMsgForm.ShowError("请在网页上选择要搜索的供应商商品列表页面");
return;
}
this.pbLoading.Visible = true;
dgvProduct.Rows.Clear();
lstJSTListProductInfo.Clear();
if (cancellationTokenSource == null || cancellationTokenSource.IsCancellationRequested)
cancellationTokenSource = new CancellationTokenSource();
Task.Run(() =>
{
try
{
GetProdList();
}
catch (Exception ex)
{
BaseMsgForm.ShowError(ex.Message);
}
Invoke(new Action(() =>
{
this.pbLoading.Visible = false;
//this.statusBar.lblTaskStatus.Text = "正在删除...";
}));
}, cancellationTokenSource.Token);
}
void GetProdList()
{
List<Cookie> cookieList = CEFBrowser.GetCookieList(".scm121.com", cefWebBrowser.GetCookieManager(null));
var shop = new ShopLoginInfo();
shop.Cookies = JsonHelper.SerializeObject(cookieList);
var Jobj = JsonHelper.JObjectParse(currentGetListData);
Jobj["pageSize"] = 70;
int page = pageStart;
while(page <= pageEnd)
{
if (cancellationTokenSource.IsCancellationRequested)
break;
Jobj["pageNum"] = page;
Jobj["mallSort"] = "SELL_SEVEN";
Jobj["platformType"] = platformType;
Invoke(new Action(() =>
{
this.statusBar.lblTaskStatus.Text = "正在采集第 " + page + " 页";
}));
Thread.Sleep(Randomx.GetId(1000, 2000));
page++;
string url = "https://sc.scm121.com/api/goods/buyer/supplier/goods/list";
string referer = "https://sc.scm121.com/manage/goods/qualitySupplier/detail/" + Jobj["supplierId"] + "?showErpList=1";
var lstRst = JSTHttpResponseBLL.JSTPostResponse(shop, url, JsonHelper.SerializeObject(Jobj), referer, appVersion);
for (int i = 0; i < 3 && !lstRst.Contains("\"success\":true"); i++)
{
Thread.Sleep(Randomx.GetId(1000, 2000));
lstRst = JSTHttpResponseBLL.JSTPostResponse(shop, url, JsonHelper.SerializeObject(Jobj), referer, appVersion);
}
if (!lstRst.Contains("\"success\":true"))
{
var errMsg = BaseRegex.GetStringJson(ref lstRst, "message");
if (string.IsNullOrEmpty(errMsg))
errMsg = lstRst;
BaseMsgForm.ShowError("查询错误:" + errMsg);
return;
}
List<JSTListProductInfo> jstLst = new List<JSTListProductInfo>();
try
{
foreach (var jItem in JsonHelper.JObjectParse(lstRst)["data"])
{
JSTListProductInfo jstProd = JsonHelper.DeserializeJsonToObject<JSTListProductInfo>(JsonHelper.SerializeObject(jItem));
jstProd.jstProductJson = JsonHelper.SerializeObject(jItem);
jstProd.dbProduct = new KJDDBProduct();
jstProd.dbProduct.from_shop_id = jstProd.supplierId;
jstProd.dbProduct.from_shop_name = jstProd.supplierName;
jstProd.dbProduct.offline_supplier_id = jstProd.offlineSupplierId;
jstProd.dbProduct.offline_supplier_name = jstProd.offlineSupplierName;
jstProd.dbProduct.spu_id = jstProd.spuId;
jstProd.dbProduct.skc_id = jstProd.coId;
//jstProd.dbProduct.price_text = jstProd.minSalesPrice.ParseToString();
//jstProd.dbProduct.main_cat_id = jstProd.categoryLv1Id.ParseToString();
//jstProd.dbProduct.main_cat_name = jstProd.mainCategoryName.ParseToString();
//jstProd.dbProduct.cat_id = jstProd.categoryLv3Id.ParseToString();
jstProd.dbProduct.cat_name = jstProd.categoryName.ParseToString();
jstProd.dbProduct.ext_code = jstProd.styleCode;
jstProd.dbProduct.product_name = jstProd.itemName;
jstProd.dbProduct.product_json = "";
jstProd.dbProduct.size_json = "{}";
jstProd.dbProduct.main_img = jstProd.itemMainImage?.FirstOrDefault();
jstProd.dbProduct.sale_count = jstProd.saleSeven;
jstProd.dbProduct.sale_count_text = string.IsNullOrEmpty(jstProd.saleSevenDesensitized) ? jstProd.saleSeven.ParseToString() : jstProd.saleSevenDesensitized;
jstProd.dbProduct.product_get_type_text = "厂商直采";
jstLst.Add(jstProd);
}
if (jstLst.Count <= 0)
break;
// 经销商销量小于设定值,则单品销量肯定小于设定值,退出
//jstLst = jstLst.Where(p => p.supplierSaleSeven >= filterSaleCount).ToList();
//if (jstLst.Count <= 0)
// break;
if (filterSaleCountDays == 7)
jstLst = jstLst.Where(p => p.saleSeven >= filterSaleCount).ToList();
else
jstLst = jstLst.Where(p => p.saleThirty >= filterSaleCount).ToList();
jstLst = jstLst.Where(p => !lstJSTListProductInfo.Any(p1 => p1.id == p.id)).ToList();
lstJSTListProductInfo.AddRange(jstLst);
foreach (var prod in jstLst)
{
Invoke(new Action(() =>
{
var id = dgvProduct.Rows.Add(
true,
prod.id,
(prod.itemMainImage?.FirstOrDefault()).ParseToString().Replace("https://", "http://"),
DataGridViewExtension.defaultBitmap,
prod.itemName,
prod.saleSeven,
prod.saleThirty,
prod.categoryName,
"预估:" + prod.minSalesPrice + " 采集详情后显示实际值",
"删除"
);
dgvProduct.Rows[id].Height = 60;
}));
}
}
catch (Exception ex)
{
Invoke(new Action(() =>
{
this.statusBar.lblTaskStatus.Text = "发生错误 " + ex.Message;
}));
Thread.Sleep(2000);
}
}
Invoke(new Action(() =>
{
BaseMsgForm.ShowInfo("采集完成");
}));
}
private void txtFilterSaleCount_TextChanged(object sender, EventArgs e)
{
filterSaleCount = txtFilterSaleCount.Text.Trim().ParseToInt();
}
private void txtPageStart_TextChanged(object sender, EventArgs e)
{
pageStart = txtPageStart.Text.Trim().ParseToInt();
}
private void txtPageEnd_TextChanged(object sender, EventArgs e)
{
pageEnd = txtPageEnd.Text.Trim().ParseToInt();
}
private void btnStopStop_Click(object sender, EventArgs e)
{
if (cancellationTokenSource != null)
cancellationTokenSource.Cancel();
Task.Run(() =>
{
Thread.Sleep(3000);
Invoke(new Action(() =>
{
if (cancellationTokenSource == null || cancellationTokenSource.IsCancellationRequested)
pbLoading.Visible = false;
}));
});
}
private void btnGetDetail_Click(object sender, EventArgs e)
{
if (platformType == "Pinduoduo")
GetPinDuoduoProd();
else if (platformType == "douyin")
GetDyProd();
}
private void btnSaveDb_Click(object sender, EventArgs e)
{
//"&product_get_type=" + HttpUtility.UrlEncode("厂商直采", Encoding.UTF8);
ConcurrentList<DataGridViewRow> rowLst = new ConcurrentList<DataGridViewRow>();
rowLst.AddRange(dgvProduct.Rows.Cast<DataGridViewRow>().Where(r => r.Cells["colCheck"].Value.ParseToBool() == true));
this.pbLoading.Visible = true;
Task.Run(() =>
{
List<Cookie> cookieList = CEFBrowser.GetCookieList(".scm121.com", cefWebBrowser.GetCookieManager(null));
var shop = new ShopLoginInfo();
shop.Cookies = JsonHelper.SerializeObject(cookieList);
foreach (var row in rowLst)
{
if (cancellationTokenSource.IsCancellationRequested)
break;
var prodId = row.Cells["colProductId"].Value.ParseToString();
var prod = lstJSTListProductInfo.FirstOrDefault(c => c.id == prodId);
if (prod == null || prod.dbProduct == null || prod.dbProduct.product_json.Length < 10)
continue;
var dbProd = prod.dbProduct;
bool isExist = false;
var existUrl = BaseClass.BuildObjString("product/get_product_list");
string existData = UserLogin.GetSignaturex() + "&search_spu=" + prod.spuId;
string html = GetHtml.PostUtf8(existUrl, existData);
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
html = GetHtml.PostUtf8(existUrl, existData);
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
{
Invoke(new Action(() =>
{
row.Cells["colMsg"].Value = "入库失败,产品数据库连接失败";
}));
continue;
}
else
{
if (html.Contains("\"data\":[") && !html.Contains("\"data\":[]"))
isExist = true;
}
var SetPartnerSpuRst = "";
var url = BaseClass.BuildObjString("product/add_product");
if (isExist)
{
if (chkOverride.Checked)
{
url = BaseClass.BuildObjString("product/mdy_product");
}
else
{
Invoke(new Action(() =>
{
row.Cells["colMsg"].Value = "已存在相同id商品,跳过";
}));
continue;
}
}
else
{
SetPartnerSpuRst = SetPartnerSpu(shop, prod);
//{"success":true,"total":null,"data":{"message":"成功添加1款分销商品,系统会自动按商品拆分订单并推送给对应供应商","count":1,"shelvesType":"DISTRIBUTION"},"message":null,"code":"0000","hasNext":false,"now":1769330182209,"extra":{}}
}
var data = Work.UserLogin.GetSignaturex() +
"&from_shop_id=" + prod.dbProduct.from_shop_id +
"&from_shop_name=" + prod.dbProduct.from_shop_name +
"&offline_supplier_id=" + prod.dbProduct.offline_supplier_id +
"&offline_supplier_name=" + prod.dbProduct.offline_supplier_name +
"&spu_id=" + prod.dbProduct.spu_id.ParseToString() +
"&skc_id=" + prod.dbProduct.skc_id.ParseToString() +
"&price_text=" + prod.dbProduct.price_text +
"&main_cat_id=" + prod.dbProduct.main_cat_id +
"&main_cat_name=" + HttpUtility.UrlEncode(prod.dbProduct.main_cat_name.ParseToString(), Encoding.UTF8) +
"&cat_id=" + prod.dbProduct.cat_id +
"&cat_name=" + HttpUtility.UrlEncode((prod.dbProduct.cat_name ?? prod.categoryName).ParseToString(), Encoding.UTF8) +
"&ext_code=" + HttpUtility.UrlEncode(prod.dbProduct.ext_code, Encoding.UTF8) +
"&product_name=" + HttpUtility.UrlEncode(prod.dbProduct.product_name, Encoding.UTF8) +
"&product_json=" + HttpUtility.UrlEncode(dbProd.product_json, Encoding.UTF8) +
"&size_json=" + HttpUtility.UrlEncode(dbProd.size_json, Encoding.UTF8) +
"&main_img=" + HttpUtility.UrlEncode(dbProd.main_img, Encoding.UTF8) +
"&product_get_type=" + HttpUtility.UrlEncode("厂商直采", Encoding.UTF8);
if (SetPartnerSpuRst.Contains("\"success\":true"))
{
data += "&distribution_set=1";
}
if (dbProd.main_cat_id == "15543" || dbProd.main_cat_name == "书籍/杂志/报纸")
{
data += "&special_prod_type=" + HttpUtility.UrlEncode("书籍", Encoding.UTF8);
}
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"))
{
string msg = "商品入库失败!请检查网络连接:" + BaseRegex.GetStringJson(ref html, "msg");
Invoke(new Action(() =>
{
row.Cells["colMsg"].Value = msg;
}));
}
else
{
string msg = "商品入库成功!";
Invoke(new Action(() =>
{
row.Cells["colMsg"].Value = msg;
}));
}
}
Invoke(new Action(() =>
{
this.pbLoading.Visible = false;
BaseMsgForm.ShowInfo("商品入库完毕!");
}));
}, cancellationTokenSource.Token);
}
private void cmbSaleCount_SelectedIndexChanged(object sender, EventArgs e)
{
}
private void cmbSaleCount_TextChanged(object sender, EventArgs e)
{
if (cmbSaleCount.Text == "7日销量≥")
filterSaleCountDays = 7;
else
filterSaleCountDays = 30;
}
private void cmbPlatformType_SelectedIndexChanged(object sender, EventArgs e)
{
//["TouTiaoFXG","Taobao","Pinduoduo","WXChannel"]
if (cmbPlatformType.Text == "抖音")
{
platformType = "douyin";
}
else if (cmbPlatformType.Text == "淘宝")
{
platformType = "Taobao";
}
else if (cmbPlatformType.Text == "微信")
{
platformType = "WXChannel";
}
else
{
platformType = "Pinduoduo";
}
}
private void GetPinDuoduoProd()
{
//https://sc.scm121.com/api/goods/goods/goGoodsPdd/queryBaseData?itemSpuId=26903724F0044AC5976D098842D919E3&shelvesType=DISTRIBUTION&originator=SUPPLIER&itemCoId=14202245
//https://sc.scm121.com/manage/goods/qualitySupplier/detail/93D12D2BD21649DC8240E2265BE37E2A?showErpList=1
this.pbLoading.Visible = true;
if (cancellationTokenSource == null || cancellationTokenSource.IsCancellationRequested)
cancellationTokenSource = new CancellationTokenSource();
Task.Run(() =>
{
List<Cookie> cookieList = CEFBrowser.GetCookieList(".scm121.com", cefWebBrowser.GetCookieManager(null));
var shop = new ShopLoginInfo();
shop.Cookies = JsonHelper.SerializeObject(cookieList);
ConcurrentList<DataGridViewRow> rowLst = new ConcurrentList<DataGridViewRow>();
rowLst.AddRange(dgvProduct.Rows.Cast<DataGridViewRow>());
foreach (DataGridViewRow row in rowLst)
{
if (cancellationTokenSource.IsCancellationRequested)
break;
if (row.Index < 0 || row.Cells["colCheck"].Value.ParseToBool() != true)
continue;
var prodId = row.Cells["colProductId"].Value.ParseToString();
var prod = lstJSTListProductInfo.FirstOrDefault(c => c.id == prodId);
// 不存在或已经采集过
if (prod == null || prod?.dbProduct?.product_json?.ParseToString().Length > 10)
continue;
Thread.Sleep(Randomx.GetId(500, 1500));
if (chkSkip.Checked)
{
bool isExist = false;
var existUrl = BaseClass.BuildObjString("product/get_product_list");
string existData = UserLogin.GetSignaturex() + "&search_spu=" + prod.spuId;
string html = GetHtml.PostUtf8(existUrl, existData);
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
html = GetHtml.PostUtf8(existUrl, existData);
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
{
//Invoke(new Action(() =>
//{
// row.Cells["colMsg"].Value = "采集详情失败,产品数据库连接失败";
//}));
//continue;
}
else
{
if (html.Contains("\"data\":[") && !html.Contains("\"data\":[]"))
isExist = true;
}
prod.getProductMsg = "商品已存在,跳过详情采集";
if (isExist)
{
try { row.Cells["colMsg"].Value = prod.getProductMsg; } catch { }
continue;
}
}
string url = "https://sc.scm121.com/api/goods/goods/goGoodsPdd/queryBaseData?itemSpuId=" + prod.itemSpuId + "&shelvesType=DISTRIBUTION&originator=SUPPLIER&itemCoId=" + prod.itemCoId;
string referer = "https://sc.scm121.com/manage/goods/qualitySupplier/detail/" + prod.supplierId + "?showErpList=1";
var getDetailRst = JSTHttpResponseBLL.JSTGetResponse(shop, url, referer, appVersion);
if (!getDetailRst.Contains("\"success\":true"))
getDetailRst = JSTHttpResponseBLL.JSTGetResponse(shop, url, referer, appVersion);
if (!getDetailRst.Contains("\"success\":true"))
{
var errMsg = BaseRegex.GetStringJson(ref getDetailRst, "message");
if (string.IsNullOrEmpty(errMsg))
errMsg = getDetailRst;
prod.getProductMsg = "采集失败 " + errMsg;
Invoke(new Action(() =>
{
try { row.Cells["colMsg"].Value = prod.getProductMsg; } catch { }
}));
continue;
}
try
{
var jObj = JsonHelper.JObjectParse(getDetailRst)["data"];
prod.dbProduct.cat_id = jObj["catId"].ParseToString();
prod.dbProduct.main_cat_id = jObj["categoryData"].FirstOrDefault().ParseToString();
prod.dbProduct.product_json = "{\"pddData\":" + JsonHelper.SerializeObject(jObj) + ",\"jstProd\":" + prod.jstProductJson + "}";
var priceMin = jObj["skuInfo"]["goodsSkuDetail"].Min(s => s["supplyPrice"].ParseToDecimal());
var priceMax = jObj["skuInfo"]["goodsSkuDetail"].Max(s => s["supplyPrice"].ParseToDecimal());
prod.dbProduct.price_text = priceMin + "-" + priceMax;
prod.getProductMsg = "采集成功";
Invoke(new Action(() =>
{
row.Cells["colMsg"].Value = prod.getProductMsg;
row.Cells["colCate"].Value = prod.categoryName.IsNullOrEmpty() ? prod?.dbProduct?.cat_id : prod.categoryName;
row.Cells["colPrice"].Value = prod.dbProduct.price_text;
}));
}
catch (Exception ex)
{
prod.getProductMsg = "采集失败 " + ex.Message;
Invoke(new Action(() =>
{
try { row.Cells["colMsg"].Value = prod.getProductMsg; } catch { }
}));
}
if (rowLst.IndexOf(row) % 20 == 0 )
NaiBa.Util.Helper.ConfigHelper.SaveConfig("supplier_product_list_" + MainForm.ProcessCount, lstJSTListProductInfo);
}
NaiBa.Util.Helper.ConfigHelper.SaveConfig("supplier_product_list_" + MainForm.ProcessCount, lstJSTListProductInfo);
Invoke(new Action(() =>
{
BaseMsgForm.ShowInfo("采集完成");
pbLoading.Visible = false;
}));
}, cancellationTokenSource.Token);
}
private void GetDyProd()
{
this.pbLoading.Visible = true;
if (cancellationTokenSource == null || cancellationTokenSource.IsCancellationRequested)
cancellationTokenSource = new CancellationTokenSource();
Task.Run(() =>
{
List<Cookie> cookieList = CEFBrowser.GetCookieList(".scm121.com", cefWebBrowser.GetCookieManager(null));
var shop = new ShopLoginInfo();
shop.Cookies = JsonHelper.SerializeObject(cookieList);
ConcurrentList<DataGridViewRow> rowLst = new ConcurrentList<DataGridViewRow>();
rowLst.AddRange(dgvProduct.Rows.Cast<DataGridViewRow>());
foreach (DataGridViewRow row in rowLst)
{
if (cancellationTokenSource.IsCancellationRequested)
break;
if (row.Index < 0 || row.Cells["colCheck"].Value.ParseToBool() != true)
continue;
var prodId = row.Cells["colProductId"].Value.ParseToString();
var prod = lstJSTListProductInfo.FirstOrDefault(c => c.id == prodId);
// 不存在或已经采集过
if (prod == null || prod?.dbProduct?.product_json?.ParseToString().Length > 10)
continue;
Thread.Sleep(Randomx.GetId(500, 1500));
if (chkSkip.Checked)
{
bool isExist = false;
var existUrl = BaseClass.BuildObjString("product/get_product_list");
string existData = UserLogin.GetSignaturex() + "&search_spu=" + prod.spuId;
string html = GetHtml.PostUtf8(existUrl, existData);
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
html = GetHtml.PostUtf8(existUrl, existData);
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
{
//Invoke(new Action(() =>
//{
// row.Cells["colMsg"].Value = "采集详情失败,产品数据库连接失败";
//}));
//continue;
}
else
{
if (html.Contains("\"data\":[") && !html.Contains("\"data\":[]"))
isExist = true;
}
if (isExist)
{
prod.getProductMsg = "商品已存在,跳过详情采集";
row.Cells["colMsg"].Value = prod.getProductMsg;
continue;
}
}
string url = "https://sc.scm121.com/api/goods/goods/goGoodsDouyin/queryBaseData?itemSpuId=" + prod.itemSpuId + "&shelvesType=DISTRIBUTION&originator=SUPPLIER&itemCoId=" + prod.itemCoId;
string referer = "https://sc.scm121.com/manage/goods/qualitySupplier/detail/" + prod.supplierId + "?showErpList=1";
var getDetailRst = JSTHttpResponseBLL.JSTGetResponse(shop, url, referer, appVersion);
if (!getDetailRst.Contains("\"success\":true"))
getDetailRst = JSTHttpResponseBLL.JSTGetResponse(shop, url, referer);
if (!getDetailRst.Contains("\"success\":true"))
{
var errMsg = BaseRegex.GetStringJson(ref getDetailRst, "message");
if (string.IsNullOrEmpty(errMsg))
errMsg = getDetailRst;
prod.getProductMsg = "采集失败 " + errMsg;
Invoke(new Action(() =>
{
try { row.Cells["colMsg"].Value = prod.getProductMsg; } catch { }
}));
continue;
}
try
{
var jObj = JsonHelper.JObjectParse(getDetailRst)["data"];
prod.dbProduct.cat_id = jObj["leafCategoryId"].ParseToString();
prod.dbProduct.main_cat_id = jObj["categoryData"].FirstOrDefault().ParseToString();
prod.dbProduct.product_json = "{\"dyData\":" + JsonHelper.SerializeObject(jObj) + ",\"jstProd\":" + prod.jstProductJson + "}";
var priceMin = jObj["skuInfo"]["goodsSkuDetail"].Min(s => s["supplyPrice"].ParseToDecimal());
var priceMax = jObj["skuInfo"]["goodsSkuDetail"].Max(s => s["supplyPrice"].ParseToDecimal());
prod.dbProduct.price_text = priceMin + "-" + priceMax;
prod.getProductMsg = "采集成功";
Invoke(new Action(() =>
{
row.Cells["colMsg"].Value = prod.getProductMsg;
row.Cells["colCate"].Value = prod.categoryName.IsNullOrEmpty() ? prod?.dbProduct?.cat_id : prod.categoryName;
row.Cells["colPrice"].Value = prod.dbProduct.price_text;
}));
}
catch (Exception ex)
{
prod.getProductMsg = "采集失败 " + ex.Message;
Invoke(new Action(() =>
{
try { row.Cells["colMsg"].Value = prod.getProductMsg; } catch { }
}));
}
if (rowLst.IndexOf(row) % 20 == 0)
NaiBa.Util.Helper.ConfigHelper.SaveConfig("supplier_product_list_" + MainForm.ProcessCount, lstJSTListProductInfo);
}
NaiBa.Util.Helper.ConfigHelper.SaveConfig("supplier_product_list_" + MainForm.ProcessCount, lstJSTListProductInfo);
Invoke(new Action(() =>
{
BaseMsgForm.ShowInfo("采集完成");
pbLoading.Visible = false;
}));
}, cancellationTokenSource.Token);
}
public string SetPartnerSpu(ShopLoginInfo shop, JSTListProductInfo jstProd)
{
string url = "https://sc.scm121.com/api/goods/buyer/partnerSpu/add";
string referer = "https://sc.scm121.com/manage/goods/qualitySupplier/detail/" + jstProd.supplierId + "?showErpList=1";
string data = @"{""shelvesType"":""DISTRIBUTION"",""spuIdList"":[{""itemCoId"":""" + jstProd.itemCoId + @""",""spuId"":""" + jstProd.spuId + @"""}],""itemSource"":""GYL""}";
var response = JSTHttpResponseBLL.JSTPostResponse(shop, url, data, referer, appVersion);
return response;
}
}
}
@@ -117,4 +117,37 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="colCheck.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colProductId.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colImgUrl.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colImg.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colGoodsName.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colHotValue.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colSales30.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colCate.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colPrice.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colDel.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colMsg.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
</root>