diff --git a/AllBase/BaseClass.cs b/AllBase/BaseClass.cs index 53cdce9..51344fc 100644 --- a/AllBase/BaseClass.cs +++ b/AllBase/BaseClass.cs @@ -27,7 +27,7 @@ namespace AllBase /// /// 版本ID /// - public static int VersionCount = 909; + public static int VersionCount = 912; //public static int VersionCount = 613; /// diff --git a/KJDService/KJD_WebService/BLL/BXX/BXXProductManage.cs b/KJDService/KJD_WebService/BLL/BXX/BXXProductManage.cs index 463f715..05de46e 100644 --- a/KJDService/KJD_WebService/BLL/BXX/BXXProductManage.cs +++ b/KJDService/KJD_WebService/BLL/BXX/BXXProductManage.cs @@ -1288,8 +1288,8 @@ namespace KJD_Web.BLL.BXX //sql += " ORDER BY RAND()"; //sql += " limit " + Math.Max(page - 1, 0) * page_size + "," + page_size; - var limit = RandomUtils.GetId(Math.Max(1, count - page_size)); - sql += " limit " + limit + "," + page_size; + var limit = RandomUtils.GetId(Math.Max(0, count - page_size)); + sql += " limit " + limit + "," + 5000; dt = mySql.ExecuteDataTable(sql); Thread.Sleep(100); @@ -1299,7 +1299,7 @@ namespace KJD_Web.BLL.BXX return "{\"code\":500,\"msg\":\"" + mySql.Message + "\",\"data\":[],\"count\":" + 0 + "}"; } - var db_ids = string.Join(",", dt.Rows.Cast().Select(r => r["id"].ParseToInt())); + var db_ids = string.Join(",", dt.Rows.Cast().Select(r => r["id"].ParseToInt()).OrderBy(x => RandomUtils.GetId(10000000)).Take(page_size)); sql = "select p.id,p.from_shop_id,p.spu_id,p.skc_id,p.main_cat_id,p.main_cat_name,p.cat_id,p.cat_name,p.price_text,p.ext_code," + " p.product_name,p.main_img,p.group,p.notes,p.add_time,p.mdy_time,p.product_get_type," + " p.wx_safe_status,p.special_prod_type,p.wx_cat_1,p.wx_cat_2,p.wx_cat_3,p.send_to_out_server," + diff --git a/KJDService/KJD_WebService/KJD_WebService.csproj.user b/KJDService/KJD_WebService/KJD_WebService.csproj.user index 4bcdc04..c789fae 100644 --- a/KJDService/KJD_WebService/KJD_WebService.csproj.user +++ b/KJDService/KJD_WebService/KJD_WebService.csproj.user @@ -1,4 +1,4 @@ - + true diff --git a/TEMUKJD/BLL/PDDProdFormConverter.cs b/TEMUKJD/BLL/PDDProdFormConverter.cs index e3caefb..80fb688 100644 --- a/TEMUKJD/BLL/PDDProdFormConverter.cs +++ b/TEMUKJD/BLL/PDDProdFormConverter.cs @@ -671,22 +671,27 @@ namespace TemuKJD.BLL } var itemNo = jSku["itemNo"].ParseToString(); var baseSkuId = jSku["baseSkuId"].ParseToString(); - var skuId = jstSecretCodeLst["skus"].FirstOrDefault(s => s["skuCode"].ParseToString() == itemNo)?["skuId"].ParseToString(); - // skuCode可能不唯一 - skuId = jstSecretCodeLst["skus"].FirstOrDefault(s => s["warehouseSkuId"].ParseToString() == baseSkuId)?["skuId"].ParseToString(); - if (skuId.IsNullOrEmpty()) + // skuCode可能不唯一,使用skuId取加密后的货号 + //var skuId = jstSecretCodeLst["skus"].FirstOrDefault(s => s["skuCode"].ParseToString() == itemNo)?["skuId"].ParseToString(); + var skuId = jstSecretCodeLst["skus"].FirstOrDefault(s => s["warehouseSkuId"].ParseToString() == baseSkuId)?["skuId"].ParseToString(); + if (skuId.IsNullOrEmpty() || string.IsNullOrEmpty(itemNo)) { convertRst = "SKU货号不存在"; return null; } - if (jstSecretCodeLst["skus"].Select(s => s["spuCode"].ParseToString()).Distinct().Count() != jstSecretCodeLst["skus"].Count()) - { - convertRst = "SKU货号重复"; - return null; - } + // 外部编码(货号) skuInfo.out_sku_sn = skuId; prodInfo.detail.sku.Add(skuInfo); } + // 测试发现skuCoke重复可能对推单有影响,先吧skuCode重复的排除掉 + var skuCount = jstGoodsObj["skuInfo"]["goodsSkuDetail"].Select(s => s["baseSkuId"].ParseToString()).Distinct().Count(); + var itemNoCount = jstGoodsObj["skuInfo"]["goodsSkuDetail"].Select(s => s["itemNo"].ParseToString()).Distinct().Count(); + var skusStr = jstGoodsObj["skuInfo"]["goodsSkuDetail"].ParseToString(); + if (skuCount != itemNoCount) + { + convertRst = "SKU货号重复"; + return null; + } prodInfo.detail.sku_type = null; prodInfo.detail.song_huo_an_zhuang = null; prodInfo.detail.song_huo_ru_hu = null; diff --git a/TEMUKJD/PDDForms/ProductSelectForms/PDDDBProdListForm.cs b/TEMUKJD/PDDForms/ProductSelectForms/PDDDBProdListForm.cs index 84a1a55..ca43bd9 100644 --- a/TEMUKJD/PDDForms/ProductSelectForms/PDDDBProdListForm.cs +++ b/TEMUKJD/PDDForms/ProductSelectForms/PDDDBProdListForm.cs @@ -591,36 +591,36 @@ namespace TemuKJD.PDDForms.ProductSelectForms break; case "": dgvDbProduct.Rows[e.RowIndex].Cells["colSelect"].Value = !(bool)dgvDbProduct.Rows[e.RowIndex].Cells["colSelect"].Value; - rowIndex1 = rowIndex2; - rowIndex2 = e.RowIndex; - if (IsShiftDown) - { - if (rowIndex1 > -1 && rowIndex2 > -1) - { - try - { - if (rowIndex1 > rowIndex2) - { - for (int i = rowIndex2; i <= rowIndex1; i++) - { - dgvDbProduct.Rows[i].Cells["colSelect"].Value = dgvDbProduct.Rows[rowIndex1].Cells["colSelect"].Value; - } - } - else - { - for (int i = rowIndex1; i <= rowIndex2; i++) - { - dgvDbProduct.Rows[i].Cells["colSelect"].Value = dgvDbProduct.Rows[rowIndex1].Cells["colSelect"].Value; - } - } - } - catch - { - } - //rowIndex1 = -1; - //rowIndex2 = -1; - } - } + //rowIndex1 = rowIndex2; + //rowIndex2 = e.RowIndex; + //if (IsShiftDown) + //{ + // if (rowIndex1 > -1 && rowIndex2 > -1) + // { + // try + // { + // if (rowIndex1 > rowIndex2) + // { + // for (int i = rowIndex2; i <= rowIndex1; i++) + // { + // dgvDbProduct.Rows[i].Cells["colSelect"].Value = dgvDbProduct.Rows[rowIndex1].Cells["colSelect"].Value; + // } + // } + // else + // { + // for (int i = rowIndex1; i <= rowIndex2; i++) + // { + // dgvDbProduct.Rows[i].Cells["colSelect"].Value = dgvDbProduct.Rows[rowIndex1].Cells["colSelect"].Value; + // } + // } + // } + // catch + // { + // } + // //rowIndex1 = -1; + // //rowIndex2 = -1; + // } + //} break; default: break; @@ -1747,35 +1747,35 @@ namespace TemuKJD.PDDForms.ProductSelectForms }); } - int rowIndex1 = -1; - int rowIndex2 = -1; - bool IsShiftDown = false; + //int rowIndex1 = -1; + //int rowIndex2 = -1; + //bool IsShiftDown = false; private void PDDDBProdListForm_KeyDown(object sender, KeyEventArgs e) { - switch (e.KeyCode) - { - case Keys.Shift: - case Keys.ShiftKey: - case Keys.LShiftKey: - case Keys.RShiftKey: - IsShiftDown = true; - break; - } + //switch (e.KeyCode) + //{ + // case Keys.Shift: + // case Keys.ShiftKey: + // case Keys.LShiftKey: + // case Keys.RShiftKey: + // IsShiftDown = true; + // break; + //} } private void PDDDBProdListForm_KeyUp(object sender, KeyEventArgs e) { - switch (e.KeyCode) - { - case Keys.Shift: - case Keys.ShiftKey: - case Keys.LShiftKey: - case Keys.RShiftKey: - IsShiftDown = false; - rowIndex1 = -1; - rowIndex2 = -1; - break; - } + //switch (e.KeyCode) + //{ + // case Keys.Shift: + // case Keys.ShiftKey: + // case Keys.LShiftKey: + // case Keys.RShiftKey: + // IsShiftDown = false; + // rowIndex1 = -1; + // rowIndex2 = -1; + // break; + //} } private void cmbSourceType_SelectedIndexChanged(object sender, EventArgs e) diff --git a/TEMUKJD/UserComponent/DataGridViewEx.cs b/TEMUKJD/UserComponent/DataGridViewEx.cs index 2701e84..461605b 100644 --- a/TEMUKJD/UserComponent/DataGridViewEx.cs +++ b/TEMUKJD/UserComponent/DataGridViewEx.cs @@ -7,16 +7,19 @@ using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using DevComponents.DotNetBar.Controls; +using NaiBa.Util.Extension; namespace TemuKJD.UserComponent { public class DataGridViewEx : DataGridView { + Form parentForm = null; public DataGridViewEx() { BackgroundColor = Color.White; AlternatingRowsDefaultCellStyle.BackColor = Color.FromArgb(249, 249, 249); RowPostPaint += DataGridViewEx_RowPostPaint; + this.CellContentClick += DataGridViewEx_CellContentClick; this.SetStyle( ControlStyles.OptimizedDoubleBuffer | @@ -24,6 +27,94 @@ namespace TemuKJD.UserComponent ControlStyles.ResizeRedraw | ControlStyles.AllPaintingInWmPaint, true); + + Task.Run(() => + { + for (int i = 0; i < 50; i++) + { + System.Threading.Thread.Sleep(100); + parentForm = FindForm(); + if (parentForm != null) + { + parentForm.KeyPreview = true; + parentForm.KeyDown += ParentForm_KeyDown; + parentForm.KeyUp += ParentForm_KeyUp; + break; + } + } + }); + } + + private void DataGridViewEx_CellContentClick(object sender, DataGridViewCellEventArgs e) + { + if (e.ColumnIndex < 0) + return; + var colIndex = this.Columns.Cast().FirstOrDefault(c => c is DataGridViewCheckBoxColumn).Index; + if (colIndex < 0 || e.ColumnIndex != colIndex) + return; + + rowIndex1 = rowIndex2; + rowIndex2 = e.RowIndex; + if (IsShiftDown) + { + if (rowIndex1 > -1 && rowIndex2 > -1) + { + try + { + if (rowIndex1 > rowIndex2) + { + for (int i = rowIndex2; i <= rowIndex1 - 1; i++) + { + this.Rows[i].Cells[colIndex].Value = this.Rows[rowIndex1].Cells[colIndex].Value; + } + this.Rows[rowIndex1].Cells[rowIndex1].Value = !this.Rows[rowIndex1].Cells[rowIndex2].Value.ParseToBool(); + } + else + { + for (int i = rowIndex1; i <= rowIndex2 - 1; i++) + { + this.Rows[i].Cells[colIndex].Value = this.Rows[rowIndex1].Cells[colIndex].Value; + } + this.Rows[rowIndex1].Cells[rowIndex2].Value = !this.Rows[rowIndex1].Cells[rowIndex1].Value.ParseToBool(); + } + } + catch + { + } + //rowIndex1 = -1; + //rowIndex2 = -1; + } + } + } + + int rowIndex1 = -1; + int rowIndex2 = -1; + bool IsShiftDown = false; + private void ParentForm_KeyDown(object sender, KeyEventArgs e) + { + switch (e.KeyCode) + { + case Keys.Shift: + case Keys.ShiftKey: + case Keys.LShiftKey: + case Keys.RShiftKey: + IsShiftDown = true; + break; + } + } + private void ParentForm_KeyUp(object sender, KeyEventArgs e) + { + switch (e.KeyCode) + { + case Keys.Shift: + case Keys.ShiftKey: + case Keys.LShiftKey: + case Keys.RShiftKey: + IsShiftDown = false; + rowIndex1 = -1; + rowIndex2 = -1; + break; + } } private Color _BorderColor = Color.FromArgb(63, 126, 255); diff --git a/TEMUKJD/WXForms/ShopForms/WXShopListForm.cs b/TEMUKJD/WXForms/ShopForms/WXShopListForm.cs index d303e94..a5a8dba 100644 --- a/TEMUKJD/WXForms/ShopForms/WXShopListForm.cs +++ b/TEMUKJD/WXForms/ShopForms/WXShopListForm.cs @@ -820,6 +820,7 @@ namespace TemuKJD.WXForms.ShopForms shopMultiLoginForm.openType = EnumOpenType.multi_login; //shopMultiLoginForm.WindowState = FormWindowState.Maximized; shopMultiLoginForm.ShowDialog(); + RefreshDataGridView(true, shopMultiLoginForm.lstSwitchShop.ToList()); } } break; diff --git a/TEMUKJD/WXForms/ShopForms/WXShopMultiLoginForm.Designer.cs b/TEMUKJD/WXForms/ShopForms/WXShopMultiLoginForm.Designer.cs index bf00a81..759a760 100644 --- a/TEMUKJD/WXForms/ShopForms/WXShopMultiLoginForm.Designer.cs +++ b/TEMUKJD/WXForms/ShopForms/WXShopMultiLoginForm.Designer.cs @@ -32,6 +32,7 @@ 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.pbLoading = new System.Windows.Forms.PictureBox(); this.dgvShop = new TemuKJD.UserComponent.DataGridViewEx(); this.colSelect = new System.Windows.Forms.DataGridViewCheckBoxColumn(); this.colShopLoginName = new System.Windows.Forms.DataGridViewTextBoxColumn(); @@ -50,6 +51,7 @@ ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); this.splitContainer1.Panel2.SuspendLayout(); this.splitContainer1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.pbLoading)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.dgvShop)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).BeginInit(); this.splitContainer2.Panel1.SuspendLayout(); @@ -73,12 +75,25 @@ // splitContainer1.Panel2 // this.splitContainer1.Panel2.BackColor = System.Drawing.Color.White; + this.splitContainer1.Panel2.Controls.Add(this.pbLoading); this.splitContainer1.Panel2.Controls.Add(this.dgvShop); this.splitContainer1.Size = new System.Drawing.Size(1438, 659); - this.splitContainer1.SplitterDistance = 1106; + this.splitContainer1.SplitterDistance = 1108; this.splitContainer1.SplitterWidth = 3; this.splitContainer1.TabIndex = 4; // + // pbLoading + // + this.pbLoading.Anchor = System.Windows.Forms.AnchorStyles.None; + this.pbLoading.Image = global::TemuKJD.Properties.Resources.loading_blue; + this.pbLoading.Location = new System.Drawing.Point(139, 304); + this.pbLoading.Name = "pbLoading"; + this.pbLoading.Size = new System.Drawing.Size(50, 50); + this.pbLoading.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; + this.pbLoading.TabIndex = 676; + this.pbLoading.TabStop = false; + this.pbLoading.Visible = false; + // // dgvShop // this.dgvShop.AllowUserToAddRows = false; @@ -112,7 +127,7 @@ this.dgvShop.ReadOnly = true; this.dgvShop.RowHeadersWidth = 25; this.dgvShop.RowTemplate.Height = 23; - this.dgvShop.Size = new System.Drawing.Size(329, 659); + this.dgvShop.Size = new System.Drawing.Size(327, 659); this.dgvShop.TabIndex = 7; // // colSelect @@ -277,7 +292,7 @@ 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.Text = "自动批量登录"; this.btnRefreshNum.Click += new System.EventHandler(this.btnRefreshNum_Click); // // WXShopMultiLoginForm @@ -297,6 +312,7 @@ this.splitContainer1.Panel2.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit(); this.splitContainer1.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.pbLoading)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.dgvShop)).EndInit(); this.splitContainer2.Panel1.ResumeLayout(false); this.splitContainer2.Panel1.PerformLayout(); @@ -329,5 +345,6 @@ private System.Windows.Forms.DataGridViewCheckBoxColumn colCanUse; private System.Windows.Forms.DataGridViewTextBoxColumn colMessage; private DevComponents.DotNetBar.PanelEx btnRefreshNum; + private System.Windows.Forms.PictureBox pbLoading; } } \ No newline at end of file diff --git a/TEMUKJD/WXForms/ShopForms/WXShopMultiLoginForm.cs b/TEMUKJD/WXForms/ShopForms/WXShopMultiLoginForm.cs index 18cd52c..e5a6ce5 100644 --- a/TEMUKJD/WXForms/ShopForms/WXShopMultiLoginForm.cs +++ b/TEMUKJD/WXForms/ShopForms/WXShopMultiLoginForm.cs @@ -40,16 +40,16 @@ namespace TemuKJD.WXForms.ShopForms public string MultiLoginCookieName = ""; public string InitUrl = ""; public ChromiumWebBrowser cefWebBrowser = null; + public ShopLoginInfo mainShop = null; + public ConcurrentList lstSwitchShop = new ConcurrentList(); + public ConcurrentList lstSwitchInfo = new ConcurrentList(); const string DefaultUrl = "https://store.weixin.qq.com/shop/home"; const string shopLoginUrl = "https://store.weixin.qq.com/shop?redirect_url=%2Fhome"; private string currentUrl = ""; private string shopCookieHead = "store.weixin.qq.com"; - private ShopLoginInfo mainShop = null; private ConcurrentList lstShopCompany = new ConcurrentList(); - private ConcurrentList lstSwitchShop = new ConcurrentList(); - private ConcurrentList lstSwitchInfo = new ConcurrentList(); public WXShopMultiLoginForm(ShopLoginInfo shopInfo) @@ -328,52 +328,91 @@ namespace TemuKJD.WXForms.ShopForms private void btnRefreshNum_Click(object sender, EventArgs e) { - foreach (var shop in lstSwitchShop) + pbLoading.Visible = true; + btnRefreshNum.Enabled = false; + Task.Run(() => { - 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(() => + foreach (var shop in lstSwitchShop) { - row.Cells["colMessage"].Value = "-"; - })); - - WXShopListForm.Instance.CheckShopLogin(new ShopLoginInfo[] { shop }, false); - if (shop.LoginStatus == "登录成功") - { - Thread.Sleep(100); + 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 = "登录成功"; + row.Cells["colMessage"].Value = "-"; })); - continue; - } - string jsStr1 = @"document.getElementsByClassName('shop-info-popover')[0].style =''; + 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); + }"; + 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); + t1 = cefWebBrowser.GetMainFrame().EvaluateScriptAsync(jsStr1); + t1.Wait(5000); - Thread.Sleep(Randomx.GetId(2000, 3000)); + Thread.Sleep(Randomx.GetId(3000, 3500)); - List cookieList = CEFBrowser.GetCookieList(shopCookieHead, cefWebBrowser.GetCookieManager(null)); - break; - } + List cookieList = CEFBrowser.GetCookieList(shopCookieHead, cefWebBrowser.GetCookieManager(null)); + var cookies = cookieList.Where(c => c.Domain == this.shopCookieHead).ToList(); + if (!cookies.Any(c => c.Name == "biz_ticket")) + { + cookies.Add(new CefSharp.Cookie() + { + Name = "biz_ticket", + Value = "", + Domain = "store.weixin.qq.com", + Expires = null, + HttpOnly = true, + Path = "/", + Priority = CefSharp.Enums.CookiePriority.Medium, + SameSite = CefSharp.Enums.CookieSameSite.Unspecified, + Secure = true, + }); + } + + WXShopUpdateCookieForm.CheckCookieUpdate(shop, cookies); + Invoke(new Action(() => + { + bool canUse = shop.LoginStatus == "登录成功"; + row.Cells["colMessage"].Value = canUse ? "登录成功" : "登录失败,请稍后重试"; + row.Cells["colLoginStatus"].Value = canUse ? "在线" : "掉线"; + row.Cells["colCanUse"].Value = canUse; + displayAuthStatus(shop); + })); + Thread.Sleep(Randomx.GetId(2500, 5000)); + } + + + Invoke(new Action(() => + { + btnRefreshNum.Enabled = true; + pbLoading.Visible = false; + BaseMsgForm.ShowInfo("操作完成!"); + })); + }); } void displayAuthStatus(ShopLoginInfo shop) diff --git a/TEMUKJD/WXForms/ShopForms/WXShopUpdateCookieForm.cs b/TEMUKJD/WXForms/ShopForms/WXShopUpdateCookieForm.cs index f412582..3b1f428 100644 --- a/TEMUKJD/WXForms/ShopForms/WXShopUpdateCookieForm.cs +++ b/TEMUKJD/WXForms/ShopForms/WXShopUpdateCookieForm.cs @@ -110,15 +110,15 @@ namespace TemuKJD.WXForms.ShopForms string RK = BaseRegex.GetStringCookie(ref txt, "RK").ParseToString().Trim('\''); string yyb_muid = BaseRegex.GetStringCookie(ref txt, "yyb_muid").ParseToString().Trim('\''); - cookieLst.Add(new CefSharp.Cookie() { Name = "_qimei_uuid42", Value = _qimei_uuid42, Domain = ".qq.com", Expires = DateTime.Now.AddMonths(1) }); - cookieLst.Add(new CefSharp.Cookie() { Name = "_qpsvr_localtk", Value = _qpsvr_localtk, Domain = ".qq.com", Expires = DateTime.Now.AddMonths(1) }); + //cookieLst.Add(new CefSharp.Cookie() { Name = "_qimei_uuid42", Value = _qimei_uuid42, Domain = ".qq.com", Expires = DateTime.Now.AddMonths(1) }); + //cookieLst.Add(new CefSharp.Cookie() { Name = "_qpsvr_localtk", Value = _qpsvr_localtk, Domain = ".qq.com", Expires = DateTime.Now.AddMonths(1) }); cookieLst.Add(new CefSharp.Cookie() { Name = "biz_magic", Value = biz_magic, Domain = "store.weixin.qq.com", Expires = DateTime.Now.AddMonths(1) }); cookieLst.Add(new CefSharp.Cookie() { Name = "biz_rand", Value = biz_rand, Domain = "store.weixin.qq.com", Expires = DateTime.Now.AddMonths(1) }); cookieLst.Add(new CefSharp.Cookie() { Name = "biz_ticket", Value = biz_ticket, Domain = "store.weixin.qq.com", Expires = DateTime.Now.AddMonths(1) }); cookieLst.Add(new CefSharp.Cookie() { Name = "biz_token", Value = biz_token, Domain = "store.weixin.qq.com", Expires = DateTime.Now.AddMonths(1) }); - cookieLst.Add(new CefSharp.Cookie() { Name = "ptcz", Value = ptcz, Domain = ".qq.com", Expires = DateTime.Now.AddMonths(1) }); - cookieLst.Add(new CefSharp.Cookie() { Name = "RK", Value = RK, Domain = ".qq.com", Expires = DateTime.Now.AddMonths(1) }); - cookieLst.Add(new CefSharp.Cookie() { Name = "yyb_muid", Value = yyb_muid, Domain = ".qq.com", Expires = DateTime.Now.AddMonths(1) }); + //cookieLst.Add(new CefSharp.Cookie() { Name = "ptcz", Value = ptcz, Domain = ".qq.com", Expires = DateTime.Now.AddMonths(1) }); + //cookieLst.Add(new CefSharp.Cookie() { Name = "RK", Value = RK, Domain = ".qq.com", Expires = DateTime.Now.AddMonths(1) }); + //cookieLst.Add(new CefSharp.Cookie() { Name = "yyb_muid", Value = yyb_muid, Domain = ".qq.com", Expires = DateTime.Now.AddMonths(1) }); if (string.IsNullOrEmpty(biz_magic)) { @@ -126,6 +126,17 @@ namespace TemuKJD.WXForms.ShopForms return false; } + string chkRst = CheckCookieUpdate(shopLoginInfo, cookieLst); + if (!string.IsNullOrEmpty(chkRst)) + { + BaseMsgForm.ShowError(chkRst); + return false; + } + return true; + } + + public static string CheckCookieUpdate(ShopLoginInfo shopLoginInfo, List cookieLst) + { // 建立一个临时店铺并用这个店铺去登录 var cookieShop = new ShopLoginInfo(); cookieShop.Cookies = JsonHelper.SerializeObject(cookieLst); @@ -137,8 +148,7 @@ namespace TemuKJD.WXForms.ShopForms var indexEnd = data.IndexOf(";window.__USE_VITE__="); if (index < 1000) { - BaseMsgForm.ShowError("cookie已失效!"); - return false; + return "cookie已失效!"; } var dataStr = data.Substring(index, indexEnd - index); dataStr = GetHtml.Unicode2String(dataStr); @@ -147,15 +157,14 @@ namespace TemuKJD.WXForms.ShopForms var nickName = BaseRegex.GetStringJson(ref data, "nickName"); if (shopLoginInfo.ShopId != shopId) { - BaseMsgForm.ShowError("cookie与店铺不匹配,请核对店铺!"); - return false; + return "cookie与店铺不匹配,请核对店铺!"; } shopLoginInfo.Cookies = JsonHelper.SerializeObject(cookieLst); shopLoginInfo.ShopAccount = nickName; shopLoginInfo.LoginStatus = "登录成功"; WXShopListForm.UpdateServerShopCookies(shopLoginInfo); // 店铺cookie写入服务端,多店共用一个登录账号一组cookie - return true; + return ""; } /// diff --git a/TEMUKJD/WXForms/TalkForms/WxTalkForm.cs b/TEMUKJD/WXForms/TalkForms/WxTalkForm.cs index 2b9930b..48ed98d 100644 --- a/TEMUKJD/WXForms/TalkForms/WxTalkForm.cs +++ b/TEMUKJD/WXForms/TalkForms/WxTalkForm.cs @@ -1385,7 +1385,7 @@ namespace TemuKJD.WXForms.TalkForms List notesLst = notes.Split(new string[] { ";", ";", ",", "," }, StringSplitOptions.RemoveEmptyEntries).ToList(); foreach(DataGridViewRow row in dgvShop.Rows) { - if (string.IsNullOrEmpty(notes) || notesLst.Contains(row.Cells["colShopNotes"].Value.ParseToString()) && row.Cells["colShopName"].Value.ParseToString().Contains(shopName)) + if ((string.IsNullOrEmpty(notes) || notesLst.Contains(row.Cells["colShopNotes"].Value.ParseToString())) && row.Cells["colShopName"].Value.ParseToString().Contains(shopName)) { row.Visible = true; }