From 3db584fe1e56b7f1ea33469df8cff0033c0fb092 Mon Sep 17 00:00:00 2001 From: wule Date: Wed, 4 Mar 2026 09:34:57 +0800 Subject: [PATCH] =?UTF-8?q?=E8=81=9A=E6=B0=B4=E6=BD=AD=E5=95=86=E5=93=81?= =?UTF-8?q?=E9=87=87=E9=9B=86=E6=9C=AA=E5=AE=8C=E5=96=84=E7=9A=84=E9=80=BB?= =?UTF-8?q?=E8=BE=91=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AllBase/BaseClass.cs | 2 +- .../BLL/BXX/BXXProductManage.cs | 28 +- .../PDDDBProdListForm.Designer.cs | 58 +-- .../ProductSelectForms/PDDDBProdListForm.cs | 19 + .../GetJuShuitanProdForm.Designer.cs | 115 ++++- TEMUKJD/ToolForms/GetJuShuitanProdForm.cs | 423 ++++++++++++++---- .../WXDBProdUploadForm.Designer.cs | 40 +- 7 files changed, 510 insertions(+), 175 deletions(-) diff --git a/AllBase/BaseClass.cs b/AllBase/BaseClass.cs index 66bc16b..c35f197 100644 --- a/AllBase/BaseClass.cs +++ b/AllBase/BaseClass.cs @@ -27,7 +27,7 @@ namespace AllBase /// /// 版本ID /// - public static int VersionCount = 879; + public static int VersionCount = 880; //public static int VersionCount = 613; /// diff --git a/KJDService/KJD_WebService/BLL/BXX/BXXProductManage.cs b/KJDService/KJD_WebService/BLL/BXX/BXXProductManage.cs index cb0e15a..bc0746f 100644 --- a/KJDService/KJD_WebService/BLL/BXX/BXXProductManage.cs +++ b/KJDService/KJD_WebService/BLL/BXX/BXXProductManage.cs @@ -362,7 +362,7 @@ namespace KJD_Web.BLL.BXX string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString; MysqlUtils mySql = new MysqlUtils(conn); - string sql = "select count(*) from bxx.product p FORCE INDEX (index_wx_safe_status) where p.is_del=0"; + string sql = "select count(*) from bxx.product p FORCE INDEX (f_wx_safe_status) where p.is_del=0"; string where = ""; if (!string.IsNullOrEmpty(from_shop_id)) @@ -996,7 +996,7 @@ namespace KJD_Web.BLL.BXX string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString; MysqlUtils mySql = new MysqlUtils(conn); - string sql = "select count(*) from bxx.product p FORCE INDEX (index_wx_safe_status) where p.is_del=0"; + string sql = "select count(*) from bxx.product p FORCE INDEX (f_wx_safe_status) where p.is_del=0"; string where = ""; if (!string.IsNullOrEmpty(in_ext_codes)) @@ -1095,8 +1095,8 @@ namespace KJD_Web.BLL.BXX var db_ids = string.Join(",", dt.Rows.Cast().Select(r => r["id"].ParseToInt())); sql = "select p.id,p.from_shop_id,p.spu_id,p.skc_id,p.main_cat_id,p.main_cat_name,p.cat_id,p.cat_name,p.price_text,p.ext_code," + - " p.product_name,p.main_img,p.group,p.notes,p.add_time,p.mdy_time,p.select_total_count,p.product_get_type,p.sale_count,p.sale_count_text," + - " p.fission_words,p.head_words,p.end_words,p.wx_safe_status,p.special_prod_type,p.wx_cat_1,p.wx_cat_2,p.wx_cat_3," + + " p.product_name,p.main_img,p.group,p.notes,p.add_time,p.mdy_time,p.product_get_type," + + " p.wx_safe_status,p.special_prod_type,p.wx_cat_1,p.wx_cat_2,p.wx_cat_3,p.send_to_out_server," + " p.wx_cat_leaf" + " from bxx.product p where p.is_del=0"; //where子句 @@ -1121,12 +1121,12 @@ namespace KJD_Web.BLL.BXX { id = Convert.ToInt32(row["id"]), from_shop_id = row["from_shop_id"].ToString(), - skc_id = row["skc_id"].ToString(), spu_id = row["spu_id"].ToString(), - cat_id = row["cat_id"].ToString(), - cat_name = row["cat_name"].ToString(), + skc_id = row["skc_id"].ToString(), main_cat_id = row["main_cat_id"].ToString(), main_cat_name = row["main_cat_name"].ToString(), + cat_id = row["cat_id"].ToString(), + cat_name = row["cat_name"].ToString(), wx_cat_1 = row["wx_cat_1"].ToString(), wx_cat_2 = row["wx_cat_2"].ToString(), wx_cat_3 = row["wx_cat_3"].ToString(), @@ -1135,25 +1135,21 @@ namespace KJD_Web.BLL.BXX product_name = row["product_name"].ToString(), main_img = row["main_img"].ToString(), ext_code = row["ext_code"].ToString(), - //product_json = row["product_json"].ToString(), - //size_json = row["size_json"].ToString(), add_time = Convert.ToDateTime(row["add_time"]), mdy_time = Convert.ToDateTime(row["mdy_time"]), group = row["group"].ToString(), notes = row["notes"].ToString(), - select_total_count = row["select_total_count"].ParseToInt(), - end_words = row["end_words"].ParseToString(), - fission_words = row["fission_words"].ParseToString(), - head_words = row["head_words"].ParseToString(), product_get_type_text = row["product_get_type"].ParseToString(), - sale_count = row["sale_count"].ParseToInt(), - sale_count_text = row["sale_count_text"].ToString(), + //sale_count = row["sale_count"].ParseToInt(), + //sale_count_text = row["sale_count_text"].ToString(), wx_safe_status = row["wx_safe_status"].ToString(), special_prod_type = row["special_prod_type"].ToString(), + send_to_out_server = row["send_to_out_server"].ParseToInt(), }; productLst.Add(prod); } - var data = JsonUtils.SerializerObjectToString(productLst); + JsonSerializerSettings jsonSetting = new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore }; + var data = JsonUtils.SerializerObjectToString(productLst, jsonSetting); var seconds = (DateTime.Now - timeCalc).TotalSeconds.ToString("0.000"); if (product_get_type == "厂商直采" && count > 500) count *= 3; diff --git a/TEMUKJD/PDDForms/ProductSelectForms/PDDDBProdListForm.Designer.cs b/TEMUKJD/PDDForms/ProductSelectForms/PDDDBProdListForm.Designer.cs index ae13871..8951689 100644 --- a/TEMUKJD/PDDForms/ProductSelectForms/PDDDBProdListForm.Designer.cs +++ b/TEMUKJD/PDDForms/ProductSelectForms/PDDDBProdListForm.Designer.cs @@ -113,8 +113,6 @@ namespace TemuKJD.PDDForms.ProductSelectForms this.btnSelect = new DevComponents.DotNetBar.PanelEx(); this.label11 = new System.Windows.Forms.Label(); this.dgvDbProduct = new TemuKJD.UserComponent.DataGridViewEx(); - this.ucSplitPage1 = new TemuKJD.UserControls.UcSplitPage(); - this.statusBar = new TemuKJD.UserControls.StatusBarUserControl(); this.colSelect = new System.Windows.Forms.DataGridViewCheckBoxColumn(); this.col_db_id = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.colFromShopId = new System.Windows.Forms.DataGridViewTextBoxColumn(); @@ -148,6 +146,8 @@ namespace TemuKJD.PDDForms.ProductSelectForms this.col_edit = new System.Windows.Forms.DataGridViewLinkColumn(); this.col_delete = new System.Windows.Forms.DataGridViewLinkColumn(); this.col_select_product = new System.Windows.Forms.DataGridViewLinkColumn(); + this.ucSplitPage1 = new TemuKJD.UserControls.UcSplitPage(); + this.statusBar = new TemuKJD.UserControls.StatusBarUserControl(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); this.splitContainer1.Panel1.SuspendLayout(); this.splitContainer1.Panel2.SuspendLayout(); @@ -1125,7 +1125,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms // // txtSKC // - this.txtSKC.Location = new System.Drawing.Point(87, 80); + this.txtSKC.Location = new System.Drawing.Point(48, 64); this.txtSKC.Name = "txtSKC"; this.txtSKC.Size = new System.Drawing.Size(90, 23); this.txtSKC.TabIndex = 432; @@ -1134,7 +1134,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms // label1 // this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(54, 83); + this.label1.Location = new System.Drawing.Point(15, 67); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(43, 17); this.label1.TabIndex = 433; @@ -1240,31 +1240,6 @@ namespace TemuKJD.PDDForms.ProductSelectForms this.dgvDbProduct.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgvDbProduct_CellContentClick); this.dgvDbProduct.Scroll += new System.Windows.Forms.ScrollEventHandler(this.dgvDbProduct_Scroll); // - // ucSplitPage1 - // - this.ucSplitPage1.CurrentPage = 1; - this.ucSplitPage1.Dock = System.Windows.Forms.DockStyle.Right; - this.ucSplitPage1.IsShowPageSize = true; - 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 = 100; - this.ucSplitPage1.Size = new System.Drawing.Size(453, 25); - this.ucSplitPage1.TabIndex = 6; - this.ucSplitPage1.TotalPage = 1; - // - // statusBar - // - this.statusBar.BackColor = System.Drawing.Color.White; - this.statusBar.Dock = System.Windows.Forms.DockStyle.Fill; - this.statusBar.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.statusBar.Location = new System.Drawing.Point(0, 0); - this.statusBar.Margin = new System.Windows.Forms.Padding(0); - this.statusBar.Name = "statusBar"; - this.statusBar.Size = new System.Drawing.Size(1438, 25); - this.statusBar.TabIndex = 5; - // // colSelect // this.colSelect.FillWeight = 26F; @@ -1541,6 +1516,31 @@ namespace TemuKJD.PDDForms.ProductSelectForms this.col_select_product.Resizable = System.Windows.Forms.DataGridViewTriState.True; this.col_select_product.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; // + // ucSplitPage1 + // + this.ucSplitPage1.CurrentPage = 1; + this.ucSplitPage1.Dock = System.Windows.Forms.DockStyle.Right; + this.ucSplitPage1.IsShowPageSize = true; + this.ucSplitPage1.Location = new System.Drawing.Point(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 = 100; + this.ucSplitPage1.Size = new System.Drawing.Size(453, 25); + this.ucSplitPage1.TabIndex = 6; + this.ucSplitPage1.TotalPage = 1; + // + // statusBar + // + this.statusBar.BackColor = System.Drawing.Color.White; + this.statusBar.Dock = System.Windows.Forms.DockStyle.Fill; + this.statusBar.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.statusBar.Location = new System.Drawing.Point(0, 0); + this.statusBar.Margin = new System.Windows.Forms.Padding(0); + this.statusBar.Name = "statusBar"; + this.statusBar.Size = new System.Drawing.Size(1438, 25); + this.statusBar.TabIndex = 5; + // // PDDDBProdListForm // this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; diff --git a/TEMUKJD/PDDForms/ProductSelectForms/PDDDBProdListForm.cs b/TEMUKJD/PDDForms/ProductSelectForms/PDDDBProdListForm.cs index 9f13bda..249cf33 100644 --- a/TEMUKJD/PDDForms/ProductSelectForms/PDDDBProdListForm.cs +++ b/TEMUKJD/PDDForms/ProductSelectForms/PDDDBProdListForm.cs @@ -10,6 +10,7 @@ using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; +using System.Diagnostics; using System.Drawing; using System.IO; using System.Linq; @@ -470,6 +471,24 @@ namespace TemuKJD.PDDForms.ProductSelectForms this.txtExtCodePrice.Text = dgvDbProduct.Rows[e.RowIndex].Cells["colExtCodePrice"].Value?.ParseToDecimal().ToString(); this.pnlEditExtCodePrice.Visible = true; break; + case "资料编码/真实上家": + try + { + if (string.IsNullOrEmpty(dbProduct.real_spu_id) || string.IsNullOrEmpty(dbProduct.real_coid)) + return; + + string url = "https://sc.scm121.com/manage/goods/qualitySupplier/goodsDetail/" + dbProduct.real_spu_id + "?itemCoId=" + dbProduct.real_coid + "&noBack=true"; + Process.Start(new ProcessStartInfo(url) + { + UseShellExecute = true + }); + } + catch + { + // 可能需要手动指定浏览器路径 + Process.Start(new ProcessStartInfo("https://www.baidu.com") { UseShellExecute = true }); + } + break; case "": dgvDbProduct.Rows[e.RowIndex].Cells["colSelect"].Value = !(bool)dgvDbProduct.Rows[e.RowIndex].Cells["colSelect"].Value; break; diff --git a/TEMUKJD/ToolForms/GetJuShuitanProdForm.Designer.cs b/TEMUKJD/ToolForms/GetJuShuitanProdForm.Designer.cs index 964b9d1..a1ecf5d 100644 --- a/TEMUKJD/ToolForms/GetJuShuitanProdForm.Designer.cs +++ b/TEMUKJD/ToolForms/GetJuShuitanProdForm.Designer.cs @@ -98,6 +98,9 @@ namespace TemuKJD.ToolForms this.cmbMultiCookieName = new DevComponents.DotNetBar.Controls.ComboBoxEx(); this.btnMultiLogin = new DevComponents.DotNetBar.PanelEx(); this.btnDel = new DevComponents.DotNetBar.PanelEx(); + this.label7 = new System.Windows.Forms.Label(); + this.txtWaitSeconds = new System.Windows.Forms.TextBox(); + this.label8 = new System.Windows.Forms.Label(); this.btnGetHotGood = new DevComponents.DotNetBar.PanelEx(); this.btnCancelSelect = new DevComponents.DotNetBar.PanelEx(); this.txtTitle = new System.Windows.Forms.TextBox(); @@ -124,6 +127,7 @@ namespace TemuKJD.ToolForms this.btnSaveCookie = new DevComponents.DotNetBar.PanelEx(); this.btnImportCookie = new DevComponents.DotNetBar.PanelEx(); this.label2 = new System.Windows.Forms.Label(); + this.btnExportCookie = new DevComponents.DotNetBar.PanelEx(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).BeginInit(); this.splitContainer2.Panel1.SuspendLayout(); this.splitContainer2.SuspendLayout(); @@ -160,7 +164,7 @@ namespace TemuKJD.ToolForms this.splitContainer2.Panel1.Controls.Add(this.btnNext); this.splitContainer2.Panel1.Controls.Add(this.btnPrev); this.splitContainer2.Panel1.Controls.Add(this.txtAddress); - this.splitContainer2.Size = new System.Drawing.Size(1390, 433); + this.splitContainer2.Size = new System.Drawing.Size(1390, 435); this.splitContainer2.SplitterDistance = 26; this.splitContainer2.TabIndex = 6; // @@ -199,7 +203,7 @@ namespace TemuKJD.ToolForms // this.pbLoading.Anchor = System.Windows.Forms.AnchorStyles.None; this.pbLoading.Image = global::TemuKJD.Properties.Resources.loading_blue; - this.pbLoading.Location = new System.Drawing.Point(673, 193); + this.pbLoading.Location = new System.Drawing.Point(673, 194); this.pbLoading.Name = "pbLoading"; this.pbLoading.Size = new System.Drawing.Size(50, 50); this.pbLoading.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; @@ -245,7 +249,7 @@ namespace TemuKJD.ToolForms this.dgvProduct.Name = "dgvProduct"; this.dgvProduct.ReadOnly = true; this.dgvProduct.RowTemplate.Height = 23; - this.dgvProduct.Size = new System.Drawing.Size(1390, 432); + this.dgvProduct.Size = new System.Drawing.Size(1390, 434); this.dgvProduct.TabIndex = 7; this.dgvProduct.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgvProduct_CellContentClick); // @@ -371,6 +375,10 @@ namespace TemuKJD.ToolForms // splitContainer1.Panel2 // this.splitContainer1.Panel2.BackColor = System.Drawing.Color.White; + this.splitContainer1.Panel2.Controls.Add(this.btnExportCookie); + this.splitContainer1.Panel2.Controls.Add(this.label7); + this.splitContainer1.Panel2.Controls.Add(this.txtWaitSeconds); + this.splitContainer1.Panel2.Controls.Add(this.label8); this.splitContainer1.Panel2.Controls.Add(this.btnGetHotGood); this.splitContainer1.Panel2.Controls.Add(this.btnCancelSelect); this.splitContainer1.Panel2.Controls.Add(this.txtTitle); @@ -389,7 +397,6 @@ namespace TemuKJD.ToolForms this.splitContainer1.Panel2.Controls.Add(this.txtPageStart); this.splitContainer1.Panel2.Controls.Add(this.label3); this.splitContainer1.Panel2.Controls.Add(this.btnCollectSupplier); - 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); @@ -397,8 +404,9 @@ namespace TemuKJD.ToolForms this.splitContainer1.Panel2.Controls.Add(this.btnSaveCookie); this.splitContainer1.Panel2.Controls.Add(this.btnImportCookie); this.splitContainer1.Panel2.Controls.Add(this.label2); + this.splitContainer1.Panel2.Controls.Add(this.line1); this.splitContainer1.Size = new System.Drawing.Size(1404, 561); - this.splitContainer1.SplitterDistance = 469; + this.splitContainer1.SplitterDistance = 471; this.splitContainer1.SplitterWidth = 3; this.splitContainer1.TabIndex = 4; // @@ -414,7 +422,7 @@ namespace TemuKJD.ToolForms this.ucTabControlMetro1.Name = "ucTabControlMetro1"; this.ucTabControlMetro1.SelectedIndex = 0; this.ucTabControlMetro1.ShowCloseButton = false; - this.ucTabControlMetro1.Size = new System.Drawing.Size(1404, 469); + this.ucTabControlMetro1.Size = new System.Drawing.Size(1404, 471); this.ucTabControlMetro1.TabIndex = 462; this.ucTabControlMetro1.TabSelectColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); this.ucTabControlMetro1.TabSelectTextColor = System.Drawing.Color.Gray; @@ -426,7 +434,7 @@ namespace TemuKJD.ToolForms this.tabPage1.Location = new System.Drawing.Point(4, 26); this.tabPage1.Name = "tabPage1"; this.tabPage1.Padding = new System.Windows.Forms.Padding(3); - this.tabPage1.Size = new System.Drawing.Size(1396, 439); + this.tabPage1.Size = new System.Drawing.Size(1396, 441); this.tabPage1.TabIndex = 0; this.tabPage1.Text = "商品页面"; this.tabPage1.UseVisualStyleBackColor = true; @@ -438,7 +446,7 @@ namespace TemuKJD.ToolForms this.tabPage2.Location = new System.Drawing.Point(4, 26); this.tabPage2.Name = "tabPage2"; this.tabPage2.Padding = new System.Windows.Forms.Padding(3); - this.tabPage2.Size = new System.Drawing.Size(1396, 438); + this.tabPage2.Size = new System.Drawing.Size(1396, 440); this.tabPage2.TabIndex = 1; this.tabPage2.Text = "采集列表"; this.tabPage2.UseVisualStyleBackColor = true; @@ -448,7 +456,7 @@ namespace TemuKJD.ToolForms this.tabPage3.Controls.Add(this.splitContainer3); this.tabPage3.Location = new System.Drawing.Point(4, 26); this.tabPage3.Name = "tabPage3"; - this.tabPage3.Size = new System.Drawing.Size(1396, 438); + this.tabPage3.Size = new System.Drawing.Size(1396, 440); this.tabPage3.TabIndex = 2; this.tabPage3.Text = "下架SKU查询"; this.tabPage3.UseVisualStyleBackColor = true; @@ -480,7 +488,7 @@ namespace TemuKJD.ToolForms // this.splitContainer3.Panel2.Controls.Add(this.pictureBox1); this.splitContainer3.Panel2.Controls.Add(this.dgvDownSku); - this.splitContainer3.Size = new System.Drawing.Size(1396, 438); + this.splitContainer3.Size = new System.Drawing.Size(1396, 440); this.splitContainer3.SplitterDistance = 82; this.splitContainer3.TabIndex = 0; // @@ -638,7 +646,7 @@ namespace TemuKJD.ToolForms // this.pictureBox1.Anchor = System.Windows.Forms.AnchorStyles.None; this.pictureBox1.Image = global::TemuKJD.Properties.Resources.loading_blue; - this.pictureBox1.Location = new System.Drawing.Point(673, 151); + this.pictureBox1.Location = new System.Drawing.Point(673, 152); this.pictureBox1.Name = "pictureBox1"; this.pictureBox1.Size = new System.Drawing.Size(50, 50); this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; @@ -686,7 +694,7 @@ namespace TemuKJD.ToolForms this.dgvDownSku.Name = "dgvDownSku"; this.dgvDownSku.ReadOnly = true; this.dgvDownSku.RowTemplate.Height = 23; - this.dgvDownSku.Size = new System.Drawing.Size(1396, 352); + this.dgvDownSku.Size = new System.Drawing.Size(1396, 354); this.dgvDownSku.TabIndex = 8; // // colDownSelect @@ -877,6 +885,39 @@ namespace TemuKJD.ToolForms this.btnDel.TabIndex = 409; this.btnDel.Text = "删"; // + // label7 + // + this.label7.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.label7.AutoSize = true; + this.label7.Location = new System.Drawing.Point(952, 35); + this.label7.Margin = new System.Windows.Forms.Padding(6, 0, 0, 0); + this.label7.Name = "label7"; + this.label7.Size = new System.Drawing.Size(56, 17); + this.label7.TabIndex = 1027; + this.label7.Text = "额外等待"; + // + // txtWaitSeconds + // + this.txtWaitSeconds.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.txtWaitSeconds.Location = new System.Drawing.Point(1008, 32); + this.txtWaitSeconds.Margin = new System.Windows.Forms.Padding(0, 2, 0, 2); + this.txtWaitSeconds.Name = "txtWaitSeconds"; + this.txtWaitSeconds.Size = new System.Drawing.Size(24, 23); + this.txtWaitSeconds.TabIndex = 1028; + this.txtWaitSeconds.Text = "1"; + this.txtWaitSeconds.TextChanged += new System.EventHandler(this.txtWaitSeconds_TextChanged); + // + // label8 + // + this.label8.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.label8.AutoSize = true; + this.label8.Location = new System.Drawing.Point(1032, 35); + this.label8.Margin = new System.Windows.Forms.Padding(6, 0, 0, 0); + this.label8.Name = "label8"; + this.label8.Size = new System.Drawing.Size(20, 17); + this.label8.TabIndex = 1029; + this.label8.Text = "秒"; + // // btnGetHotGood // this.btnGetHotGood.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); @@ -972,6 +1013,7 @@ namespace TemuKJD.ToolForms this.chkSkip.TabIndex = 942; this.chkSkip.Text = "采集时跳过库中已存在商品"; this.chkSkip.UseVisualStyleBackColor = true; + this.chkSkip.CheckedChanged += new System.EventHandler(this.chkSkip_CheckedChanged); // // chkOverride // @@ -1181,9 +1223,9 @@ namespace TemuKJD.ToolForms // 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(296, 7); + this.line1.Location = new System.Drawing.Point(298, 7); this.line1.Name = "line1"; - this.line1.Size = new System.Drawing.Size(25, 74); + this.line1.Size = new System.Drawing.Size(20, 74); this.line1.TabIndex = 790; this.line1.Text = "line1"; this.line1.VerticalLine = true; @@ -1214,9 +1256,9 @@ 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(171, 57); + this.btnRefreshCookie.Location = new System.Drawing.Point(153, 57); this.btnRefreshCookie.Name = "btnRefreshCookie"; - this.btnRefreshCookie.Size = new System.Drawing.Size(125, 25); + this.btnRefreshCookie.Size = new System.Drawing.Size(72, 25); this.btnRefreshCookie.Style.Alignment = System.Drawing.StringAlignment.Center; this.btnRefreshCookie.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); this.btnRefreshCookie.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); @@ -1229,7 +1271,7 @@ 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 @@ -1240,7 +1282,7 @@ namespace TemuKJD.ToolForms 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(164, 78); + this.txtCookie.Size = new System.Drawing.Size(145, 78); this.txtCookie.TabIndex = 766; this.txtCookie.Text = "填写cookie后点击导入cookie并刷新"; // @@ -1251,9 +1293,9 @@ 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("微软雅黑", 8F); - this.btnSaveCookie.Location = new System.Drawing.Point(171, 30); + this.btnSaveCookie.Location = new System.Drawing.Point(153, 30); this.btnSaveCookie.Name = "btnSaveCookie"; - this.btnSaveCookie.Size = new System.Drawing.Size(125, 25); + this.btnSaveCookie.Size = new System.Drawing.Size(146, 25); this.btnSaveCookie.Style.Alignment = System.Drawing.StringAlignment.Center; this.btnSaveCookie.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); this.btnSaveCookie.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); @@ -1276,9 +1318,9 @@ 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(171, 3); + this.btnImportCookie.Location = new System.Drawing.Point(153, 3); this.btnImportCookie.Name = "btnImportCookie"; - this.btnImportCookie.Size = new System.Drawing.Size(125, 25); + this.btnImportCookie.Size = new System.Drawing.Size(146, 25); this.btnImportCookie.Style.Alignment = System.Drawing.StringAlignment.Center; this.btnImportCookie.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); this.btnImportCookie.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); @@ -1304,6 +1346,31 @@ namespace TemuKJD.ToolForms this.label2.TabIndex = 789; this.label2.Text = "供应商"; // + // btnExportCookie + // + this.btnExportCookie.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.btnExportCookie.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; + this.btnExportCookie.Cursor = System.Windows.Forms.Cursors.Hand; + this.btnExportCookie.DisabledBackColor = System.Drawing.Color.Empty; + this.btnExportCookie.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.btnExportCookie.Location = new System.Drawing.Point(227, 57); + this.btnExportCookie.Name = "btnExportCookie"; + this.btnExportCookie.Size = new System.Drawing.Size(72, 25); + this.btnExportCookie.Style.Alignment = System.Drawing.StringAlignment.Center; + this.btnExportCookie.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); + this.btnExportCookie.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); + this.btnExportCookie.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder; + this.btnExportCookie.Style.BorderDashStyle = System.Drawing.Drawing2D.DashStyle.Dash; + this.btnExportCookie.Style.BorderSide = DevComponents.DotNetBar.eBorderSide.None; + this.btnExportCookie.Style.ForeColor.Color = System.Drawing.Color.White; + this.btnExportCookie.Style.GradientAngle = 90; + this.btnExportCookie.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center; + this.btnExportCookie.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255))))); + this.btnExportCookie.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255))))); + this.btnExportCookie.TabIndex = 1063; + this.btnExportCookie.Text = "导出cookie"; + this.btnExportCookie.Click += new System.EventHandler(this.btnExportCookie_Click); + // // GetJuShuitanProdForm // this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; @@ -1424,5 +1491,9 @@ namespace TemuKJD.ToolForms private System.Windows.Forms.DataGridViewTextBoxColumn colPrice; private System.Windows.Forms.DataGridViewLinkColumn colDel; private System.Windows.Forms.DataGridViewTextBoxColumn colMsg; + private System.Windows.Forms.Label label7; + private System.Windows.Forms.TextBox txtWaitSeconds; + private System.Windows.Forms.Label label8; + private DevComponents.DotNetBar.PanelEx btnExportCookie; } } \ No newline at end of file diff --git a/TEMUKJD/ToolForms/GetJuShuitanProdForm.cs b/TEMUKJD/ToolForms/GetJuShuitanProdForm.cs index b2186aa..b020fd7 100644 --- a/TEMUKJD/ToolForms/GetJuShuitanProdForm.cs +++ b/TEMUKJD/ToolForms/GetJuShuitanProdForm.cs @@ -13,6 +13,7 @@ using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; +using System.Globalization; using System.Linq; using System.Text; using System.Threading; @@ -1001,6 +1002,7 @@ namespace TemuKJD.ToolForms } } + int getDetailWait = 1; private void GetPinDuoduoProd() { //https://sc.scm121.com/api/goods/goods/goGoodsPdd/queryBaseData?itemSpuId=26903724F0044AC5976D098842D919E3&shelvesType=DISTRIBUTION&originator=SUPPLIER&itemCoId=14202245 @@ -1033,12 +1035,13 @@ namespace TemuKJD.ToolForms 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; if (chkSkip.Checked) { + // 不存在或已经采集过 + if (prod == null || prod?.dbProduct?.product_json?.ParseToString().Length > 10) + continue; + if (prod.getProductMsg == "商品已存在,跳过详情采集") continue; if (prod.getProductMsg.ParseToString().Contains("入库成功") || prod.getProductMsg.ParseToString().Contains("已存在相同id商品")) @@ -1073,6 +1076,8 @@ namespace TemuKJD.ToolForms } } Thread.Sleep(Randomx.GetId(500, 1500)); + // 休眠 + Thread.Sleep(getDetailWait * 1000); // 爆款专区查询真实供应商coid和供应商退货地址 if (prod.itemCoId == "12840800" || prod.supplierName == "寻合作-爆款专区") @@ -1231,7 +1236,14 @@ namespace TemuKJD.ToolForms prod.dbProduct.distribution_set = 1; } //{"success":true,"total":null,"data":{"message":"成功添加1款分销商品,系统会自动按商品拆分订单并推送给对应供应商","count":1,"shelvesType":"DISTRIBUTION"},"message":null,"code":"0000","hasNext":false,"now":1769330182209,"extra":{}} - + + // 先获取Pdd店铺信息 + if (string.IsNullOrEmpty(jstPddShopId)) + { + var getShopIdRst = GetPddShopId(shop, prod); + //{"success":true,"total":1,"data":[{"shopId":"20115638","supplierId":"14791477","shopName":"阿杰小铺浦哈哈","shopType":"拼多多","shopTypeKey":"拼多多","shopTypeValue":"拼多多","itemSpuId":null,"shopItemSpuId":null,"shopAuthorizationDate":"2027-01-23 11:17:00","userName":null,"shelvesStatus":false,"updated":null,"sessionStatus":2,"sessionUid":null,"created":null,"hasPermission":true,"enabled":true,"mainSpuId":null,"shelved":false,"appCid":0,"riskVerifyUrl":null,"storeType":"COMMON"}],"message":null,"code":"0000","hasNext":false,"now":1769588598917,"extra":{}} + jstPddShopId = BaseRegex.GetStringJson(ref getShopIdRst, "shopId"); + } // 采集商品详情 var getPddDetailRst = GetPddBaseData(shop, prod); @@ -1252,22 +1264,23 @@ namespace TemuKJD.ToolForms { var jObj = JsonHelper.JObjectParse(getPddDetailRst)["data"]; - // 未维护拼多多平台数据的,采集聚水潭基础数据转化为拼多多数据,给客户上传草稿箱使用 + // 未维护拼多多平台数据的,采集聚水潭拼多多页面基础数据,转化为拼多多数据,给客户上传草稿箱使用 if (jObj.IsJTokenNullOrEmpty()) { - jObj = GetJstDetail(shop, prod, row); + jObj = GetJstPddPageDetail(shop, prod, row); if (jObj == null) continue; } - prod.dbProduct.cat_id = jObj["catId"].ParseToString(); + // 未维护拼多多平台数据的,采集聚水潭商品详情页面基础数据,转化为拼多多数据,给客户上传草稿箱使用 + //if (jObj.IsJTokenNullOrEmpty()) + //{ + // jObj = GetJstPageDetail(shop, prod, row); + // if (jObj == null) + // continue; + //} - if (string.IsNullOrEmpty(jstPddShopId)) - { - var getShopIdRst = GetPddShopId(shop, prod); - //{"success":true,"total":1,"data":[{"shopId":"20115638","supplierId":"14791477","shopName":"阿杰小铺浦哈哈","shopType":"拼多多","shopTypeKey":"拼多多","shopTypeValue":"拼多多","itemSpuId":null,"shopItemSpuId":null,"shopAuthorizationDate":"2027-01-23 11:17:00","userName":null,"shelvesStatus":false,"updated":null,"sessionStatus":2,"sessionUid":null,"created":null,"hasPermission":true,"enabled":true,"mainSpuId":null,"shelved":false,"appCid":0,"riskVerifyUrl":null,"storeType":"COMMON"}],"message":null,"code":"0000","hasNext":false,"now":1769588598917,"extra":{}} - jstPddShopId = BaseRegex.GetStringJson(ref getShopIdRst, "shopId"); - } + prod.dbProduct.cat_id = jObj["catId"].ParseToString(); // 获取属性 if (prod.dbProduct.cat_id.IsNullOrEmpty()) @@ -1376,6 +1389,8 @@ namespace TemuKJD.ToolForms }, cancellationTokenSource.Token); } + + /// /// 获取聚水潭商品详情并转换为聚水潭拼多多商品详情 /// @@ -1383,7 +1398,7 @@ namespace TemuKJD.ToolForms /// /// /// - private JObject GetJstDetail(ShopLoginInfo shop, JSTListProductInfo prod, DataGridViewRow row) + private JObject GetJstPageDetail(ShopLoginInfo shop, JSTListProductInfo prod, DataGridViewRow row) { var detailRst = GetGoodsDetail(shop, prod); if (!detailRst.Contains("\"success\":true")) @@ -1399,90 +1414,248 @@ namespace TemuKJD.ToolForms return null; } - var JstData = JsonHelper.JObjectParse(detailRst)["data"]; - var PddData = new JObject(); - PddData["id"] = JstData["supplierId"].ParseToString(); - PddData["coId"] = JstData["coId"].ParseToString(); - PddData["carouselGallery"] = JstData["itemMainImage"]; - PddData["categoryData"] = new JArray() { 1 }; - PddData["catId"] = 1; - //PddData["detailGallery"] = JstData["itemDetailImages"]; - if (JstData["itemDetailImages"].IsJTokenNullOrEmpty() || JstData["itemDetailImages"].Count() == 0) + try { - PddData["detailGallery"] = new JArray(); - foreach(var jItem in PddData["carouselGallery"]) + var JstData = JsonHelper.JObjectParse(detailRst)["data"]; + var PddData = new JObject(); + PddData["id"] = JstData["supplierId"].ParseToString(); + PddData["coId"] = JstData["coId"].ParseToString(); + PddData["carouselGallery"] = JstData["itemMainImage"]; + PddData["categoryData"] = new JArray() { 1 }; + PddData["catId"] = 1; + //PddData["detailGallery"] = JstData["itemDetailImages"]; + if (JstData["itemDetailImages"].IsJTokenNullOrEmpty() || JstData["itemDetailImages"].Count() == 0) { - (PddData["detailGallery"] as JArray).Add(jItem); + PddData["detailGallery"] = new JArray(); + foreach (var jItem in PddData["carouselGallery"]) + { + (PddData["detailGallery"] as JArray).Add(jItem); + } } - } - else - { - PddData["detailGallery"] = new JArray(); - foreach (var jItem in JstData["itemDetailImages"]) + else { - (PddData["detailGallery"] as JArray).Add(jItem["imageUrl"]); + PddData["detailGallery"] = new JArray(); + foreach (var jItem in JstData["itemDetailImages"]) + { + (PddData["detailGallery"] as JArray).Add(jItem["imageUrl"]); + } } - } - PddData["goodsDesc"] = JstData["itemName"].ParseToString(); - PddData["goodsName"] = JstData["itemName"].ParseToString(); - PddData["goodsProperties"] = new JArray(); - PddData["marketPrice"] = JstData["maxSupplyPrice"].ParseToDecimal() * 2 + 10; - PddData["styleCode"] = JstData["styleCode"]; - PddData["itemSpuId"] = JstData["itemSpuId"]; - PddData["skuInfo"] = new JObject(); - (PddData["skuInfo"] as JObject).Add("goodsSkuDetail", new JArray()); - foreach (var jstSkuObj in JstData["itemSkuList"]) - { - JObject skuObj = new JObject(); - (PddData["skuInfo"]["goodsSkuDetail"] as JArray).Add(skuObj); + PddData["goodsDesc"] = JstData["itemName"].ParseToString(); + PddData["goodsName"] = JstData["itemName"].ParseToString(); + PddData["goodsProperties"] = new JArray(); + PddData["marketPrice"] = JstData["maxSupplyPrice"].ParseToDecimal() * 2 + 10; + PddData["styleCode"] = JstData["styleCode"]; + PddData["itemSpuId"] = JstData["itemSpuId"]; + PddData["skuInfo"] = new JObject(); + (PddData["skuInfo"] as JObject).Add("goodsSkuDetail", new JArray()); + foreach (var jstSkuObj in JstData["itemSkuList"]) + { + JObject skuObj = new JObject(); + (PddData["skuInfo"]["goodsSkuDetail"] as JArray).Add(skuObj); - skuObj["quantity"] = jstSkuObj["stock"]; - skuObj["skus"] = new JArray(); - if (!jstSkuObj["colour"].IsJTokenNullOrEmpty()) - { - JObject jSpecColor = new JObject(); - (skuObj["skus"] as JArray).Add(jSpecColor); - jSpecColor["v"] = jstSkuObj["colour"].ParseToString(); - jSpecColor["k"] = "颜色"; + skuObj["quantity"] = jstSkuObj["stock"]; + skuObj["skus"] = new JArray(); + if (!jstSkuObj["colour"].IsJTokenNullOrEmpty()) + { + JObject jSpecColor = new JObject(); + (skuObj["skus"] as JArray).Add(jSpecColor); + jSpecColor["v"] = jstSkuObj["colour"].ParseToString(); + jSpecColor["k"] = "颜色"; + } + if (!jstSkuObj["spec"].IsJTokenNullOrEmpty()) + { + JObject jSpecColor = new JObject(); + (skuObj["skus"] as JArray).Add(jSpecColor); + jSpecColor["v"] = jstSkuObj["spec"].ParseToString(); + jSpecColor["k"] = "尺码"; + } + skuObj["supplyPrice"] = jstSkuObj["supplyPrice"]; + skuObj["erpSkuStatus"] = jstSkuObj["erpSkuStatus"]; + skuObj["baseSkuId"] = jstSkuObj["id"]; + skuObj["coId"] = jstSkuObj["coId"]; + skuObj["isOnsale"] = 1; + skuObj["itemNo"] = jstSkuObj["itemCode"].IsJTokenNullOrEmpty() ? jstSkuObj["erpStyleCode"] : jstSkuObj["itemCode"]; + skuObj["pic"] = jstSkuObj["pic"]; + skuObj["jdSkuStatus"] = 1; + skuObj["limitQuantity"] = 999; + skuObj["sales"] = 0; + skuObj["aliSkuStatus"] = 1; + skuObj["preSaleTime"] = ""; + skuObj["price"] = jstSkuObj["supplyPrice"].ParseToDecimal() + 1; + skuObj["multiPrice"] = jstSkuObj["supplyPrice"]; + skuObj["id"] = jstSkuObj["id"]; } - if (!jstSkuObj["spec"].IsJTokenNullOrEmpty()) + + PddData["whiteImage"] = JstData["whiteImage"]; + PddData["colourRelation"] = JstData["colourSet"]; + PddData["specRelation"] = JstData["specSet"]; + PddData["itemCoId"] = JstData["itemCoId"]; + PddData["shopTypeEnum"] = "Pinduoduo"; + PddData["forecastMainImage"] = PddData["carouselGallery"].FirstOrDefault(); + PddData["forecastItemName"] = PddData["goodsName"]; + PddData["mainImage"] = PddData["carouselGallery"]; + PddData["leafCategoryId"] = PddData["catId"].ParseToString(); + PddData["itemName"] = PddData["goodsName"]; + PddData["groupPreSaleDay"] = 0; + PddData["categoryPropStr"] = "[]"; + + return PddData; + } + catch (Exception ex) + { + return null; + } + } + + private JObject GetJstPddPageDetail(ShopLoginInfo shop, JSTListProductInfo prod, DataGridViewRow row) + { + // 获取商品详情 + var detailRst = GetItemSpuInfo(shop, prod); + if (!detailRst.Contains("\"success\":true")) + { + var errMsg = BaseRegex.GetStringJson(ref detailRst, "message"); + if (string.IsNullOrEmpty(errMsg)) + errMsg = detailRst; + prod.getProductMsg = "采集失败 " + errMsg; + Invoke(new Action(() => { - JObject jSpecColor = new JObject(); - (skuObj["skus"] as JArray).Add(jSpecColor); - jSpecColor["v"] = jstSkuObj["spec"].ParseToString(); - jSpecColor["k"] = "尺码"; - } - skuObj["supplyPrice"] = jstSkuObj["supplyPrice"]; - skuObj["erpSkuStatus"] = jstSkuObj["erpSkuStatus"]; - skuObj["baseSkuId"] = jstSkuObj["id"]; - skuObj["coId"] = jstSkuObj["coId"]; - skuObj["isOnsale"] = 1; - skuObj["itemNo"] = jstSkuObj["itemCode"].IsJTokenNullOrEmpty() ? jstSkuObj["erpStyleCode"] : jstSkuObj["itemCode"]; - skuObj["pic"] = jstSkuObj["pic"]; - skuObj["jdSkuStatus"] = 1; - skuObj["limitQuantity"] = 999; - skuObj["sales"] = 0; - skuObj["aliSkuStatus"] = 1; - skuObj["preSaleTime"] = ""; - skuObj["price"] = jstSkuObj["supplyPrice"].ParseToDecimal() + 1; - skuObj["multiPrice"] = jstSkuObj["supplyPrice"]; - skuObj["id"] = jstSkuObj["id"]; + try { row.Cells["colMsg"].Value = prod.getProductMsg; } catch { } + })); + return null; } - PddData["whiteImage"] = JstData["whiteImage"]; - PddData["colourRelation"] = JstData["colourSet"]; - PddData["specRelation"] = JstData["specSet"]; - PddData["itemCoId"] = JstData["itemCoId"]; - PddData["shopTypeEnum"] = "Pinduoduo"; - PddData["forecastMainImage"] = PddData["carouselGallery"].FirstOrDefault(); - PddData["forecastItemName"] = PddData["goodsName"]; - PddData["mainImage"] = PddData["carouselGallery"]; - PddData["leafCategoryId"] = "1"; - PddData["itemName"] = PddData["goodsName"]; - PddData["groupPreSaleDay"] = 0; - PddData["categoryPropStr"] = "[]"; + // 获取类目预测 + var cateRst = categoryForecastWithPlatform(shop, prod, jstPddShopId); + Thread.Sleep(Randomx.GetId(1000, 2000)); + if (!cateRst.Contains("\"success\":true")) + { + var errMsg = BaseRegex.GetStringJson(ref cateRst, "message"); + if (string.IsNullOrEmpty(errMsg)) + errMsg = cateRst; + prod.getProductMsg = "采集失败 " + errMsg; + Invoke(new Action(() => + { + try { row.Cells["colMsg"].Value = prod.getProductMsg; } catch { } + })); + return null; + } - return PddData; + try + { + var JstPddData = JsonHelper.JObjectParse(detailRst)["data"]; + var pddCateForecast = JsonHelper.JObjectParse(cateRst)["data"].FirstOrDefault()?["forecastCategory"] as JArray; + + var PddData = new JObject(); + PddData["id"] = JstPddData["goodsItemSpu"]["id"].ParseToString(); + PddData["coId"] = JstPddData["goodsItemSpu"]["coId"].ParseToString(); + PddData["carouselGallery"] = JstPddData["goodsItemSpu"]["itemMainImage"]; + PddData["categoryData"] = new JArray(); + foreach (var catItem in pddCateForecast) + { + (PddData["categoryData"] as JArray).Add(catItem["categoryId"]); + } + PddData["catId"] = (pddCateForecast.LastOrDefault()?["categoryId"]).ParseToLong(); + if (JstPddData["goodsItemPhoto"]["itemDetailImages"].IsJTokenNullOrEmpty() || JstPddData["goodsItemPhoto"]["itemDetailImages"].Count() == 0) + { + PddData["detailGallery"] = new JArray(); + foreach (var jItem in PddData["carouselGallery"]) + { + (PddData["detailGallery"] as JArray).Add(jItem); + } + } + else + { + PddData["detailGallery"] = new JArray(); + foreach (var jItem in JstPddData["goodsItemPhoto"]["itemDetailImages"]) + { + (PddData["detailGallery"] as JArray).Add(jItem["imageUrl"]); + } + } + + PddData["goodsDesc"] = JstPddData["goodsItemSpu"]["itemName"].ParseToString(); + PddData["goodsName"] = JstPddData["goodsItemSpu"]["itemName"].ParseToString(); + PddData["goodsProperties"] = new JArray(); + + // 市场价 + PddData["marketPrice"] = 0; + + PddData["styleCode"] = JstPddData["goodsItemSpu"]["styleCode"]; + PddData["itemSpuId"] = JstPddData["goodsItemSpu"]["itemSpuId"]; + + PddData["colourRelation"] = new JObject(); // JstPddData["colourSet"]; + PddData["specRelation"] = new JObject(); //JstPddData["specSet"]; + + PddData["skuInfo"] = new JObject(); + (PddData["skuInfo"] as JObject).Add("goodsSkuDetail", new JArray()); + foreach (var jstSkuObjC in JstPddData["colourItemSkus"]) + { + //string colour = jstSkuObjC["colour"].ParseToString(); + foreach (var jstSkuObj in jstSkuObjC["goodsItemSkus"]) + { + JObject skuObj = new JObject(); + (PddData["skuInfo"]["goodsSkuDetail"] as JArray).Add(skuObj); + + skuObj["quantity"] = jstSkuObj["skuStock"]; + skuObj["skus"] = new JArray(); + if (!jstSkuObj["colour"].IsNullOrEmpty()) + { + JObject jSpecColor = new JObject(); + (skuObj["skus"] as JArray).Add(jSpecColor); + jSpecColor["v"] = jstSkuObj["colour"].ParseToString(); + jSpecColor["k"] = JstPddData["goodsItemSpu"]["realColorName"].ParseToString().IsNullOrEmpty() ? "颜色" : JstPddData["goodsItemSpu"]["realColorName"]; + (PddData["colourRelation"] as JObject)[jstSkuObj["colour"].ParseToString()] = jstSkuObj["colour"]; + } + if (!jstSkuObj["spec"].IsJTokenNullOrEmpty()) + { + JObject jSpecColor = new JObject(); + (skuObj["skus"] as JArray).Add(jSpecColor); + jSpecColor["v"] = jstSkuObj["spec"].ParseToString(); + jSpecColor["k"] = JstPddData["goodsItemSpu"]["realSpecName"].ParseToString().IsNullOrEmpty() ? "尺码" : JstPddData["goodsItemSpu"]["realSpecName"]; + (PddData["specRelation"] as JObject)[jstSkuObj["spec"].ParseToString()] = jstSkuObj["spec"]; + } + skuObj["supplyPrice"] = jstSkuObj["supplyPrice"]; + skuObj["erpSkuStatus"] = jstSkuObj["erpSkuStatus"]; + skuObj["baseSkuId"] = jstSkuObj["id"]; + skuObj["coId"] = JstPddData["goodsItemSpu"]["coId"]; + skuObj["isOnsale"] = 1; + skuObj["itemNo"] = jstSkuObj["itemCode"]; + skuObj["pic"] = jstSkuObj["pic"]; + skuObj["jdSkuStatus"] = 1; + skuObj["limitQuantity"] = 999; + skuObj["sales"] = 0; + skuObj["aliSkuStatus"] = 1; + skuObj["preSaleTime"] = ""; + skuObj["price"] = jstSkuObj["supplyPrice"].ParseToDecimal() + 1; + skuObj["multiPrice"] = jstSkuObj["supplyPrice"]; + skuObj["id"] = jstSkuObj["id"]; + + // 市场价 + PddData["marketPrice"] = Math.Max(PddData["marketPrice"].ParseToDecimal(), skuObj["multiPrice"].ParseToDecimal() * 2 + 10); + } + } + + PddData["whiteImage"] = JstPddData["goodsItemPhoto"]["whiteImage"]; + PddData["itemCoId"] = JstPddData["goodsItemSpu"]["coId"].ParseToString(); + PddData["shopTypeEnum"] = "Pinduoduo"; + PddData["forecastMainImage"] = PddData["carouselGallery"].FirstOrDefault(); + PddData["forecastItemName"] = PddData["goodsName"]; + PddData["mainImage"] = PddData["carouselGallery"]; + PddData["leafCategoryId"] = PddData["catId"].ParseToString(); + PddData["itemName"] = PddData["goodsName"]; + PddData["groupPreSaleDay"] = 0; + PddData["categoryPropStr"] = "[]"; + + return PddData; + } + catch (Exception ex) + { + prod.getProductMsg = "详情采集失败:" + ex.Message; + Invoke(new Action(() => + { + try { row.Cells["colMsg"].Value = prod.getProductMsg; } catch { } + })); + return null; + } } private void GetDyProd() @@ -1650,6 +1823,39 @@ namespace TemuKJD.ToolForms return detailRst; } + public string GetItemSpuInfo(ShopLoginInfo shop, JSTListProductInfo jstLstProd) + { + string url = "https://sc.scm121.com/api/goods/shelves/itemSpuShelves/getItemSpuInfo"; + string referer = "https://sc.scm121.com/manage/goods/qualitySupplier/goodsDetail/" + jstLstProd.itemSpuId + "?itemCoId=" + jstLstProd.itemCoId + "&noBack=true"; + string data = @"{""itemSpuId"":""" + jstLstProd.itemSpuId + @""",""itemCoId"":""" + jstLstProd.itemCoId + @"""}"; + data = @"{""id"":""" + jstLstProd.itemSpuId + @""",""platformType"":""Pinduoduo"",""shelvesType"":""DISTRIBUTION"",""companyType"":""SUPPLIER"",""itemCoId"":""" + + jstLstProd.itemCoId + @"""}"; + + var detailRst = ""; + for (int i = 0; i < 3 && !detailRst.Contains("\"success\":true"); i++) + { + Thread.Sleep(Randomx.GetId(1000, 2000)); + detailRst = JSTHttpResponseBLL.JSTPostResponse(shop, url, data, referer, appVersion); + } + return detailRst; + } + + public string categoryForecastWithPlatform(ShopLoginInfo shop, JSTListProductInfo jstLstProd, string shopId) + { + string url = "https://sc.scm121.com/api/goods/platform/category/categoryForecastWithPlatform"; + string referer = "https://sc.scm121.com/manage/goods/qualitySupplier/goodsDetail/" + jstLstProd.itemSpuId + "?itemCoId=" + jstLstProd.itemCoId + "&noBack=true"; + string data = @"{""itemCoId"":""" + jstLstProd.coId + @""",""itemSpuId"":""" + jstLstProd.itemSpuId + + @""",""shopId"":""" + shopId + @""",""shopType"":""Pinduoduo"",""itemName"":""" + jstLstProd.itemName + @"""}"; + + var detailRst = ""; + for (int i = 0; i < 3 && !detailRst.Contains("\"success\":true"); i++) + { + Thread.Sleep(Randomx.GetId(1000, 2000)); + detailRst = JSTHttpResponseBLL.JSTPostResponse(shop, url, data, referer, appVersion); + } + return detailRst; + } + public string GetPddShopId(ShopLoginInfo shop, JSTListProductInfo jstLstProd) { string url = "https://sc.scm121.com/api/goods/shelves/mxStoresInformation/selectStoresInfo?shopTypeKey=%E6%8B%BC%E5%A4%9A%E5%A4%9A&spuId=" + @@ -2260,6 +2466,49 @@ namespace TemuKJD.ToolForms if (CancelGetDown != null) CancelGetDown.Cancel(); } + + private void chkSkip_CheckedChanged(object sender, EventArgs e) + { + + } + + private void txtWaitSeconds_TextChanged(object sender, EventArgs e) + { + getDetailWait = txtWaitSeconds.Text.ParseToInt(); + } + + private void btnExportCookie_Click(object sender, EventArgs e) + { + List cookieList = CEFBrowser.GetCookieList(".scm121.com", cefWebBrowser.GetCookieManager(null)); + var shop = new ShopLoginInfo(); + shop.Cookies = JsonHelper.SerializeObject(cookieList); + + List cooks = null; + try { cooks = JsonHelper.DeserializeJsonToList(shop.Cookies); } catch (Exception ex) { } + if (cooks == null) + cooks = new List(); + + string cookJs = ""; + var keys = new string[] { "acw_tc", "DISTRYBUTION_TOKEN" }; + foreach (var shopCook in cooks) + { + var cookie = shopCook.Name + "=" + shopCook.Value; + if (!keys.Any(k => cookie.StartsWith(k))) + continue; + cookJs += "\r\ndocument.cookie='" + cookie.Substring(0, Math.Max(0, cookie.IndexOf("="))) + "=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;';"; + } + foreach (var shopCook in cooks) + { + var cookie = shopCook.Name + "=" + shopCook.Value; + if (!keys.Any(k => cookie.StartsWith(k))) + continue; + cookJs += "\r\ndocument.cookie='" + cookie + "; domain=.scm121.com; expires=" + + DateTime.Now.AddMonths(1).ToUniversalTime().ToString("ddd, dd MMM yyyy HH:mm:ss 'UTC'", new DateTimeFormatInfo()) + "; path=/';"; + } + cookJs += "\r\nsetTimeout(() => { window.location.href='https://sc.scm121.com/suppliersManage/suppliersList/onlineSuppliers'; }, 200)"; + Clipboard.SetDataObject(cookJs); + BaseMsgForm.ShowInfo("复制成功"); + } } /// diff --git a/TEMUKJD/WXForms/ProductForms/WXDBProdUploadForm.Designer.cs b/TEMUKJD/WXForms/ProductForms/WXDBProdUploadForm.Designer.cs index c785b85..f672abe 100644 --- a/TEMUKJD/WXForms/ProductForms/WXDBProdUploadForm.Designer.cs +++ b/TEMUKJD/WXForms/ProductForms/WXDBProdUploadForm.Designer.cs @@ -228,7 +228,7 @@ namespace TemuKJD.WXForms.ProductForms // splitContainer1.Panel2 // this.splitContainer1.Panel2.Controls.Add(this.splitContainer3); - this.splitContainer1.Size = new System.Drawing.Size(1557, 546); + this.splitContainer1.Size = new System.Drawing.Size(1499, 546); this.splitContainer1.SplitterDistance = 165; this.splitContainer1.TabIndex = 11; // @@ -284,7 +284,7 @@ namespace TemuKJD.WXForms.ProductForms this.ucGroupBoxEx2.Controls.Add(this.chkStepAddPrice); this.ucGroupBoxEx2.Location = new System.Drawing.Point(571, 2); this.ucGroupBoxEx2.Name = "ucGroupBoxEx2"; - this.ucGroupBoxEx2.Size = new System.Drawing.Size(984, 165); + this.ucGroupBoxEx2.Size = new System.Drawing.Size(926, 165); this.ucGroupBoxEx2.TabIndex = 667; this.ucGroupBoxEx2.TabStop = false; this.ucGroupBoxEx2.Text = "商品上传"; @@ -318,7 +318,7 @@ namespace TemuKJD.WXForms.ProductForms // this.label6.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.label6.AutoSize = true; - this.label6.Location = new System.Drawing.Point(795, 18); + this.label6.Location = new System.Drawing.Point(737, 18); this.label6.Margin = new System.Windows.Forms.Padding(6, 0, 0, 0); this.label6.Name = "label6"; this.label6.Size = new System.Drawing.Size(56, 17); @@ -328,7 +328,7 @@ namespace TemuKJD.WXForms.ProductForms // txtWaitSeconds // this.txtWaitSeconds.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.txtWaitSeconds.Location = new System.Drawing.Point(851, 15); + this.txtWaitSeconds.Location = new System.Drawing.Point(793, 15); this.txtWaitSeconds.Margin = new System.Windows.Forms.Padding(0, 2, 0, 2); this.txtWaitSeconds.Name = "txtWaitSeconds"; this.txtWaitSeconds.Size = new System.Drawing.Size(24, 23); @@ -564,7 +564,7 @@ namespace TemuKJD.WXForms.ProductForms this.txtReplaceText.Margin = new System.Windows.Forms.Padding(0, 3, 3, 3); this.txtReplaceText.Multiline = true; this.txtReplaceText.Name = "txtReplaceText"; - this.txtReplaceText.Size = new System.Drawing.Size(344, 40); + this.txtReplaceText.Size = new System.Drawing.Size(286, 40); this.txtReplaceText.TabIndex = 740; this.txtReplaceText.Text = "真丝,蚕丝,香云纱,羊绒,羊毛,羊羔绒,羊羔毛,羽绒,皮草"; this.txtReplaceText.TextChanged += new System.EventHandler(this.txtReplaceText_TextChanged); @@ -594,7 +594,7 @@ namespace TemuKJD.WXForms.ProductForms // this.label7.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.label7.AutoSize = true; - this.label7.Location = new System.Drawing.Point(875, 18); + this.label7.Location = new System.Drawing.Point(817, 18); this.label7.Margin = new System.Windows.Forms.Padding(6, 0, 0, 0); this.label7.Name = "label7"; this.label7.Size = new System.Drawing.Size(20, 17); @@ -607,7 +607,7 @@ namespace TemuKJD.WXForms.ProductForms this.btnStop.CanvasColor = System.Drawing.SystemColors.Control; this.btnStop.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; this.btnStop.DisabledBackColor = System.Drawing.Color.Empty; - this.btnStop.Location = new System.Drawing.Point(900, 47); + this.btnStop.Location = new System.Drawing.Point(842, 47); this.btnStop.Margin = new System.Windows.Forms.Padding(4, 2, 2, 2); this.btnStop.Name = "btnStop"; this.btnStop.Size = new System.Drawing.Size(71, 23); @@ -645,7 +645,7 @@ namespace TemuKJD.WXForms.ProductForms this.btnClearDgv.CanvasColor = System.Drawing.SystemColors.Control; this.btnClearDgv.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; this.btnClearDgv.DisabledBackColor = System.Drawing.Color.Empty; - this.btnClearDgv.Location = new System.Drawing.Point(900, 75); + this.btnClearDgv.Location = new System.Drawing.Point(842, 75); this.btnClearDgv.Margin = new System.Windows.Forms.Padding(4, 2, 2, 2); this.btnClearDgv.Name = "btnClearDgv"; this.btnClearDgv.Size = new System.Drawing.Size(71, 23); @@ -851,7 +851,7 @@ namespace TemuKJD.WXForms.ProductForms this.btnUpload.Cursor = System.Windows.Forms.Cursors.Hand; this.btnUpload.DisabledBackColor = System.Drawing.Color.Empty; this.btnUpload.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.btnUpload.Location = new System.Drawing.Point(900, 19); + this.btnUpload.Location = new System.Drawing.Point(842, 19); this.btnUpload.Name = "btnUpload"; this.btnUpload.Size = new System.Drawing.Size(71, 23); this.btnUpload.Style.Alignment = System.Drawing.StringAlignment.Center; @@ -1612,7 +1612,7 @@ namespace TemuKJD.WXForms.ProductForms // splitContainer3.Panel2 // this.splitContainer3.Panel2.Controls.Add(this.splitContainer4); - this.splitContainer3.Size = new System.Drawing.Size(1557, 377); + this.splitContainer3.Size = new System.Drawing.Size(1499, 377); this.splitContainer3.SplitterDistance = 347; this.splitContainer3.TabIndex = 1; // @@ -1640,7 +1640,7 @@ namespace TemuKJD.WXForms.ProductForms this.splitContainer2.Panel2.Controls.Add(this.chkTestNoAuditUpload); this.splitContainer2.Panel2.Controls.Add(this.dgvSelectProduct); this.splitContainer2.Panel2.Padding = new System.Windows.Forms.Padding(0, 0, 4, 0); - this.splitContainer2.Size = new System.Drawing.Size(1557, 347); + this.splitContainer2.Size = new System.Drawing.Size(1499, 347); this.splitContainer2.SplitterDistance = 350; this.splitContainer2.TabIndex = 0; // @@ -1833,7 +1833,7 @@ namespace TemuKJD.WXForms.ProductForms // this.pbLoading.Anchor = System.Windows.Forms.AnchorStyles.None; this.pbLoading.Image = global::TemuKJD.Properties.Resources.loading_blue; - this.pbLoading.Location = new System.Drawing.Point(576, 148); + this.pbLoading.Location = new System.Drawing.Point(547, 148); this.pbLoading.Name = "pbLoading"; this.pbLoading.Size = new System.Drawing.Size(50, 50); this.pbLoading.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; @@ -1848,7 +1848,7 @@ namespace TemuKJD.WXForms.ProductForms this.并发上传.Cursor = System.Windows.Forms.Cursors.Hand; this.并发上传.DisabledBackColor = System.Drawing.Color.Empty; this.并发上传.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.并发上传.Location = new System.Drawing.Point(1077, 30); + this.并发上传.Location = new System.Drawing.Point(1019, 30); this.并发上传.Name = "并发上传"; this.并发上传.Size = new System.Drawing.Size(118, 23); this.并发上传.Style.Alignment = System.Drawing.StringAlignment.Center; @@ -1905,7 +1905,7 @@ namespace TemuKJD.WXForms.ProductForms // chkTestNoAuditUpload // this.chkTestNoAuditUpload.AutoSize = true; - this.chkTestNoAuditUpload.Location = new System.Drawing.Point(926, 31); + this.chkTestNoAuditUpload.Location = new System.Drawing.Point(11, 59); this.chkTestNoAuditUpload.Name = "chkTestNoAuditUpload"; this.chkTestNoAuditUpload.Size = new System.Drawing.Size(123, 21); this.chkTestNoAuditUpload.TabIndex = 779; @@ -1959,7 +1959,7 @@ namespace TemuKJD.WXForms.ProductForms this.dgvSelectProduct.Name = "dgvSelectProduct"; this.dgvSelectProduct.ReadOnly = true; this.dgvSelectProduct.RowTemplate.Height = 23; - this.dgvSelectProduct.Size = new System.Drawing.Size(1199, 347); + this.dgvSelectProduct.Size = new System.Drawing.Size(1141, 347); this.dgvSelectProduct.TabIndex = 187; this.dgvSelectProduct.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgvSelectProduct_CellContentClick); // @@ -2158,8 +2158,8 @@ namespace TemuKJD.WXForms.ProductForms // this.splitContainer4.Panel2.Controls.Add(this.btnClear); this.splitContainer4.Panel2.Controls.Add(this.panelEx1); - this.splitContainer4.Size = new System.Drawing.Size(1557, 26); - this.splitContainer4.SplitterDistance = 866; + this.splitContainer4.Size = new System.Drawing.Size(1499, 26); + this.splitContainer4.SplitterDistance = 808; this.splitContainer4.TabIndex = 3; // // statusBar @@ -2170,7 +2170,7 @@ namespace TemuKJD.WXForms.ProductForms this.statusBar.Location = new System.Drawing.Point(0, 0); this.statusBar.Margin = new System.Windows.Forms.Padding(0); this.statusBar.Name = "statusBar"; - this.statusBar.Size = new System.Drawing.Size(866, 26); + this.statusBar.Size = new System.Drawing.Size(808, 26); this.statusBar.TabIndex = 2; // // btnClear @@ -2230,14 +2230,14 @@ namespace TemuKJD.WXForms.ProductForms | System.Windows.Forms.AnchorStyles.Right))); this.panel1.Location = new System.Drawing.Point(699, 552); this.panel1.Name = "panel1"; - this.panel1.Size = new System.Drawing.Size(881, 86); + this.panel1.Size = new System.Drawing.Size(873, 86); this.panel1.TabIndex = 189; // // WXDBProdUploadForm // this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; this.BackColor = System.Drawing.Color.White; - this.ClientSize = new System.Drawing.Size(1583, 641); + this.ClientSize = new System.Drawing.Size(1575, 641); this.Controls.Add(this.splitContainer1); this.Controls.Add(this.panel1); this.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));