From b27c473c995ccf78fb5823e1db129224c98a6fab Mon Sep 17 00:00:00 2001 From: wule Date: Fri, 13 Mar 2026 19:07:15 +0800 Subject: [PATCH] tijiao --- .../ProductSelectForms/PDDDBProdListForm.cs | 7 +- .../ShopForms/WXShopListForm.Designer.cs | 66 ++-- TEMUKJD/WXForms/ShopForms/WXShopListForm.cs | 17 + TEMUKJD/WXForms/ShopForms/WXShopListForm.resx | 3 + TEMUKJD/WXForms/ShopForms/WXShopLoginForm.cs | 1 + .../WXShopMultiLoginForm.Designer.cs | 312 ++++++++---------- .../WXForms/ShopForms/WXShopMultiLoginForm.cs | 125 ++++++- .../ShopForms/WXShopMultiLoginForm.resx | 15 - 8 files changed, 327 insertions(+), 219 deletions(-) diff --git a/TEMUKJD/PDDForms/ProductSelectForms/PDDDBProdListForm.cs b/TEMUKJD/PDDForms/ProductSelectForms/PDDDBProdListForm.cs index 9f3a239..84a1a55 100644 --- a/TEMUKJD/PDDForms/ProductSelectForms/PDDDBProdListForm.cs +++ b/TEMUKJD/PDDForms/ProductSelectForms/PDDDBProdListForm.cs @@ -120,8 +120,8 @@ namespace TemuKJD.PDDForms.ProductSelectForms this.dgvDbProduct.AddMergeColumnHeader(new List() { "colExtCodePrice", "colEdit" }, "货号价格"); this.dgvDbProduct.AddMergeColumn(new List() { "colExtCodePrice", "colEdit" }); - this.dtpStart.Value = new DateTime(2026, 3, 6, 16, 0, 0); - this.dtpEnd.Value = new DateTime(2026, 3, 7, 18, 0, 0); + this.dtpStart.Value = new DateTime(2026, 3, 12, 0, 0, 0); + this.dtpEnd.Value = new DateTime(2026, 3, 13, 13, 0, 0); } private void btnSearch_Click(object sender, EventArgs e) @@ -1675,7 +1675,10 @@ namespace TemuKJD.PDDForms.ProductSelectForms if (prod != null) { if (outGoodsParam.skus.Any(s => !skuSecretJson.Contains(s.warehouseSkuId))) + { + prod.send_to_out_server = 2; continue; + } var url2 = BaseClass.BuildPDDObjString("product/mdy_product"); if (skuSecretJson.Contains("warehouseGoodsId") && skuSecretJson.Contains("goodsId") && diff --git a/TEMUKJD/WXForms/ShopForms/WXShopListForm.Designer.cs b/TEMUKJD/WXForms/ShopForms/WXShopListForm.Designer.cs index 3727f1e..dd5aff9 100644 --- a/TEMUKJD/WXForms/ShopForms/WXShopListForm.Designer.cs +++ b/TEMUKJD/WXForms/ShopForms/WXShopListForm.Designer.cs @@ -58,8 +58,6 @@ this.pbLoading = new System.Windows.Forms.PictureBox(); this.btnImport = new TemuKJD.UserControls.ButtonEx(); this.dgvShop = new TemuKJD.UserComponent.DataGridViewEx(); - this.chkAutoDrag = new System.Windows.Forms.CheckBox(); - this.statusBar = new TemuKJD.UserControls.StatusBarUserControl(); this.colSelect = new System.Windows.Forms.DataGridViewCheckBoxColumn(); this.colLoginName = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.colShopId = new System.Windows.Forms.DataGridViewTextBoxColumn(); @@ -76,6 +74,7 @@ this.colGotoShop = new System.Windows.Forms.DataGridViewLinkColumn(); this.colShopOperate = new System.Windows.Forms.DataGridViewLinkColumn(); this.colRelogin = new System.Windows.Forms.DataGridViewLinkColumn(); + this.colSwitchLogin = new System.Windows.Forms.DataGridViewLinkColumn(); this.colReLogin2 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.colBuyApi = new System.Windows.Forms.DataGridViewLinkColumn(); this.colMultiLogin = new System.Windows.Forms.DataGridViewLinkColumn(); @@ -85,6 +84,8 @@ this.colCopyCookies = new System.Windows.Forms.DataGridViewLinkColumn(); this.colEdit = new System.Windows.Forms.DataGridViewLinkColumn(); this.colDelete = new System.Windows.Forms.DataGridViewLinkColumn(); + this.chkAutoDrag = new System.Windows.Forms.CheckBox(); + this.statusBar = new TemuKJD.UserControls.StatusBarUserControl(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); this.splitContainer1.Panel1.SuspendLayout(); this.splitContainer1.Panel2.SuspendLayout(); @@ -575,6 +576,7 @@ this.colGotoShop, this.colShopOperate, this.colRelogin, + this.colSwitchLogin, this.colReLogin2, this.colBuyApi, this.colMultiLogin, @@ -593,31 +595,6 @@ this.dgvShop.TabIndex = 5; this.dgvShop.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgvShop_CellContentClick); // - // chkAutoDrag - // - this.chkAutoDrag.Anchor = System.Windows.Forms.AnchorStyles.Right; - this.chkAutoDrag.AutoSize = true; - this.chkAutoDrag.BackColor = System.Drawing.Color.White; - this.chkAutoDrag.Location = new System.Drawing.Point(1108, 2); - this.chkAutoDrag.Name = "chkAutoDrag"; - this.chkAutoDrag.Size = new System.Drawing.Size(159, 21); - this.chkAutoDrag.TabIndex = 3; - this.chkAutoDrag.Text = "登录时自动滑动拼图验证"; - this.chkAutoDrag.UseVisualStyleBackColor = false; - this.chkAutoDrag.Visible = false; - this.chkAutoDrag.Click += new System.EventHandler(this.chkAutoDrag_Click); - // - // statusBar - // - this.statusBar.BackColor = System.Drawing.Color.White; - this.statusBar.Dock = System.Windows.Forms.DockStyle.Bottom; - this.statusBar.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.statusBar.Location = new System.Drawing.Point(0, -1); - this.statusBar.Margin = new System.Windows.Forms.Padding(0); - this.statusBar.Name = "statusBar"; - this.statusBar.Size = new System.Drawing.Size(1264, 29); - this.statusBar.TabIndex = 1; - // // colSelect // this.colSelect.FillWeight = 26F; @@ -743,6 +720,15 @@ this.colRelogin.Resizable = System.Windows.Forms.DataGridViewTriState.True; this.colRelogin.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; // + // colSwitchLogin + // + this.colSwitchLogin.FillWeight = 60F; + this.colSwitchLogin.HeaderText = "批量登录"; + this.colSwitchLogin.Name = "colSwitchLogin"; + this.colSwitchLogin.ReadOnly = true; + this.colSwitchLogin.Resizable = System.Windows.Forms.DataGridViewTriState.True; + this.colSwitchLogin.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; + // // colReLogin2 // this.colReLogin2.FillWeight = 55F; @@ -824,6 +810,31 @@ this.colDelete.Name = "colDelete"; this.colDelete.ReadOnly = true; // + // chkAutoDrag + // + this.chkAutoDrag.Anchor = System.Windows.Forms.AnchorStyles.Right; + this.chkAutoDrag.AutoSize = true; + this.chkAutoDrag.BackColor = System.Drawing.Color.White; + this.chkAutoDrag.Location = new System.Drawing.Point(1108, 2); + this.chkAutoDrag.Name = "chkAutoDrag"; + this.chkAutoDrag.Size = new System.Drawing.Size(159, 21); + this.chkAutoDrag.TabIndex = 3; + this.chkAutoDrag.Text = "登录时自动滑动拼图验证"; + this.chkAutoDrag.UseVisualStyleBackColor = false; + this.chkAutoDrag.Visible = false; + this.chkAutoDrag.Click += new System.EventHandler(this.chkAutoDrag_Click); + // + // statusBar + // + this.statusBar.BackColor = System.Drawing.Color.White; + this.statusBar.Dock = System.Windows.Forms.DockStyle.Bottom; + this.statusBar.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.statusBar.Location = new System.Drawing.Point(0, -1); + this.statusBar.Margin = new System.Windows.Forms.Padding(0); + this.statusBar.Name = "statusBar"; + this.statusBar.Size = new System.Drawing.Size(1264, 29); + this.statusBar.TabIndex = 1; + // // WXShopListForm // this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; @@ -906,6 +917,7 @@ private System.Windows.Forms.DataGridViewLinkColumn colGotoShop; private System.Windows.Forms.DataGridViewLinkColumn colShopOperate; private System.Windows.Forms.DataGridViewLinkColumn colRelogin; + private System.Windows.Forms.DataGridViewLinkColumn colSwitchLogin; private System.Windows.Forms.DataGridViewTextBoxColumn colReLogin2; private System.Windows.Forms.DataGridViewLinkColumn colBuyApi; private System.Windows.Forms.DataGridViewLinkColumn colMultiLogin; diff --git a/TEMUKJD/WXForms/ShopForms/WXShopListForm.cs b/TEMUKJD/WXForms/ShopForms/WXShopListForm.cs index 2721f0e..d303e94 100644 --- a/TEMUKJD/WXForms/ShopForms/WXShopListForm.cs +++ b/TEMUKJD/WXForms/ShopForms/WXShopListForm.cs @@ -523,6 +523,7 @@ namespace TemuKJD.WXForms.ShopForms "进入", "检测", string.IsNullOrWhiteSpace(param.LoginStatus) ? "未登录" : param.LoginStatus.Trim(), + "批量登录", string.IsNullOrWhiteSpace(param.LoginStatus2) ? "国际版未登录" : param.LoginStatus2.Trim(), "购买", "多重登录", @@ -806,6 +807,22 @@ namespace TemuKJD.WXForms.ShopForms } IsOperate = false; break; + case "批量登录": + { + CheckShopLogin(new string[] { shop.LoginName }, false); + if (shop.LoginStatus != "登录成功") + { + BaseMsgForm.ShowError("批量登录需要主店铺处于登录状态!"); + } + else + { + WXShopMultiLoginForm shopMultiLoginForm = new WXShopMultiLoginForm(shop); + shopMultiLoginForm.openType = EnumOpenType.multi_login; + //shopMultiLoginForm.WindowState = FormWindowState.Maximized; + shopMultiLoginForm.ShowDialog(); + } + } + break; //case "多重登录": // IsOperate = true; // ShopLoginForm shopMultiLoginForm = new ShopLoginForm(shop); diff --git a/TEMUKJD/WXForms/ShopForms/WXShopListForm.resx b/TEMUKJD/WXForms/ShopForms/WXShopListForm.resx index c6ae58b..280f21f 100644 --- a/TEMUKJD/WXForms/ShopForms/WXShopListForm.resx +++ b/TEMUKJD/WXForms/ShopForms/WXShopListForm.resx @@ -165,6 +165,9 @@ True + + True + True diff --git a/TEMUKJD/WXForms/ShopForms/WXShopLoginForm.cs b/TEMUKJD/WXForms/ShopForms/WXShopLoginForm.cs index e280258..380f8bd 100644 --- a/TEMUKJD/WXForms/ShopForms/WXShopLoginForm.cs +++ b/TEMUKJD/WXForms/ShopForms/WXShopLoginForm.cs @@ -35,6 +35,7 @@ namespace TemuKJD.WXForms.ShopForms login, manage, refresh_cookie, + multi_login, } public partial class WXShopLoginForm : BaseGeneralForm { diff --git a/TEMUKJD/WXForms/ShopForms/WXShopMultiLoginForm.Designer.cs b/TEMUKJD/WXForms/ShopForms/WXShopMultiLoginForm.Designer.cs index f24736c..bf00a81 100644 --- a/TEMUKJD/WXForms/ShopForms/WXShopMultiLoginForm.Designer.cs +++ b/TEMUKJD/WXForms/ShopForms/WXShopMultiLoginForm.Designer.cs @@ -32,36 +32,33 @@ System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(WXShopMultiLoginForm)); this.splitContainer1 = new System.Windows.Forms.SplitContainer(); - this.splitContainer2 = new System.Windows.Forms.SplitContainer(); - this.btnNext = new System.Windows.Forms.Button(); - this.btnPrev = new System.Windows.Forms.Button(); - this.txtAddress = new System.Windows.Forms.TextBox(); - this.splitContainer3 = new System.Windows.Forms.SplitContainer(); this.dgvShop = new TemuKJD.UserComponent.DataGridViewEx(); this.colSelect = new System.Windows.Forms.DataGridViewCheckBoxColumn(); 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.colSelectProduct = new System.Windows.Forms.DataGridViewLinkColumn(); this.colLoginStatus = new System.Windows.Forms.DataGridViewLinkColumn(); - this.colApi = new System.Windows.Forms.DataGridViewLinkColumn(); this.colCanUse = new System.Windows.Forms.DataGridViewCheckBoxColumn(); - this.colUploadCount = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.colOnSaleNum = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.colRemaining = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.colMessage = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.splitContainer2 = new System.Windows.Forms.SplitContainer(); + this.btnNext = new System.Windows.Forms.Button(); + this.btnPrev = new System.Windows.Forms.Button(); + this.txtAddress = new System.Windows.Forms.TextBox(); + this.splitContainer3 = new System.Windows.Forms.SplitContainer(); + this.btnRefreshNum = new DevComponents.DotNetBar.PanelEx(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); this.splitContainer1.Panel2.SuspendLayout(); this.splitContainer1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.dgvShop)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).BeginInit(); this.splitContainer2.Panel1.SuspendLayout(); this.splitContainer2.Panel2.SuspendLayout(); this.splitContainer2.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer3)).BeginInit(); this.splitContainer3.Panel1.SuspendLayout(); + this.splitContainer3.Panel2.SuspendLayout(); this.splitContainer3.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.dgvShop)).BeginInit(); this.SuspendLayout(); // // splitContainer1 @@ -77,11 +74,113 @@ // this.splitContainer1.Panel2.BackColor = System.Drawing.Color.White; this.splitContainer1.Panel2.Controls.Add(this.dgvShop); - this.splitContainer1.Size = new System.Drawing.Size(1438, 686); - this.splitContainer1.SplitterDistance = 1100; + this.splitContainer1.Size = new System.Drawing.Size(1438, 659); + this.splitContainer1.SplitterDistance = 1106; this.splitContainer1.SplitterWidth = 3; this.splitContainer1.TabIndex = 4; // + // dgvShop + // + this.dgvShop.AllowUserToAddRows = false; + this.dgvShop.AllowUserToDeleteRows = false; + dataGridViewCellStyle1.BackColor = System.Drawing.Color.WhiteSmoke; + this.dgvShop.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1; + this.dgvShop.AutoRowNumber = true; + this.dgvShop.BackgroundColor = System.Drawing.Color.White; + this.dgvShop.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); + dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle2.BackColor = System.Drawing.SystemColors.Control; + dataGridViewCellStyle2.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + dataGridViewCellStyle2.ForeColor = System.Drawing.SystemColors.WindowText; + dataGridViewCellStyle2.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle2.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.False; + this.dgvShop.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle2; + this.dgvShop.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; + this.dgvShop.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { + this.colSelect, + this.colShopLoginName, + this.colShopId, + this.colShopName, + this.colShopNotes, + this.colLoginStatus, + this.colCanUse, + this.colMessage}); + this.dgvShop.Dock = System.Windows.Forms.DockStyle.Fill; + this.dgvShop.Location = new System.Drawing.Point(0, 0); + this.dgvShop.Name = "dgvShop"; + this.dgvShop.ReadOnly = true; + this.dgvShop.RowHeadersWidth = 25; + this.dgvShop.RowTemplate.Height = 23; + this.dgvShop.Size = new System.Drawing.Size(329, 659); + 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.Visible = false; + 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 = 75; + // + // colShopNotes + // + this.colShopNotes.HeaderText = "备注"; + this.colShopNotes.Name = "colShopNotes"; + this.colShopNotes.ReadOnly = true; + this.colShopNotes.Width = 75; + // + // 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; + // // splitContainer2 // this.splitContainer2.BackColor = System.Drawing.Color.White; @@ -137,6 +236,7 @@ // // splitContainer3 // + this.splitContainer3.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224))))); this.splitContainer3.Dock = System.Windows.Forms.DockStyle.Fill; this.splitContainer3.FixedPanel = System.Windows.Forms.FixedPanel.Panel2; this.splitContainer3.Location = new System.Drawing.Point(0, 0); @@ -146,158 +246,39 @@ // splitContainer3.Panel1 // this.splitContainer3.Panel1.Controls.Add(this.splitContainer1); + // + // splitContainer3.Panel2 + // + this.splitContainer3.Panel2.BackColor = System.Drawing.Color.White; + this.splitContainer3.Panel2.Controls.Add(this.btnRefreshNum); this.splitContainer3.Size = new System.Drawing.Size(1438, 736); - this.splitContainer3.SplitterDistance = 686; + this.splitContainer3.SplitterDistance = 659; this.splitContainer3.TabIndex = 5; // - // dgvShop + // btnRefreshNum // - this.dgvShop.AllowUserToAddRows = false; - this.dgvShop.AllowUserToDeleteRows = false; - dataGridViewCellStyle1.BackColor = System.Drawing.Color.WhiteSmoke; - this.dgvShop.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1; - this.dgvShop.AutoRowNumber = true; - this.dgvShop.BackgroundColor = System.Drawing.Color.White; - this.dgvShop.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); - dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; - dataGridViewCellStyle2.BackColor = System.Drawing.SystemColors.Control; - dataGridViewCellStyle2.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - dataGridViewCellStyle2.ForeColor = System.Drawing.SystemColors.WindowText; - dataGridViewCellStyle2.SelectionBackColor = System.Drawing.SystemColors.Highlight; - dataGridViewCellStyle2.SelectionForeColor = System.Drawing.SystemColors.HighlightText; - dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.False; - this.dgvShop.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle2; - this.dgvShop.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; - this.dgvShop.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { - this.colSelect, - this.colShopLoginName, - this.colShopId, - this.colShopName, - this.colShopNotes, - this.colSelectProduct, - this.colLoginStatus, - this.colApi, - this.colCanUse, - this.colUploadCount, - this.colOnSaleNum, - this.colRemaining, - this.colMessage}); - this.dgvShop.Dock = System.Windows.Forms.DockStyle.Fill; - this.dgvShop.Location = new System.Drawing.Point(0, 0); - this.dgvShop.Name = "dgvShop"; - this.dgvShop.ReadOnly = true; - this.dgvShop.RowHeadersWidth = 25; - this.dgvShop.RowTemplate.Height = 23; - this.dgvShop.Size = new System.Drawing.Size(335, 686); - 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.Visible = false; - 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 = 75; - // - // colShopNotes - // - this.colShopNotes.HeaderText = "备注"; - this.colShopNotes.Name = "colShopNotes"; - this.colShopNotes.ReadOnly = true; - this.colShopNotes.Width = 75; - // - // colSelectProduct - // - this.colSelectProduct.HeaderText = "选择商品"; - this.colSelectProduct.Name = "colSelectProduct"; - this.colSelectProduct.ReadOnly = true; - this.colSelectProduct.Resizable = System.Windows.Forms.DataGridViewTriState.True; - this.colSelectProduct.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; - this.colSelectProduct.Visible = false; - this.colSelectProduct.Width = 62; - // - // 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; - // - // colApi - // - this.colApi.HeaderText = "Api"; - this.colApi.Name = "colApi"; - this.colApi.ReadOnly = true; - this.colApi.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; - this.colApi.Visible = false; - this.colApi.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; - // - // colUploadCount - // - this.colUploadCount.HeaderText = "已传"; - this.colUploadCount.Name = "colUploadCount"; - this.colUploadCount.ReadOnly = true; - this.colUploadCount.Visible = false; - this.colUploadCount.Width = 38; - // - // colOnSaleNum - // - this.colOnSaleNum.HeaderText = "在售"; - this.colOnSaleNum.Name = "colOnSaleNum"; - this.colOnSaleNum.ReadOnly = true; - this.colOnSaleNum.Visible = false; - this.colOnSaleNum.Width = 38; - // - // colRemaining - // - this.colRemaining.HeaderText = "月限额"; - this.colRemaining.Name = "colRemaining"; - this.colRemaining.ReadOnly = true; - this.colRemaining.Visible = false; - // - // colMessage - // - this.colMessage.HeaderText = "消息"; - this.colMessage.Name = "colMessage"; - this.colMessage.ReadOnly = true; + this.btnRefreshNum.Anchor = System.Windows.Forms.AnchorStyles.Right; + this.btnRefreshNum.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; + this.btnRefreshNum.Cursor = System.Windows.Forms.Cursors.Hand; + this.btnRefreshNum.DisabledBackColor = System.Drawing.Color.Empty; + this.btnRefreshNum.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.btnRefreshNum.Location = new System.Drawing.Point(1304, 24); + this.btnRefreshNum.Name = "btnRefreshNum"; + this.btnRefreshNum.Size = new System.Drawing.Size(102, 24); + this.btnRefreshNum.Style.Alignment = System.Drawing.StringAlignment.Center; + this.btnRefreshNum.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); + this.btnRefreshNum.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); + this.btnRefreshNum.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder; + this.btnRefreshNum.Style.BorderDashStyle = System.Drawing.Drawing2D.DashStyle.Dash; + this.btnRefreshNum.Style.BorderSide = DevComponents.DotNetBar.eBorderSide.None; + this.btnRefreshNum.Style.ForeColor.Color = System.Drawing.Color.White; + this.btnRefreshNum.Style.GradientAngle = 90; + this.btnRefreshNum.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center; + this.btnRefreshNum.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255))))); + this.btnRefreshNum.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255))))); + this.btnRefreshNum.TabIndex = 442; + this.btnRefreshNum.Text = "自动切换登录"; + this.btnRefreshNum.Click += new System.EventHandler(this.btnRefreshNum_Click); // // WXShopMultiLoginForm // @@ -316,15 +297,16 @@ this.splitContainer1.Panel2.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit(); this.splitContainer1.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.dgvShop)).EndInit(); this.splitContainer2.Panel1.ResumeLayout(false); this.splitContainer2.Panel1.PerformLayout(); this.splitContainer2.Panel2.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).EndInit(); this.splitContainer2.ResumeLayout(false); this.splitContainer3.Panel1.ResumeLayout(false); + this.splitContainer3.Panel2.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.splitContainer3)).EndInit(); this.splitContainer3.ResumeLayout(false); - ((System.ComponentModel.ISupportInitialize)(this.dgvShop)).EndInit(); this.ResumeLayout(false); } @@ -343,13 +325,9 @@ private System.Windows.Forms.DataGridViewTextBoxColumn colShopId; private System.Windows.Forms.DataGridViewTextBoxColumn colShopName; private System.Windows.Forms.DataGridViewTextBoxColumn colShopNotes; - private System.Windows.Forms.DataGridViewLinkColumn colSelectProduct; private System.Windows.Forms.DataGridViewLinkColumn colLoginStatus; - private System.Windows.Forms.DataGridViewLinkColumn colApi; private System.Windows.Forms.DataGridViewCheckBoxColumn colCanUse; - private System.Windows.Forms.DataGridViewTextBoxColumn colUploadCount; - private System.Windows.Forms.DataGridViewTextBoxColumn colOnSaleNum; - private System.Windows.Forms.DataGridViewTextBoxColumn colRemaining; private System.Windows.Forms.DataGridViewTextBoxColumn colMessage; + private DevComponents.DotNetBar.PanelEx btnRefreshNum; } } \ No newline at end of file diff --git a/TEMUKJD/WXForms/ShopForms/WXShopMultiLoginForm.cs b/TEMUKJD/WXForms/ShopForms/WXShopMultiLoginForm.cs index 4c2549b..18cd52c 100644 --- a/TEMUKJD/WXForms/ShopForms/WXShopMultiLoginForm.cs +++ b/TEMUKJD/WXForms/ShopForms/WXShopMultiLoginForm.cs @@ -46,9 +46,10 @@ namespace TemuKJD.WXForms.ShopForms private string currentUrl = ""; private string shopCookieHead = "store.weixin.qq.com"; - private ShopLoginInfo shop = null; + private ShopLoginInfo mainShop = null; private ConcurrentList lstShopCompany = new ConcurrentList(); private ConcurrentList lstSwitchShop = new ConcurrentList(); + private ConcurrentList lstSwitchInfo = new ConcurrentList(); public WXShopMultiLoginForm(ShopLoginInfo shopInfo) @@ -56,12 +57,57 @@ namespace TemuKJD.WXForms.ShopForms InitializeComponent(); shopMultiLoginFormInstance = this; - this.shop = shopInfo; + this.mainShop = shopInfo; + + Task.Run(() => + { + var shopSwitchRst = WXShopSwitch.getShopSwitchList(mainShop); + if (!shopSwitchRst.Contains("\"code\":0")) + { + BaseMsgForm.ShowError("获取切换列表失败!"); + return; + } + + try + { + string shopSwitchStr = JsonHelper.SerializeObject(JsonHelper.JObjectParse(shopSwitchRst)["list"]); + lstSwitchInfo.Clear(); + lstSwitchShop.Clear(); + lstSwitchInfo.AddRange(JsonHelper.DeserializeJsonToList(shopSwitchStr)); + lstSwitchShop.AddRange(GlobalConfig.ShopLoginList.Where(s => lstSwitchInfo.Any(sw => sw.appid == s.ShopId))); + foreach(var shop in lstSwitchShop) + { + bool canUse = shop.LoginStatus == "登录成功"; + Invoke(new Action(() => + { + this.dgvShop.Rows.Add + ( + true, + shop.LoginName, + shop.ShopId, + shop.ShopAccount, + shop.Notes, + canUse ? "在线" : "掉线", + canUse, + "-" + ); + })); + displayAuthStatus(shop); + } + } + catch (Exception ex) + { + BaseMsgForm.ShowError("切换列表解析失败!"); + } + }); } private void ShopLoginForm_Load(object sender, EventArgs e) { - this.splitContainer1.SplitterDistance = this.splitContainer1.Height - 62; + this.Size = new Size(1680, 900); + this.CenterToScreen(); + + this.splitContainer3.SplitterDistance = this.splitContainer3.Height - 62; if (string.IsNullOrWhiteSpace(InitUrl)) InitUrl = DefaultUrl; @@ -92,7 +138,7 @@ namespace TemuKJD.WXForms.ShopForms /// private void initCefAndMainShop() { - if (openType != EnumOpenType.login && shop == null) + if (openType != EnumOpenType.login && mainShop == null) return; if (cefWebBrowser == null) @@ -124,9 +170,9 @@ namespace TemuKJD.WXForms.ShopForms List cookieLst = new List(); try { - if (shop != null) + if (mainShop != null) { - cookieLst = JsonHelper.DeserializeJsonToList(shop.Cookies.ParseToString()); + cookieLst = JsonHelper.DeserializeJsonToList(mainShop.Cookies.ParseToString()); if (cookieLst == null) cookieLst = new List(); } @@ -221,12 +267,12 @@ namespace TemuKJD.WXForms.ShopForms var shopId = BaseRegex.GetStringJson(ref data, "appid"); var nickName = BaseRegex.GetStringJson(ref data, "nickName"); var openId = BaseRegex.GetStringJson(ref data, "openid"); // oGu7k7HxmUyOmc1X6VM7GQwS-9cI - if (shop != null && shop.ShopId != shopId) + if (mainShop != null && mainShop.ShopId != shopId) { BaseMsgForm.ShowError("cookie与店铺不匹配,请核对店铺!"); return; } - if (shop == null && GlobalConfig.ShopLoginList.Any(s=>s.ShopId == shopId)) + if (mainShop == null && GlobalConfig.ShopLoginList.Any(s=>s.ShopId == shopId)) { BaseMsgForm.ShowError("录入的新店铺已存在,请核对店铺!"); return; @@ -279,6 +325,69 @@ namespace TemuKJD.WXForms.ShopForms { cefWebBrowser.Forward(); } + + private void btnRefreshNum_Click(object sender, EventArgs e) + { + foreach (var shop in lstSwitchShop) + { + var switchInfo = lstSwitchInfo.FirstOrDefault(s => s.appid == shop.ShopId); + var row = dgvShop.Rows.Cast().FirstOrDefault(r => r.Cells["colShopId"].Value.ParseToString() == shop.ShopId); + Invoke(new Action(() => + { + row.Cells["colMessage"].Value = "-"; + })); + + WXShopListForm.Instance.CheckShopLogin(new ShopLoginInfo[] { shop }, false); + if (shop.LoginStatus == "登录成功") + { + Thread.Sleep(100); + Invoke(new Action(() => + { + row.Cells["colMessage"].Value = "登录成功"; + })); + continue; + } + + string jsStr1 = @"document.getElementsByClassName('shop-info-popover')[0].style =''; + var divLst = document.getElementsByClassName('shop-info-popover')[0].getElementsByTagName('div'); + for (i=0; i= 0){ + divLst[i].click(); + //return 'success' + } + }"; + var t1 = cefWebBrowser.GetMainFrame().EvaluateScriptAsync(jsStr1); + t1.Wait(5000); + + Thread.Sleep(Randomx.GetId(500, 1000)); + jsStr1 = @"for (i=0; i= 0){ + divLst[i].click(); + } + }"; + t1 = cefWebBrowser.GetMainFrame().EvaluateScriptAsync(jsStr1); + t1.Wait(5000); + + Thread.Sleep(Randomx.GetId(2000, 3000)); + + + List cookieList = CEFBrowser.GetCookieList(shopCookieHead, cefWebBrowser.GetCookieManager(null)); + break; + } + } + + void displayAuthStatus(ShopLoginInfo shop) + { + var rows = this.dgvShop.Rows.Cast().Where(r => r.Cells["colShopId"].Value.ParseToString() == shop?.ShopId); + foreach (var row in rows) + { + bool canUse = row.Cells["colLoginStatus"].Value.ParseToString() == "在线"; + (row.Cells["colLoginStatus"] as DataGridViewLinkCell).Style.ForeColor = canUse ? Color.Blue : Color.Red; + (row.Cells["colLoginStatus"] as DataGridViewLinkCell).LinkColor = canUse ? Color.Blue : Color.Red; + (row.Cells["colLoginStatus"] as DataGridViewLinkCell).ActiveLinkColor = canUse ? Color.LightBlue : Color.OrangeRed; + (row.Cells["colLoginStatus"] as DataGridViewLinkCell).VisitedLinkColor = canUse ? Color.DarkBlue : Color.DarkRed; + } + } } public class WXShopSwitch diff --git a/TEMUKJD/WXForms/ShopForms/WXShopMultiLoginForm.resx b/TEMUKJD/WXForms/ShopForms/WXShopMultiLoginForm.resx index a65de0c..8a934a0 100644 --- a/TEMUKJD/WXForms/ShopForms/WXShopMultiLoginForm.resx +++ b/TEMUKJD/WXForms/ShopForms/WXShopMultiLoginForm.resx @@ -129,27 +129,12 @@ True - - True - True - - True - True - - True - - - True - - - True - True