From 8f5debb85cca73d605372d1a4e13de0fc6db82c9 Mon Sep 17 00:00:00 2001 From: wule_5900x Date: Sun, 28 Jun 2026 10:05:46 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BD=A3=E9=87=91=E4=B8=8A=E8=B4=A7=E9=80=BB?= =?UTF-8?q?=E8=BE=91=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AllBase/BaseClass.cs | 2 +- .../ProductForms/WXDBProdUploadForm.cs | 36 +- .../WXProdPreSaleForm.Designer.cs | 308 ++++++++++++------ .../WXForms/ProductForms/WXProdPreSaleForm.cs | 223 ++++++++++++- .../ProductForms/WXProdPreSaleForm.resx | 3 + 5 files changed, 458 insertions(+), 114 deletions(-) diff --git a/AllBase/BaseClass.cs b/AllBase/BaseClass.cs index 95d1c89..8991970 100644 --- a/AllBase/BaseClass.cs +++ b/AllBase/BaseClass.cs @@ -27,7 +27,7 @@ namespace AllBase /// /// 版本ID /// - public static int VersionCount = 1191; + public static int VersionCount = 1192; public static string MainPath = "29wx"; //public static string MainPath = "29wx"; //public static string MainPath = "29pdd"; diff --git a/TEMUKJD/WXForms/ProductForms/WXDBProdUploadForm.cs b/TEMUKJD/WXForms/ProductForms/WXDBProdUploadForm.cs index 906aee6..db41490 100644 --- a/TEMUKJD/WXForms/ProductForms/WXDBProdUploadForm.cs +++ b/TEMUKJD/WXForms/ProductForms/WXDBProdUploadForm.cs @@ -329,10 +329,10 @@ namespace TemuKJD.WXForms.ProductForms { lblSourceType.Visible = true; cmbSourceType.Visible = true; - if (!string.IsNullOrWhiteSpace(cmbSourceType.Text)) + //if (!string.IsNullOrWhiteSpace(cmbSourceType.Text)) { - //lblGroupFilter.Visible = true; - //cmbGroupFilter.Visible = true; + lblGroupFilter.Visible = true; + cmbGroupFilter.Visible = true; } } if (BaseClass.UserAuthority.ParseToString().Contains("微信回采")) @@ -1604,11 +1604,12 @@ namespace TemuKJD.WXForms.ProductForms fromCommissionRate = BaseRegex.GetStringJson(ref prodCommissionRst, "commission_rate").ParseToNullableInt(); if (fromCommissionRate == null) fromCommissionRate = -1; - if (prodCommissionRst.Contains("\"data\":[]")) + if (prodCommissionRst.Contains("\"data\":[]") || BaseRegex.GetStringJson(ref prodCommissionRst, "mdy_time").ParseToString().ParseToDateTime() < DateTime.Now.AddDays(-30)) { var assistantShop = new ShopLoginInfo(); assistantShop.Cookies = JsonHelper.SerializeObject(lstWxSaleAssistantCookie); var result = WxGetAssistant.wxGetAssistant(assistantShop, dbProd.spu_id); + Thread.Sleep(Randomx.GetId(500, 1500)); if (result.Contains("mcn magic invalid")) { Invoke(new Action(() => @@ -3161,6 +3162,11 @@ namespace TemuKJD.WXForms.ProductForms upProdParam.product.info.param.Add(wxPropParam); foreach (var wxEditCategoryParam in wxEditPropParam.categorys) { + // 修改书名 + //if (wxEditPropParam.categorys.FirstOrDefault().name == "书名" && wxEditCategoryParam == wxEditPropParam.categorys.LastOrDefault()) + //{ + // wxEditCategoryParam.name = prodTitle; + //} var wxCategoryParam = new categoryPropParam() { catType = wxEditCategoryParam.catType, @@ -3313,6 +3319,16 @@ namespace TemuKJD.WXForms.ProductForms //书籍属性处理 if (upProdParam.product.info.category.FirstOrDefault()?.name == "图书" || prodInfo.detail.cats.FirstOrDefault() == "书籍/杂志/报纸") { + // 修改书名 作者 + //if (attr.name == "书名" /*&& dbProd.product_get_type_text == "微信小店"*/) + //{ + // attrValue = prodTitle; + //} + //if (attr.name == "作者" && attrValue == "无") + //{ + // attrValue = new List() { "赵老师", "钱老师", "孙老师", "李老师", "周老师", "吴老师", "郑老师", "王老师", "张老师", "孙老师", "刘老师" }.OrderBy(x => Guid.NewGuid()).FirstOrDefault(); + //} + if (attrValue.IsNullOrEmpty() && attr.type == "integer_unit" && (propInfo.values.FirstOrDefault()?.value).IsNumber()) { attrValue = propInfo.values.FirstOrDefault()?.value + " " + attr.value.Split(';').FirstOrDefault(); @@ -3587,7 +3603,7 @@ namespace TemuKJD.WXForms.ProductForms if (attr.name == "出版社名称") attrValue = new List() { "技术出版社", "文化出版社", "美术出版社" }[Randomx.GetId(3)]; if (attr.name == "作者") - attrValue = new List() { "李老师", "张老师", "王老师" }[Randomx.GetId(3)]; + attrValue = new List() { "赵老师", "钱老师", "孙老师", "李老师", "周老师", "吴老师", "郑老师", "王老师", "张老师", "孙老师", "刘老师" }.OrderBy(x => Guid.NewGuid()).FirstOrDefault(); if (attr.name == "包装") attrValue = "平装"; if (attr.name == "出版时间") @@ -4144,7 +4160,7 @@ namespace TemuKJD.WXForms.ProductForms } } // 微信店采直接复制 - else if (dbProd.product_get_type_text == "微信店采") + else if (dbProd.product_get_type_text == "微信店采") //&& upProdParam.product.info.category.FirstOrDefault()?.name != "图书") { upProdParam.product.info.qualificationList.Clear(); if (wxEditProdInfo.product?.info?.qualificationList?.Count > 0) @@ -4181,9 +4197,10 @@ namespace TemuKJD.WXForms.ProductForms })); } - string publisher = "出版社:" + new List() { "技术出版社", "文化出版社", "美术出版社" }[Randomx.GetId(3)]; + string publisher = "出版社名称:" + new List() { "技术出版社", "文化出版社", "美术出版社" }[Randomx.GetId(3)]; string isbn = "ISBN:"; string bookName = "书名:"; + //string bookName = "图书名称:"; string bookPrice = "定价:" + upProdParam.product.productSkus.Max(s => s.productSkuInfo.salePrice) * 0.01; string author = "作者:王老师"; string publishTime = "出版时间:" + DateTime.Now.AddMonths(-3).ToString("yyyy年MM月dd日"); @@ -4193,10 +4210,11 @@ namespace TemuKJD.WXForms.ProductForms foreach (var propParam in upProdParam.product.info.param) { if (propParam.categorys[0].name.Contains("出版社名称")) - publisher = "出版社:" + propParam.categorys[1].name; + publisher = "出版社名称:" + propParam.categorys[1].name; else if (propParam.categorys[0].name.Contains("ISBN版号/CN刊号")) isbn = "ISBN:" + propParam.categorys[1].name; else if (propParam.categorys[0].name.Contains("书名")) + //bookName = "图书名称:" + propParam.categorys[1].name; bookName = "书名:" + propParam.categorys[1].name; else if (propParam.categorys[0].name.Contains("定价")) { @@ -4228,6 +4246,8 @@ namespace TemuKJD.WXForms.ProductForms g.Clear(Color.White); //Font font = new Font("宋体", 15, FontStyle.Bold); Font font = new Font("微软雅黑", 15, FontStyle.Regular); + //Font font = new Font("微软雅黑", 16, FontStyle.Regular); + //Font font = new Font("宋体", 17, FontStyle.Bold); Brush textBrush = Brushes.Black; g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.ClearTypeGridFit; RectangleF rectF = new RectangleF(80, 80, 800 - 80, 800 - 80); diff --git a/TEMUKJD/WXForms/ProductForms/WXProdPreSaleForm.Designer.cs b/TEMUKJD/WXForms/ProductForms/WXProdPreSaleForm.Designer.cs index c9c6482..0e7e4d4 100644 --- a/TEMUKJD/WXForms/ProductForms/WXProdPreSaleForm.Designer.cs +++ b/TEMUKJD/WXForms/ProductForms/WXProdPreSaleForm.Designer.cs @@ -32,15 +32,15 @@ namespace TemuKJD.WXForms.ProductForms private void InitializeComponent() { this.components = new System.ComponentModel.Container(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle(); - 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.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle9 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle10 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle11 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle12 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle13 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle14 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle15 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle16 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle17 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle18 = new System.Windows.Forms.DataGridViewCellStyle(); this.splitContainer1 = new System.Windows.Forms.SplitContainer(); this.ucGroupBoxEx3 = new TemuKJD.UserComponent.UcGroupBoxEx(this.components); this.btnBatchRealDel = new DevComponents.DotNetBar.PanelEx(); @@ -54,6 +54,13 @@ namespace TemuKJD.WXForms.ProductForms this.btnClearList = new DevComponents.DotNetBar.PanelEx(); this.btnDown = new DevComponents.DotNetBar.PanelEx(); this.ucGroupBoxEx2 = new TemuKJD.UserComponent.UcGroupBoxEx(this.components); + this.btnRestorePrice = new DevComponents.DotNetBar.PanelEx(); + this.label7 = new System.Windows.Forms.Label(); + this.txtPrice = new System.Windows.Forms.TextBox(); + this.btnSetPrice = new DevComponents.DotNetBar.PanelEx(); + this.label6 = new System.Windows.Forms.Label(); + this.txtNotDownCount = new System.Windows.Forms.TextBox(); + this.chkNotDownCount = new TemuKJD.UserComponent.UcCheckBox(this.components); this.chkFailDownProd = new TemuKJD.UserComponent.UcCheckBox(this.components); this.chkNoPreSale = new TemuKJD.UserComponent.UcCheckBox(this.components); this.label18 = new System.Windows.Forms.Label(); @@ -63,6 +70,7 @@ namespace TemuKJD.WXForms.ProductForms this.btnClearDgv = new DevComponents.DotNetBar.PanelEx(); this.btnSetPreSale = new DevComponents.DotNetBar.PanelEx(); this.ucGroupBoxEx4 = new TemuKJD.UserComponent.UcGroupBoxEx(this.components); + this.chkSearchPromotionLink = new TemuKJD.UserComponent.UcCheckBox(this.components); this.cmbOnSaleStatus = new System.Windows.Forms.ComboBox(); this.cmbPreType = new System.Windows.Forms.ComboBox(); this.label3 = new System.Windows.Forms.Label(); @@ -130,6 +138,7 @@ namespace TemuKJD.WXForms.ProductForms this.colSkuFakeImgUrl = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.colSkuFakeImg = new System.Windows.Forms.DataGridViewImageColumn(); this.colProductName = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.colPromotionLink = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.colProductCat = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.colExtCode = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.colPrice = new System.Windows.Forms.DataGridViewTextBoxColumn(); @@ -143,9 +152,6 @@ namespace TemuKJD.WXForms.ProductForms this.colOpResult = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.splitContainer4 = new System.Windows.Forms.SplitContainer(); this.statusBar = new TemuKJD.UserControls.StatusBarUserControl(); - this.chkNotDownCount = new TemuKJD.UserComponent.UcCheckBox(this.components); - this.txtNotDownCount = new System.Windows.Forms.TextBox(); - this.label6 = new System.Windows.Forms.Label(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); this.splitContainer1.Panel1.SuspendLayout(); this.splitContainer1.Panel2.SuspendLayout(); @@ -442,6 +448,10 @@ namespace TemuKJD.WXForms.ProductForms this.ucGroupBoxEx2.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; this.ucGroupBoxEx2.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); this.ucGroupBoxEx2.BorderStyle = TemuKJD.UserComponent.UcGroupBoxEx.GroupBoxBorderStyle.ROUND; + this.ucGroupBoxEx2.Controls.Add(this.btnRestorePrice); + this.ucGroupBoxEx2.Controls.Add(this.label7); + this.ucGroupBoxEx2.Controls.Add(this.txtPrice); + this.ucGroupBoxEx2.Controls.Add(this.btnSetPrice); this.ucGroupBoxEx2.Controls.Add(this.label6); this.ucGroupBoxEx2.Controls.Add(this.txtNotDownCount); this.ucGroupBoxEx2.Controls.Add(this.chkNotDownCount); @@ -458,7 +468,105 @@ namespace TemuKJD.WXForms.ProductForms this.ucGroupBoxEx2.Size = new System.Drawing.Size(410, 165); this.ucGroupBoxEx2.TabIndex = 667; this.ucGroupBoxEx2.TabStop = false; - this.ucGroupBoxEx2.Text = "设置预售"; + this.ucGroupBoxEx2.Text = "设置预售/价格"; + // + // btnRestorePrice + // + this.btnRestorePrice.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; + this.btnRestorePrice.Cursor = System.Windows.Forms.Cursors.Hand; + this.btnRestorePrice.DisabledBackColor = System.Drawing.Color.Empty; + this.btnRestorePrice.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.btnRestorePrice.Location = new System.Drawing.Point(242, 129); + this.btnRestorePrice.Name = "btnRestorePrice"; + this.btnRestorePrice.Size = new System.Drawing.Size(84, 23); + this.btnRestorePrice.Style.Alignment = System.Drawing.StringAlignment.Center; + this.btnRestorePrice.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); + this.btnRestorePrice.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); + this.btnRestorePrice.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder; + this.btnRestorePrice.Style.BorderDashStyle = System.Drawing.Drawing2D.DashStyle.Dash; + this.btnRestorePrice.Style.BorderSide = DevComponents.DotNetBar.eBorderSide.None; + this.btnRestorePrice.Style.ForeColor.Color = System.Drawing.Color.White; + this.btnRestorePrice.Style.GradientAngle = 90; + this.btnRestorePrice.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center; + this.btnRestorePrice.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255))))); + this.btnRestorePrice.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255))))); + this.btnRestorePrice.TabIndex = 854; + this.btnRestorePrice.Text = "批量设置价格"; + // + // label7 + // + this.label7.AutoSize = true; + this.label7.Location = new System.Drawing.Point(17, 132); + this.label7.Margin = new System.Windows.Forms.Padding(6, 0, 0, 0); + this.label7.Name = "label7"; + this.label7.RightToLeft = System.Windows.Forms.RightToLeft.Yes; + this.label7.Size = new System.Drawing.Size(92, 17); + this.label7.TabIndex = 847; + this.label7.Text = "批量设置价格为"; + // + // txtPrice + // + this.txtPrice.Location = new System.Drawing.Point(113, 129); + this.txtPrice.Margin = new System.Windows.Forms.Padding(0, 3, 3, 3); + this.txtPrice.Name = "txtPrice"; + this.txtPrice.Size = new System.Drawing.Size(33, 23); + this.txtPrice.TabIndex = 846; + // + // btnSetPrice + // + this.btnSetPrice.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; + this.btnSetPrice.Cursor = System.Windows.Forms.Cursors.Hand; + this.btnSetPrice.DisabledBackColor = System.Drawing.Color.Empty; + this.btnSetPrice.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.btnSetPrice.Location = new System.Drawing.Point(152, 129); + this.btnSetPrice.Name = "btnSetPrice"; + this.btnSetPrice.Size = new System.Drawing.Size(84, 23); + this.btnSetPrice.Style.Alignment = System.Drawing.StringAlignment.Center; + this.btnSetPrice.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); + this.btnSetPrice.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); + this.btnSetPrice.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder; + this.btnSetPrice.Style.BorderDashStyle = System.Drawing.Drawing2D.DashStyle.Dash; + this.btnSetPrice.Style.BorderSide = DevComponents.DotNetBar.eBorderSide.None; + this.btnSetPrice.Style.ForeColor.Color = System.Drawing.Color.White; + this.btnSetPrice.Style.GradientAngle = 90; + this.btnSetPrice.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center; + this.btnSetPrice.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255))))); + this.btnSetPrice.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255))))); + this.btnSetPrice.TabIndex = 845; + this.btnSetPrice.Text = "批量设置价格"; + this.btnSetPrice.Click += new System.EventHandler(this.btnSetPrice_Click); + // + // label6 + // + this.label6.AutoSize = true; + this.label6.Location = new System.Drawing.Point(193, 96); + this.label6.Margin = new System.Windows.Forms.Padding(6, 0, 0, 0); + this.label6.Name = "label6"; + this.label6.RightToLeft = System.Windows.Forms.RightToLeft.Yes; + this.label6.Size = new System.Drawing.Size(32, 17); + this.label6.TabIndex = 832; + this.label6.Text = "商品"; + // + // txtNotDownCount + // + this.txtNotDownCount.Location = new System.Drawing.Point(165, 93); + this.txtNotDownCount.Margin = new System.Windows.Forms.Padding(0, 3, 3, 3); + this.txtNotDownCount.Name = "txtNotDownCount"; + this.txtNotDownCount.Size = new System.Drawing.Size(28, 23); + this.txtNotDownCount.TabIndex = 831; + this.txtNotDownCount.Text = "1"; + // + // chkNotDownCount + // + this.chkNotDownCount.AutoSize = true; + this.chkNotDownCount.Checked = true; + this.chkNotDownCount.CheckState = System.Windows.Forms.CheckState.Checked; + this.chkNotDownCount.Location = new System.Drawing.Point(17, 94); + this.chkNotDownCount.Name = "chkNotDownCount"; + this.chkNotDownCount.Size = new System.Drawing.Size(156, 21); + this.chkNotDownCount.TabIndex = 830; + this.chkNotDownCount.Text = "预售失败也不下架销量≥"; + this.chkNotDownCount.UseVisualStyleBackColor = true; // // chkFailDownProd // @@ -597,6 +705,7 @@ namespace TemuKJD.WXForms.ProductForms | System.Windows.Forms.AnchorStyles.Left))); this.ucGroupBoxEx4.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); this.ucGroupBoxEx4.BorderStyle = TemuKJD.UserComponent.UcGroupBoxEx.GroupBoxBorderStyle.ROUND; + this.ucGroupBoxEx4.Controls.Add(this.chkSearchPromotionLink); this.ucGroupBoxEx4.Controls.Add(this.cmbOnSaleStatus); this.ucGroupBoxEx4.Controls.Add(this.cmbPreType); this.ucGroupBoxEx4.Controls.Add(this.label3); @@ -619,6 +728,17 @@ namespace TemuKJD.WXForms.ProductForms this.ucGroupBoxEx4.TabStop = false; this.ucGroupBoxEx4.Text = "商品查询"; // + // chkSearchPromotionLink + // + this.chkSearchPromotionLink.AutoSize = true; + this.chkSearchPromotionLink.Location = new System.Drawing.Point(231, 61); + this.chkSearchPromotionLink.Name = "chkSearchPromotionLink"; + this.chkSearchPromotionLink.Size = new System.Drawing.Size(147, 21); + this.chkSearchPromotionLink.TabIndex = 827; + this.chkSearchPromotionLink.Text = "同时查询商品推广短链"; + this.chkSearchPromotionLink.UseVisualStyleBackColor = true; + this.chkSearchPromotionLink.CheckedChanged += new System.EventHandler(this.chkSearchPromotionLink_CheckedChanged); + // // cmbOnSaleStatus // this.cmbOnSaleStatus.FormattingEnabled = true; @@ -664,7 +784,7 @@ namespace TemuKJD.WXForms.ProductForms // txtIdFilter // this.txtIdFilter.Font = new System.Drawing.Font("微软雅黑", 10F); - this.txtIdFilter.Location = new System.Drawing.Point(262, 59); + this.txtIdFilter.Location = new System.Drawing.Point(262, 93); this.txtIdFilter.Margin = new System.Windows.Forms.Padding(0, 2, 0, 2); this.txtIdFilter.Name = "txtIdFilter"; this.txtIdFilter.Size = new System.Drawing.Size(134, 25); @@ -674,7 +794,7 @@ namespace TemuKJD.WXForms.ProductForms // lblIdFilter // this.lblIdFilter.AutoSize = true; - this.lblIdFilter.Location = new System.Drawing.Point(242, 63); + this.lblIdFilter.Location = new System.Drawing.Point(242, 97); this.lblIdFilter.Margin = new System.Windows.Forms.Padding(6, 0, 0, 0); this.lblIdFilter.Name = "lblIdFilter"; this.lblIdFilter.Size = new System.Drawing.Size(21, 17); @@ -736,7 +856,7 @@ namespace TemuKJD.WXForms.ProductForms this.txtProductName.Location = new System.Drawing.Point(68, 93); this.txtProductName.Margin = new System.Windows.Forms.Padding(0, 2, 0, 2); this.txtProductName.Name = "txtProductName"; - this.txtProductName.Size = new System.Drawing.Size(328, 25); + this.txtProductName.Size = new System.Drawing.Size(134, 25); this.txtProductName.TabIndex = 784; this.txtProductName.Visible = false; // @@ -1202,19 +1322,19 @@ namespace TemuKJD.WXForms.ProductForms // this.dgvShop.AllowUserToAddRows = false; this.dgvShop.AllowUserToDeleteRows = false; - dataGridViewCellStyle1.BackColor = System.Drawing.Color.WhiteSmoke; - this.dgvShop.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1; + dataGridViewCellStyle10.BackColor = System.Drawing.Color.WhiteSmoke; + this.dgvShop.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle10; this.dgvShop.AutoRowNumber = true; this.dgvShop.BackgroundColor = System.Drawing.Color.White; this.dgvShop.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); - dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; - dataGridViewCellStyle2.BackColor = System.Drawing.SystemColors.Control; - dataGridViewCellStyle2.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - dataGridViewCellStyle2.ForeColor = System.Drawing.SystemColors.WindowText; - dataGridViewCellStyle2.SelectionBackColor = System.Drawing.SystemColors.Highlight; - dataGridViewCellStyle2.SelectionForeColor = System.Drawing.SystemColors.HighlightText; - dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.False; - this.dgvShop.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle2; + dataGridViewCellStyle11.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle11.BackColor = System.Drawing.SystemColors.Control; + dataGridViewCellStyle11.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + dataGridViewCellStyle11.ForeColor = System.Drawing.SystemColors.WindowText; + dataGridViewCellStyle11.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle11.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle11.WrapMode = System.Windows.Forms.DataGridViewTriState.False; + this.dgvShop.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle11; this.dgvShop.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.dgvShop.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.colSelect, @@ -1383,19 +1503,19 @@ namespace TemuKJD.WXForms.ProductForms // this.dgvSelectProduct.AllowUserToAddRows = false; this.dgvSelectProduct.AllowUserToDeleteRows = false; - dataGridViewCellStyle3.BackColor = System.Drawing.Color.WhiteSmoke; - this.dgvSelectProduct.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle3; + dataGridViewCellStyle12.BackColor = System.Drawing.Color.WhiteSmoke; + this.dgvSelectProduct.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle12; this.dgvSelectProduct.AutoRowNumber = true; this.dgvSelectProduct.BackgroundColor = System.Drawing.Color.White; this.dgvSelectProduct.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); - dataGridViewCellStyle4.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; - dataGridViewCellStyle4.BackColor = System.Drawing.SystemColors.Control; - dataGridViewCellStyle4.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - dataGridViewCellStyle4.ForeColor = System.Drawing.SystemColors.WindowText; - dataGridViewCellStyle4.SelectionBackColor = System.Drawing.SystemColors.Highlight; - dataGridViewCellStyle4.SelectionForeColor = System.Drawing.SystemColors.HighlightText; - dataGridViewCellStyle4.WrapMode = System.Windows.Forms.DataGridViewTriState.False; - this.dgvSelectProduct.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle4; + dataGridViewCellStyle13.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle13.BackColor = System.Drawing.SystemColors.Control; + dataGridViewCellStyle13.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + dataGridViewCellStyle13.ForeColor = System.Drawing.SystemColors.WindowText; + dataGridViewCellStyle13.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle13.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle13.WrapMode = System.Windows.Forms.DataGridViewTriState.False; + this.dgvSelectProduct.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle13; this.dgvSelectProduct.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.dgvSelectProduct.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.colCheck, @@ -1412,6 +1532,7 @@ namespace TemuKJD.WXForms.ProductForms this.colSkuFakeImgUrl, this.colSkuFakeImg, this.colProductName, + this.colPromotionLink, this.colProductCat, this.colExtCode, this.colPrice, @@ -1459,8 +1580,8 @@ namespace TemuKJD.WXForms.ProductForms // // colSupplierName // - dataGridViewCellStyle5.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.colSupplierName.DefaultCellStyle = dataGridViewCellStyle5; + dataGridViewCellStyle14.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.colSupplierName.DefaultCellStyle = dataGridViewCellStyle14; this.colSupplierName.Frozen = true; this.colSupplierName.HeaderText = "店铺名称"; this.colSupplierName.Name = "colSupplierName"; @@ -1548,17 +1669,24 @@ namespace TemuKJD.WXForms.ProductForms // // colProductName // - dataGridViewCellStyle6.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.colProductName.DefaultCellStyle = dataGridViewCellStyle6; + dataGridViewCellStyle15.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.colProductName.DefaultCellStyle = dataGridViewCellStyle15; this.colProductName.HeaderText = "商品标题"; this.colProductName.Name = "colProductName"; this.colProductName.ReadOnly = true; this.colProductName.Width = 140; // + // colPromotionLink + // + this.colPromotionLink.HeaderText = "推广链接"; + this.colPromotionLink.Name = "colPromotionLink"; + this.colPromotionLink.ReadOnly = true; + this.colPromotionLink.Visible = false; + // // colProductCat // - dataGridViewCellStyle7.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.colProductCat.DefaultCellStyle = dataGridViewCellStyle7; + dataGridViewCellStyle16.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.colProductCat.DefaultCellStyle = dataGridViewCellStyle16; this.colProductCat.HeaderText = "商品类目"; this.colProductCat.Name = "colProductCat"; this.colProductCat.ReadOnly = true; @@ -1587,8 +1715,8 @@ namespace TemuKJD.WXForms.ProductForms // // colMsg // - dataGridViewCellStyle8.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.colMsg.DefaultCellStyle = dataGridViewCellStyle8; + dataGridViewCellStyle17.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.colMsg.DefaultCellStyle = dataGridViewCellStyle17; this.colMsg.HeaderText = "状态"; this.colMsg.Name = "colMsg"; this.colMsg.ReadOnly = true; @@ -1626,8 +1754,8 @@ namespace TemuKJD.WXForms.ProductForms // // colAddTime // - dataGridViewCellStyle9.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.colAddTime.DefaultCellStyle = dataGridViewCellStyle9; + dataGridViewCellStyle18.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.colAddTime.DefaultCellStyle = dataGridViewCellStyle18; this.colAddTime.HeaderText = "上架时间"; this.colAddTime.Name = "colAddTime"; this.colAddTime.ReadOnly = true; @@ -1665,38 +1793,6 @@ namespace TemuKJD.WXForms.ProductForms this.statusBar.Size = new System.Drawing.Size(1165, 26); this.statusBar.TabIndex = 2; // - // chkNotDownCount - // - this.chkNotDownCount.AutoSize = true; - this.chkNotDownCount.Checked = true; - this.chkNotDownCount.CheckState = System.Windows.Forms.CheckState.Checked; - this.chkNotDownCount.Location = new System.Drawing.Point(17, 94); - this.chkNotDownCount.Name = "chkNotDownCount"; - this.chkNotDownCount.Size = new System.Drawing.Size(156, 21); - this.chkNotDownCount.TabIndex = 830; - this.chkNotDownCount.Text = "预售失败也不下架销量≥"; - this.chkNotDownCount.UseVisualStyleBackColor = true; - // - // txtNotDownCount - // - this.txtNotDownCount.Location = new System.Drawing.Point(165, 93); - this.txtNotDownCount.Margin = new System.Windows.Forms.Padding(0, 3, 3, 3); - this.txtNotDownCount.Name = "txtNotDownCount"; - this.txtNotDownCount.Size = new System.Drawing.Size(28, 23); - this.txtNotDownCount.TabIndex = 831; - this.txtNotDownCount.Text = "1"; - // - // label6 - // - this.label6.AutoSize = true; - this.label6.Location = new System.Drawing.Point(193, 96); - this.label6.Margin = new System.Windows.Forms.Padding(6, 0, 0, 0); - this.label6.Name = "label6"; - this.label6.RightToLeft = System.Windows.Forms.RightToLeft.Yes; - this.label6.Size = new System.Drawing.Size(32, 17); - this.label6.TabIndex = 832; - this.label6.Text = "商品"; - // // WXProdPreSaleForm // this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; @@ -1802,31 +1898,6 @@ namespace TemuKJD.WXForms.ProductForms private DevComponents.DotNetBar.PanelEx btnBatchDel; private System.Windows.Forms.ComboBox cmbOnSaleStatus; private System.Windows.Forms.Label label5; - private System.Windows.Forms.DataGridViewCheckBoxColumn colCheck; - private System.Windows.Forms.DataGridViewTextBoxColumn colSelectId; - private System.Windows.Forms.DataGridViewTextBoxColumn colSupplierId; - private System.Windows.Forms.DataGridViewTextBoxColumn colSupplierName; - private System.Windows.Forms.DataGridViewLinkColumn colLogin; - private System.Windows.Forms.DataGridViewLinkColumn colInShop; - private System.Windows.Forms.DataGridViewLinkColumn colSpuId; - private System.Windows.Forms.DataGridViewLinkColumn colSkcId; - private System.Windows.Forms.DataGridViewTextBoxColumn colDraftId; - private System.Windows.Forms.DataGridViewTextBoxColumn colImgUrl; - private System.Windows.Forms.DataGridViewImageColumn colProductSkcPic; - private System.Windows.Forms.DataGridViewTextBoxColumn colSkuFakeImgUrl; - private System.Windows.Forms.DataGridViewImageColumn colSkuFakeImg; - private System.Windows.Forms.DataGridViewTextBoxColumn colProductName; - private System.Windows.Forms.DataGridViewTextBoxColumn colProductCat; - private System.Windows.Forms.DataGridViewTextBoxColumn colExtCode; - private System.Windows.Forms.DataGridViewTextBoxColumn colPrice; - private System.Windows.Forms.DataGridViewTextBoxColumn colSoldNum; - private System.Windows.Forms.DataGridViewTextBoxColumn colMsg; - private System.Windows.Forms.DataGridViewTextBoxColumn colPreSale; - private System.Windows.Forms.DataGridViewTextBoxColumn colNotes; - private System.Windows.Forms.DataGridViewLinkColumn colUserNotes; - private System.Windows.Forms.DataGridViewLinkColumn ColDelete; - private System.Windows.Forms.DataGridViewTextBoxColumn colAddTime; - private System.Windows.Forms.DataGridViewTextBoxColumn colOpResult; private DevComponents.DotNetBar.PanelEx btnSelectLimit2; private DevComponents.DotNetBar.PanelEx btnSelectLimit1; private DevComponents.DotNetBar.PanelEx btnBatchRealDel; @@ -1849,5 +1920,36 @@ namespace TemuKJD.WXForms.ProductForms private System.Windows.Forms.TextBox txtNotDownCount; private UserComponent.UcCheckBox chkNotDownCount; private System.Windows.Forms.Label label6; + private UserComponent.UcCheckBox chkSearchPromotionLink; + private System.Windows.Forms.DataGridViewCheckBoxColumn colCheck; + private System.Windows.Forms.DataGridViewTextBoxColumn colSelectId; + private System.Windows.Forms.DataGridViewTextBoxColumn colSupplierId; + private System.Windows.Forms.DataGridViewTextBoxColumn colSupplierName; + private System.Windows.Forms.DataGridViewLinkColumn colLogin; + private System.Windows.Forms.DataGridViewLinkColumn colInShop; + private System.Windows.Forms.DataGridViewLinkColumn colSpuId; + private System.Windows.Forms.DataGridViewLinkColumn colSkcId; + private System.Windows.Forms.DataGridViewTextBoxColumn colDraftId; + private System.Windows.Forms.DataGridViewTextBoxColumn colImgUrl; + private System.Windows.Forms.DataGridViewImageColumn colProductSkcPic; + private System.Windows.Forms.DataGridViewTextBoxColumn colSkuFakeImgUrl; + private System.Windows.Forms.DataGridViewImageColumn colSkuFakeImg; + private System.Windows.Forms.DataGridViewTextBoxColumn colProductName; + private System.Windows.Forms.DataGridViewTextBoxColumn colPromotionLink; + private System.Windows.Forms.DataGridViewTextBoxColumn colProductCat; + private System.Windows.Forms.DataGridViewTextBoxColumn colExtCode; + private System.Windows.Forms.DataGridViewTextBoxColumn colPrice; + private System.Windows.Forms.DataGridViewTextBoxColumn colSoldNum; + private System.Windows.Forms.DataGridViewTextBoxColumn colMsg; + private System.Windows.Forms.DataGridViewTextBoxColumn colPreSale; + private System.Windows.Forms.DataGridViewTextBoxColumn colNotes; + private System.Windows.Forms.DataGridViewLinkColumn colUserNotes; + private System.Windows.Forms.DataGridViewLinkColumn ColDelete; + private System.Windows.Forms.DataGridViewTextBoxColumn colAddTime; + private System.Windows.Forms.DataGridViewTextBoxColumn colOpResult; + private System.Windows.Forms.TextBox txtPrice; + private DevComponents.DotNetBar.PanelEx btnSetPrice; + private DevComponents.DotNetBar.PanelEx btnRestorePrice; + private System.Windows.Forms.Label label7; } } \ No newline at end of file diff --git a/TEMUKJD/WXForms/ProductForms/WXProdPreSaleForm.cs b/TEMUKJD/WXForms/ProductForms/WXProdPreSaleForm.cs index 736a9c1..1071000 100644 --- a/TEMUKJD/WXForms/ProductForms/WXProdPreSaleForm.cs +++ b/TEMUKJD/WXForms/ProductForms/WXProdPreSaleForm.cs @@ -777,6 +777,8 @@ namespace TemuKJD.WXForms.ProductForms })); foreach (JObject prod in prodObjs["productList"]) { + string StatusStr = ""; + int rowIndex = 0; var pStr = JsonHelper.SerializeObject(prod); Invoke(new Action(() => { @@ -787,7 +789,7 @@ namespace TemuKJD.WXForms.ProductForms { } - string StatusStr = "其他"; + StatusStr = "其他"; if (prod["status"].ParseToInt() == 5) StatusStr = "在售"; if (prod["status"].ParseToInt() == 11) @@ -805,7 +807,7 @@ namespace TemuKJD.WXForms.ProductForms var Limit2 = BaseRegex.GetStringJson(ref pStr, "secondLevelLabelName").ParseToString().Length > 0 ? "\r\n低风险规则上架" : ""; StatusStr += Limit1 + Limit2; - var rowIndex = this.dgvSelectProduct.Rows.Add( + rowIndex = this.dgvSelectProduct.Rows.Add( false, "", shop.ShopId, @@ -820,6 +822,7 @@ namespace TemuKJD.WXForms.ProductForms "", // 替换图地址 null, // 替换图 prod["title"].ParseToString(), // 用户端显示商品原名 + "", // 推广短链 (prod["recommendCategory"].IsJTokenNullOrEmpty() || prod["recommendCategory"]["categoryNames"].IsJTokenNullOrEmpty()) ? "" : string.Join(" >> ", prod["recommendCategory"]["categoryNames"].Select(s => s.ParseToString())), // 类目名称 prod["spuCode"].ParseToString(), @@ -847,6 +850,37 @@ namespace TemuKJD.WXForms.ProductForms dgvSelectProduct.Rows[rowIndex].Cells["colMsg"].Style.ForeColor = color; dgvSelectProduct.Rows[rowIndex].Cells["colPreSale"].Style.ForeColor = dgvSelectProduct.Rows[rowIndex].Cells["colPreSale"].Value.ParseToString().Contains("预售") ? Color.Green : Color.Blue; })); + + if (StatusStr.ParseToString().StartsWith("在售") && chkSearchPromotionLink.Checked == true) + { + Task.Run(() => { }); + var PromotionRst = WXPreSale.GetPromotionLink(shop, prod["productId"].ParseToString(), page); + Thread.Sleep(Randomx.GetId(50, 150)); + if (PromotionRst.ParseToString().Contains("\"code\":0")) + { + var shareUrl = BaseRegex.GetStringJson(ref PromotionRst, "shareUrl"); + var shortLink = BaseRegex.GetStringJson(ref PromotionRst, "shortLink"); + if (!string.IsNullOrEmpty(shareUrl)) + { + Invoke(new Action(() => { + dgvSelectProduct.Rows[rowIndex].Cells["colPromotionLink"].Value = shareUrl; + })); + } + else + { + Invoke(new Action(() => { + dgvSelectProduct.Rows[rowIndex].Cells["colPromotionLink"].Value = "链接获取失败"; + })); + } + } + else + { + var errMsg = BaseRegex.GetStringJsonByRegs(ref PromotionRst, PromotionRst, "errMsg", "errorMsg", "err_msg", "error_msg", "errormsg"); + Invoke(new Action(() => { + dgvSelectProduct.Rows[rowIndex].Cells["colPromotionLink"].Value = errMsg; + })); + } + } } } catch (Exception ex) @@ -1592,6 +1626,177 @@ namespace TemuKJD.WXForms.ProductForms } } } + + private void chkSearchPromotionLink_CheckedChanged(object sender, EventArgs e) + { + this.dgvSelectProduct.Columns["colPromotionLink"].Visible = chkSearchPromotionLink.Checked; + } + + private void btnSetPrice_Click(object sender, EventArgs e) + { + if (txtPrice.Text.ParseToDecimal().IsNullOrZero()) + { + BaseMsgForm.ShowError("请输入批量设置金额!"); + return; + } + var rowLst = dgvSelectProduct.Rows.Cast().Where(r => r.Cells["colCheck"].Value.ParseToBool() == true).ToList(); + if (rowLst.Count <= 0) + { + BaseMsgForm.ShowError("请勾选需要操作的商品!"); + return; + } + if (rowLst.Any(r => r.Cells["colMsg"].Value.ParseToString().Contains("在售") == false)) + { + BaseMsgForm.ShowError("只能勾选在售商品!"); + return; + } + + if (BaseMsgForm.ShowConfirm("确认要修改商品价格?").DialogResult != DialogResult.OK) + return; + + this.pbLoading.Visible = true; + this.btnSetPreSale.Enabled = false; + if (cancellationTokenSource != null && !cancellationTokenSource.IsCancellationRequested) + cancellationTokenSource.Cancel(); + cancellationTokenSource = new CancellationTokenSource(); + Task.Run(() => + { + SetProdDown(rowLst); + Invoke(new Action(() => + { + if (cancellationTokenSource.IsCancellationRequested) + { + this.statusBar.lblTaskStatus.Text = "商品修改价格中断"; + BaseMsgForm.ShowInfo("商品修改价格中断"); + } + else + { + this.statusBar.lblTaskStatus.Text = "商品修改价格完毕"; + BaseMsgForm.ShowInfo("商品修改价格完毕"); + } + + this.pbLoading.Visible = false; + this.btnSetPreSale.Enabled = true; + })); + }, cancellationTokenSource.Token); + + } + + void SetProdPrice(List rowLst) + { + Invoke(new Action(() => + { + this.pbLoading.Visible = true; + this.statusBar.lblTaskStatus.Text = "正在修改价格" + "...".Substring(0, DateTime.Now.Second % 4); + this.statusBar.pgbTaskProgress.Maximum = dgvSelectProduct.Rows.Count; + this.statusBar.UpdateProgressBar(0); + })); + + while (rowLst.Count > 0) + { + if (cancellationTokenSource.IsCancellationRequested) + break; + + var r0 = rowLst.FirstOrDefault(); + var shopId = r0.Cells["colSupplierId"].Value.ParseToString(); + var shop = GlobalConfig.ShopLoginList.FirstOrDefault(s => s.ShopId == shopId); + var rowLstTmp = rowLst.Where(r => r.Cells["colSupplierId"].Value.ParseToString() == shopId).Take(50).ToList(); + + foreach (var r in rowLstTmp) + { + rowLst.Remove(r); + + Invoke(new Action(() => + { + this.statusBar.lblTaskStatus.Text = "正在修改价格" + "...".Substring(0, DateTime.Now.Second % 4); + this.statusBar.UpdateProgressBar(this.statusBar.pgbTaskProgress.Value + 1); + r.Cells["colOpResult"].Value = ""; + })); + } + if (shop == null) + { + Invoke(new Action(() => + { + foreach (var r in rowLstTmp) + { + r.Cells["colOpResult"].Value = "店铺不存在"; + } + })); + continue; + } + if (shop.LoginStatus != "登录成功") + { + Invoke(new Action(() => + { + foreach (var r in rowLstTmp) + { + r.Cells["colOpResult"].Value = "店铺掉线"; + } + })); + continue; + } + + List prodIdLst = new List(); + foreach (var row in rowLstTmp) + { + var prodId = row.Cells["colDraftId"].Value.ParseToString(); + prodIdLst.Add(prodId); + } + + var downProdRst = WXPreSale.DownProd(shop, string.Join(",", prodIdLst)); + Thread.Sleep(Randomx.GetId(1000, 1500)); + if (!downProdRst.Contains("\"code\":0")) + { + if (downProdRst.Contains("biz magic invalid")) + { + WXShopListForm.Instance.CheckShopLogin(new ShopLoginInfo[] { shop }, false); + if (shop.LoginStatus != "登录成功") + { + Invoke(new Action(() => + { + foreach (var row in rowLstTmp) + { + row.Cells["colOpResult"].Value = "店铺掉线"; + } + })); + continue; + } + } + + var errmsg = BaseRegex.GetStringJson(ref downProdRst, "msg"); + if (string.IsNullOrWhiteSpace(errmsg)) + errmsg = downProdRst; + + Invoke(new Action(() => + { + foreach (var row in rowLstTmp) + { + if (downProdRst.Contains("\"code\":108002")) + { + var prodId = row.Cells["colDraftId"].Value.ParseToString(); + if (downProdRst.Contains(prodId)) + row.Cells["colOpResult"].Value = "修改价格失败,请检查商品是否已下架或不存在"; + else + row.Cells["colOpResult"].Value = "修改价格成功"; + } + else + row.Cells["colOpResult"].Value = errmsg; + } + })); + } + + if (downProdRst.Contains("\"code\":0")) + { + Invoke(new Action(() => + { + foreach (var row in rowLstTmp) + { + row.Cells["colOpResult"].Value = "修改价格成功"; + } + })); + } + } + } } public class WXPreSale @@ -1694,5 +1899,19 @@ namespace TemuKJD.WXForms.ProductForms var result = WXHttpResponseBLL.WeiXinPostResponse(shop, url, body, referer); return result; } + + /// + /// 获取推广信息 + /// + /// + /// + /// + public static string GetPromotionLink(ShopLoginInfo shop, string prodId, int pageId) + { + string url = "https://store.weixin.qq.com/shop-faas/mmecnodematerial/product?token=&lang=zh_CN&productId=" + prodId; + string referer = "https://store.weixin.qq.com/shop/goods/list?currentPage=" + pageId; + var result = WXHttpResponseBLL.WeiXinGetResponse(shop, url, referer); + return result; + } } } diff --git a/TEMUKJD/WXForms/ProductForms/WXProdPreSaleForm.resx b/TEMUKJD/WXForms/ProductForms/WXProdPreSaleForm.resx index fd17c3b..4303aa0 100644 --- a/TEMUKJD/WXForms/ProductForms/WXProdPreSaleForm.resx +++ b/TEMUKJD/WXForms/ProductForms/WXProdPreSaleForm.resx @@ -195,6 +195,9 @@ True + + True + True