From 42be98616bd6cfb1c37eed58a81e70d7be56a433 Mon Sep 17 00:00:00 2001 From: wule Date: Mon, 19 Jan 2026 18:11:33 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=A2=E6=9C=8D=E6=8F=90=E7=A4=BA=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AllBase/BaseClass.cs | 2 +- TEMUKJD/BaseForms/BaseTalkForm.designer.cs | 58 ++--- TEMUKJD/ChangeForm.cs | 3 +- TEMUKJD/Extension/DataGridViewExtension.cs | 2 +- ...oductThirdSelectListManageForm.Designer.cs | 8 +- .../AdminForms/PDDAdminShopListForm.cs | 8 +- TEMUKJD/PDDForms/ShopForms/PDDShopListForm.cs | 4 +- .../WXForms/AdminForms/WXAdminShopListForm.cs | 4 +- .../ProductForms/WXDBProdUploadForm.cs | 21 +- TEMUKJD/WXForms/ShopForms/WXShopListForm.cs | 4 +- .../WXForms/TalkForms/WxTalkForm.Designer.cs | 167 ++++++------- TEMUKJD/WXForms/TalkForms/WxTalkForm.cs | 226 +++++++++++++++++- 12 files changed, 366 insertions(+), 141 deletions(-) diff --git a/AllBase/BaseClass.cs b/AllBase/BaseClass.cs index 5cc2f93..dfdf5d2 100644 --- a/AllBase/BaseClass.cs +++ b/AllBase/BaseClass.cs @@ -27,7 +27,7 @@ namespace AllBase /// /// 版本ID /// - public static int VersionCount = 792; + public static int VersionCount = 793; //public static int VersionCount = 613; /// diff --git a/TEMUKJD/BaseForms/BaseTalkForm.designer.cs b/TEMUKJD/BaseForms/BaseTalkForm.designer.cs index 3ddf010..5aedf42 100644 --- a/TEMUKJD/BaseForms/BaseTalkForm.designer.cs +++ b/TEMUKJD/BaseForms/BaseTalkForm.designer.cs @@ -29,6 +29,8 @@ private void InitializeComponent() { this.panel1 = new System.Windows.Forms.Panel(); + this.lblVersionName = new System.Windows.Forms.Label(); + this.lblVersionInfo = new System.Windows.Forms.Label(); this.panel2 = new System.Windows.Forms.Panel(); this.pbMinBase = new System.Windows.Forms.PictureBox(); this.pbCloseBase = new System.Windows.Forms.PictureBox(); @@ -36,8 +38,6 @@ this.pbMaxBase = new System.Windows.Forms.PictureBox(); this.pbLogo = new System.Windows.Forms.PictureBox(); this.lbTitle = new System.Windows.Forms.Label(); - this.lblVersionName = new System.Windows.Forms.Label(); - this.lblVersionInfo = new System.Windows.Forms.Label(); this.panel1.SuspendLayout(); this.panel2.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.pbMinBase)).BeginInit(); @@ -64,13 +64,36 @@ this.panel1.MouseMove += new System.Windows.Forms.MouseEventHandler(this.Panel1_MouseMove); this.panel1.MouseUp += new System.Windows.Forms.MouseEventHandler(this.Panel1_MouseUp); // + // lblVersionName + // + this.lblVersionName.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.lblVersionName.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(192)))), ((int)(((byte)(0))))); + this.lblVersionName.Location = new System.Drawing.Point(723, 33); + this.lblVersionName.Name = "lblVersionName"; + this.lblVersionName.Size = new System.Drawing.Size(238, 23); + this.lblVersionName.TabIndex = 81; + this.lblVersionName.Text = "版本类型"; + this.lblVersionName.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + this.lblVersionName.Visible = false; + // + // lblVersionInfo + // + this.lblVersionInfo.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.lblVersionInfo.ForeColor = System.Drawing.SystemColors.ControlDark; + this.lblVersionInfo.Location = new System.Drawing.Point(723, 56); + this.lblVersionInfo.Name = "lblVersionInfo"; + this.lblVersionInfo.Size = new System.Drawing.Size(238, 23); + this.lblVersionInfo.TabIndex = 80; + this.lblVersionInfo.Text = "版本信息"; + this.lblVersionInfo.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // // panel2 // this.panel2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.panel2.Controls.Add(this.pbMinBase); - this.panel2.Controls.Add(this.pbCloseBase); this.panel2.Controls.Add(this.pbNormalBase); this.panel2.Controls.Add(this.pbMaxBase); + this.panel2.Controls.Add(this.pbCloseBase); this.panel2.Location = new System.Drawing.Point(804, 0); this.panel2.Name = "panel2"; this.panel2.Size = new System.Drawing.Size(160, 32); @@ -94,7 +117,7 @@ // this.pbCloseBase.Dock = System.Windows.Forms.DockStyle.Right; this.pbCloseBase.Image = global::TemuKJD.Properties.Resources.close; - this.pbCloseBase.Location = new System.Drawing.Point(64, 0); + this.pbCloseBase.Location = new System.Drawing.Point(128, 0); this.pbCloseBase.Name = "pbCloseBase"; this.pbCloseBase.Size = new System.Drawing.Size(32, 32); this.pbCloseBase.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage; @@ -108,7 +131,7 @@ // this.pbNormalBase.Dock = System.Windows.Forms.DockStyle.Right; this.pbNormalBase.Image = global::TemuKJD.Properties.Resources.normal; - this.pbNormalBase.Location = new System.Drawing.Point(96, 0); + this.pbNormalBase.Location = new System.Drawing.Point(64, 0); this.pbNormalBase.Name = "pbNormalBase"; this.pbNormalBase.Size = new System.Drawing.Size(32, 32); this.pbNormalBase.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage; @@ -123,7 +146,7 @@ // this.pbMaxBase.Dock = System.Windows.Forms.DockStyle.Right; this.pbMaxBase.Image = global::TemuKJD.Properties.Resources.max; - this.pbMaxBase.Location = new System.Drawing.Point(128, 0); + this.pbMaxBase.Location = new System.Drawing.Point(96, 0); this.pbMaxBase.Name = "pbMaxBase"; this.pbMaxBase.Size = new System.Drawing.Size(32, 32); this.pbMaxBase.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage; @@ -158,29 +181,6 @@ this.lbTitle.MouseMove += new System.Windows.Forms.MouseEventHandler(this.lbTitle_MouseMove); this.lbTitle.MouseUp += new System.Windows.Forms.MouseEventHandler(this.lbTitle_MouseUp); // - // lblVersionName - // - this.lblVersionName.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.lblVersionName.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(192)))), ((int)(((byte)(0))))); - this.lblVersionName.Location = new System.Drawing.Point(723, 33); - this.lblVersionName.Name = "lblVersionName"; - this.lblVersionName.Size = new System.Drawing.Size(238, 23); - this.lblVersionName.TabIndex = 81; - this.lblVersionName.Text = "版本类型"; - this.lblVersionName.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - this.lblVersionName.Visible = false; - // - // lblVersionInfo - // - this.lblVersionInfo.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.lblVersionInfo.ForeColor = System.Drawing.SystemColors.ControlDark; - this.lblVersionInfo.Location = new System.Drawing.Point(723, 56); - this.lblVersionInfo.Name = "lblVersionInfo"; - this.lblVersionInfo.Size = new System.Drawing.Size(238, 23); - this.lblVersionInfo.TabIndex = 80; - this.lblVersionInfo.Text = "版本信息"; - this.lblVersionInfo.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // // BaseTalkForm // this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; diff --git a/TEMUKJD/ChangeForm.cs b/TEMUKJD/ChangeForm.cs index 8de6247..e22fdb1 100644 --- a/TEMUKJD/ChangeForm.cs +++ b/TEMUKJD/ChangeForm.cs @@ -39,7 +39,7 @@ namespace TemuKJD pnlExtend.Visible = BaseClass.DarenYaoyue; //直接登录上货工具 - if (BaseClass.MainPath != "weixin1") + if (BaseClass.MainPath != "weixin") // 在此处切换是否显示登录客服选项功能 { label1.Visible = true; pnlChat.Visible = pnlUploadGoods.Visible = false; @@ -116,6 +116,7 @@ namespace TemuKJD //Hide(); WxTalkForm cf = new WxTalkForm(); + cf.Size = new Size(Screen.PrimaryScreen.WorkingArea.Width - 200, Screen.PrimaryScreen.WorkingArea.Height - 100); cf.Show(); //cf.SetTitle(); Hide(); diff --git a/TEMUKJD/Extension/DataGridViewExtension.cs b/TEMUKJD/Extension/DataGridViewExtension.cs index b68a1f5..3fbebf5 100644 --- a/TEMUKJD/Extension/DataGridViewExtension.cs +++ b/TEMUKJD/Extension/DataGridViewExtension.cs @@ -804,7 +804,7 @@ namespace TemuKJD.Extension if (row.Index < 0) return; - if (row.Index >= 0 && row.Cells[imgColumn].Value != null && row.Cells[imgColumn].Value != defaultBitmap) + if (row.Index >= 0 && row.Cells[imgColumn]?.Value != null && row.Cells[imgColumn]?.Value != defaultBitmap) return; Image image = defaultBitmap; diff --git a/TEMUKJD/KJDForms/ProductThirdSelectForms/ProductThirdSelectListManageForm.Designer.cs b/TEMUKJD/KJDForms/ProductThirdSelectForms/ProductThirdSelectListManageForm.Designer.cs index 1d30833..14ef73f 100644 --- a/TEMUKJD/KJDForms/ProductThirdSelectForms/ProductThirdSelectListManageForm.Designer.cs +++ b/TEMUKJD/KJDForms/ProductThirdSelectForms/ProductThirdSelectListManageForm.Designer.cs @@ -1139,7 +1139,7 @@ this.cmbSearchYear.Items.AddRange(new object[] { "2025", "2026"}); - this.cmbSearchYear.Location = new System.Drawing.Point(1017, 11); + this.cmbSearchYear.Location = new System.Drawing.Point(1017, 8); this.cmbSearchYear.Margin = new System.Windows.Forms.Padding(0); this.cmbSearchYear.Name = "cmbSearchYear"; this.cmbSearchYear.Size = new System.Drawing.Size(55, 25); @@ -1154,7 +1154,7 @@ "全部", "重上", "已买"}); - this.cmbUserNotes.Location = new System.Drawing.Point(927, 8); + this.cmbUserNotes.Location = new System.Drawing.Point(927, 11); this.cmbUserNotes.Margin = new System.Windows.Forms.Padding(0); this.cmbUserNotes.Name = "cmbUserNotes"; this.cmbUserNotes.Size = new System.Drawing.Size(52, 25); @@ -1171,7 +1171,7 @@ "核价成功", "核价成功(重复)", "重复"}); - this.cmbNotes.Location = new System.Drawing.Point(813, 8); + this.cmbNotes.Location = new System.Drawing.Point(813, 11); this.cmbNotes.Margin = new System.Windows.Forms.Padding(0); this.cmbNotes.Name = "cmbNotes"; this.cmbNotes.Size = new System.Drawing.Size(52, 25); @@ -1198,7 +1198,7 @@ "已上传", "草稿箱", "全部"}); - this.cmbStatus.Location = new System.Drawing.Point(723, 8); + this.cmbStatus.Location = new System.Drawing.Point(723, 11); this.cmbStatus.Margin = new System.Windows.Forms.Padding(0); this.cmbStatus.Name = "cmbStatus"; this.cmbStatus.Size = new System.Drawing.Size(52, 25); diff --git a/TEMUKJD/PDDForms/AdminForms/PDDAdminShopListForm.cs b/TEMUKJD/PDDForms/AdminForms/PDDAdminShopListForm.cs index e25209c..74bff76 100644 --- a/TEMUKJD/PDDForms/AdminForms/PDDAdminShopListForm.cs +++ b/TEMUKJD/PDDForms/AdminForms/PDDAdminShopListForm.cs @@ -506,11 +506,11 @@ namespace TemuKJD.PDDForms.AdminForms var loginResult = PDDShopListForm.CheckShopLogin(shop); if (loginResult.Contains("\"success\":true") && !loginResult.Contains("\"login\":true")) { - shop.Cookies = "empty=true;"; + shop.Cookies = "[]"; foreach (var sc in campanys) { sc.LoginStatus = "未登录"; - shop.Cookies = "empty=true;"; + shop.Cookies = "[]"; } } else @@ -524,11 +524,11 @@ namespace TemuKJD.PDDForms.AdminForms loginResult = PDDShopListForm.GetShopStatus2(shop); if (!loginResult.Contains("\"success\":true")) { - shop.Cookies2 = "empty=true;"; + shop.Cookies2 = "[]"; foreach (var sc in campanys) { sc.LoginStatus2 = "国际版未登录"; - sc.Cookies2 = "empty=true;"; + sc.Cookies2 = "[]"; } } else diff --git a/TEMUKJD/PDDForms/ShopForms/PDDShopListForm.cs b/TEMUKJD/PDDForms/ShopForms/PDDShopListForm.cs index 5eaa93c..9d72975 100644 --- a/TEMUKJD/PDDForms/ShopForms/PDDShopListForm.cs +++ b/TEMUKJD/PDDForms/ShopForms/PDDShopListForm.cs @@ -578,11 +578,11 @@ namespace TemuKJD.PDDForms.ShopForms var loginResult = CheckShopLogin(shop); if (loginResult.Contains("\"success\":true") && !loginResult.Contains("\"login\":true")) { - shop.Cookies = "empty=true;"; + shop.Cookies = "[]"; foreach (var sc in campanys) { sc.LoginStatus = "未登录"; - shop.Cookies = "empty=true;"; + shop.Cookies = "[]"; } } else diff --git a/TEMUKJD/WXForms/AdminForms/WXAdminShopListForm.cs b/TEMUKJD/WXForms/AdminForms/WXAdminShopListForm.cs index 38750bc..ba24842 100644 --- a/TEMUKJD/WXForms/AdminForms/WXAdminShopListForm.cs +++ b/TEMUKJD/WXForms/AdminForms/WXAdminShopListForm.cs @@ -487,11 +487,11 @@ namespace TemuKJD.WXForms.AdminForms var loginResult = WXShopListForm.CheckShopLogin(shop); if (loginResult.Contains("\"success\":true") && !loginResult.Contains("\"login\":true")) { - shop.Cookies = "empty=true;"; + shop.Cookies = "[]"; foreach (var sc in campanys) { sc.LoginStatus = "未登录"; - shop.Cookies = "empty=true;"; + shop.Cookies = "[]"; } } else diff --git a/TEMUKJD/WXForms/ProductForms/WXDBProdUploadForm.cs b/TEMUKJD/WXForms/ProductForms/WXDBProdUploadForm.cs index d2890d1..105d618 100644 --- a/TEMUKJD/WXForms/ProductForms/WXDBProdUploadForm.cs +++ b/TEMUKJD/WXForms/ProductForms/WXDBProdUploadForm.cs @@ -1173,6 +1173,12 @@ namespace TemuKJD.WXForms.ProductForms using (Graphics g = Graphics.FromImage(imageBg)) { g.DrawImage(image, new Rectangle(0, 0, imageBg.Width, imageBg.Height), 0, 0, image.Width, image.Height, GraphicsUnit.Pixel); + if (upProdParam.product.info.category.FirstOrDefault()?.name == "图书" || prodInfo.detail.cats.FirstOrDefault() == "书籍/杂志/报纸") + { + + g.FillRectangle(new SolidBrush(Color.FromArgb(Randomx.GetId(256), Randomx.GetId(256), Randomx.GetId(256))), + new Rectangle(Randomx.GetId(imageBg.Width - 30), Randomx.GetId(imageBg.Height - 30), 30, 30)); + } } // 取前三张图片保存到系统temp路径,配合商品标题获取商品类目 @@ -1374,7 +1380,10 @@ namespace TemuKJD.WXForms.ProductForms detailGalleries.Add(new gallery_item() { type = 2, url = prodInfo.detail.galleries.FirstOrDefault(g => g.type == 1)?.url }); foreach (var gallery_item in detailGalleries) { - var locationStr = UploadImg(shop, gallery_item.url, cell); + bool randomDrawBlock = false; + if (upProdParam.product.info.category.FirstOrDefault()?.name == "图书" || prodInfo.detail.cats.FirstOrDefault() == "书籍/杂志/报纸") + randomDrawBlock = true; + var locationStr = UploadImg(shop, gallery_item.url, cell, randomDrawBlock); if (!locationStr.Contains("\"success\":true")) return locationStr; var location = BaseRegex.GetStringJson(ref locationStr, "Location"); @@ -1405,7 +1414,7 @@ namespace TemuKJD.WXForms.ProductForms attr = productAttr.attr.FirstOrDefault(r => r.name == "填充物种类" || r.name == "填充物"); } - // 书籍类目匹配 + // 书籍类目属性匹配 if (upProdParam.product.info.category.FirstOrDefault()?.name == "图书" || prodInfo.detail.cats.FirstOrDefault() == "书籍/杂志/报纸") { if (propInfo.name == "出版社名称") @@ -1442,6 +1451,7 @@ namespace TemuKJD.WXForms.ProductForms { attrValue = propInfo.values.FirstOrDefault()?.value; } + //书籍属性处理 if (upProdParam.product.info.category.FirstOrDefault()?.name == "图书" || prodInfo.detail.cats.FirstOrDefault() == "书籍/杂志/报纸") { if (attrValue.IsNullOrEmpty() && attr.type == "integer_unit" && (propInfo.values.FirstOrDefault()?.value).IsNumber()) @@ -1756,7 +1766,7 @@ namespace TemuKJD.WXForms.ProductForms #region 书籍类生成书籍图片 //qualificationList - if (1 == 1) + if (upProdParam.product.info.category.FirstOrDefault()?.name == "图书" || prodInfo.detail.cats.FirstOrDefault() == "书籍/杂志/报纸") { if (cell != null) { @@ -1918,7 +1928,7 @@ namespace TemuKJD.WXForms.ProductForms } - public string UploadImg(ShopLoginInfo shop, string img_url, DataGridViewCell cell = null) + public string UploadImg(ShopLoginInfo shop, string img_url, DataGridViewCell cell = null, bool randomBlock = false) { string getImgError; var image = GetHtml.GetUrlImg(img_url.Replace("https://", "http://"), out getImgError); @@ -1934,6 +1944,9 @@ namespace TemuKJD.WXForms.ProductForms using (Graphics g = Graphics.FromImage(imageBg)) { g.DrawImage(image, new Rectangle(0, 0, imageBg.Width, imageBg.Height), 0, 0, image.Width, image.Height, GraphicsUnit.Pixel); + if (randomBlock) + g.FillRectangle(new SolidBrush(Color.FromArgb(Randomx.GetId(256), Randomx.GetId(256), Randomx.GetId(256))), + new Rectangle(Randomx.GetId(imageBg.Width - 30), Randomx.GetId(imageBg.Height - 30), 30, 30)); } } catch (Exception ex) diff --git a/TEMUKJD/WXForms/ShopForms/WXShopListForm.cs b/TEMUKJD/WXForms/ShopForms/WXShopListForm.cs index 143588a..a98eb02 100644 --- a/TEMUKJD/WXForms/ShopForms/WXShopListForm.cs +++ b/TEMUKJD/WXForms/ShopForms/WXShopListForm.cs @@ -590,11 +590,11 @@ namespace TemuKJD.WXForms.ShopForms var loginResult = CheckShopLogin(shop); if (!loginResult.Contains("\"code\":0")) { - shop.Cookies = "empty=true;"; + shop.Cookies = "[]"; foreach (var sc in campanys) { sc.LoginStatus = "未登录"; - shop.Cookies = "empty=true;"; + shop.Cookies = "[]"; } } else diff --git a/TEMUKJD/WXForms/TalkForms/WxTalkForm.Designer.cs b/TEMUKJD/WXForms/TalkForms/WxTalkForm.Designer.cs index 3d4cb0c..533731f 100644 --- a/TEMUKJD/WXForms/TalkForms/WxTalkForm.Designer.cs +++ b/TEMUKJD/WXForms/TalkForms/WxTalkForm.Designer.cs @@ -46,14 +46,6 @@ namespace TemuKJD.WXForms.TalkForms this.chkIsAutoReply = new System.Windows.Forms.CheckBox(); this.splitContainer4 = new System.Windows.Forms.SplitContainer(); this.dgvShop = new TemuKJD.UserComponent.DataGridViewEx(); - this.colSelect = new TemuKJD.UserComponent.UcDataGridViewCheckBoxColumn(this.components); - this.colShopLoginName = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.colShopId = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.colShopName = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.colShopNotes = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.colLoginStatus = new System.Windows.Forms.DataGridViewLinkColumn(); - this.colCanUse = new System.Windows.Forms.DataGridViewCheckBoxColumn(); - this.colMessage = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.pnlRefresh = new DevComponents.DotNetBar.PanelEx(); this.ucTabControl1 = new TemuKJD.UserComponent.UcTabControl(); this.tabPage1 = new System.Windows.Forms.TabPage(); @@ -69,6 +61,14 @@ namespace TemuKJD.WXForms.TalkForms this.dataGridViewTextBoxColumn3 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.dataGridViewTextBoxColumn4 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.dataGridViewLinkColumn2 = new System.Windows.Forms.DataGridViewLinkColumn(); + this.colSelect = new TemuKJD.UserComponent.UcDataGridViewCheckBoxColumn(this.components); + this.colShopLoginName = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.colShopId = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.colShopName = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.colShopNotes = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.colLoginStatus = new System.Windows.Forms.DataGridViewLinkColumn(); + this.colCanUse = new System.Windows.Forms.DataGridViewCheckBoxColumn(); + this.colMessage = new System.Windows.Forms.DataGridViewTextBoxColumn(); ((System.ComponentModel.ISupportInitialize)(this.pbLogo)).BeginInit(); this.panel3.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); @@ -96,7 +96,7 @@ namespace TemuKJD.WXForms.TalkForms // lblVersionName // this.lblVersionName.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.lblVersionName.Location = new System.Drawing.Point(1791, 33); + this.lblVersionName.Location = new System.Drawing.Point(3927, 33); // // panel3 // @@ -325,72 +325,8 @@ namespace TemuKJD.WXForms.TalkForms this.dgvShop.RowTemplate.Height = 23; this.dgvShop.Size = new System.Drawing.Size(266, 555); this.dgvShop.TabIndex = 7; - // - // colSelect - // - this.colSelect.HeaderText = "全选"; - this.colSelect.Name = "colSelect"; - this.colSelect.ReadOnly = true; - this.colSelect.Resizable = System.Windows.Forms.DataGridViewTriState.True; - this.colSelect.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; - this.colSelect.Width = 28; - // - // colShopLoginName - // - this.colShopLoginName.HeaderText = "店铺登录名"; - this.colShopLoginName.Name = "colShopLoginName"; - this.colShopLoginName.ReadOnly = true; - this.colShopLoginName.Visible = false; - // - // colShopId - // - this.colShopId.HeaderText = "店铺Id"; - this.colShopId.Name = "colShopId"; - this.colShopId.ReadOnly = true; - this.colShopId.Visible = false; - this.colShopId.Width = 55; - // - // colShopName - // - this.colShopName.FillWeight = 150F; - this.colShopName.HeaderText = "店铺名称"; - this.colShopName.Name = "colShopName"; - this.colShopName.ReadOnly = true; - this.colShopName.Resizable = System.Windows.Forms.DataGridViewTriState.True; - this.colShopName.Width = 70; - // - // colShopNotes - // - this.colShopNotes.HeaderText = "分组"; - this.colShopNotes.Name = "colShopNotes"; - this.colShopNotes.ReadOnly = true; - this.colShopNotes.Width = 70; - // - // colLoginStatus - // - this.colLoginStatus.HeaderText = "状态"; - this.colLoginStatus.Name = "colLoginStatus"; - this.colLoginStatus.ReadOnly = true; - this.colLoginStatus.Resizable = System.Windows.Forms.DataGridViewTriState.True; - this.colLoginStatus.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; - this.colLoginStatus.Width = 38; - // - // colCanUse - // - this.colCanUse.HeaderText = "可用"; - this.colCanUse.Name = "colCanUse"; - this.colCanUse.ReadOnly = true; - this.colCanUse.Resizable = System.Windows.Forms.DataGridViewTriState.True; - this.colCanUse.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; - this.colCanUse.Visible = false; - this.colCanUse.Width = 28; - // - // colMessage - // - this.colMessage.HeaderText = "消息"; - this.colMessage.Name = "colMessage"; - this.colMessage.ReadOnly = true; - this.colMessage.Width = 120; + this.dgvShop.CellClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgvShop_CellClick); + this.dgvShop.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgvShop_CellContentClick); // // pnlRefresh // @@ -542,6 +478,72 @@ namespace TemuKJD.WXForms.TalkForms this.dataGridViewLinkColumn2.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; this.dataGridViewLinkColumn2.Width = 106; // + // colSelect + // + this.colSelect.HeaderText = "选"; + this.colSelect.Name = "colSelect"; + this.colSelect.ReadOnly = true; + this.colSelect.Resizable = System.Windows.Forms.DataGridViewTriState.True; + this.colSelect.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; + this.colSelect.Width = 28; + // + // colShopLoginName + // + this.colShopLoginName.HeaderText = "店铺登录名"; + this.colShopLoginName.Name = "colShopLoginName"; + this.colShopLoginName.ReadOnly = true; + this.colShopLoginName.Visible = false; + // + // colShopId + // + this.colShopId.HeaderText = "店铺Id"; + this.colShopId.Name = "colShopId"; + this.colShopId.ReadOnly = true; + this.colShopId.Visible = false; + this.colShopId.Width = 55; + // + // colShopName + // + this.colShopName.FillWeight = 150F; + this.colShopName.HeaderText = "店铺名称"; + this.colShopName.Name = "colShopName"; + this.colShopName.ReadOnly = true; + this.colShopName.Resizable = System.Windows.Forms.DataGridViewTriState.True; + this.colShopName.Width = 70; + // + // colShopNotes + // + this.colShopNotes.HeaderText = "分组"; + this.colShopNotes.Name = "colShopNotes"; + this.colShopNotes.ReadOnly = true; + this.colShopNotes.Width = 70; + // + // colLoginStatus + // + this.colLoginStatus.HeaderText = "状态"; + this.colLoginStatus.Name = "colLoginStatus"; + this.colLoginStatus.ReadOnly = true; + this.colLoginStatus.Resizable = System.Windows.Forms.DataGridViewTriState.True; + this.colLoginStatus.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; + this.colLoginStatus.Width = 38; + // + // colCanUse + // + this.colCanUse.HeaderText = "可用"; + this.colCanUse.Name = "colCanUse"; + this.colCanUse.ReadOnly = true; + this.colCanUse.Resizable = System.Windows.Forms.DataGridViewTriState.True; + this.colCanUse.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; + this.colCanUse.Visible = false; + this.colCanUse.Width = 28; + // + // colMessage + // + this.colMessage.HeaderText = "消息"; + this.colMessage.Name = "colMessage"; + this.colMessage.ReadOnly = true; + this.colMessage.Width = 120; + // // WxTalkForm // this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; @@ -550,8 +552,9 @@ namespace TemuKJD.WXForms.TalkForms this.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.Name = "WxTalkForm"; - this.Text = "微信客服"; - this.TitleText = "微信客服"; + this.ShowMaximizeBox = true; + this.Text = "`"; + this.TitleText = "`"; this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.WxTalkForm_FormClosed); this.Load += new System.EventHandler(this.WxTalkForm_Load); this.Controls.SetChildIndex(this.panel3, 0); @@ -603,6 +606,11 @@ namespace TemuKJD.WXForms.TalkForms private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn4; private System.Windows.Forms.DataGridViewLinkColumn dataGridViewLinkColumn2; private UserComponent.DataGridViewEx dgvShop; + private UserComponent.UcTabControl ucTabControl1; + private System.Windows.Forms.TabPage tabPage1; + private System.Windows.Forms.Panel pnlTalk; + private System.Windows.Forms.TabPage tabPage2; + private System.Windows.Forms.Panel mainPanel; private UserComponent.UcDataGridViewCheckBoxColumn colSelect; private System.Windows.Forms.DataGridViewTextBoxColumn colShopLoginName; private System.Windows.Forms.DataGridViewTextBoxColumn colShopId; @@ -611,10 +619,5 @@ namespace TemuKJD.WXForms.TalkForms private System.Windows.Forms.DataGridViewLinkColumn colLoginStatus; private System.Windows.Forms.DataGridViewCheckBoxColumn colCanUse; private System.Windows.Forms.DataGridViewTextBoxColumn colMessage; - private UserComponent.UcTabControl ucTabControl1; - private System.Windows.Forms.TabPage tabPage1; - private System.Windows.Forms.Panel pnlTalk; - private System.Windows.Forms.TabPage tabPage2; - private System.Windows.Forms.Panel mainPanel; } } \ No newline at end of file diff --git a/TEMUKJD/WXForms/TalkForms/WxTalkForm.cs b/TEMUKJD/WXForms/TalkForms/WxTalkForm.cs index c7305aa..038ae10 100644 --- a/TEMUKJD/WXForms/TalkForms/WxTalkForm.cs +++ b/TEMUKJD/WXForms/TalkForms/WxTalkForm.cs @@ -22,6 +22,7 @@ using System.Windows.Forms; using TemuKJD.BaseForms; using TemuKJD.Helper; using TemuKJD.ToolForms; +using TemuKJD.WXForms.ShopForms; using TemuKJD.WXForms.TalkForms.TalkHelper; namespace TemuKJD.WXForms.TalkForms @@ -187,9 +188,14 @@ namespace TemuKJD.WXForms.TalkForms { var cookieManager = shop.Chat.RequestContext.GetCookieManager(null); - var cookieLst = JsonHelper.DeserializeJsonToList(shop.Cookies.ParseToString()); - if (cookieLst == null) - cookieLst = new List(); + var cookieLst = new List(); + try + { + cookieLst = JsonHelper.DeserializeJsonToList(shop.Cookies.ParseToString().Replace("empty=true;", "[]")); + } + catch + { + } cookieManager.DeleteCookies("qq.com", null); foreach (var cook in cookieLst) @@ -224,7 +230,11 @@ namespace TemuKJD.WXForms.TalkForms { int iGrid = 0; if (r == null) + { iGrid = dgvShop.Rows.Add(); + if (iGrid == 0) + dgvShop.Rows[iGrid].Cells["colSelect"].Value = true; + } else iGrid = r.Index; @@ -247,7 +257,12 @@ namespace TemuKJD.WXForms.TalkForms //new ChromiumWebBrowser("https://store.weixin.qq.com/shop/kf); CustomResourceRequestHandler resourceRequestHandler = new CustomResourceRequestHandler(); - resourceRequestHandler.ResourceLoadCompleteEvent += RequestHandler_ResourceLoadComplete; + Task.Run(() => + { + var handler = resourceRequestHandler; + Thread.Sleep(3000); + handler.ResourceLoadCompleteEvent += RequestHandler_ResourceLoadComplete; + }); cefWebBrowser.RequestHandler = new CustomRequestHandler(resourceRequestHandler); cefWebBrowser.KeyboardHandler = new KeyboardHandler(); @@ -282,13 +297,131 @@ namespace TemuKJD.WXForms.TalkForms private void RequestHandler_ResourceLoadComplete(object sender, string url, string postData, string responseData) { if (responseData.Contains("你好")) + { + } + if (url.Contains("action=get_nosession_summary") || url.Contains("action=get_open_session_summary") || url.Contains("action=get_session_summary") || url.Contains("action=get_sync_msg")) { Task.Run(() => { + getResourceLoadMsg(sender as ChromiumWebBrowser, url, postData, responseData); }); } } + private void getResourceLoadMsg(ChromiumWebBrowser cef, string url, string postData, string responseData) + { + if (cef == null) + return; + + var shop = GlobalConfig.ShopLoginList.FirstOrDefault(s => s.Chat == cef); + if (shop == null) + return; + + Task.Run(() => + { + var row = dgvShop.Rows.Cast().FirstOrDefault(r => r.Cells["colShopId"].Value.ParseToString() == shop.ShopId); + if (row == null) + return; + + if (url.Contains("action=get_nosession_summary")) + { + //{"base_resp":{"err_msg":"ok","ret":0},"list":[{"session_status":1,"summary":{"accept_by_robot":2,"accept_by_robot_time":"0","complaint_info":{"complaint_expire_time":0,"complaint_id":"0"},"extra_info":"{\"head_img\":\"http:\\/\\/wx.qlogo.cn\\/mmhead\\/Q3auHgzwzM6vehibAAib9ia4ejxH7ibula7RuH4rTO7H7equgOZPVZl5Ew\\/64\",\"nickname\":\"Vader\",\"list\":[],\"qa_info_list\":[]}","id":"1","is_delete":0,"lastest_msg_content":"","lastest_msg_id":"4348928114244206592","lastest_msg_kf_content":"{\"content\":\"你好\"}","lastest_user_msg_time":"1768807915","msg_type":1,"recv_open_account":"wxf4460bce24e5d58d","recv_openid":"","room_id":"4348927951587721218","scene":6,"send_open_account":"","send_openid":"o9cq802Ue5pCVRmzuzkFUcnoHjcM","send_scene":6,"unread_msg_num":"1","unreplied_msg_time":"1768807915","update_time":"1768807915"}}],"num":1} + //{"base_resp":{"err_msg":"ok","ret":0},"list":[],"num":0} + var jObj = JsonHelper.JObjectParse(responseData); + //{"base_resp":{"err_msg":"ok","ret":0},"list":[{"session_status":1,"summary":{"accept_by_robot":2,"accept_by_robot_time":"0","complaint_info":{"complaint_expire_time":0,"complaint_id":"0"},"extra_info":"{\"head_img\":\"http:\\/\\/wx.qlogo.cn\\/mmhead\\/PiajxSqBRaEIuS5Aa65qsCwzKFpmSiciazvMbicxfEyHvTmD8MpQibR85wg\\/64\",\"nickname\":\"jtt\",\"list\":[],\"qa_info_list\":[]}","id":"160","is_delete":0,"lastest_msg_content":"","lastest_msg_id":"4349035115016224786","lastest_msg_kf_content":"{\"type\":13,\"content\":\"{\\\"finder_live_id\\\":\\\"\\\",\\\"finder_username\\\":\\\"\\\",\\\"finder_object_id\\\":\\\"\\\",\\\"finder_nonce_id\\\":\\\"\\\",\\\"app_id\\\":\\\"wxca8d4b8e8feedc2a\\\",\\\"page_path\\\":\\\"main/pages/productDetail/productDetail.html?productId=10000405003763&realappid=wx2664a142d76831dd&cacheKey=3d585c9672aa92a088812cf9f8b30e0a&cacheType=backup&businessId=1&requestId=4349035091393462273&subScene=1208\\\",\\\"product_id\\\":\\\"10000405003763\\\",\\\"cover_url\\\":\\\"https://wst.wxapp.tc.qq.com/161/20304/snscosdownload/SH/reserved/695a36c7000ab9b70c029451f0d71715000000a100004f50?imageView2/1/w/400/h/400/q/50\\\",\\\"product_title\\\":\\\"运动套装女春秋2024新款时尚小熊卫衣连帽宽松跑步服休闲两件套潮\\\",\\\"market_price\\\":\\\"39530\\\",\\\"selling_price\\\":\\\"38730\\\",\\\"platform_head_img\\\":\\\"http://mmbiz.qpic.cn/mmbiz_jpg/cpXibyAIsexe8vObd8jWMktZk6sg1kKJgicdnzFiaxR1XvU0Kchlfdewsu7JETDF3lLp5cyULNNee94UPGeU1r9Rw/0?wx_fmt=jpeg/0\\\",\\\"platform_name\\\":\\\"夜笙供应链\\\",\\\"shop_window_id\\\":\\\"\\\",\\\"live_status\\\":\\\"\\\",\\\"flash_sale_price\\\":0,\\\"flash_sale_end_time\\\":0,\\\"ec_source\\\":\\\"\\\",\\\"selling_price_wording\\\":\\\"\\\",\\\"ext_conv\\\":{\\\"ext_conv_type\\\":1,\\\"ec_product_url\\\":\\\"https://channels.weixin.qq.com/shop?login_appid=wx2664a142d76831dd&redirect_url=%2Fgoods%2Fentry%3FproductId%3D10000405003763\\\",\\\"context\\\":\\\"\\\"}}\"}","lastest_user_msg_time":"1768814292","msg_type":11,"recv_open_account":"wx2664a142d76831dd","recv_openid":"","room_id":"4349034984388345858","scene":6,"send_open_account":"","send_openid":"o9cq800-I4XeS-NiBgsIae1y38Ac","send_scene":6,"unread_msg_num":"1","unreplied_msg_time":"1768814293","update_time":"1768814292"}}],"num":1} + //if (jObj["num"].ParseToInt() <= 0) + // return; + return; + } + if (url.Contains("action=get_open_session_summary")) + { + //{"base_resp":{"err_msg":"ok","ret":0},"pin_summary_list":[],"summary_cursor":"4349020771451830279","summary_list":[{"complaint_info":{"complaint_expire_time":0,"complaint_id":"","complaint_status":0},"ext_info":{},"extra_info":"{\"head_img\":\"http:\\/\\/wx.qlogo.cn\\/mmhead\\/PiajxSqBRaEIuS5Aa65qsCwzKFpmSiciazvMbicxfEyHvTmD8MpQibR85wg\\/64\",\"nickname\":\"jtt\",\"list\":[],\"qa_info_list\":[]}","id":"5","is_delete":0,"is_expired":0,"is_pin":0,"is_pin_update_time":"0","kf_openid":"o9cq801T0m1dIivQzMyUwBvW5Znk","kf_reply_status":0,"lastest_msg_content":"","lastest_msg_id":"4349029975415865363","lastest_msg_kf_content":"{\"content\":\"你好\"}","lastest_user_msg_time":"1768813986","msg_type":1,"recv_open_account":"wxad4163db54e87b44","recv_openid":"o9cq801T0m1dIivQzMyUwBvW5Znk","room_id":"4348999364009132044","room_session_status":0,"scene":6,"send_open_account":"","send_openid":"o9cq800-I4XeS-NiBgsIae1y38Ac","send_scene":6,"session_close_source":0,"star_label":0,"star_label_update_time":"0","sync_id":"78","unread_msg_num":"1","unreplied_msg_time":"1768813988","update_time":"1768813986","user_openid":"o9cq800-I4XeS-NiBgsIae1y38Ac"}]} + //{"base_resp":{"err_msg":"ok","ret":0},"pin_summary_list":[],"summary_cursor":"4349035365970083850","summary_list":[{"complaint_info":{"complaint_expire_time":0,"complaint_id":"","complaint_status":0},"ext_info":{},"extra_info":"{\"head_img\":\"http:\\/\\/wx.qlogo.cn\\/mmhead\\/PiajxSqBRaEIuS5Aa65qsCwzKFpmSiciazvMbicxfEyHvTmD8MpQibR85wg\\/64\",\"nickname\":\"jtt\",\"list\":[],\"qa_info_list\":[]}","id":"160","is_delete":0,"is_expired":0,"is_pin":0,"is_pin_update_time":"0","kf_openid":"o9cq801T0m1dIivQzMyUwBvW5Znk","kf_reply_status":1,"lastest_msg_content":"","lastest_msg_id":"4349035365970083850","lastest_msg_kf_content":"{\"content\":\"在的亲\"}","lastest_user_msg_time":"1768814292","msg_type":1,"recv_open_account":"wx2664a142d76831dd","recv_openid":"o9cq801T0m1dIivQzMyUwBvW5Znk","room_id":"4349034984388345858","room_session_status":0,"scene":6,"send_open_account":"wx2664a142d76831dd","send_openid":"o9cq801T0m1dIivQzMyUwBvW5Znk","send_scene":6,"session_close_source":0,"star_label":0,"star_label_update_time":"0","sync_id":"3186","unread_msg_num":"0","unreplied_msg_time":"0","update_time":"1768814308","user_openid":"o9cq800-I4XeS-NiBgsIae1y38Ac"},{"complaint_info":{"complaint_expire_time":0,"complaint_id":"","complaint_status":0},"ext_info":{},"extra_info":"{\"head_img\":\"http:\\/\\/wx.qlogo.cn\\/mmhead\\/sstLNDibp2U6zXibjfoE1tUiaHCOKX1olnJNZnFGehlibg4liacAAWmj2VQ\\/64\",\"nickname\":\"我是上帝的女儿李善容\",\"list\":[],\"qa_info_list\":[]}","id":"154","is_delete":0,"is_expired":0,"is_pin":0,"is_pin_update_time":"0","kf_openid":"o9cq801T0m1dIivQzMyUwBvW5Znk","kf_reply_status":0,"lastest_msg_content":"","lastest_msg_id":"4347360170765271042","lastest_msg_kf_content":"{\"type\":\"SessionTimeoutRedDot\",\"content\":\"你已超过10分钟未回复该会话,请及时处理。\",\"room_id\":\"4339855644638920709\",\"msg_id\":\"4347350053416747021\",\"is_anonymous_msg\":0,\"need_update_summary\":1}","lastest_user_msg_time":"1768713854","msg_type":24,"recv_open_account":"wx2664a142d76831dd","recv_openid":"o9cq801T0m1dIivQzMyUwBvW5Znk","room_id":"4339855644638920709","room_session_status":0,"scene":6,"send_open_account":"","send_openid":"o9cq802n8yQWq6bwbx2w8rp_aygk","send_scene":6,"session_close_source":0,"star_label":0,"star_label_update_time":"0","sync_id":"3042","unread_msg_num":"0","unreplied_msg_time":"1768713857","update_time":"1768714458","user_openid":"o9cq802n8yQWq6bwbx2w8rp_aygk"},{"complaint_info":{"complaint_expire_time":0,"complaint_id":"","complaint_status":0},"ext_info":{},"extra_info":"{\"head_img\":\"http:\\/\\/wx.qlogo.cn\\/mmhead\\/IbQhd2Y9oKdcIf3tbP1pciaic0icL271V7iaqWQqGvrrrMbq26tSHnFf9Q\\/64\",\"nickname\":\"素色🍃᭄年华\",\"list\":[],\"qa_info_list\":[]}","id":"155","is_delete":0,"is_expired":0,"is_pin":0,"is_pin_update_time":"0","kf_openid":"o9cq801T0m1dIivQzMyUwBvW5Znk","kf_reply_status":1,"lastest_msg_content":"","lastest_msg_id":"4347305586245287937","lastest_msg_kf_content":"{\"type\":\"SessionTimeoutRedDot\",\"content\":\"你已超过10分钟未回复该会话,请及时处理。\",\"room_id\":\"4340576309047115777\",\"msg_id\":\"4347295489464516617\",\"is_anonymous_msg\":0,\"need_update_summary\":1}","lastest_user_msg_time":"1768710602","msg_type":24,"recv_open_account":"wx2664a142d76831dd","recv_openid":"o9cq801T0m1dIivQzMyUwBvW5Znk","room_id":"4340576309047115777","room_session_status":0,"scene":6,"send_open_account":"","send_openid":"o9cq80-t4oDOfQD6J6oJ8pp4yA7M","send_scene":6,"session_close_source":0,"star_label":0,"star_label_update_time":"0","sync_id":"3035","unread_msg_num":"0","unreplied_msg_time":"1768710604","update_time":"1768711205","user_openid":"o9cq80-t4oDOfQD6J6oJ8pp4yA7M"}]} + var jObj = JsonHelper.JObjectParse(responseData); + return; + } + else if (url.Contains("action=get_session_summary")) + { + //{"base_resp":{"err_msg":"ok","ret":0},"pin_summary_list":[],"summary_cursor":"4349042918267191303","summary_list":[{"complaint_info":{"complaint_expire_time":0,"complaint_id":"","complaint_status":0},"ext_info":{},"extra_info":"{\"head_img\":\"http:\\/\\/wx.qlogo.cn\\/mmhead\\/PiajxSqBRaEIuS5Aa65qsCwzKFpmSiciazvMbicxfEyHvTmD8MpQibR85wg\\/64\",\"nickname\":\"jtt\",\"list\":[],\"qa_info_list\":[]}","id":"5","is_delete":0,"is_expired":0,"is_pin":0,"is_pin_update_time":"0","kf_openid":"o9cq801T0m1dIivQzMyUwBvW5Znk","kf_reply_status":1,"lastest_msg_content":"","lastest_msg_id":"4349042918267191303","lastest_msg_kf_content":"{\"content\":\"您好亲,有什么需要帮助的吗\"}","lastest_user_msg_time":"1768814710","msg_type":1,"recv_open_account":"wxad4163db54e87b44","recv_openid":"o9cq801T0m1dIivQzMyUwBvW5Znk","room_id":"4348999364009132044","room_session_status":0,"scene":6,"send_open_account":"wxad4163db54e87b44","send_openid":"o9cq801T0m1dIivQzMyUwBvW5Znk","send_scene":6,"session_close_source":0,"star_label":0,"star_label_update_time":"0","sync_id":"87","unread_msg_num":"0","unreplied_msg_time":"0","update_time":"1768814758","user_openid":"o9cq800-I4XeS-NiBgsIae1y38Ac"},{"complaint_info":{"complaint_expire_time":0,"complaint_id":"","complaint_status":0},"ext_info":{},"extra_info":"{\"head_img\":\"http:\\/\\/wx.qlogo.cn\\/mmhead\\/Q3auHgzwzM6vehibAAib9ia4ejxH7ibula7RuH4rTO7H7equgOZPVZl5Ew\\/64\",\"nickname\":\"Vader\",\"list\":[],\"qa_info_list\":[]}","id":"2","is_delete":0,"is_expired":1,"is_pin":0,"is_pin_update_time":"0","kf_reply_status":1,"lastest_msg_content":"","lastest_msg_id":"4348993861855264779","lastest_msg_kf_content":"{\"type\":\"EndRoom\",\"content\":\"用户超时未回,会话已结束,两天内仍可再次联系\",\"room_id\":\"4348684483414425612\",\"msg_id\":\"4348993861855264779\",\"is_anonymous_msg\":0,\"need_update_summary\":1}","lastest_user_msg_time":"1768811222","msg_type":5,"recv_open_account":"wxad4163db54e87b44","recv_openid":"o9cq801T0m1dIivQzMyUwBvW5Znk","room_id":"4348684483414425612","scene":6,"send_open_account":"","send_openid":"o9cq802Ue5pCVRmzuzkFUcnoHjcM","send_scene":6,"star_label":0,"star_label_update_time":"0","sync_id":"59","unread_msg_num":"0","unreplied_msg_time":"0","update_time":"1768811834","user_openid":"o9cq802Ue5pCVRmzuzkFUcnoHjcM"},{"complaint_info":{"complaint_expire_time":0,"complaint_id":"","complaint_status":0},"ext_info":{},"extra_info":"{\"head_img\":\"http:\\/\\/wx.qlogo.cn\\/mmhead\\/Q3auHgzwzM61GOTjShX4GX3aSpuNiavic5xxAickB0fxH1Bic8Az5d0LCA\\/64\",\"nickname\":\"春暖花开\",\"list\":[],\"qa_info_list\":[]}","id":"4","is_delete":0,"is_expired":1,"is_pin":0,"is_pin_update_time":"0","kf_reply_status":1,"lastest_msg_content":"","lastest_msg_id":"4348932333527973902","lastest_msg_kf_content":"{\"type\":\"EndRoom\",\"content\":\"用户超时未回,会话已结束,两天内仍可再次联系\",\"room_id\":\"4348906544732405760\",\"msg_id\":\"4348932333527973902\",\"is_anonymous_msg\":0,\"need_update_summary\":1}","lastest_user_msg_time":"1768807466","msg_type":5,"recv_open_account":"wxad4163db54e87b44","recv_openid":"o9cq801T0m1dIivQzMyUwBvW5Znk","room_id":"4348906544732405760","scene":6,"send_open_account":"","send_openid":"o9cq807-mRKhlh-MPBpeYyar46HA","send_scene":6,"star_label":0,"star_label_update_time":"0","sync_id":"44","unread_msg_num":"0","unreplied_msg_time":"0","update_time":"1768808166","user_openid":"o9cq807-mRKhlh-MPBpeYyar46HA"},{"complaint_info":{"complaint_expire_time":0,"complaint_id":"","complaint_status":0},"ext_info":{},"extra_info":"{\"head_img\":\"http:\\/\\/wx.qlogo.cn\\/mmhead\\/PdibpV1sFDHeGJDbIwia4cv3UUPxnHqjFQ4piaSFEeJlViaeDPicHuQITkw\\/64\",\"nickname\":\"春雨\",\"list\":[],\"qa_info_list\":[]}","id":"3","is_delete":0,"is_expired":1,"is_pin":0,"is_pin_update_time":"0","kf_reply_status":1,"lastest_msg_content":"","lastest_msg_id":"4348888492147638275","lastest_msg_kf_content":"{\"type\":\"EndRoom\",\"content\":\"用户超时未回,会话已结束,两天内仍可再次联系\",\"room_id\":\"4348715191491690506\",\"msg_id\":\"4348888492147638275\",\"is_anonymous_msg\":0,\"need_update_summary\":1}","lastest_user_msg_time":"1768795504","msg_type":5,"recv_open_account":"wxad4163db54e87b44","recv_openid":"o9cq801T0m1dIivQzMyUwBvW5Znk","room_id":"4348715191491690506","scene":6,"send_open_account":"","send_openid":"o9cq805nSmIjHqNthn9QbNimVAsE","send_scene":6,"star_label":0,"star_label_update_time":"0","sync_id":"29","unread_msg_num":"0","unreplied_msg_time":"0","update_time":"1768805553","user_openid":"o9cq805nSmIjHqNthn9QbNimVAsE"},{"complaint_info":{"complaint_expire_time":0,"complaint_id":"","complaint_status":0},"ext_info":{},"extra_info":"{\"head_img\":\"http:\\/\\/wx.qlogo.cn\\/mmhead\\/PiajxSqBRaEJLajvZG4pYqhDrljibs7sNChSx6Cib2mN6KicJgbRESR8Rg\\/64\",\"nickname\":\"喂累了额\",\"list\":[],\"qa_info_list\":[]}","id":"1","is_delete":0,"is_expired":1,"is_pin":0,"is_pin_update_time":"0","kf_reply_status":1,"lastest_msg_content":"","lastest_msg_id":"4348884857446612993","lastest_msg_kf_content":"{\"type\":\"EndRoom\",\"content\":\"用户超时未回,会话已结束,两天内仍可再次联系\",\"room_id\":\"4347660512343588869\",\"msg_id\":\"4348884857446612993\",\"is_anonymous_msg\":0,\"need_update_summary\":1}","lastest_user_msg_time":"1768732601","msg_type":5,"recv_open_account":"wxad4163db54e87b44","recv_openid":"o9cq801T0m1dIivQzMyUwBvW5Znk","room_id":"4347660512343588869","scene":6,"send_open_account":"","send_openid":"o9cq8038HnVM43HL44F5yGx6S6P0","send_scene":6,"star_label":0,"star_label_update_time":"0","sync_id":"27","unread_msg_num":"0","unreplied_msg_time":"0","update_time":"1768805337","user_openid":"o9cq8038HnVM43HL44F5yGx6S6P0"}]} + var jObj = JsonHelper.JObjectParse(responseData); + return; + } + else if (url.Contains("action=get_sync_msg")) + { + //{"finder_live_id":"","finder_username":"","finder_object_id":"","finder_nonce_id":"","app_id":"wxca8d4b8e8feedc2a","page_path":"main/pages/productDetail/productDetail.html?productId=10000444468035&realappid=wx2664a142d76831dd&cacheKey=4f69a37c98838eb27e484b6def86d0ca&cacheType=backup&businessId=1&requestId=4348991209208823817&subScene=1208","product_id":"10000444468035","cover_url":"https://wst.wxapp.tc.qq.com/161/20304/snscosdownload/SH/reserved/69677007000d0f3329fc594d77ef1b15000000a000004f50?imageView2/1/w/400/h/400/q/50","product_title":"保暖加绒中老年妈妈装棉服","market_price":"6980","selling_price":"6180","platform_head_img":"http://mmbiz.qpic.cn/mmbiz_jpg/cpXibyAIsexe8vObd8jWMktZk6sg1kKJgicdnzFiaxR1XvU0Kchlfdewsu7JETDF3lLp5cyULNNee94UPGeU1r9Rw/0?wx_fmt=jpeg/0","platform_name":"夜笙供应链","shop_window_id":"","live_status":"","flash_sale_price":0,"flash_sale_end_time":0,"ec_source":"","selling_price_wording":"","ext_conv":{"ext_conv_type":1,"ec_product_url":"https://channels.weixin.qq.com/shop?login_appid=wx2664a142d76831dd&redirect_url=%2Fgoods%2Fentry%3FproductId%3D10000444468035","context":""}} + try + { + if (responseData.Contains("更新房间游标")) + return; + + var jObj = JsonHelper.JObjectParse(responseData); + if (jObj["total_num"].ParseToInt() <= 0) + return; + // 自己发的消息或者客服自动回复消息不闪烁提示 ------------------------------------------------------------------------------------------------------- + // 您好!人工客服目前无法及时回复,您可以留言详细问题,我们会尽快为您服务! + //"send_open_account": "wxad4163db54e87b44", + var send_open_account = jObj["list"].LastOrDefault()?["send_open_account"].ParseToString(); + if (send_open_account == shop.ShopId) + return; + var msg_kf_content = jObj["list"].LastOrDefault()?["msg_kf_content"].ParseToString(); + var contentObj = JsonHelper.JObjectParse(msg_kf_content); + var content = contentObj["content"].ParseToString(); + if (content.Contains("更新房间游标")) + return; + + // 处理 msg_type=5 的情况 (应该是系统提示消息,有些提示比如关闭会话的无需闪烁) ------------------------------------------------------ + // 以下 "msg_type":5 + // 你已超过90秒未回复该会话,请及时处理。 + // 你已超过3分钟未回复该会话,请及时处理。 + // 你已超过10分钟未回复该会话,请及时处理。 + // 超过48小时未回复用户,会话已结束 + // {"base_resp":{"err_msg":"ok","ret":0},"kf_openid":"o9cq801T0m1dIivQzMyUwBvW5Znk","list":[{"accept_by_robot":0,"async_check_spam_stage":0,"client_ms":"1768806150100","create_time":"1768806150","create_time_ms":"1768806150100","encrypt_msg_kf_content":"","extra_info":"{\"head_img\":\"http:\\/\\/wx.qlogo.cn\\/mmhead\\/Q3auHgzwzM6vehibAAib9ia4ejxH7ibula7RuH4rTO7H7equgOZPVZl5Ew\\/64\",\"nickname\":\"Vader\",\"list\":[],\"qa_info_list\":[]}","id":"31","imunion_msg_id":"mmec-commkf-v2-4348898496719831040","insert_create_time_ms":"1768806150148","is_anonymous_msg":0,"is_delete":0,"is_expired":0,"is_fail":0,"is_hit_spam":0,"is_revoked":0,"is_sys_msg":1,"msg_direction":3,"msg_id":"4348898496719831040","msg_kf_content":"{\"type\":\"EndRoom\",\"content\":\"用户超时未回,会话已结束,两天内仍可再次联系\",\"room_id\":\"4348684483414425612\",\"msg_id\":\"4348898496719831040\",\"is_anonymous_msg\":0,\"need_update_summary\":1}","msg_type":5,"properties":"0","recv_open_account":"wxad4163db54e87b44","recv_openid":"o9cq801T0m1dIivQzMyUwBvW5Znk","reply_type":0,"room_id":"4348684483414425612","room_useruin":"0","scene":6,"send_open_account":"","send_openid":"o9cq802Ue5pCVRmzuzkFUcnoHjcM","send_scene":6,"session_id":"0","update_time":"1768806150"}],"total_num":1} + if (content.Contains("用户超时未回,会话已结束,两天内仍可再次联系")) + return; + // {"base_resp":{"err_msg":"ok","ret":0},"kf_openid":"o9cq801T0m1dIivQzMyUwBvW5Znk","list":[{"accept_by_robot":0,"async_check_spam_stage":0,"client_ms":"1768808777632","create_time":"1768808777","create_time_ms":"1768808777632","encrypt_msg_kf_content":"","extra_info":"{\"head_img\":\"http:\\/\\/wx.qlogo.cn\\/mmhead\\/Q3auHgzwzM6vehibAAib9ia4ejxH7ibula7RuH4rTO7H7equgOZPVZl5Ew\\/64\",\"nickname\":\"Vader\",\"list\":[],\"qa_info_list\":[]}","id":"46","imunion_msg_id":"mmec-commkf-v2-4348942579357122569","insert_create_time_ms":"1768808777711","is_anonymous_msg":1,"is_delete":0,"is_expired":0,"is_fail":0,"is_hit_spam":0,"is_revoked":0,"is_sys_msg":1,"msg_direction":3,"msg_id":"4348942579357122569","msg_kf_content":"{\"type\":\"AcceptRoom\",\"content\":\"用户已接入\",\"room_id\":\"4348684483414425612\",\"msg_id\":\"4348942569912549377\",\"is_anonymous_msg\":1,\"need_update_summary\":0,\"summary_content\":\"{\\\"id\\\":\\\"2\\\",\\\"room_id\\\":\\\"4348684483414425612\\\",\\\"scene\\\":6,\\\"account\\\":\\\"3641079964\\\",\\\"send_scene\\\":6,\\\"send_account\\\":\\\"user_acct_2044334303_6\\\",\\\"send_uin\\\":2044334303,\\\"lastest_msg_id\\\":\\\"4348942543756476432\\\",\\\"lastest_msg_content\\\":\\\"\\\",\\\"unread_msg_num\\\":\\\"1\\\",\\\"update_time\\\":\\\"1768808774\\\",\\\"kf_uin\\\":1525084715,\\\"extra_info\\\":\\\"{\\\\\\\"head_img\\\\\\\":\\\\\\\"http:\\\\\\\\\\\\\\/\\\\\\\\\\\\\\/wx.qlogo.cn\\\\\\\\\\\\\\/mmhead\\\\\\\\\\\\\\/Q3auHgzwzM6vehibAAib9ia4ejxH7ibula7RuH4rTO7H7equgOZPVZl5Ew\\\\\\\\\\\\\\/64\\\\\\\",\\\\\\\"nickname\\\\\\\":\\\\\\\"Vader\\\\\\\",\\\\\\\"list\\\\\\\":[],\\\\\\\"qa_info_list\\\\\\\":[]}\\\",\\\"lastest_msg_kf_content\\\":\\\"{\\\\\\\"content\\\\\\\":\\\\\\\"测试\\\\\\\"}\\\",\\\"lastest_user_msg_time\\\":\\\"1768808774\\\",\\\"msg_type\\\":1,\\\"send_open_account\\\":\\\"\\\",\\\"recv_open_account\\\":\\\"wxad4163db54e87b44\\\",\\\"send_openid\\\":\\\"o9cq802Ue5pCVRmzuzkFUcnoHjcM\\\",\\\"recv_openid\\\":\\\"o9cq801T0m1dIivQzMyUwBvW5Znk\\\",\\\"is_delete\\\":0,\\\"star_label\\\":0,\\\"star_label_update_time\\\":\\\"0\\\",\\\"unreplied_msg_time\\\":\\\"1768808777\\\",\\\"kf_reply_status\\\":0,\\\"sync_id\\\":\\\"45\\\",\\\"is_pin\\\":0,\\\"is_pin_update_time\\\":\\\"0\\\",\\\"ext_info\\\":{},\\\"complaint_info\\\":{\\\"complaint_expire_time\\\":0,\\\"complaint_id\\\":\\\"\\\",\\\"complaint_status\\\":0},\\\"user_uin\\\":2044334303,\\\"is_expired\\\":0}\"}","msg_type":5,"properties":"0","recv_open_account":"wxad4163db54e87b44","recv_openid":"o9cq801T0m1dIivQzMyUwBvW5Znk","reply_type":0,"room_id":"4348684483414425612","room_useruin":"0","scene":6,"send_open_account":"","send_openid":"o9cq802Ue5pCVRmzuzkFUcnoHjcM","send_scene":6,"session_id":"0","update_time":"1768808777"}],"total_num":1} + //if (content.Contains("用户已接入")) + // return; + + //content {"finder_live_id":"","finder_username":"","finder_object_id":"","finder_nonce_id":"","app_id":"wxca8d4b8e8feedc2a","page_path":"main/pages/productDetail/productDetail.html?productId=10000458846351&realappid=wxad4163db54e87b44&cacheKey=5e17e5db9339a95043ba1f8a3d02454d&cacheType=backup&businessId=1&requestId=4349008357285756937&subScene=1208","product_id":"10000458846351","cover_url":"https://wst.wxapp.tc.qq.com/161/20304/snscosdownload/SH/reserved/695a8faa000d37b31b2e9b6f55e91715000000a100004f50?imageView2/1/w/400/h/400/q/50","product_title":"旗袍复古国风外套新款加绒中老年时尚中式盘扣妈妈唐装开衫上衣女","market_price":"0","selling_price":"15895","platform_head_img":"http://mmbiz.qpic.cn/mmbiz_jpg/v9IeicMmfib92I87ia9hWs58ozuHZ8CRk6jyf6qgLwzibNSjAPekLzdf7yxOdQqR6od63tLH9s2zTxJbuqVTs6E19w/0?wx_fmt=jpeg/0","platform_name":"曼月森工厂店","shop_window_id":"","live_status":"","flash_sale_price":0,"flash_sale_end_time":0,"ec_source":"","selling_price_wording":"","ext_conv":{"ext_conv_type":1,"ec_product_url":"https://channels.weixin.qq.com/shop?login_appid=wxad4163db54e87b44&redirect_url=%2Fgoods%2Fentry%3FproductId%3D10000458846351","context":""}} + var product_title = BaseRegex.GetStringJson(ref content, "product_title"); + if (!string.IsNullOrWhiteSpace(product_title)) + content = "用户发送商品:" + product_title; + + // 在消息格子内显示消息 + row.Cells["colMessage"].Value = content; + } + catch + { + return; + } + } + + // 进行闪烁 + Task.Run(() => { FlashDgvRow(row); }); + // 播放声音 + playSound(); + // 消息弹框,暂时废弃 + if (!ChatConfig.ChatSettingConfig.IsNotShowMessageWindow) + { + } + }); + } + + void FlashDgvRow(DataGridViewRow row) + { + if (row.Tag == null) + row.Tag = row.DefaultCellStyle.BackColor; + for (int j = 0; j < 6; j++) + { + Invoke(new Action(() => { row.DefaultCellStyle.BackColor = Color.White; })); + Thread.Sleep(120); + Invoke(new Action(() => { row.DefaultCellStyle.BackColor = Color.FromArgb(245, 95, 50); })); + Thread.Sleep(120); + Invoke(new Action(() => { row.DefaultCellStyle.BackColor = Color.FromArgb(245, 45, 10); })); + Thread.Sleep(120); + } + } + private void MainLifeHandler_OnPop(object sender, PopData e) { var targetUrl = e.Url; @@ -360,9 +493,14 @@ namespace TemuKJD.WXForms.TalkForms if (shop == null) return; - var cookieLst = JsonHelper.DeserializeJsonToList(shop.Cookies.ParseToString()); - if (cookieLst == null) - cookieLst = new List(); + var cookieLst = new List(); + try + { + cookieLst = JsonHelper.DeserializeJsonToList(shop.Cookies.ParseToString().Replace("empty=true;", "[]")); + } + catch + { + } var cookieManager = mainWebBrowser.RequestContext.GetCookieManager(null); cookieManager.DeleteCookiesAsync("qq.com", null).Wait(); @@ -507,8 +645,6 @@ namespace TemuKJD.WXForms.TalkForms { ChatConfig.ChatSettingConfig.IsAutoReLogin = chkIsAutoReLogin.Checked; ChatConfig.SaveChatSettingParam(); - - //GlobalConfig.DouShopSettingParam.IsAutoDragLogin = chkIsAutoReLogin.Checked; } private void chkIsAutoReply_CheckedChanged(object sender, EventArgs e) @@ -591,5 +727,77 @@ namespace TemuKJD.WXForms.TalkForms //} //catch { } } + + private void dgvShop_CellContentClick(object sender, DataGridViewCellEventArgs e) + { + if (e.ColumnIndex < 0 || e.RowIndex < 0) + return; + + string shopId = dgvShop.Rows[e.RowIndex].Cells["colShopId"].Value?.ToString(); + if (string.IsNullOrEmpty(shopId)) + return; + var shop = GlobalConfig.ShopLoginList.FirstOrDefault(s => s.ShopId == shopId); + if (shop == null) + return; + + if (dgvShop.Columns[e.ColumnIndex].HeaderText == "状态" && dgvShop.Rows[e.RowIndex].Cells[e.ColumnIndex].Value?.ToString() == "掉线") + { + Task.Run(() => + { + // 如需登录,引导至登录窗口,禁止从聊天窗口登录。 + Invoke(new Action(() => + { + // 登录抖音小店 + WXShopLoginForm lf = new WXShopLoginForm(shop); + lf.ShowDialog(); + })); + + WXShopListForm.Instance.CheckShopLogin(new ShopLoginInfo[] { shop }, false); + LoadShop(new List() { shop }); + if (shop.LoginStatus == "登录成功") + { + ShowChat(shop); + while (shop.Chat.IsLoading) + { + Thread.Sleep(50); + } + } + }); + } + + } + + private void dgvShop_CellClick(object sender, DataGridViewCellEventArgs e) + { + if (e.ColumnIndex < 0 || e.RowIndex < 0) + return; + + foreach (DataGridViewRow r in dgvShop.Rows) + r.Cells["colSelect"].Value = false; + + var row = dgvShop.Rows[e.RowIndex]; + row.Cells["colSelect"].Value = true; + if (row.Tag != null) + row.DefaultCellStyle.BackColor = row.Tag is Color ? (Color)row.Tag : Color.White; + + string shopId = row.Cells["colShopId"].Value?.ToString(); + if (string.IsNullOrEmpty(shopId)) + return; + var shop = GlobalConfig.ShopLoginList.Where(s => s.ShopId == shopId).FirstOrDefault(); + if (shop == null) + return; + + if (shop?.Chat != null) + { + currentShop = shop; + shop.Chat.Dock = DockStyle.Fill; + shop.Chat.BringToFront(); + } + + Task.Run(() => + { + SetMainBrowserUrl(shop); + }); + } } }