微信类目获取

This commit is contained in:
wule committed 2026-01-26 22:33:05 +08:00
1 parent c2c4c8da1a
commit ddc5f6490f
24 files changed
+1082 -268

No files matched your search

@@ -48,7 +48,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
if(string.IsNullOrWhiteSpace(dbProd?.product_json))
{
var prodTmp = GetProductDetail(dbProd.id.ToString());
var prodTmp = GetPddProductDetail(dbProd.id.ToString());
if (prodTmp != null)
dbProd = prodTmp;
}
@@ -100,14 +100,14 @@ namespace TemuKJD.PDDForms.ProductSelectForms
imgFrom.ShowDialog();
}
public KJDDBProduct GetProductDetail(string prodDbId)
public static KJDDBProduct GetPddProductDetail(string prodDbId)
{
if (string.IsNullOrEmpty(prodDbId))
return new KJDDBProduct();
List<KJDDBProduct> list = new List<KJDDBProduct>();
var url = BaseClass.BuildObjString("product/get_product_detail_list");
var url = BaseClass.BuildPDDObjString("product/get_product_detail_list");
var data = "";
data = UserLogin.GetSignaturex() + "&search_db_ids=" + prodDbId;
@@ -37,8 +37,12 @@ namespace TemuKJD.PDDForms.ProductSelectForms
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle6 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle7 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle8 = new System.Windows.Forms.DataGridViewCellStyle();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(PDDDBProdListForm));
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.cmbWxCat = new System.Windows.Forms.ComboBox();
this.label12 = new System.Windows.Forms.Label();
this.btnGetProdWxCate = new DevComponents.DotNetBar.PanelEx();
this.cmbSetWxSafe = new System.Windows.Forms.ComboBox();
this.btnSetWxSafe = new DevComponents.DotNetBar.PanelEx();
this.btnImport = new DevComponents.DotNetBar.PanelEx();
@@ -77,6 +81,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
this.btnSetGroup = new DevComponents.DotNetBar.PanelEx();
this.label7 = new System.Windows.Forms.Label();
this.splitContainer2 = new System.Windows.Forms.SplitContainer();
this.btnGetAllCate = new DevComponents.DotNetBar.PanelEx();
this.pnlEditExtCodePrice = new System.Windows.Forms.Panel();
this.lblExtCode = new System.Windows.Forms.Label();
this.panel2 = new System.Windows.Forms.Panel();
@@ -148,6 +153,9 @@ namespace TemuKJD.PDDForms.ProductSelectForms
//
// splitContainer1.Panel1
//
this.splitContainer1.Panel1.Controls.Add(this.cmbWxCat);
this.splitContainer1.Panel1.Controls.Add(this.label12);
this.splitContainer1.Panel1.Controls.Add(this.btnGetProdWxCate);
this.splitContainer1.Panel1.Controls.Add(this.cmbSetWxSafe);
this.splitContainer1.Panel1.Controls.Add(this.btnSetWxSafe);
this.splitContainer1.Panel1.Controls.Add(this.btnImport);
@@ -171,6 +179,57 @@ namespace TemuKJD.PDDForms.ProductSelectForms
this.splitContainer1.SplitterDistance = 76;
this.splitContainer1.TabIndex = 1;
//
// cmbWxCat
//
this.cmbWxCat.Anchor = System.Windows.Forms.AnchorStyles.Right;
this.cmbWxCat.FormattingEnabled = true;
this.cmbWxCat.Items.AddRange(new object[] {
"",
"有",
"无"});
this.cmbWxCat.Location = new System.Drawing.Point(676, 9);
this.cmbWxCat.Margin = new System.Windows.Forms.Padding(0, 3, 3, 3);
this.cmbWxCat.Name = "cmbWxCat";
this.cmbWxCat.Size = new System.Drawing.Size(49, 25);
this.cmbWxCat.TabIndex = 802;
this.cmbWxCat.Text = "无";
//
// label12
//
this.label12.Anchor = System.Windows.Forms.AnchorStyles.Right;
this.label12.AutoSize = true;
this.label12.Location = new System.Drawing.Point(619, 13);
this.label12.Margin = new System.Windows.Forms.Padding(3, 0, 0, 0);
this.label12.Name = "label12";
this.label12.Size = new System.Drawing.Size(68, 17);
this.label12.TabIndex = 801;
this.label12.Text = "微信类目:";
//
// btnGetProdWxCate
//
this.btnGetProdWxCate.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnGetProdWxCate.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
this.btnGetProdWxCate.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnGetProdWxCate.DisabledBackColor = System.Drawing.Color.Empty;
this.btnGetProdWxCate.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnGetProdWxCate.Location = new System.Drawing.Point(731, 9);
this.btnGetProdWxCate.Name = "btnGetProdWxCate";
this.btnGetProdWxCate.Size = new System.Drawing.Size(84, 25);
this.btnGetProdWxCate.Style.Alignment = System.Drawing.StringAlignment.Center;
this.btnGetProdWxCate.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.btnGetProdWxCate.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.btnGetProdWxCate.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder;
this.btnGetProdWxCate.Style.BorderDashStyle = System.Drawing.Drawing2D.DashStyle.Dash;
this.btnGetProdWxCate.Style.BorderSide = DevComponents.DotNetBar.eBorderSide.None;
this.btnGetProdWxCate.Style.ForeColor.Color = System.Drawing.Color.White;
this.btnGetProdWxCate.Style.GradientAngle = 90;
this.btnGetProdWxCate.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center;
this.btnGetProdWxCate.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255)))));
this.btnGetProdWxCate.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255)))));
this.btnGetProdWxCate.TabIndex = 781;
this.btnGetProdWxCate.Text = "微信类目识别";
this.btnGetProdWxCate.Click += new System.EventHandler(this.btnGetProdWxCate_Click);
//
// cmbSetWxSafe
//
this.cmbSetWxSafe.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
@@ -180,7 +239,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
"安全商品",
"违规商品",
"未校验"});
this.cmbSetWxSafe.Location = new System.Drawing.Point(750, 44);
this.cmbSetWxSafe.Location = new System.Drawing.Point(861, 43);
this.cmbSetWxSafe.Margin = new System.Windows.Forms.Padding(0, 3, 3, 3);
this.cmbSetWxSafe.Name = "cmbSetWxSafe";
this.cmbSetWxSafe.Size = new System.Drawing.Size(85, 25);
@@ -193,7 +252,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
this.btnSetWxSafe.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnSetWxSafe.DisabledBackColor = System.Drawing.Color.Empty;
this.btnSetWxSafe.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnSetWxSafe.Location = new System.Drawing.Point(837, 44);
this.btnSetWxSafe.Location = new System.Drawing.Point(948, 43);
this.btnSetWxSafe.Name = "btnSetWxSafe";
this.btnSetWxSafe.Size = new System.Drawing.Size(84, 25);
this.btnSetWxSafe.Style.Alignment = System.Drawing.StringAlignment.Center;
@@ -218,7 +277,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
this.btnImport.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnImport.DisabledBackColor = System.Drawing.Color.Empty;
this.btnImport.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnImport.Location = new System.Drawing.Point(1045, 26);
this.btnImport.Location = new System.Drawing.Point(1048, 43);
this.btnImport.Name = "btnImport";
this.btnImport.Size = new System.Drawing.Size(84, 25);
this.btnImport.Style.Alignment = System.Drawing.StringAlignment.Center;
@@ -350,7 +409,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
this.tableLayoutPanel1.RowCount = 2;
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tableLayoutPanel1.Size = new System.Drawing.Size(727, 71);
this.tableLayoutPanel1.Size = new System.Drawing.Size(609, 71);
this.tableLayoutPanel1.TabIndex = 679;
//
// cmbSpProdType
@@ -361,17 +420,17 @@ namespace TemuKJD.PDDForms.ProductSelectForms
"",
"普通商品",
"书籍"});
this.cmbSpProdType.Location = new System.Drawing.Point(444, 43);
this.cmbSpProdType.Location = new System.Drawing.Point(381, 40);
this.cmbSpProdType.Margin = new System.Windows.Forms.Padding(0, 3, 3, 3);
this.cmbSpProdType.Name = "cmbSpProdType";
this.cmbSpProdType.Size = new System.Drawing.Size(70, 25);
this.cmbSpProdType.Size = new System.Drawing.Size(49, 25);
this.cmbSpProdType.TabIndex = 677;
//
// label11
//
this.label11.Anchor = System.Windows.Forms.AnchorStyles.Right;
this.label11.AutoSize = true;
this.label11.Location = new System.Drawing.Point(376, 44);
this.label11.Location = new System.Drawing.Point(313, 44);
this.label11.Margin = new System.Windows.Forms.Padding(3, 0, 0, 0);
this.label11.Name = "label11";
this.label11.Size = new System.Drawing.Size(68, 17);
@@ -388,17 +447,17 @@ namespace TemuKJD.PDDForms.ProductSelectForms
"厂商直采",
"机会商品",
"外部数据"});
this.cmbSourceType.Location = new System.Drawing.Point(300, 43);
this.cmbSourceType.Location = new System.Drawing.Point(258, 40);
this.cmbSourceType.Margin = new System.Windows.Forms.Padding(0, 3, 3, 3);
this.cmbSourceType.Name = "cmbSourceType";
this.cmbSourceType.Size = new System.Drawing.Size(70, 25);
this.cmbSourceType.Size = new System.Drawing.Size(49, 25);
this.cmbSourceType.TabIndex = 654;
//
// label10
//
this.label10.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.label10.AutoSize = true;
this.label10.Location = new System.Drawing.Point(256, 44);
this.label10.Location = new System.Drawing.Point(214, 44);
this.label10.Margin = new System.Windows.Forms.Padding(3, 0, 0, 0);
this.label10.Name = "label10";
this.label10.Size = new System.Drawing.Size(44, 17);
@@ -422,14 +481,14 @@ namespace TemuKJD.PDDForms.ProductSelectForms
this.txtSPU.Location = new System.Drawing.Point(60, 6);
this.txtSPU.Margin = new System.Windows.Forms.Padding(0, 3, 3, 3);
this.txtSPU.Name = "txtSPU";
this.txtSPU.Size = new System.Drawing.Size(70, 23);
this.txtSPU.Size = new System.Drawing.Size(49, 23);
this.txtSPU.TabIndex = 434;
//
// label2
//
this.label2.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(136, 9);
this.label2.Location = new System.Drawing.Point(115, 9);
this.label2.Margin = new System.Windows.Forms.Padding(3, 0, 0, 0);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(44, 17);
@@ -439,17 +498,17 @@ namespace TemuKJD.PDDForms.ProductSelectForms
// txtCat
//
this.txtCat.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.txtCat.Location = new System.Drawing.Point(180, 6);
this.txtCat.Location = new System.Drawing.Point(159, 6);
this.txtCat.Margin = new System.Windows.Forms.Padding(0, 3, 3, 3);
this.txtCat.Name = "txtCat";
this.txtCat.Size = new System.Drawing.Size(70, 23);
this.txtCat.Size = new System.Drawing.Size(49, 23);
this.txtCat.TabIndex = 425;
//
// label3
//
this.label3.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(256, 9);
this.label3.Location = new System.Drawing.Point(214, 9);
this.label3.Margin = new System.Windows.Forms.Padding(3, 0, 0, 0);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(44, 17);
@@ -459,17 +518,17 @@ namespace TemuKJD.PDDForms.ProductSelectForms
// txtProdName
//
this.txtProdName.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.txtProdName.Location = new System.Drawing.Point(300, 6);
this.txtProdName.Location = new System.Drawing.Point(258, 6);
this.txtProdName.Margin = new System.Windows.Forms.Padding(0, 3, 3, 3);
this.txtProdName.Name = "txtProdName";
this.txtProdName.Size = new System.Drawing.Size(70, 23);
this.txtProdName.Size = new System.Drawing.Size(49, 23);
this.txtProdName.TabIndex = 427;
//
// label4
//
this.label4.Anchor = System.Windows.Forms.AnchorStyles.Right;
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(400, 9);
this.label4.Location = new System.Drawing.Point(337, 9);
this.label4.Margin = new System.Windows.Forms.Padding(3, 0, 0, 0);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(44, 17);
@@ -479,17 +538,17 @@ namespace TemuKJD.PDDForms.ProductSelectForms
// txtExtCode
//
this.txtExtCode.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.txtExtCode.Location = new System.Drawing.Point(444, 6);
this.txtExtCode.Location = new System.Drawing.Point(381, 6);
this.txtExtCode.Margin = new System.Windows.Forms.Padding(0, 3, 3, 3);
this.txtExtCode.Name = "txtExtCode";
this.txtExtCode.Size = new System.Drawing.Size(70, 23);
this.txtExtCode.Size = new System.Drawing.Size(49, 23);
this.txtExtCode.TabIndex = 429;
//
// label6
//
this.label6.Anchor = System.Windows.Forms.AnchorStyles.Right;
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(544, 9);
this.label6.Location = new System.Drawing.Point(460, 9);
this.label6.Margin = new System.Windows.Forms.Padding(3, 0, 0, 0);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(44, 17);
@@ -503,9 +562,9 @@ namespace TemuKJD.PDDForms.ProductSelectForms
this.cmbSort.Items.AddRange(new object[] {
"入库时间",
"认领总数"});
this.cmbSort.Location = new System.Drawing.Point(591, 7);
this.cmbSort.Location = new System.Drawing.Point(507, 5);
this.cmbSort.Name = "cmbSort";
this.cmbSort.Size = new System.Drawing.Size(67, 25);
this.cmbSort.Size = new System.Drawing.Size(46, 25);
this.cmbSort.TabIndex = 448;
this.cmbSort.Text = "入库时间";
//
@@ -516,9 +575,9 @@ namespace TemuKJD.PDDForms.ProductSelectForms
this.btnSearch.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnSearch.DisabledBackColor = System.Drawing.Color.Empty;
this.btnSearch.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnSearch.Location = new System.Drawing.Point(664, 5);
this.btnSearch.Location = new System.Drawing.Point(559, 5);
this.btnSearch.Name = "btnSearch";
this.btnSearch.Size = new System.Drawing.Size(56, 25);
this.btnSearch.Size = new System.Drawing.Size(46, 25);
this.btnSearch.Style.Alignment = System.Drawing.StringAlignment.Center;
this.btnSearch.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.btnSearch.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
@@ -551,14 +610,14 @@ namespace TemuKJD.PDDForms.ProductSelectForms
this.txtNotes.Location = new System.Drawing.Point(60, 41);
this.txtNotes.Margin = new System.Windows.Forms.Padding(0, 3, 3, 3);
this.txtNotes.Name = "txtNotes";
this.txtNotes.Size = new System.Drawing.Size(70, 23);
this.txtNotes.Size = new System.Drawing.Size(49, 23);
this.txtNotes.TabIndex = 439;
//
// lblGroup
//
this.lblGroup.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.lblGroup.AutoSize = true;
this.lblGroup.Location = new System.Drawing.Point(136, 44);
this.lblGroup.Location = new System.Drawing.Point(115, 44);
this.lblGroup.Margin = new System.Windows.Forms.Padding(3, 0, 0, 0);
this.lblGroup.Name = "lblGroup";
this.lblGroup.Size = new System.Drawing.Size(44, 17);
@@ -569,10 +628,10 @@ namespace TemuKJD.PDDForms.ProductSelectForms
//
this.cmbGroupFilter.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.cmbGroupFilter.FormattingEnabled = true;
this.cmbGroupFilter.Location = new System.Drawing.Point(180, 43);
this.cmbGroupFilter.Location = new System.Drawing.Point(159, 40);
this.cmbGroupFilter.Margin = new System.Windows.Forms.Padding(0, 3, 3, 3);
this.cmbGroupFilter.Name = "cmbGroupFilter";
this.cmbGroupFilter.Size = new System.Drawing.Size(70, 25);
this.cmbGroupFilter.Size = new System.Drawing.Size(49, 25);
this.cmbGroupFilter.TabIndex = 653;
//
// cmbWxSafe
@@ -584,17 +643,17 @@ namespace TemuKJD.PDDForms.ProductSelectForms
"安全商品",
"违规商品",
"未校验"});
this.cmbWxSafe.Location = new System.Drawing.Point(588, 43);
this.cmbWxSafe.Location = new System.Drawing.Point(504, 40);
this.cmbWxSafe.Margin = new System.Windows.Forms.Padding(0, 3, 3, 3);
this.cmbWxSafe.Name = "cmbWxSafe";
this.cmbWxSafe.Size = new System.Drawing.Size(70, 25);
this.cmbWxSafe.Size = new System.Drawing.Size(49, 25);
this.cmbWxSafe.TabIndex = 676;
//
// lblWxSafe
//
this.lblWxSafe.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.lblWxSafe.AutoSize = true;
this.lblWxSafe.Location = new System.Drawing.Point(520, 44);
this.lblWxSafe.Location = new System.Drawing.Point(436, 44);
this.lblWxSafe.Margin = new System.Windows.Forms.Padding(3, 0, 0, 0);
this.lblWxSafe.Name = "lblWxSafe";
this.lblWxSafe.Size = new System.Drawing.Size(68, 17);
@@ -607,9 +666,9 @@ namespace TemuKJD.PDDForms.ProductSelectForms
this.pnlEmpty.CanvasColor = System.Drawing.SystemColors.Control;
this.pnlEmpty.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
this.pnlEmpty.DisabledBackColor = System.Drawing.Color.Empty;
this.pnlEmpty.Location = new System.Drawing.Point(664, 40);
this.pnlEmpty.Location = new System.Drawing.Point(559, 40);
this.pnlEmpty.Name = "pnlEmpty";
this.pnlEmpty.Size = new System.Drawing.Size(56, 25);
this.pnlEmpty.Size = new System.Drawing.Size(46, 25);
this.pnlEmpty.Style.Alignment = System.Drawing.StringAlignment.Center;
this.pnlEmpty.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(185)))), ((int)(((byte)(215)))), ((int)(((byte)(255)))));
this.pnlEmpty.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(185)))), ((int)(((byte)(215)))), ((int)(((byte)(255)))));
@@ -623,7 +682,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
this.pnlEmpty.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.pnlEmpty.StyleMouseOver.ForeColor.Color = System.Drawing.Color.White;
this.pnlEmpty.TabIndex = 431;
this.pnlEmpty.Text = "清空条件";
this.pnlEmpty.Text = "清空";
this.pnlEmpty.Click += new System.EventHandler(this.pnlEmpty_Click);
//
// btnExportTxt
@@ -658,7 +717,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
this.btnDelSelect.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnDelSelect.DisabledBackColor = System.Drawing.Color.Empty;
this.btnDelSelect.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnDelSelect.Location = new System.Drawing.Point(941, 26);
this.btnDelSelect.Location = new System.Drawing.Point(1048, 9);
this.btnDelSelect.Name = "btnDelSelect";
this.btnDelSelect.Size = new System.Drawing.Size(84, 25);
this.btnDelSelect.Style.Alignment = System.Drawing.StringAlignment.Center;
@@ -680,7 +739,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
//
this.cmbGroup.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.cmbGroup.FormattingEnabled = true;
this.cmbGroup.Location = new System.Drawing.Point(750, 10);
this.cmbGroup.Location = new System.Drawing.Point(861, 9);
this.cmbGroup.Name = "cmbGroup";
this.cmbGroup.Size = new System.Drawing.Size(85, 25);
this.cmbGroup.TabIndex = 640;
@@ -692,7 +751,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
this.btnSetGroup.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnSetGroup.DisabledBackColor = System.Drawing.Color.Empty;
this.btnSetGroup.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnSetGroup.Location = new System.Drawing.Point(837, 10);
this.btnSetGroup.Location = new System.Drawing.Point(948, 9);
this.btnSetGroup.Name = "btnSetGroup";
this.btnSetGroup.Size = new System.Drawing.Size(84, 25);
this.btnSetGroup.Style.Alignment = System.Drawing.StringAlignment.Center;
@@ -731,6 +790,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
//
// splitContainer2.Panel1
//
this.splitContainer2.Panel1.Controls.Add(this.btnGetAllCate);
this.splitContainer2.Panel1.Controls.Add(this.pnlEditExtCodePrice);
this.splitContainer2.Panel1.Controls.Add(this.pbLoading);
this.splitContainer2.Panel1.Controls.Add(this.txtSKC);
@@ -747,6 +807,31 @@ namespace TemuKJD.PDDForms.ProductSelectForms
this.splitContainer2.SplitterDistance = 577;
this.splitContainer2.TabIndex = 0;
//
// btnGetAllCate
//
this.btnGetAllCate.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
this.btnGetAllCate.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnGetAllCate.DisabledBackColor = System.Drawing.Color.Empty;
this.btnGetAllCate.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnGetAllCate.Location = new System.Drawing.Point(15, 33);
this.btnGetAllCate.Name = "btnGetAllCate";
this.btnGetAllCate.Size = new System.Drawing.Size(84, 25);
this.btnGetAllCate.Style.Alignment = System.Drawing.StringAlignment.Center;
this.btnGetAllCate.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.btnGetAllCate.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.btnGetAllCate.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder;
this.btnGetAllCate.Style.BorderDashStyle = System.Drawing.Drawing2D.DashStyle.Dash;
this.btnGetAllCate.Style.BorderSide = DevComponents.DotNetBar.eBorderSide.None;
this.btnGetAllCate.Style.ForeColor.Color = System.Drawing.Color.White;
this.btnGetAllCate.Style.GradientAngle = 90;
this.btnGetAllCate.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center;
this.btnGetAllCate.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255)))));
this.btnGetAllCate.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255)))));
this.btnGetAllCate.TabIndex = 777;
this.btnGetAllCate.Text = "取微信全类目";
this.btnGetAllCate.Visible = false;
this.btnGetAllCate.Click += new System.EventHandler(this.btnGetAllCate_Click);
//
// pnlEditExtCodePrice
//
this.pnlEditExtCodePrice.Anchor = System.Windows.Forms.AnchorStyles.None;
@@ -1025,6 +1110,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
this.colSkuReplaceImg.ReadOnly = true;
this.colSkuReplaceImg.Resizable = System.Windows.Forms.DataGridViewTriState.True;
this.colSkuReplaceImg.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
this.colSkuReplaceImg.Visible = false;
//
// col_spu_id
//
@@ -1041,6 +1127,8 @@ namespace TemuKJD.PDDForms.ProductSelectForms
//
// col_cat_name
//
dataGridViewCellStyle4.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.col_cat_name.DefaultCellStyle = dataGridViewCellStyle4;
this.col_cat_name.HeaderText = "类目";
this.col_cat_name.Name = "col_cat_name";
this.col_cat_name.ReadOnly = true;
@@ -1105,16 +1193,16 @@ namespace TemuKJD.PDDForms.ProductSelectForms
//
// col_notes
//
dataGridViewCellStyle4.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.col_notes.DefaultCellStyle = dataGridViewCellStyle4;
dataGridViewCellStyle5.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.col_notes.DefaultCellStyle = dataGridViewCellStyle5;
this.col_notes.HeaderText = "备注";
this.col_notes.Name = "col_notes";
this.col_notes.ReadOnly = true;
//
// colHeadWords
//
dataGridViewCellStyle5.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.colHeadWords.DefaultCellStyle = dataGridViewCellStyle5;
dataGridViewCellStyle6.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.colHeadWords.DefaultCellStyle = dataGridViewCellStyle6;
this.colHeadWords.HeaderText = "标题前缀";
this.colHeadWords.Name = "colHeadWords";
this.colHeadWords.ReadOnly = true;
@@ -1122,8 +1210,8 @@ namespace TemuKJD.PDDForms.ProductSelectForms
//
// colEndWords
//
dataGridViewCellStyle6.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.colEndWords.DefaultCellStyle = dataGridViewCellStyle6;
dataGridViewCellStyle7.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.colEndWords.DefaultCellStyle = dataGridViewCellStyle7;
this.colEndWords.HeaderText = "标题后缀";
this.colEndWords.Name = "colEndWords";
this.colEndWords.ReadOnly = true;
@@ -1131,8 +1219,8 @@ namespace TemuKJD.PDDForms.ProductSelectForms
//
// colFissionWords
//
dataGridViewCellStyle7.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.colFissionWords.DefaultCellStyle = dataGridViewCellStyle7;
dataGridViewCellStyle8.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.colFissionWords.DefaultCellStyle = dataGridViewCellStyle8;
this.colFissionWords.HeaderText = "裂变词";
this.colFissionWords.Name = "colFissionWords";
this.colFissionWords.ReadOnly = true;
@@ -1203,12 +1291,12 @@ namespace TemuKJD.PDDForms.ProductSelectForms
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.Location = new System.Drawing.Point(985, 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.PageSize = 100;
this.ucSplitPage1.Size = new System.Drawing.Size(453, 25);
this.ucSplitPage1.TabIndex = 6;
this.ucSplitPage1.TotalPage = 1;
//
@@ -1313,6 +1401,8 @@ namespace TemuKJD.PDDForms.ProductSelectForms
private DevComponents.DotNetBar.PanelEx btnSetWxSafe;
private System.Windows.Forms.ComboBox cmbSpProdType;
private System.Windows.Forms.Label label11;
private DevComponents.DotNetBar.PanelEx btnGetAllCate;
private DevComponents.DotNetBar.PanelEx btnGetProdWxCate;
private System.Windows.Forms.DataGridViewCheckBoxColumn colSelect;
private System.Windows.Forms.DataGridViewTextBoxColumn col_db_id;
private System.Windows.Forms.DataGridViewTextBoxColumn colFromShopId;
@@ -1344,5 +1434,7 @@ 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 System.Windows.Forms.ComboBox cmbWxCat;
private System.Windows.Forms.Label label12;
}
}
@@ -1,6 +1,8 @@
using AllBase;
using AllBase.Helper;
using AllBase.Model.Result;
using AllBase.Model.Result.PDDResult;
using AllBase.Model.Result.WXResult;
using NaiBa.Util;
using NaiBa.Util.Extension;
using Newtonsoft.Json.Linq;
@@ -155,6 +157,39 @@ namespace TemuKJD.PDDForms.ProductSelectForms
}
foreach (var prod in lstTemuDbProduct)
{
string catName = prod.cat_name;
if (prod.wx_cat_leaf != null)
{
var catN = GlobalConfig.WxCatList.FirstOrDefault(c => c.cat_id == prod.wx_cat_leaf.ParseToString())?.name;
if (!string.IsNullOrEmpty(catN))
{
catName = catN;
}
}
if (prod.wx_cat_3 != null)
{
var catN = GlobalConfig.WxCatList.FirstOrDefault(c => c.cat_id == prod.wx_cat_3.ParseToString())?.name;
if (!string.IsNullOrEmpty(catN))
{
catName = catN + " >> " + catName;
}
}
if (prod.wx_cat_2 != null)
{
var catN = GlobalConfig.WxCatList.FirstOrDefault(c => c.cat_id == prod.wx_cat_2.ParseToString())?.name;
if (!string.IsNullOrEmpty(catN))
{
catName = catN + " >> " + catName;
}
}
if (prod.wx_cat_1 != null)
{
var catN = GlobalConfig.WxCatList.FirstOrDefault(c => c.cat_id == prod.wx_cat_1.ParseToString())?.name;
if (!string.IsNullOrEmpty(catN))
{
catName = catN + " >> " + catName;
}
}
Invoke(new Action(() =>
{
int rowIndex = this.dgvDbProduct.Rows.Add(
@@ -168,7 +203,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
DataGridViewExtension.defaultBitmap,
prod.spu_id,
prod.skc_id,
prod.cat_name,
catName,
prod.ext_code,
prod.group,
prod.price_text, // 母店价格
@@ -279,6 +314,11 @@ namespace TemuKJD.PDDForms.ProductSelectForms
"&search_prod_name=" + txtProdName.Text.Trim() +
"&wx_safe_status=" + cmbWxSafe.Text.Trim() +
"&special_prod_type=" + cmbSpProdType.Text.Trim();
if(!string.IsNullOrEmpty(cmbWxCat.Text))
{
data += "&has_wx_cat=" + (cmbWxCat.Text.Trim() == "有").ParseToString().ToLower();
}
if (cmbSourceType.Text.Trim() != "全部")
{
data += "&product_get_type=" + cmbSourceType.Text.Trim();
@@ -390,7 +430,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
imgFrom.ShowDialog();
break;
case "认领":
Task.Run(() => { SelectProduct(new KJDDBProduct[] { dbProduct }); });
//Task.Run(() => { SelectProduct(new KJDDBProduct[] { dbProduct }); });
break;
case "编辑":
this.lblExtCodePrice.Text = "调整货号 " + dgvDbProduct.Rows[e.RowIndex].Cells["col_ext_code"].Value.ParseToString() + " 价格";
@@ -406,162 +446,6 @@ namespace TemuKJD.PDDForms.ProductSelectForms
}
}
private void SelectProduct(KJDDBProduct[] prods)
{
if (shop == null)
{
BaseMsgForm.ShowError("店铺不能为空!");
return;
}
if (prods == null || prods.Count() == 0)
{
BaseMsgForm.ShowError("认领商品不能为空!");
return;
}
Invoke(new Action(() =>
{
this.pbLoading.Visible = true;
this.statusBar.lblTaskStatus.Text = "正在认领...";
this.statusBar.pgbTaskProgress.Maximum = prods.Length;
this.statusBar.UpdateProgressBar(0);
}));
string errorMsg = "";
foreach (var prod in prods)
{
Invoke(new Action(() =>
{
this.statusBar.UpdateProgressBar(this.statusBar.pgbTaskProgress.Value + 1);
}));
if (prod == null)
{
errorMsg += "prod null; ";
continue;
}
if (shop.AddProductRemaining <=0)
{
if (!errorMsg.Contains("本月商品认领限额已用完"))
errorMsg += " 本月商品认领限额已用完,请下个月再操作!";
continue;
}
try
{
var fissionProductName = GetFissionProductName(prod);
var url = BaseClass.BuildObjString("product/add_user_select_product");
var data = UserLogin.GetSignaturex() +
"&out_product_id=" + prod.id +
"&shop_id=" + shop.ShopId +
"&shop_account=" + shop.ShopAccount +
"&main_user_name=" + shop.UserName +
"&sub_user_name=" + shop.SubUserName +
"&add_product_remaining=" + shop.AddProductRemaining +
"&add_fission_product_name=" + GetHtml.UrlEncodeUtf8(fissionProductName) +
"&status=待上传";
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"))
{
errorMsg += prod.spu_id + " " + BaseRegex.GetStringJson(ref html, "msg") + "; ";
}
else
{
prod.select_count++;
prod.select_total_count++;
Invoke(new Action(() =>
{
var row = this.dgvDbProduct.Rows.Cast<DataGridViewRow>().FirstOrDefault(r => r.Cells["col_db_id"].Value.ParseToInt() == prod.id);
if (row != null)
{
row.Cells["colAddTimes"].Value = prod.select_count;
row.Cells["colSelectTotalCount"].Value = prod.select_total_count;
}
}));
shop.AddProductRemaining = shop.AddProductRemaining - 1;
}
}
catch (Exception ex) {
errorMsg += ex.Message + "; ";
}
}
if (!string.IsNullOrEmpty(errorMsg))
{
Invoke(new Action(() =>
{
BaseMsgForm.ShowError("认领商品失败,请重试!\r\n" + errorMsg.Trim());
}));
}
else
{
Invoke(new Action(() =>
{
BaseMsgForm.ShowInfo("认领商品成功!");
}));
}
Invoke(new Action(() =>
{
this.pbLoading.Visible = false;
this.statusBar.lblTaskStatus.Text = "认领完成";
this.statusBar.UpdateProgressBar(prods.Length);
}));
}
public static string GetFissionProductName(KJDDBProduct prod)
{
string headWords = "";
if (!string.IsNullOrWhiteSpace(prod.head_words))
{
var numberRegex = BaseRegex.GetMatchRegex(prod.head_words.Trim(), "\\d{1,9}");
var numbers = numberRegex.Cast<Match>().Select(m => m.Value.ParseToInt()).ToList();
//var numbers = prod.head_words.Split(new string[] { "-", "个" }, StringSplitOptions.RemoveEmptyEntries).Select(w => w.ParseToInt()).ToList();
int minNum = 5;
int maxNum = 19;
if (numbers.Count > 0 && numbers[0] > 0)
{
minNum = numbers[0];
if (numbers.Count > 1 && numbers[1] > 0)
{
maxNum = numbers[1];
}
if (maxNum < minNum)
{
maxNum = minNum;
}
headWords += Randomx.GetId(minNum, maxNum + 1) + prod.head_words.Trim().Replace(minNum + "-" + maxNum, "");
}
}
//string endWords = string.IsNullOrEmpty(prod.end_words) ? "适合不同的搭配风格" : prod.end_words;
string endWords = string.IsNullOrWhiteSpace(prod.end_words) ? "" : prod.end_words;
List<string> fissionLst = new List<string>();
fissionLst.AddRange(prod.fission_words.ParseToString().Split(new string[] { "\r", "\n" }, StringSplitOptions.RemoveEmptyEntries));
string centerWords = ",";
while (fissionLst.Count > 0)
{
int id = Randomx.GetId(fissionLst.Count);
var fissionTxt = fissionLst[id];
fissionLst.RemoveAt(id);
var allTxt = headWords + prod.product_name + centerWords + fissionTxt + "," + endWords;
byte[] bytes = Encoding.GetEncoding("gb2312").GetBytes(allTxt);
if (bytes.Length > 250)
{
break;
}
centerWords += fissionTxt + ",";
}
return (headWords + prod.product_name + centerWords + endWords).Trim(',');
}
private void DeleteProduct(string dbId, bool isUpdate = true)
{
var url = BaseClass.BuildPDDObjString("product/del_db_product");
@@ -594,7 +478,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
{
this.btnSelect.Enabled = false;
Task.Run(() => {
SelectProduct(prodList);
//SelectProduct(prodList);
Invoke(new Action(() =>
{
this.btnSelect.Enabled = true;
@@ -1065,5 +949,225 @@ namespace TemuKJD.PDDForms.ProductSelectForms
}
}
}
private void btnGetAllCate_Click(object sender, EventArgs e)
{
new WxApiBLL().GetWxToken();
var url1 = BaseClass.BuildPDDObjString("product/get_wx_all_cate");
var data1 = UserLogin.GetSignaturex();
data1 += "&token=" + GlobalConfig.WxTokenList.OrderBy(x => Guid.NewGuid()).FirstOrDefault()?.accessToken;
var html1 = GetHtml.PostUtf8(url1, data1);
var catDataObj = JsonHelper.JObjectParse(html1)["cats_v2"];
var catDataObjLst = JsonHelper.JObjectParse(html1)["cats_v2"].Take(10).ToList();
GlobalConfig.WxCatList.Clear();
foreach (var catAndQuaObj in catDataObj)
{
foreach (var catObj in catAndQuaObj["cat_and_qua"])
{
WxCatInfo catInfo = new WxCatInfo()
{
cat_id = catObj["cat"]["cat_id"].ParseToString(),
f_cat_id = catObj["cat"]["f_cat_id"].ParseToString(),
is_local_life = catObj["cat"]["is_local_life"].ParseToBool(),
leaf = catObj["cat"]["leaf"].ParseToBool(),
level = catObj["cat"]["level"].ParseToInt(),
name = catObj["cat"]["name"].ParseToString(),
};
if (!GlobalConfig.WxCatList.Any(c => c.cat_id == catInfo.cat_id))
GlobalConfig.WxCatList.Add(catInfo);
}
}
var catV2Str = JsonHelper.SerializeObject(GlobalConfig.WxCatList);
}
private void btnGetProdWxCate_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();
if (prodList.Length == 0)
return;
this.statusBar.pgbTaskProgress.Maximum = prodList.Length;
this.statusBar.UpdateProgressBar(0);
this.pbLoading.Visible = true;
Task.Run(() =>
{
try
{
GetProdWxCat(prodList);
}
catch (Exception ex)
{
BaseMsgForm.ShowError(ex.Message);
}
// 刷新结果
SearchDbProd(this.ucSplitPage1.CurrentPage);
Invoke(new Action(() =>
{
pbLoading.Visible = false;
BaseMsgForm.ShowInfo("操作完成!");
}));
});
}
void GetProdWxCat(KJDDBProduct[] prodList)
{
foreach (var prod in prodList)
{
// 获取微信accessToken
var token = new WxApiBLL().GetWxToken();
try
{
JObject obj = new JObject();
obj["req_type"] = 1;
obj["head_imgs"] = new JArray();
var dbProd = PDDDBProdEditForm.GetPddProductDetail(prod.id.ParseToString());
var prodObj = JsonHelper.JObjectParse(dbProd.product_json);
List<string> mainImgLst = new List<string>();
if (!prodObj["jstProd"].IsNullOrEmpty())
{
var jstProd = JsonHelper.DeserializeJsonToObject<JSTListProductInfo>(JsonHelper.SerializeObject(prodObj["jstProd"]));
mainImgLst = jstProd.itemMainImage.Take(3).ToList();
foreach (var img in mainImgLst)
{
var urlImg = BaseClass.BuildPDDObjString("product/wx_api_upload_image");
var upDate = UserLogin.GetSignaturex();
upDate += "&token=" + token;
upDate += "&post_data=" + GetHtml.UrlEncodeUtf8("{\"img_url\":\"" + img + "\"}");
var upDateRst = GetHtml.PostUtf8(urlImg, upDate);
var upImgUrl = BaseRegex.GetStringJson(ref upDateRst, "img_url");
(obj["head_imgs"] as JArray).Add(upImgUrl);
}
obj["title"] = jstProd.itemName;
string post_data = JsonHelper.SerializeObject(obj);
var url1 = BaseClass.BuildPDDObjString("product/wx_api_category_classify");
var data1 = UserLogin.GetSignaturex();
data1 += "&token=" + token;
data1 += "&post_data=" + GetHtml.UrlEncodeUtf8(post_data);
var html1 = GetHtml.PostUtf8(url1, data1);
var catId = BaseRegex.GetStringJson(ref html1, "cat_id");
var jCatFirstLst = JsonHelper.JObjectParse(html1)["categories"].FirstOrDefault()["cats"] as JArray;
int index = 0;
foreach (JObject jCatObj in jCatFirstLst)
{
index++;
if (index == 1)
{
var catStr = jCatObj["cat_info"]["cat_id"].ParseToString();
dbProd.wx_cat_1 = catStr.ParseToLong();
dbProd.main_cat_id = catStr;
dbProd.main_cat_name = GlobalConfig.WxCatList.FirstOrDefault(c => c.cat_id == dbProd.wx_cat_1.ParseToString()).name;
}
if (index == 2)
{
var catStr = jCatObj["cat_info"]["cat_id"].ParseToString();
dbProd.wx_cat_2 = catStr.ParseToLong();
var wxCat = GlobalConfig.WxCatList.FirstOrDefault(c => c.cat_id == dbProd.wx_cat_2.ParseToString()).name;
}
if (index == 3)
{
var catStr = jCatObj["cat_info"]["cat_id"].ParseToString();
dbProd.wx_cat_3 = catStr.ParseToLong();
var wxCat = GlobalConfig.WxCatList.FirstOrDefault(c => c.cat_id == dbProd.wx_cat_3.ParseToString()).name;
}
if (index == jCatFirstLst.Count)
{
var catStr = jCatObj["cat_info"]["cat_id"].ParseToString();
dbProd.wx_cat_leaf = catStr.ParseToLong();
dbProd.cat_id = catStr;
dbProd.cat_name = GlobalConfig.WxCatList.FirstOrDefault(c => c.cat_id == dbProd.wx_cat_leaf.ParseToString()).name;
}
}
}
if (dbProd.wx_cat_1 != null && dbProd.wx_cat_leaf != null)
{
var row = dgvDbProduct.Rows.Cast<DataGridViewRow>().FirstOrDefault(r => r.Cells["col_spu_id"].Value.ParseToString() == dbProd.spu_id);
var url = BaseClass.BuildPDDObjString("product/mdy_product");
var data = Work.UserLogin.GetSignaturex() +
"&spu_id=" + dbProd.spu_id +
"&wx_cat_1=" + dbProd.wx_cat_1 +
"&wx_cat_2=" + dbProd.wx_cat_2 +
"&wx_cat_3=" + dbProd.wx_cat_3 +
"&wx_cat_leaf=" + dbProd.wx_cat_leaf +
"&cat_id=" + dbProd.cat_id +
"&cat_name=" + HttpUtility.UrlEncode(dbProd.cat_name, Encoding.UTF8) +
"&main_cat_id=" + dbProd.main_cat_id +
"&main_cat_name=" + HttpUtility.UrlEncode(dbProd.main_cat_name, Encoding.UTF8);
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"))
{
if (row != null)
Invoke(new Action(() =>
{
row.Cells["col_cat_name"].Value = "类目获取失败" + BaseRegex.GetStringJson(ref html, "msg");
}));
}
else
{
if (row != null)
{
string catName = dbProd.cat_name;
if (dbProd.wx_cat_leaf != null)
{
var catN = GlobalConfig.WxCatList.FirstOrDefault(c => c.cat_id == dbProd.wx_cat_leaf.ParseToString())?.name;
if (!string.IsNullOrEmpty(catN))
{
catName = catN;
}
}
if (dbProd.wx_cat_3 != null)
{
var catN = GlobalConfig.WxCatList.FirstOrDefault(c => c.cat_id == dbProd.wx_cat_3.ParseToString())?.name;
if (!string.IsNullOrEmpty(catN))
{
catName = catN + " >> " + catName;
}
}
if (dbProd.wx_cat_2 != null)
{
var catN = GlobalConfig.WxCatList.FirstOrDefault(c => c.cat_id == dbProd.wx_cat_2.ParseToString())?.name;
if (!string.IsNullOrEmpty(catN))
{
catName = catN + " >> " + catName;
}
}
if (prod.wx_cat_1 != null)
{
var catN = GlobalConfig.WxCatList.FirstOrDefault(c => c.cat_id == dbProd.wx_cat_1.ParseToString())?.name;
if (!string.IsNullOrEmpty(catN))
{
catName = catN + " >> " + catName;
}
}
Invoke(new Action(() =>
{
row.Cells["col_cat_name"].Value = catName;
}));
}
}
}
}
catch (Exception ex)
{
}
Invoke(new Action(() =>
{
this.statusBar.UpdateProgressBar(this.statusBar.pgbTaskProgress.Value + 1);
}));
}
}
}
}