diff --git a/AllBase/BaseClass.cs b/AllBase/BaseClass.cs index 2346137..604cab6 100644 --- a/AllBase/BaseClass.cs +++ b/AllBase/BaseClass.cs @@ -27,7 +27,7 @@ namespace AllBase /// /// 版本ID /// - public static int VersionCount = 993; + public static int VersionCount = 996; //public static int VersionCount = 613; /// diff --git a/AllBase/Model/Result/PDDResult/PddBuyerOrderInfoLite.cs b/AllBase/Model/Result/PDDResult/PddBuyerOrderInfoLite.cs index 2d8ca82..5a0a472 100644 --- a/AllBase/Model/Result/PDDResult/PddBuyerOrderInfoLite.cs +++ b/AllBase/Model/Result/PDDResult/PddBuyerOrderInfoLite.cs @@ -11,25 +11,31 @@ namespace AllBase.Model.Result.PDDResult { //平台快递编码 微信快递名称 PDD //EMS EMS 邮政快递包裹 + //EMS EMS 邮政电商标快 //JTSD 极兔速递 极兔速递 //STO 申通快递 申通快递 //YD 韵达速递 韵达快递 //YTO 圆通速递 圆通快递 //ZTO 中通快递 中通快递 + //BTWL 百世快运 + //HTKY 百世快递 public string outExpressCompanyMsg { get; set; } // 物流公司名称,可以尝试直接从列表中匹配 public string outExpressCompanyCode { get { - if (outExpressCompanyMsg == null) return ""; + if (outExpressCompanyMsg == null || outExpressCompanyMsg == "") return ""; if (outExpressCompanyMsg.Contains("邮政快递包裹")) return "EMS"; if (outExpressCompanyMsg.Contains("邮政电商标快")) return "EMS"; + if (outExpressCompanyMsg.Contains("邮政EMS")) return "EMS"; if (outExpressCompanyMsg.Contains("极兔速递")) return "JTSD"; if (outExpressCompanyMsg.Contains("申通快递")) return "STO"; if (outExpressCompanyMsg.Contains("韵达快递")) return "YD"; if (outExpressCompanyMsg.Contains("圆通快递")) return "YTO"; if (outExpressCompanyMsg.Contains("中通快递")) return "ZTO"; + if (outExpressCompanyMsg.Contains("百世快运")) return "BTWL"; + if (outExpressCompanyMsg.Contains("百世快递")) return "HTKY"; if (outExpressCompanyMsg.Contains("顺丰")) return "SF"; return ""; } @@ -38,7 +44,7 @@ namespace AllBase.Model.Result.PDDResult { get { - if (outExpressCompanyMsg == null) return ""; + if (outExpressCompanyMsg == null || outExpressCompanyMsg == "") return ""; if (outExpressCompanyMsg.Contains("邮政快递包裹")) return "邮政快递包裹"; if (outExpressCompanyMsg.Contains("邮政电商标快")) return "邮政电商标快"; if (outExpressCompanyMsg.Contains("极兔速递")) return "极兔速递"; @@ -46,12 +52,15 @@ namespace AllBase.Model.Result.PDDResult if (outExpressCompanyMsg.Contains("韵达快递")) return "韵达快递"; if (outExpressCompanyMsg.Contains("圆通快递")) return "圆通快递"; if (outExpressCompanyMsg.Contains("中通快递")) return "中通快递"; + if (outExpressCompanyMsg.Contains("百世快运")) return "百世快运"; + if (outExpressCompanyMsg.Contains("百世快递")) return "百世快递"; + if (outExpressCompanyMsg.Contains("邮政EMS")) return "邮政EMS"; if (outExpressCompanyMsg.Contains("顺丰")) return "顺丰速运"; - return ""; + return "物流名称获取失败"; } } public string sendStatus { get; set; } = ""; - public string refundStatus { get; set; } = ""; + //public string refundStatus { get; set; } = ""; public string buyerId { get; set; } // 买手Id public string buyerName { get; set; } // 买手名称 @@ -67,6 +76,7 @@ namespace AllBase.Model.Result.PDDResult public string order_link_url { get; set; } // "order.html?order_sn=260408-386657164922665&page_from=1", public List order_Goods { get; set; } + public after_sales after_sales { get; set; } public string order_status_prompt { get; set; } // "待收货", public string order_prompt_color { get; set; } // "#E02E24", public string activity_type { get; set; } // 3, @@ -85,6 +95,13 @@ namespace AllBase.Model.Result.PDDResult public string message { get; set; } // "商家已发货,正在通知极兔速递取件", } + public class after_sales + { + public string after_sales_id { get; set; } // "20032511557436", + public int? after_sales_type { get; set; } // 2, + public int? after_sales_status { get; set; } // 31 // 待用户拒收商品 + } + public class order_good { public string goods_id { get; set; } // "865983669848", diff --git a/KJDService/KJD_WebService/BLL/BXX/BXXProductManage.cs b/KJDService/KJD_WebService/BLL/BXX/BXXProductManage.cs index 5190f36..ee0ea67 100644 --- a/KJDService/KJD_WebService/BLL/BXX/BXXProductManage.cs +++ b/KJDService/KJD_WebService/BLL/BXX/BXXProductManage.cs @@ -521,8 +521,12 @@ namespace KJD_Web.BLL.BXX where += " and p.special_prod_type ='" + special_prod_type + "'"; if (!string.IsNullOrWhiteSpace(search_spu)) - //where += " and p.spu_id like '%" + search_spu + "%'"; - where += " and p.spu_id like '" + search_spu + "%'"; + { + if (search_spu.Contains(",") || search_spu.Contains(",") || search_spu.Contains(";") || search_spu.Contains(";")) + where += " and p.spu_id in ('" + string.Join("','", search_spu.Split(new string[] { ",", ",", ";", ";" }, StringSplitOptions.RemoveEmptyEntries)) + "')"; + else + where += " and p.spu_id like '" + search_spu + "%'"; + } if (!string.IsNullOrWhiteSpace(search_skc)) where += " and p.skc_id like '%" + search_skc + "%'"; if (!string.IsNullOrWhiteSpace(search_cat)) diff --git a/TEMUKJD/PDDForms/ProductSelectForms/PDDDBProdListForm.Designer.cs b/TEMUKJD/PDDForms/ProductSelectForms/PDDDBProdListForm.Designer.cs index ea6e53e..ccfd99b 100644 --- a/TEMUKJD/PDDForms/ProductSelectForms/PDDDBProdListForm.Designer.cs +++ b/TEMUKJD/PDDForms/ProductSelectForms/PDDDBProdListForm.Designer.cs @@ -51,6 +51,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms this.splitContainer1 = new System.Windows.Forms.SplitContainer(); this.ucTabControlMetro1 = new PinBaoBao.UserControls.UcTabControlMetro(); this.tabPage1 = new System.Windows.Forms.TabPage(); + this.btnExportIdImg = new DevComponents.DotNetBar.PanelEx(); this.btnSetGroup = new DevComponents.DotNetBar.PanelEx(); this.btnDelSelect = new DevComponents.DotNetBar.PanelEx(); this.cmbGroup = new System.Windows.Forms.ComboBox(); @@ -235,6 +236,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms // // tabPage1 // + this.tabPage1.Controls.Add(this.btnExportIdImg); this.tabPage1.Controls.Add(this.btnSetGroup); this.tabPage1.Controls.Add(this.btnDelSelect); this.tabPage1.Controls.Add(this.cmbGroup); @@ -249,6 +251,31 @@ namespace TemuKJD.PDDForms.ProductSelectForms this.tabPage1.Text = "数据操作"; this.tabPage1.UseVisualStyleBackColor = true; // + // btnExportIdImg + // + this.btnExportIdImg.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.btnExportIdImg.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; + this.btnExportIdImg.Cursor = System.Windows.Forms.Cursors.Hand; + this.btnExportIdImg.DisabledBackColor = System.Drawing.Color.Empty; + this.btnExportIdImg.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.btnExportIdImg.Location = new System.Drawing.Point(16, 11); + this.btnExportIdImg.Name = "btnExportIdImg"; + this.btnExportIdImg.Size = new System.Drawing.Size(96, 25); + this.btnExportIdImg.Style.Alignment = System.Drawing.StringAlignment.Center; + this.btnExportIdImg.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); + this.btnExportIdImg.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); + this.btnExportIdImg.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder; + this.btnExportIdImg.Style.BorderDashStyle = System.Drawing.Drawing2D.DashStyle.Dash; + this.btnExportIdImg.Style.BorderSide = DevComponents.DotNetBar.eBorderSide.None; + this.btnExportIdImg.Style.ForeColor.Color = System.Drawing.Color.White; + this.btnExportIdImg.Style.GradientAngle = 90; + this.btnExportIdImg.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center; + this.btnExportIdImg.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255))))); + this.btnExportIdImg.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255))))); + this.btnExportIdImg.TabIndex = 765; + this.btnExportIdImg.Text = "导出Id+图片"; + this.btnExportIdImg.Click += new System.EventHandler(this.btnExportIdImg_Click); + // // btnSetGroup // this.btnSetGroup.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); @@ -256,7 +283,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms this.btnSetGroup.Cursor = System.Windows.Forms.Cursors.Hand; this.btnSetGroup.DisabledBackColor = System.Drawing.Color.Empty; this.btnSetGroup.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.btnSetGroup.Location = new System.Drawing.Point(162, 11); + this.btnSetGroup.Location = new System.Drawing.Point(218, 11); this.btnSetGroup.Name = "btnSetGroup"; this.btnSetGroup.Size = new System.Drawing.Size(84, 25); this.btnSetGroup.Style.Alignment = System.Drawing.StringAlignment.Center; @@ -281,7 +308,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms this.btnDelSelect.Cursor = System.Windows.Forms.Cursors.Hand; this.btnDelSelect.DisabledBackColor = System.Drawing.Color.Empty; this.btnDelSelect.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.btnDelSelect.Location = new System.Drawing.Point(283, 11); + this.btnDelSelect.Location = new System.Drawing.Point(338, 11); this.btnDelSelect.Name = "btnDelSelect"; this.btnDelSelect.Size = new System.Drawing.Size(84, 25); this.btnDelSelect.Style.Alignment = System.Drawing.StringAlignment.Center; @@ -303,7 +330,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms // this.cmbGroup.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.cmbGroup.FormattingEnabled = true; - this.cmbGroup.Location = new System.Drawing.Point(75, 11); + this.cmbGroup.Location = new System.Drawing.Point(131, 11); this.cmbGroup.Name = "cmbGroup"; this.cmbGroup.Size = new System.Drawing.Size(85, 25); this.cmbGroup.TabIndex = 640; @@ -315,7 +342,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms this.btnImport.Cursor = System.Windows.Forms.Cursors.Hand; this.btnImport.DisabledBackColor = System.Drawing.Color.Empty; this.btnImport.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.btnImport.Location = new System.Drawing.Point(283, 39); + this.btnImport.Location = new System.Drawing.Point(338, 39); this.btnImport.Name = "btnImport"; this.btnImport.Size = new System.Drawing.Size(84, 25); this.btnImport.Style.Alignment = System.Drawing.StringAlignment.Center; @@ -342,7 +369,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms "安全商品", "违规商品", "未校验"}); - this.cmbSetWxSafe.Location = new System.Drawing.Point(75, 39); + this.cmbSetWxSafe.Location = new System.Drawing.Point(131, 39); this.cmbSetWxSafe.Margin = new System.Windows.Forms.Padding(0, 3, 3, 3); this.cmbSetWxSafe.Name = "cmbSetWxSafe"; this.cmbSetWxSafe.Size = new System.Drawing.Size(85, 25); @@ -355,7 +382,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms this.btnSetWxSafe.Cursor = System.Windows.Forms.Cursors.Hand; this.btnSetWxSafe.DisabledBackColor = System.Drawing.Color.Empty; this.btnSetWxSafe.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.btnSetWxSafe.Location = new System.Drawing.Point(162, 39); + this.btnSetWxSafe.Location = new System.Drawing.Point(218, 39); this.btnSetWxSafe.Name = "btnSetWxSafe"; this.btnSetWxSafe.Size = new System.Drawing.Size(84, 25); this.btnSetWxSafe.Style.Alignment = System.Drawing.StringAlignment.Center; @@ -388,7 +415,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms this.tabPage3.Name = "tabPage3"; this.tabPage3.Size = new System.Drawing.Size(442, 75); this.tabPage3.TabIndex = 2; - this.tabPage3.Text = "数据导出"; + this.tabPage3.Text = "商品导出"; // // chkHighestPriceSku // @@ -745,7 +772,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms "", "是", "否"}); - this.cmbPddRelation.Location = new System.Drawing.Point(743, 7); + this.cmbPddRelation.Location = new System.Drawing.Point(743, 5); this.cmbPddRelation.Margin = new System.Windows.Forms.Padding(0, 3, 3, 3); this.cmbPddRelation.Name = "cmbPddRelation"; this.cmbPddRelation.Size = new System.Drawing.Size(47, 25); @@ -800,7 +827,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms // this.cmbCat2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); this.cmbCat2.FormattingEnabled = true; - this.cmbCat2.Location = new System.Drawing.Point(278, 75); + this.cmbCat2.Location = new System.Drawing.Point(278, 77); this.cmbCat2.Margin = new System.Windows.Forms.Padding(0, 3, 3, 3); this.cmbCat2.Name = "cmbCat2"; this.cmbCat2.Size = new System.Drawing.Size(46, 25); @@ -885,7 +912,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms "机会商品", "以图搜品", "外部数据"}); - this.cmbSourceType.Location = new System.Drawing.Point(278, 40); + this.cmbSourceType.Location = new System.Drawing.Point(278, 42); this.cmbSourceType.Margin = new System.Windows.Forms.Padding(0, 3, 3, 3); this.cmbSourceType.Name = "cmbSourceType"; this.cmbSourceType.Size = new System.Drawing.Size(46, 25); @@ -931,7 +958,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms "", "是", "否"}); - this.cmbWxCat.Location = new System.Drawing.Point(622, 5); + this.cmbWxCat.Location = new System.Drawing.Point(622, 7); this.cmbWxCat.Margin = new System.Windows.Forms.Padding(0, 3, 3, 3); this.cmbWxCat.Name = "cmbWxCat"; this.cmbWxCat.Size = new System.Drawing.Size(47, 25); @@ -953,7 +980,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms this.cmbSort.Items.AddRange(new object[] { "入库时间", "认领总数"}); - this.cmbSort.Location = new System.Drawing.Point(381, 40); + this.cmbSort.Location = new System.Drawing.Point(381, 42); this.cmbSort.Margin = new System.Windows.Forms.Padding(0, 3, 3, 3); this.cmbSort.Name = "cmbSort"; this.cmbSort.Size = new System.Drawing.Size(46, 25); @@ -1029,7 +1056,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms // this.cmbGroupFilter.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); this.cmbGroupFilter.FormattingEnabled = true; - this.cmbGroupFilter.Location = new System.Drawing.Point(175, 40); + this.cmbGroupFilter.Location = new System.Drawing.Point(175, 42); this.cmbGroupFilter.Margin = new System.Windows.Forms.Padding(0, 3, 3, 3); this.cmbGroupFilter.Name = "cmbGroupFilter"; this.cmbGroupFilter.Size = new System.Drawing.Size(46, 25); @@ -1044,7 +1071,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms "是", "否", "导出未拉回"}); - this.cmbExportToOutServer.Location = new System.Drawing.Point(622, 40); + this.cmbExportToOutServer.Location = new System.Drawing.Point(622, 42); this.cmbExportToOutServer.Margin = new System.Windows.Forms.Padding(0, 3, 3, 3); this.cmbExportToOutServer.Name = "cmbExportToOutServer"; this.cmbExportToOutServer.Size = new System.Drawing.Size(47, 25); @@ -1080,7 +1107,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms "安全商品", "违规商品", "未校验"}); - this.cmbWxSafe.Location = new System.Drawing.Point(501, 40); + this.cmbWxSafe.Location = new System.Drawing.Point(501, 42); this.cmbWxSafe.Margin = new System.Windows.Forms.Padding(0, 3, 3, 3); this.cmbWxSafe.Name = "cmbWxSafe"; this.cmbWxSafe.Size = new System.Drawing.Size(47, 25); @@ -1122,7 +1149,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms // this.cmbCat1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); this.cmbCat1.FormattingEnabled = true; - this.cmbCat1.Location = new System.Drawing.Point(175, 75); + this.cmbCat1.Location = new System.Drawing.Point(175, 77); this.cmbCat1.Margin = new System.Windows.Forms.Padding(0, 3, 3, 3); this.cmbCat1.Name = "cmbCat1"; this.cmbCat1.Size = new System.Drawing.Size(46, 25); @@ -1144,7 +1171,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms // this.cmbCat3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); this.cmbCat3.FormattingEnabled = true; - this.cmbCat3.Location = new System.Drawing.Point(381, 75); + this.cmbCat3.Location = new System.Drawing.Point(381, 77); this.cmbCat3.Margin = new System.Windows.Forms.Padding(0, 3, 3, 3); this.cmbCat3.Name = "cmbCat3"; this.cmbCat3.Size = new System.Drawing.Size(46, 25); @@ -1241,7 +1268,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms "是", "否", "修复回传未拉回"}); - this.cmbHasReturn.Location = new System.Drawing.Point(743, 40); + this.cmbHasReturn.Location = new System.Drawing.Point(743, 42); this.cmbHasReturn.Margin = new System.Windows.Forms.Padding(0, 3, 3, 3); this.cmbHasReturn.Name = "cmbHasReturn"; this.cmbHasReturn.Size = new System.Drawing.Size(47, 25); @@ -2037,5 +2064,6 @@ namespace TemuKJD.PDDForms.ProductSelectForms private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1; private System.Windows.Forms.ComboBox cmbPddRelation; private System.Windows.Forms.Label label19; + private DevComponents.DotNetBar.PanelEx btnExportIdImg; } } \ No newline at end of file diff --git a/TEMUKJD/PDDForms/ProductSelectForms/PDDDBProdListForm.cs b/TEMUKJD/PDDForms/ProductSelectForms/PDDDBProdListForm.cs index d4945e9..a4f18d9 100644 --- a/TEMUKJD/PDDForms/ProductSelectForms/PDDDBProdListForm.cs +++ b/TEMUKJD/PDDForms/ProductSelectForms/PDDDBProdListForm.cs @@ -2276,5 +2276,30 @@ namespace TemuKJD.PDDForms.ProductSelectForms { } + + private void btnExportIdImg_Click(object sender, EventArgs e) + { + var prodIdImgUrlLst = dgvDbProduct.Rows.Cast() + .Where(row => row.Cells["colSelect"]?.Value.ParseToBool() == true) + .Select(r => r.Cells["col_spu_id"].Value.ParseToString() + "-" + + r.Cells["colImgUrl"].Value.ParseToString().Replace("https://", "http://").Replace("imageView2/2/w/90/h/90", "")).ToList(); + if (prodIdImgUrlLst.Count == 0) + { + BaseMsgForm.ShowError("请选择商品"); + return; + } + + SaveFileDialog dialog = new SaveFileDialog(); + dialog.Title = "保存txt文件..."; + dialog.Filter = "txt files (*.txt)|*.txt|All files (*.*)|*.*"; + dialog.RestoreDirectory = true; + dialog.FileName = "商品Id+图片Url" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".txt"; + if (dialog.ShowDialog() != DialogResult.OK) + return; + + string data = string.Join("\r\n", prodIdImgUrlLst); + File.WriteAllText(dialog.FileName, data); + BaseMsgForm.ShowInfo("导出成功!"); + } } } diff --git a/TEMUKJD/PDDForms/ProductSelectForms/PDDDBProdUserSelectForm.Designer.cs b/TEMUKJD/PDDForms/ProductSelectForms/PDDDBProdUserSelectForm.Designer.cs index 6da8735..192deb8 100644 --- a/TEMUKJD/PDDForms/ProductSelectForms/PDDDBProdUserSelectForm.Designer.cs +++ b/TEMUKJD/PDDForms/ProductSelectForms/PDDDBProdUserSelectForm.Designer.cs @@ -40,6 +40,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle8 = new System.Windows.Forms.DataGridViewCellStyle(); this.splitContainer1 = new System.Windows.Forms.SplitContainer(); this.ucGroupBoxEx2 = new TemuKJD.UserComponent.UcGroupBoxEx(this.components); + this.btnSeachPicUp = new DevComponents.DotNetBar.PanelEx(); this.txtMultiPcsSku4 = new System.Windows.Forms.TextBox(); this.label27 = new System.Windows.Forms.Label(); this.txtMultiPcsSku3 = new System.Windows.Forms.TextBox(); @@ -145,7 +146,8 @@ namespace TemuKJD.PDDForms.ProductSelectForms this.colCanUse = new System.Windows.Forms.DataGridViewCheckBoxColumn(); this.colRemaining = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.colMessage = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.btnSeachPicUp = new DevComponents.DotNetBar.PanelEx(); + this.txtLowPriceSkuPrice = new System.Windows.Forms.TextBox(); + this.panel2 = new System.Windows.Forms.Panel(); this.txtLowPriceSkuName = new System.Windows.Forms.TextBox(); this.pbSkuImg = new System.Windows.Forms.PictureBox(); this.chk15996 = new TemuKJD.UserComponent.UcCheckBox(this.components); @@ -160,7 +162,6 @@ namespace TemuKJD.PDDForms.ProductSelectForms this.chkLowPriceSku = new TemuKJD.UserComponent.UcCheckBox(this.components); this.lblLowPriceSkuImg = new System.Windows.Forms.Label(); this.label18 = new System.Windows.Forms.Label(); - this.txtLowPriceSkuPrice = new System.Windows.Forms.TextBox(); this.label19 = new System.Windows.Forms.Label(); this.dgvSelectProduct = new TemuKJD.UserComponent.DataGridViewEx(); this.colCheck = new System.Windows.Forms.DataGridViewCheckBoxColumn(); @@ -248,6 +249,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms | System.Windows.Forms.AnchorStyles.Right))); 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.btnSeachPicUp); this.ucGroupBoxEx2.Controls.Add(this.txtMultiPcsSku4); this.ucGroupBoxEx2.Controls.Add(this.label27); this.ucGroupBoxEx2.Controls.Add(this.txtMultiPcsSku3); @@ -307,6 +309,31 @@ namespace TemuKJD.PDDForms.ProductSelectForms this.ucGroupBoxEx2.TabStop = false; this.ucGroupBoxEx2.Text = "商品上传"; // + // btnSeachPicUp + // + this.btnSeachPicUp.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.btnSeachPicUp.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; + this.btnSeachPicUp.Cursor = System.Windows.Forms.Cursors.Hand; + this.btnSeachPicUp.DisabledBackColor = System.Drawing.Color.Empty; + this.btnSeachPicUp.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.btnSeachPicUp.Location = new System.Drawing.Point(967, 15); + this.btnSeachPicUp.Name = "btnSeachPicUp"; + this.btnSeachPicUp.Size = new System.Drawing.Size(66, 23); + this.btnSeachPicUp.Style.Alignment = System.Drawing.StringAlignment.Center; + this.btnSeachPicUp.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); + this.btnSeachPicUp.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); + this.btnSeachPicUp.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder; + this.btnSeachPicUp.Style.BorderDashStyle = System.Drawing.Drawing2D.DashStyle.Dash; + this.btnSeachPicUp.Style.BorderSide = DevComponents.DotNetBar.eBorderSide.None; + this.btnSeachPicUp.Style.ForeColor.Color = System.Drawing.Color.White; + this.btnSeachPicUp.Style.GradientAngle = 90; + this.btnSeachPicUp.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center; + this.btnSeachPicUp.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255))))); + this.btnSeachPicUp.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255))))); + this.btnSeachPicUp.TabIndex = 845; + this.btnSeachPicUp.Text = "以图搜款"; + this.btnSeachPicUp.Click += new System.EventHandler(this.btnSeachPicUp_Click); + // // txtMultiPcsSku4 // this.txtMultiPcsSku4.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); @@ -1588,7 +1615,8 @@ namespace TemuKJD.PDDForms.ProductSelectForms // // splitContainer2.Panel2 // - this.splitContainer2.Panel2.Controls.Add(this.btnSeachPicUp); + this.splitContainer2.Panel2.Controls.Add(this.txtLowPriceSkuPrice); + this.splitContainer2.Panel2.Controls.Add(this.panel2); this.splitContainer2.Panel2.Controls.Add(this.txtLowPriceSkuName); this.splitContainer2.Panel2.Controls.Add(this.pbSkuImg); this.splitContainer2.Panel2.Controls.Add(this.chk15996); @@ -1603,7 +1631,6 @@ namespace TemuKJD.PDDForms.ProductSelectForms this.splitContainer2.Panel2.Controls.Add(this.chkLowPriceSku); this.splitContainer2.Panel2.Controls.Add(this.lblLowPriceSkuImg); this.splitContainer2.Panel2.Controls.Add(this.label18); - this.splitContainer2.Panel2.Controls.Add(this.txtLowPriceSkuPrice); this.splitContainer2.Panel2.Controls.Add(this.label19); this.splitContainer2.Panel2.Controls.Add(this.dgvSelectProduct); this.splitContainer2.Panel2.Padding = new System.Windows.Forms.Padding(0, 0, 4, 0); @@ -1753,31 +1780,27 @@ namespace TemuKJD.PDDForms.ProductSelectForms this.colMessage.Name = "colMessage"; this.colMessage.ReadOnly = true; // - // btnSeachPicUp + // txtLowPriceSkuPrice // - this.btnSeachPicUp.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.btnSeachPicUp.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; - this.btnSeachPicUp.Cursor = System.Windows.Forms.Cursors.Hand; - this.btnSeachPicUp.DisabledBackColor = System.Drawing.Color.Empty; - this.btnSeachPicUp.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.btnSeachPicUp.Location = new System.Drawing.Point(1143, 335); - this.btnSeachPicUp.Name = "btnSeachPicUp"; - this.btnSeachPicUp.Size = new System.Drawing.Size(83, 23); - this.btnSeachPicUp.Style.Alignment = System.Drawing.StringAlignment.Center; - this.btnSeachPicUp.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); - this.btnSeachPicUp.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); - this.btnSeachPicUp.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder; - this.btnSeachPicUp.Style.BorderDashStyle = System.Drawing.Drawing2D.DashStyle.Dash; - this.btnSeachPicUp.Style.BorderSide = DevComponents.DotNetBar.eBorderSide.None; - this.btnSeachPicUp.Style.ForeColor.Color = System.Drawing.Color.White; - this.btnSeachPicUp.Style.GradientAngle = 90; - this.btnSeachPicUp.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center; - this.btnSeachPicUp.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255))))); - this.btnSeachPicUp.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255))))); - this.btnSeachPicUp.TabIndex = 845; - this.btnSeachPicUp.Text = "以图搜款"; - this.btnSeachPicUp.Visible = false; - this.btnSeachPicUp.Click += new System.EventHandler(this.btnSeachPicUp_Click); + this.txtLowPriceSkuPrice.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.txtLowPriceSkuPrice.Location = new System.Drawing.Point(201, 50); + this.txtLowPriceSkuPrice.Margin = new System.Windows.Forms.Padding(0, 2, 0, 2); + this.txtLowPriceSkuPrice.Name = "txtLowPriceSkuPrice"; + this.txtLowPriceSkuPrice.Size = new System.Drawing.Size(32, 23); + this.txtLowPriceSkuPrice.TabIndex = 658; + this.txtLowPriceSkuPrice.Text = "5"; + this.txtLowPriceSkuPrice.Visible = false; + this.txtLowPriceSkuPrice.TextChanged += new System.EventHandler(this.txtLowPriceSkuPrice_TextChanged); + // + // panel2 + // + this.panel2.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.panel2.Location = new System.Drawing.Point(345, 254); + this.panel2.Name = "panel2"; + this.panel2.Size = new System.Drawing.Size(881, 86); + this.panel2.TabIndex = 842; // // txtLowPriceSkuName // @@ -1963,18 +1986,6 @@ namespace TemuKJD.PDDForms.ProductSelectForms this.label18.Text = "保底价格"; this.label18.Visible = false; // - // txtLowPriceSkuPrice - // - this.txtLowPriceSkuPrice.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.txtLowPriceSkuPrice.Location = new System.Drawing.Point(201, 50); - this.txtLowPriceSkuPrice.Margin = new System.Windows.Forms.Padding(0, 2, 0, 2); - this.txtLowPriceSkuPrice.Name = "txtLowPriceSkuPrice"; - this.txtLowPriceSkuPrice.Size = new System.Drawing.Size(32, 23); - this.txtLowPriceSkuPrice.TabIndex = 658; - this.txtLowPriceSkuPrice.Text = "5"; - this.txtLowPriceSkuPrice.Visible = false; - this.txtLowPriceSkuPrice.TextChanged += new System.EventHandler(this.txtLowPriceSkuPrice_TextChanged); - // // label19 // this.label19.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); @@ -2518,5 +2529,6 @@ namespace TemuKJD.PDDForms.ProductSelectForms private System.Windows.Forms.Label label27; private UserComponent.UcCheckBox chkRelation; private DevComponents.DotNetBar.PanelEx btnSeachPicUp; + private System.Windows.Forms.Panel panel2; } } \ No newline at end of file diff --git a/TEMUKJD/PDDForms/ProductSelectForms/PDDDBProdUserSelectForm.cs b/TEMUKJD/PDDForms/ProductSelectForms/PDDDBProdUserSelectForm.cs index 6eb6a50..7e1bcae 100644 --- a/TEMUKJD/PDDForms/ProductSelectForms/PDDDBProdUserSelectForm.cs +++ b/TEMUKJD/PDDForms/ProductSelectForms/PDDDBProdUserSelectForm.cs @@ -29,6 +29,9 @@ using CefSharp; using TemuKJD.BLL.PddApi; using TemuKJD.WXForms.ProductForms; using System.Drawing.Imaging; +using NaiBa.CefHelper.Handler; +using TemuKJD.Helper; +using CefSharp.WinForms; namespace TemuKJD.PDDForms.ProductSelectForms { @@ -78,6 +81,8 @@ namespace TemuKJD.PDDForms.ProductSelectForms this.panel1.Width = this.Width - 80; this.panel1.Height = this.Height - 60; this.panel1.SendToBack(); + this.panel2.Dock = DockStyle.Fill; + this.panel2.SendToBack(); lstTemuDBProductSelect = NaiBa.Util.Helper.ConfigHelper.LoadConfig>("pdd_db_prod_upload_list"); if (lstTemuDBProductSelect == null) @@ -869,45 +874,6 @@ namespace TemuKJD.PDDForms.ProductSelectForms var result = ""; try { - if (!dicShopGetCount.Keys.Contains(shop)) - dicShopGetCount[shop] = 100; - else - dicShopGetCount[shop]++; - if (dicShopGetCount[shop] > 0) - { - dicShopGetCount[shop] = 0; - - PDDShopLoginForm loginForm = null; - Invoke(new Action(() => - { - this.panel1.SendToBack(); - loginForm = new PDDShopLoginForm(shop); - loginForm.TopLevel = false; - loginForm.openType = EnumOpenType.manage; - loginForm.WindowState = FormWindowState.Maximized; - loginForm.InitUrl = "https://mms.pinduoduo.com/home/"; - loginForm.Dock = DockStyle.Fill; - this.panel1.Controls.Add(loginForm); - loginForm.Show(); - })); - sleepTime = Randomx.GetId(4000, 8000); - sleepTimeTotal += sleepTime; - Thread.Sleep(sleepTime); - if (Randomx.GetId(3) > 0) // 后面重试的地方较多,一次获取的token不够了,随机再登录一次 - { - loginForm.cefWebBrowser.Load("https://mms.pinduoduo.com/goods/goods_list?msfrom=mms_sidenav"); - sleepTime = Randomx.GetId(4000, 8000); - sleepTimeTotal += sleepTime; - Thread.Sleep(sleepTime); - } - - Invoke(new Action(() => - { - if (loginForm != null) - loginForm.Close(); - })); - } - PDDShopListForm.Instance.CheckShopLogin(new string[] { shop.LoginName }, false); if (shop.LoginStatus != "登录成功") { @@ -921,6 +887,8 @@ namespace TemuKJD.PDDForms.ProductSelectForms continue; } + GetToken(shop); + if (cancellationTokenSource.IsCancellationRequested) break; @@ -1060,7 +1028,6 @@ namespace TemuKJD.PDDForms.ProductSelectForms //testUploadProd(shop); //return "测试上货"; - int sleepTime = 0; int sleepTimeTotal = 0; @@ -1999,11 +1966,11 @@ namespace TemuKJD.PDDForms.ProductSelectForms { string getImgError; var image = GetHtml.GetUrlImg(skuParam.thumb_url.Replace("https://", "http://"), out getImgError); - var imageBg = new Bitmap(image.Width, image.Height); if (!string.IsNullOrEmpty(getImgError) || image == null) { return "设置sku失败 图片上传失败"; } + var imageBg = new Bitmap(image.Width, image.Height); try { using (Graphics g = Graphics.FromImage(imageBg)) @@ -2378,11 +2345,11 @@ namespace TemuKJD.PDDForms.ProductSelectForms { string getImgError; var image = GetHtml.GetUrlImg(skuParamUpgrade.thumb_url.Replace("https://", "http://"), out getImgError); - var imageBg = new Bitmap(image.Width, image.Height); if (!string.IsNullOrEmpty(getImgError) || image == null) { return "设置升级款sku失败 图片上传失败"; } + var imageBg = new Bitmap(image.Width, image.Height); try { using (Graphics g = Graphics.FromImage(imageBg)) @@ -2956,11 +2923,11 @@ namespace TemuKJD.PDDForms.ProductSelectForms { string getImgError; var image = GetHtml.GetUrlImg(skuParamUpgrade.thumb_url.Replace("https://", "http://"), out getImgError); - var imageBg = new Bitmap(image.Width, image.Height); if (!string.IsNullOrEmpty(getImgError) || image == null) { return "设置升级款sku失败 图片上传失败"; } + var imageBg = new Bitmap(image.Width, image.Height); try { using (Graphics g = Graphics.FromImage(imageBg)) @@ -3059,11 +3026,11 @@ namespace TemuKJD.PDDForms.ProductSelectForms // { // string getImgError; // var image = GetHtml.GetUrlImg(fakeImgUrl, out getImgError); - // var imageBg = new Bitmap(image.Width, image.Height); // if (!string.IsNullOrEmpty(getImgError) || image == null) // { // return "设置替换sku失败 图片上传失败"; // } + // var imageBg = new Bitmap(image.Width, image.Height); // try // { // using (Graphics g = Graphics.FromImage(imageBg)) @@ -8904,26 +8871,25 @@ Content-Type: image/jpeg if (cancellationTokenSource != null) cancellationTokenSource.Cancel(); cancellationTokenSource = new CancellationTokenSource(); - Task.Run(() => - { - try - { - GetShopAndUpProduct(cancellationTokenSource.Token); - } - catch (Exception ex) - { - BaseMsgForm.ShowError("店铺商品上传分配错误:" + ex.Message); - } - Invoke(new Action(() => - { - if (!cancellationTokenSource.IsCancellationRequested) - BaseMsgForm.ShowConfirm("上传完成"); - else - BaseMsgForm.ShowConfirm("上传停止"); - this.btnUpload.Enabled = true; - })); - }, cancellationTokenSource.Token); - + //Task.Run(() => + //{ + // try + // { + // GetShopAndUpProduct(cancellationTokenSource.Token); + // } + // catch (Exception ex) + // { + // BaseMsgForm.ShowError("店铺商品上传分配错误:" + ex.Message); + // } + // Invoke(new Action(() => + // { + // if (!cancellationTokenSource.IsCancellationRequested) + // BaseMsgForm.ShowConfirm("上传完成"); + // else + // BaseMsgForm.ShowConfirm("上传停止"); + // this.btnUpload.Enabled = true; + // })); + //}, cancellationTokenSource.Token); Task.Run(() => { @@ -8980,11 +8946,13 @@ Content-Type: image/jpeg return; } - var randomShop = randomShopLst[Randomx.GetId(randomShopLst.Count)]; - while (currentShopList.Any(s => s.ShopId == randomShop.ShopId)) + ShopLoginInfo randomShop = null; //randomShopLst[Randomx.GetId(randomShopLst.Count)]; + while (randomShop == null) { Thread.Sleep(500); - randomShop = randomShopLst[Randomx.GetId(randomShopLst.Count)]; + if (randomShopLst.Where(s => !currentShopList.Contains(s)).ToList().Count == 0) + continue; + randomShop = randomShopLst.Where(s => !currentShopList.Contains(s)).ToList().OrderBy(x => Guid.NewGuid()).FirstOrDefault(); } currentShopList.Add(randomShop); if (cancellationTokenSource.IsCancellationRequested) @@ -9025,10 +8993,6 @@ Content-Type: image/jpeg if (prod == null) { - Invoke(new Action(() => - { - BaseMsgForm.ShowError("商品为空,将为您跳过该商品!"); - })); currentShopList.Remove(randomShop); continue; } @@ -9091,10 +9055,6 @@ Content-Type: image/jpeg double duration = 0; if (row == null) { - Invoke(new Action(() => - { - BaseMsgForm.ShowError("商品已被清除,将为您跳过该商品!"); - })); continue; } @@ -9110,12 +9070,6 @@ Content-Type: image/jpeg if (kjdDbProd?.id == 0) { prod.status = "已清除"; - //var empty_url = BaseClass.BuildObjString("product/mdy_user_select_product_status"); - //var empty_data = UserLogin.GetSignaturex() + - // "&select_add_time=" + prod.add_time.ToString("yyyy-MM-dd HH:mm:ss") + - // "&db_id=" + prod.id + - // "&status=已清除"; - //GetHtml.PostUtf8(empty_url, empty_data); } Invoke(new Action(() => @@ -9135,45 +9089,10 @@ Content-Type: image/jpeg var result = ""; try { - if (!dicShopGetCount.Keys.Contains(shop)) - dicShopGetCount[shop] = 100; - else - dicShopGetCount[shop]++; - if (dicShopGetCount[shop] > 0) - { - dicShopGetCount[shop] = 0; - - PDDShopLoginForm loginForm = null; - Invoke(new Action(() => - { - this.panel1.SendToBack(); - loginForm = new PDDShopLoginForm(shop); - loginForm.TopLevel = false; - loginForm.openType = EnumOpenType.manage; - loginForm.WindowState = FormWindowState.Maximized; - loginForm.InitUrl = "https://mms.pinduoduo.com/home/"; - loginForm.Dock = DockStyle.Fill; - this.panel1.Controls.Add(loginForm); - loginForm.Show(); - })); - sleepTime = Randomx.GetId(4000, 8000); - sleepTimeTotal += sleepTime; - Thread.Sleep(sleepTime); - if (Randomx.GetId(3) > 0) // 后面重试的地方较多,一次获取的token不够了,随机再登录一次 - { - loginForm.cefWebBrowser.Load("https://mms.pinduoduo.com/goods/goods_list?msfrom=mms_sidenav"); - sleepTime = Randomx.GetId(4000, 8000); - sleepTimeTotal += sleepTime; - Thread.Sleep(sleepTime); - } - - Invoke(new Action(() => - { - if (loginForm != null) - loginForm.Close(); - })); - } + if (cancellationTokenSource.IsCancellationRequested) + break; + // 检测是否掉线 PDDShopListForm.Instance.CheckShopLogin(new string[] { shop.LoginName }, false); if (shop.LoginStatus != "登录成功") { @@ -9187,26 +9106,26 @@ Content-Type: image/jpeg continue; } - if (cancellationTokenSource.IsCancellationRequested) - break; + // 获取token + //GetToken(shop); - //var prodDetailJson = GetHtml.UrlDecode(kjdDbProd.product_json); - //将商品上传 - result = UploadProduct(shop, kjdDbProd, prod, row.Cells["colOpResult"], startTime); + // 上传商品 + result = CefUploadProduct(shop, kjdDbProd, prod, row.Cells["colOpResult"], startTime); + Thread.Sleep(10000); Invoke(new Action(() => { - if (chkActivity.Checked) - { - row.Cells["colSkuFakeImgUrl"].Value = kjdDbProd.sku_img_replace_url; - if (row.Displayed) - { - string getImgError = ""; - Image img = GetHtml.GetUrlImg(kjdDbProd.sku_img_replace_url.Replace("https://", "http://"), out getImgError); - if (string.IsNullOrEmpty(getImgError)) - row.Cells["colSkuFakeImg"].Value = img; - } - } + //if (chkActivity.Checked) + //{ + // row.Cells["colSkuFakeImgUrl"].Value = kjdDbProd.sku_img_replace_url; + // if (row.Displayed) + // { + // string getImgError = ""; + // Image img = GetHtml.GetUrlImg(kjdDbProd.sku_img_replace_url.Replace("https://", "http://"), out getImgError); + // if (string.IsNullOrEmpty(getImgError)) + // row.Cells["colSkuFakeImg"].Value = img; + // } + //} })); if (result.Contains("您的店铺操作过于频繁,请稍后操作")) @@ -9307,6 +9226,187 @@ Content-Type: image/jpeg //this.statusBar.UpdateProgressBar(lstTemuDBProductSelect.Count); })); } + + //Dictionary dicShopCef = new Dictionary(); + string CefUploadProduct(ShopLoginInfo shop, KJDDBProduct dbProd, TemuDBProductSelect selectProd, DataGridViewCell cell, DateTime startTime) + { + Thread.Sleep(3000); + var cookieLst = JsonHelper.DeserializeJsonToList(shop.Cookies); + if (cookieLst == null) + cookieLst = new List(); + + var cefWebBrowser = shop.Chat; + + // 初始化cef + if (cefWebBrowser == null) + { + Invoke(new Action(() => + { + panel2.BringToFront(); + cefWebBrowser = NaiBa.CefHelper.CEFBrowser.CreateChromiumWebBrowser("https://mms.pinduoduo.com/home", false); + shop.Chat = cefWebBrowser; + cefWebBrowser.Tag = shop; + CustomResourceRequestHandlerLocal resourceRequestHandler = new CustomResourceRequestHandlerLocal(); + resourceRequestHandler.ResourceLoadCompleteEvent += RequestHandler_ResourceLoadComplete; + resourceRequestHandler.BeforeResourceLoadEvent += RequestHandler_BeforeResourceLoad; + cefWebBrowser.RequestHandler = new CustomRequestHandler(resourceRequestHandler); + var lifeSapnHandler = new LifeSpanHandlerLocal(PopWindowType.SelfWindow); + cefWebBrowser.LifeSpanHandler = lifeSapnHandler; + cefWebBrowser.KeyboardHandler = new KeyboardHandler(); + cefWebBrowser.FrameLoadEnd += CefWebBrowser_FrameLoadEnd; + cefWebBrowser.AddressChanged += CefWebBrowser_AddressChanged; + cefWebBrowser.LoadError += CefWebBrowser_LoadError; + cefWebBrowser.Dock = DockStyle.Fill; + panel2.Controls.Add(cefWebBrowser); + })); + } + else + { + Invoke(new Action(() => + { + panel2.BringToFront(); + })); + } + while (!cefWebBrowser.IsBrowserInitialized || !cefWebBrowser.GetBrowser().MainFrame.IsValid) + Thread.Sleep(20); + + // 设置cookie + Invoke(new Action(() => + { + NaiBa.CefHelper.CEFBrowser.DeleteCookie(cefWebBrowser.GetCookieManager(null)); + NaiBa.CefHelper.CEFBrowser.SetCookieAsync(JsonHelper.SerializeObject(cookieLst), cefWebBrowser.GetCookieManager(null)); + })); + Thread.Sleep(Randomx.GetId(1000, 1500)); + + // 加载机会商品页面 + cefWebBrowser.Load("https://mms.pinduoduo.com/goods/goods_list/chance?sourcePage=goodsListTopButton"); + while (!cefWebBrowser.GetMainFrame().IsValid || cefWebBrowser.IsLoading) + Thread.Sleep(500); + Thread.Sleep(Randomx.GetId(5000, 7000)); + + // 点击图片搜索图标 + var jsStr1 = @"(function() { var spans = document.getElementsByTagName('span'); + for (i=0; i< spans.length;i++){ + var span = spans[i]; + if (span.outerHTML.indexOf('el_image_search_button') >= 0) { + span.click(); + break; + } + } + })();"; + var response1 = cefWebBrowser.GetBrowser().MainFrame.EvaluateScriptAsync(jsStr1); + response1.Wait(1000); + Thread.Sleep(Randomx.GetId(1500, 3000)); + + // ctrl + v 复制图片 + string getImgError; + var image = GetHtml.GetUrlImg(dbProd.main_img.Replace("https://", "http://"), out getImgError); + if (!string.IsNullOrEmpty(getImgError) || image == null) + { + return "设置图片失败 图片上传失败"; + } + var bitMap = new Bitmap(image.Width, image.Height); + using (Graphics g = Graphics.FromImage(bitMap)) + { + g.DrawImage(image, new Rectangle(0, 0, bitMap.Width, bitMap.Height), 0, 0, image.Width, image.Height, GraphicsUnit.Pixel); + } + Invoke(new Action(() => { Clipboard.SetImage(bitMap); })); + + var host = cefWebBrowser.GetBrowser().GetHost(); + host.SendKeyEvent(new CefSharp.KeyEvent() { WindowsKeyCode = 86, Type = KeyEventType.RawKeyDown, Modifiers = CefEventFlags.ControlDown }); + Thread.Sleep(Randomx.GetId(5000, 7000)); + + while (txtAlpha.Text == "99") + { + Thread.Sleep(500); + } + // 点击搜索按钮 + var jsStr2 = @"(function() { var spans = document.getElementsByTagName('span'); + for (i = 0; i < spans.length; i++) { + var span = spans[i]; + if (span.innerHTML.indexOf('查询') >= 0 && span.parentElement.parentElement.innerHTML.indexOf('上传图片搜同款') >= 0) { + //span.parentElement.parentElement.parentElement.click(); + span.click(); + break; + } + } + })();"; + var response2 = cefWebBrowser.GetBrowser().MainFrame.EvaluateScriptAsync(jsStr2); + response2.Wait(1000); + + Thread.Sleep(Randomx.GetId(7000, 10000)); + while(txtAlpha.Text == "99") + { + Thread.Sleep(500); + } + Invoke(new Action(() => + { + panel2.SendToBack(); + })); + return ""; + } + + private bool RequestHandler_BeforeResourceLoad(object sender, string url, string postData, IRequest request) + { + var shop = (sender as ChromiumWebBrowser).Tag as ShopLoginInfo; + if (BaseClass.MainPath == "binxixi" && BaseClass.UsePddWorkbanch && !(shop?.Cookies).ParseToString().Contains("windows_1")) + { + var ua = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36"; + //ua = "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.5.40.8 Safari/537.36"; + request.SetHeaderByName("User-Agent", ua, true); + } + return false; + } + private void RequestHandler_ResourceLoadComplete(object sender, string url, string postData, string responseData, IRequest request) + { + } + private void CefWebBrowser_FrameLoadEnd(object sender, CefSharp.FrameLoadEndEventArgs e) + { + } + private void CefWebBrowser_AddressChanged(object sender, CefSharp.AddressChangedEventArgs e) + { + } + private void CefWebBrowser_LoadError(object sender, CefSharp.LoadErrorEventArgs e) + { + } + + + void GetToken(ShopLoginInfo shop) + { + if (!dicShopGetCount.Keys.Contains(shop)) + { + var antiLst = shop.AntiContents.Take(Math.Max(1, shop.AntiContents.Count - 5)).ToList(); + shop.AntiContents.RemoveAll(a => antiLst.Contains(a)); + dicShopGetCount[shop] = 100; + } + else + dicShopGetCount[shop]++; + if (dicShopGetCount[shop] > 1) + { + dicShopGetCount[shop] = 0; + + PDDShopLoginForm loginForm = null; + Invoke(new Action(() => + { + this.panel1.SendToBack(); + loginForm = new PDDShopLoginForm(shop); + loginForm.TopLevel = false; + loginForm.openType = EnumOpenType.manage; + loginForm.WindowState = FormWindowState.Maximized; + loginForm.InitUrl = "https://mms.pinduoduo.com/goods/goods_list?msfrom=mms_sidenav"; + loginForm.Dock = DockStyle.Fill; + this.panel1.Controls.Add(loginForm); + loginForm.Show(); + })); + Thread.Sleep(Randomx.GetId(3000, 5000)); + + Invoke(new Action(() => + { + if (loginForm != null) + loginForm.Close(); + })); + } + } } public class AddPriceRule diff --git a/TEMUKJD/PDDForms/ShopForms/PDDShopListForm.cs b/TEMUKJD/PDDForms/ShopForms/PDDShopListForm.cs index e3b63bd..a3c548e 100644 --- a/TEMUKJD/PDDForms/ShopForms/PDDShopListForm.cs +++ b/TEMUKJD/PDDForms/ShopForms/PDDShopListForm.cs @@ -39,18 +39,18 @@ namespace TemuKJD.PDDForms.ShopForms public static void UpdateShop() { // 获取本地店铺和服务端店铺。将服务端相关信息与本地店铺合并后暂时存在内存中(不保存敏感信息)。 - GlobalConfig.ShopLoginList = new ConcurrentList(); + // GlobalConfig.ShopLoginList = new ConcurrentList(); // 获取服务端店铺 var serverShopList = PDDShopListForm.GetServerShop(); - var localShopList = new ConcurrentList(); - localShopList.AddRange(serverShopList); - foreach (var localShop in localShopList) + //var localShopList = new ConcurrentList(); + //localShopList.AddRange(serverShopList); + GlobalConfig.ShopLoginList.RemoveAll(s => !serverShopList.Any(ss => ss.LoginName == s.LoginName && ss.ShopId == ss.ShopId)); + foreach (var serverShop in serverShopList) { - if (GlobalConfig.ShopLoginList.Any(s => s.LoginName == localShop.LoginName && s.ShopId == localShop.ShopId)) - continue; - - var serverShop = serverShopList.FirstOrDefault(s => s.LoginName == localShop.LoginName && s.ShopId == localShop.ShopId); - if (serverShop != null) + var localShop = serverShopList.FirstOrDefault(s => s.LoginName == serverShop.LoginName && s.ShopId == serverShop.ShopId); + if (localShop == null) + GlobalConfig.ShopLoginList.Add(serverShop); + else { localShop.ShopAccount = serverShop.ShopAccount; localShop.LoginName = serverShop.LoginName; @@ -79,10 +79,10 @@ namespace TemuKJD.PDDForms.ShopForms localShop.OperateSubSaName = serverShop.OperateSubSaName; if (localShop.TrialUploadCount < 0) localShop.TrialUploadCount = 0; - GlobalConfig.ShopLoginList.Add(localShop); } } //PddApiHelper.GetPddLocalTokens(); + PddApiHelper.GetShopClientInfo(); } public static List GetServerShop() diff --git a/TEMUKJD/WXForms/TalkForms/BuyerOrderListForm.cs b/TEMUKJD/WXForms/TalkForms/BuyerOrderListForm.cs index 7e970c5..9f630cf 100644 --- a/TEMUKJD/WXForms/TalkForms/BuyerOrderListForm.cs +++ b/TEMUKJD/WXForms/TalkForms/BuyerOrderListForm.cs @@ -161,7 +161,7 @@ namespace TemuKJD.WXForms.TalkForms order.order_status_prompt, order.outExpressCompanyName, order.tracking_number, - order.sendStatus.IsNullOrEmpty() ? order.refundStatus : order.sendStatus, + order.sendStatus, "发送", "退货" ); @@ -183,23 +183,33 @@ namespace TemuKJD.WXForms.TalkForms row.Cells["dgvOStatus"].Value = order.order_status_prompt; row.Cells["colOExpressName"].Value = order.outExpressCompanyName; row.Cells["colOExpressId"].Value = order.tracking_number; - row.Cells["colOMsg"].Value = order.sendStatus.IsNullOrEmpty() ? order.refundStatus : order.sendStatus; + row.Cells["colOMsg"].Value = order.sendStatus; } + // + if (order.outExpressCompanyName == "物流名称获取失败") + row.Cells["colOExpressName"].Style.ForeColor = Color.Orange; + else + row.Cells["colOExpressName"].Style.ForeColor = Control.DefaultForeColor; + if (order.order_status_prompt.Contains("交易成功")) { row.Cells["colOMsg"].Value = "[完]" + row.Cells["colOMsg"].Value.ParseToString(); row.Cells["colOMsg"].Style.ForeColor = Color.Green; } - if (order.order_status_prompt.Contains("退款成功") || order.order_status_prompt.Contains("交易已取消")) + else if (order.order_status_prompt.Contains("退款成功") || order.order_status_prompt.Contains("交易已取消")) { row.Cells["colOMsg"].Value = "[退]" + row.Cells["colOMsg"].Value.ParseToString(); row.Cells["colOMsg"].Style.ForeColor = Color.Gray; } - else if (order.refundStatus.Contains("待退款") || order.refundStatus.Contains("待退货")) + else if (order.after_sales != null) { row.Cells["colOMsg"].Value = "[待退]" + row.Cells["colOMsg"].Value.ParseToString(); row.Cells["colOMsg"].Style.ForeColor = Color.Red; } + else + { + row.Cells["colOMsg"].Style.ForeColor = Control.DefaultForeColor; + } } private void InitCef() @@ -233,67 +243,82 @@ namespace TemuKJD.WXForms.TalkForms private void RequestHandler_ResourceLoadComplete(object sender, string url, string postData, string responseData, IRequest request) { - var url1 = url; - //if (responseData.Contains("260415-279781076570828")) - //{ - //} - //if (url1.StartsWith("https://mobile.yangkeduo.com/orders.html?type=3&order_index=0")) - //{ - //} - if (url1.StartsWith("https://mobile.yangkeduo.com/orders.html?type=3")) //https://mobile.yangkeduo.com/orders.html?type=3 + Task.Run(() => { - Task.Run(() => + var url1 = url; + var data1 = responseData; + + //if (data1.Contains("260415-154067299863696") || data1.Contains("待用户退回商品") || data1.Contains("已寄出,待商家处理") || data1.Contains("待商家处理退货申请") || data1.Contains("待用户拒收商品")) + //{ + + //} + if (data1.Contains("260416-143256471130828")) { - var data = responseData; - if (data.Contains("display_amount")) + + } + //if (data1.Contains("260415-279781076570828")) + //{ + //} + //if (url1.StartsWith("https://mobile.yangkeduo.com/orders.html?type=3&order_index=0")) + //{ + //} + if (url1.StartsWith("https://mobile.yangkeduo.com/orders.html?type=3")) //https://mobile.yangkeduo.com/orders.html?type=3 + { + Task.Run(() => { - var jsonData = BaseRegex.GetJsonObjStrJson(ref data, "ordersStore")?.FirstOrDefault(); - var nickName = BaseRegex.GetStringJson(ref data, "nickName"); - var uid = BaseRegex.GetStringJson(ref data, "uid"); - var buyerId = GlobalConfig.BuyerLoginList.FirstOrDefault(b => b.buyer_id == uid)?.buyer_id; - if (buyerId.IsNullOrEmpty()) - buyerId = GlobalConfig.BuyerLoginList.FirstOrDefault(b => b.buyer_nick == nickName)?.buyer_id; - if (!string.IsNullOrEmpty(jsonData) && !string.IsNullOrEmpty(buyerId)) + if (data1.Contains("display_amount")) { - var ordersStr = BaseRegex.GetJsonObjStrJson(ref jsonData, "initOdersList")?.FirstOrDefault(); - if (ordersStr != null && ordersStr.StartsWith("{\"3\":")) + var jsonData = BaseRegex.GetJsonObjStrJson(ref data1, "ordersStore")?.FirstOrDefault(); + var nickName = BaseRegex.GetStringJson(ref data1, "nickName"); + var uid = BaseRegex.GetStringJson(ref data1, "uid"); + var buyerId = GlobalConfig.BuyerLoginList.FirstOrDefault(b => b.buyer_id == uid)?.buyer_id; + if (buyerId.IsNullOrEmpty()) + buyerId = GlobalConfig.BuyerLoginList.FirstOrDefault(b => b.buyer_nick == nickName)?.buyer_id; + if (!string.IsNullOrEmpty(jsonData) && !string.IsNullOrEmpty(buyerId)) { - ordersStr = "{\"orders\":" + ordersStr.Substring(5); - CefReadBuyerOrder(buyerId, ordersStr); + var ordersStr = BaseRegex.GetJsonObjStrJson(ref jsonData, "initOdersList")?.FirstOrDefault(); + if (ordersStr != null && ordersStr.StartsWith("{\"3\":")) + { + ordersStr = "{\"orders\":" + ordersStr.Substring(5); + CefReadBuyerOrder(buyerId, ordersStr); + } } } - } - }); - } - if (url1.StartsWith("https://mobile.yangkeduo.com/orders.html?type=2")) - { - Task.Run(() => + }); + } + if (url1.StartsWith("https://mobile.yangkeduo.com/orders.html?type=2")) { - var data = responseData; - if (data.Contains("display_amount")) + Task.Run(() => { - var jsonData = BaseRegex.GetJsonObjStrJson(ref data, "ordersStore")?.FirstOrDefault(); - var nickName = BaseRegex.GetStringJson(ref data, "nickName"); - var buyerId = GlobalConfig.BuyerLoginList.FirstOrDefault(b => b.buyer_nick == nickName)?.buyer_id; - if (!string.IsNullOrEmpty(jsonData) && !string.IsNullOrEmpty(nickName) && !string.IsNullOrEmpty(buyerId)) + if (data1.Contains("display_amount")) { - var ordersStr = BaseRegex.GetJsonObjStrJson(ref jsonData, "initOdersList")?.FirstOrDefault(); - if (ordersStr != null && ordersStr.StartsWith("{\"2\":")) + var jsonData = BaseRegex.GetJsonObjStrJson(ref data1, "ordersStore")?.FirstOrDefault(); + var nickName = BaseRegex.GetStringJson(ref data1, "nickName"); + var uid = BaseRegex.GetStringJson(ref data1, "uid"); + var buyerId = GlobalConfig.BuyerLoginList.FirstOrDefault(b => b.buyer_id == uid)?.buyer_id; + if (buyerId.IsNullOrEmpty()) + buyerId = GlobalConfig.BuyerLoginList.FirstOrDefault(b => b.buyer_nick == nickName)?.buyer_id; + if (!string.IsNullOrEmpty(jsonData) && !string.IsNullOrEmpty(buyerId)) { - ordersStr = "{\"orders\":" + ordersStr.Substring(5); - CefReadBuyerOrder(buyerId, ordersStr); + var ordersStr = BaseRegex.GetJsonObjStrJson(ref jsonData, "initOdersList")?.FirstOrDefault(); + if (ordersStr != null && ordersStr.StartsWith("{\"2\":")) + { + ordersStr = "{\"orders\":" + ordersStr.Substring(5); + CefReadBuyerOrder(buyerId, ordersStr); + } } } - } - }); - } - if (url1.StartsWith("https://mobile.yangkeduo.com/proxy/api/api/aristotle/order_list_v3")) - { - Task.Run(() => + }); + } + if (url1.StartsWith("https://mobile.yangkeduo.com/proxy/api/api/aristotle/order_list_v3")) { - CefReadBuyerOrder(url1, responseData); - }); - } + Task.Run(() => + { + CefReadBuyerOrder(url1, data1); + + }); + } + }); } string currentReadBuyer = ""; @@ -356,6 +381,7 @@ namespace TemuKJD.WXForms.TalkForms //order = JsonHelper.DeserializeJsonToObject(JsonHelper.SerializeObject(o)); order.activity_type = o.activity_type; + order.after_sales = o.after_sales; order.discount_amount = o.discount_amount; order.display_amount = o.display_amount; order.extra_info = JsonHelper.DeserializeJsonToObject(JsonHelper.SerializeObject(o.extra_info)); @@ -1013,23 +1039,15 @@ namespace TemuKJD.WXForms.TalkForms if (resetSendStatus) order.sendStatus = ""; - //if (order.sendStatus == "已发送") - // return; - //if (order.sendStatus == "已完成/退货") - // return; - if (order.sendStatus.Contains("外采订单已发货")) - { - return; - } // 已发货且没有运单号的属于已退货,不再发送 if (order.order_status_prompt != "拼单成功,待发货" && order.order_status_prompt != "免拼成功,待发货" && ( order.order_status_prompt.Contains("交易成功") || order.order_status_prompt.Contains("退款成功") || order.order_status_prompt.Contains("交易已取消") || + order.after_sales != null || string.IsNullOrEmpty(order.tracking_number) || - string.IsNullOrEmpty(order.outExpressCompanyName))) + string.IsNullOrEmpty(order.outExpressCompanyCode))) { - order.refundStatus = "已完成/退货"; Invoke(new Action(() => { ShowOrder(order); @@ -1037,6 +1055,13 @@ namespace TemuKJD.WXForms.TalkForms NaiBa.Util.Helper.ConfigHelper.SaveConfig("pdd_buyer_order_list", lstPddBuyerOrderInfoLite); return; } + // 外采订单已发货的订单不再尝试发货 + //if (order.sendStatus == "已发送") + // return; + if (order.sendStatus.Contains("外采订单已发货")) + { + return; + } JObject obj = new JObject(); obj["platform"] = "WEISHOP"; @@ -1116,7 +1141,7 @@ namespace TemuKJD.WXForms.TalkForms if (order == null) continue; - order.refundStatus = order.order_status_prompt.Contains("待发货") ? "待退款" : "待退货"; + //order.refundStatus = order.order_status_prompt.Contains("待发货") ? "待退款" : "待退货"; NaiBa.Util.Helper.ConfigHelper.SaveConfig("pdd_buyer_order_list", lstPddBuyerOrderInfoLite); Invoke(new Action(() => { @@ -1177,7 +1202,7 @@ namespace TemuKJD.WXForms.TalkForms var afterSaleRst = YkdBuyerOrder.SetOrderAfterSale(buyer, mobile, order.order_sn, applyAmount, refundAmount, newMaxApplyAmount); if (afterSaleRst.Contains("\"after_sales_status\":1") || afterSaleRst.Contains("该订单已全额退款")) { - order.refundStatus = "已完成/退货"; + //order.refundStatus = "已完成/退货"; order.order_status_prompt = "退款成功"; NaiBa.Util.Helper.ConfigHelper.SaveConfig("pdd_buyer_order_list", lstPddBuyerOrderInfoLite); Invoke(new Action(() =>