From 1b15eda63c069f8031e7cb6204be81ca0837e626 Mon Sep 17 00:00:00 2001 From: wule Date: Fri, 23 Jan 2026 19:09:56 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BE=9B=E5=BA=94=E5=95=86=E9=87=87=E9=9B=86?= =?UTF-8?q?=E7=9B=B8=E5=85=B3=E5=8A=9F=E8=83=BD=2010%?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../KJD_WebService/BLL/BXX/BXXUserManage.cs | 61 +++ .../KJD_WebService/BXXUserService.asmx.cs | 24 ++ TEMUKJD/BLL/JSTHttpResponseBLL.cs | 96 +++++ TEMUKJD/KJD.csproj | 10 + .../AdminForms/PDDAdminForm.Designer.cs | 38 +- TEMUKJD/PDDForms/AdminForms/PDDAdminForm.cs | 29 +- .../PDDDBProdListForm.Designer.cs | 1 + .../GetJuShuitanProdForm.Designer.cs | 372 ++++++++++++++++++ TEMUKJD/ToolForms/GetJuShuitanProdForm.cs | 162 ++++++++ TEMUKJD/ToolForms/GetJuShuitanProdForm.resx | 120 ++++++ .../WXDBProdUploadForm.Designer.cs | 62 +-- .../ProductForms/WXDBProdUploadForm.cs | 50 ++- 12 files changed, 963 insertions(+), 62 deletions(-) create mode 100644 TEMUKJD/BLL/JSTHttpResponseBLL.cs create mode 100644 TEMUKJD/ToolForms/GetJuShuitanProdForm.Designer.cs create mode 100644 TEMUKJD/ToolForms/GetJuShuitanProdForm.cs create mode 100644 TEMUKJD/ToolForms/GetJuShuitanProdForm.resx diff --git a/KJDService/KJD_WebService/BLL/BXX/BXXUserManage.cs b/KJDService/KJD_WebService/BLL/BXX/BXXUserManage.cs index 083ffbb..d8d17ef 100644 --- a/KJDService/KJD_WebService/BLL/BXX/BXXUserManage.cs +++ b/KJDService/KJD_WebService/BLL/BXX/BXXUserManage.cs @@ -466,5 +466,66 @@ namespace KJD_Web.BLL.BXX } return "{\"code\":19999,\"msg\":\"输入为空\"}"; } + + public string UpdateScm121Cookie(string inputData) + { + if (!string.IsNullOrEmpty(inputData)) + { + var id = (RegexUtils.GetStringQuery(ref inputData, "db_id")?.Replace("'", "\\'")).ParseToInt(); + if (id == 0) + id = 1; + var cookie = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "cookie"))?.Replace("'", "\\'"); + var time = RegexUtils.GetStringQuery(ref inputData, "time").ParseToInt(); + string time1 = RegexUtils.GetStringQuery(ref inputData, "code"); + if (time1 != EncrypUtil.Encryption(time)) + return "{\"code\":50000,\"msg\":\"校验失败\"}"; + + string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString; + MysqlUtils mySql = new MysqlUtils(conn); + string sql = "update bxx.scm121_user set cookie='" + cookie + "' WHERE id=" + id + ";"; + + var rst = mySql.ExecuteNonQuery(sql); + mySql.Close(); + if (rst && string.IsNullOrEmpty(mySql.Message)) + { + return "{\"code\":200,\"msg\":\"success\"}"; + } + if (!string.IsNullOrEmpty(mySql.Message)) + { + return "{\"code\":500,\"msg\":\"" + mySql.Message + "\"}"; + } + } + return "{\"code\":19999,\"msg\":\"输入为空\"}"; + } + + public string GetScm121Cookie(string inputData) + { + if (!string.IsNullOrEmpty(inputData)) + { + var id = (RegexUtils.GetStringQuery(ref inputData, "db_id")?.Replace("'", "\\'")).ParseToInt(); + if (id == 0) + id = 1; + var time = RegexUtils.GetStringQuery(ref inputData, "time").ParseToInt(); + string time1 = RegexUtils.GetStringQuery(ref inputData, "code"); + if (time1 != EncrypUtil.Encryption(time)) + return "{\"code\":50000,\"msg\":\"校验失败\"}"; + + string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString; + MysqlUtils mySql = new MysqlUtils(conn); + string sql = "select cookie from bxx.scm121_user WHERE id=" + id + ";"; + + var rst = mySql.ExecuteDataTableRow(sql); + mySql.Close(); + if (string.IsNullOrEmpty(mySql.Message)) + { + return "{\"code\":200,\"cookie\":" + rst["cookie"] + "}"; + } + if (!string.IsNullOrEmpty(mySql.Message)) + { + return "{\"code\":500,\"msg\":\"" + mySql.Message + "\"}"; + } + } + return "{\"code\":19999,\"msg\":\"输入为空\"}"; + } } } \ No newline at end of file diff --git a/KJDService/KJD_WebService/BXXUserService.asmx.cs b/KJDService/KJD_WebService/BXXUserService.asmx.cs index 6d1679a..3acee8e 100644 --- a/KJDService/KJD_WebService/BXXUserService.asmx.cs +++ b/KJDService/KJD_WebService/BXXUserService.asmx.cs @@ -173,5 +173,29 @@ namespace KJD_Web Context.Response.Write(result); Context.Response.End(); } + + [WebMethod] + public void update_scm121_cookie() + { + string jsontext = GetRequestJsonString(); + + var result = jsontext; + result = new BXXUserManage().UpdateScm121Cookie(jsontext); + + Context.Response.Write(result); + Context.Response.End(); + } + + [WebMethod] + public void get_scm121_cookie() + { + string jsontext = GetRequestJsonString(); + + var result = jsontext; + result = new BXXUserManage().GetScm121Cookie(jsontext); + + Context.Response.Write(result); + Context.Response.End(); + } } } diff --git a/TEMUKJD/BLL/JSTHttpResponseBLL.cs b/TEMUKJD/BLL/JSTHttpResponseBLL.cs new file mode 100644 index 0000000..014286a --- /dev/null +++ b/TEMUKJD/BLL/JSTHttpResponseBLL.cs @@ -0,0 +1,96 @@ +using AllBase; +using AllBase.Model.Result; +using NaiBa.Util.Extension; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Net; +using System.Text; +using System.Threading.Tasks; + +namespace TemuKJD.BLL +{ + public class JSTHttpResponseBLL + { + public static string WeiXinPostResponse(ShopLoginInfo shop, string _url, string _data, string referer) + { + string cookies = ""; + string Authorization = ""; + string gwfpArr = "0123456789abcdef"; + string gwfp = ""; + for (int i = 0; i < 32; i++) + { + gwfp += gwfpArr[Randomx.GetId(gwfpArr.Length)]; + } + try + { + var cookieLst = JsonHelper.DeserializeJsonToList(shop?.Cookies.ParseToString()); + if (cookieLst == null) + cookieLst = new List(); + foreach (var cook in cookieLst) + { + cookies += cook.Name + "=" + cook.Value + ";"; + if (cook.Name == "DISTRYBUTION_TOKEN") + Authorization = cook.Value; + } + } + catch { } + + HttpWebResponse response = null; + string result; + try + { + string url = _url; + HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); + + request.KeepAlive = true; + request.Headers.Add("sec-ch-ua-platform", @"""Windows"""); + request.Headers.Set(HttpRequestHeader.Authorization, Authorization); //"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1aWQiOiIyMDgxMjU3OCIsInJvbGVJZHMiOltdLCJ1c2VyX25hbWUiOiIxODEzMzYzMjE0NSIsImNvSWQiOiIxNDc5MTQ3NyIsImV4cGlyYXRpb24iOjE3NzAwMDE4ODcwOTgsInVzZXIiOnsiY29JZCI6IjE0NzkxNDc3IiwiY29OYW1lIjoi6YOR5bee6ICA6Ziz572R57uc5pyJ6ZmQ5YWs5Y-4IiwibG9naW5OYW1lIjoiMTgxMzM2MzIxNDUiLCJsb2dpbldheSI6IlVTRVJOQU1FIiwibmlja05hbWUiOiLogIHpqawiLCJyb2xlSWRzIjoiMTEsMTIsMTMsMTQsMTUsMTYsMTcsMTgsMjIsMjMsMjcsMjgsMjksMzAsMzEsMzIsMzMsMzQsMzUsMzYsMzksNDAsNDEsNTIsNTMsNTQsNjEsNjIsNjMsNjQsNjUsNjYsNzAsNzEsNzIsNzMsNzYsOTAsMTAxLDEwMiwxMDMsMTA0LDEwNSwxMDYsMTA3LDEwOCwxMDkiLCJ1aWQiOiIyMDgxMjU3OCJ9LCJhdXRob3JpdGllcyI6WyJKU1QtY2hhbm5lbCIsIm11bHRpTG9naW4iLCJKU1Qtc3VwcGxpZXIiXSwiY2xpZW50X2lkIjoicGMiLCJqdGkiOiJlNGFhYjhiMi01MGM3LTQ2OGQtODQ2Zi03YWM1MzFkYjdkM2UiLCJleHAiOjE3NzAwMDE4ODd9.t-OXhlZVX-zXf0SLbavN7NS6LxOPQi5js2g1ArLzOT8"); + request.Headers.Add("gwfp", gwfp); //@"20b34e80784f89c9ab8ebb9344fbc253"); + request.Headers.Add("sec-ch-ua", @"""Google Chrome"";v=""143"", ""Chromium"";v=""143"", ""Not A(Brand"";v=""24"""); + request.Headers.Add("sec-ch-ua-mobile", @"?0"); + request.Headers.Add("App-Version", @"DLZ_20260122203449"); + request.Headers.Add("Source", @"CHANNEL"); + request.UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/143.0.0.0 Safari/537.36"; + request.Headers.Add("appCode", @"pinpai.scm121.com"); + request.Accept = "*/*"; + request.Headers.Add("Sec-Fetch-Site", @"same-origin"); + request.Headers.Add("Sec-Fetch-Mode", @"cors"); + request.Headers.Add("Sec-Fetch-Dest", @"empty"); + request.Referer = referer; + request.Headers.Set(HttpRequestHeader.AcceptEncoding, "gzip, deflate, br, zstd"); + request.Headers.Set(HttpRequestHeader.AcceptLanguage, "zh-CN,zh;q=0.9"); + + request.Method = "POST"; + request.ServicePoint.Expect100Continue = false; + + string body = _data; + byte[] postBytes = System.Text.Encoding.UTF8.GetBytes(body); + request.ContentLength = postBytes.Length; + Stream stream = request.GetRequestStream(); + stream.Write(postBytes, 0, postBytes.Length); + stream.Close(); + + response = (HttpWebResponse)request.GetResponse(); + } + catch (WebException ex) + { + if (ex.Status == WebExceptionStatus.ProtocolError) + { + response = (HttpWebResponse)ex.Response; + result = GetProxyHtml.ReadResponse(response); + return result; + } + else return ex.Message; + } + catch (Exception e) + { + if (response != null) response.Close(); + return e.Message; + } + result = GetProxyHtml.ReadResponse(response); + return result; + } + } +} diff --git a/TEMUKJD/KJD.csproj b/TEMUKJD/KJD.csproj index dc1478d..e98c642 100644 --- a/TEMUKJD/KJD.csproj +++ b/TEMUKJD/KJD.csproj @@ -121,6 +121,7 @@ BaseTalkForm.cs + @@ -133,6 +134,12 @@ ChangeForm.cs + + Form + + + GetJuShuitanProdForm.cs + Form @@ -1032,6 +1039,9 @@ ChangeForm.cs + + GetJuShuitanProdForm.cs + WXAdminShopListForm.cs diff --git a/TEMUKJD/PDDForms/AdminForms/PDDAdminForm.Designer.cs b/TEMUKJD/PDDForms/AdminForms/PDDAdminForm.Designer.cs index baff24c..5b567ea 100644 --- a/TEMUKJD/PDDForms/AdminForms/PDDAdminForm.Designer.cs +++ b/TEMUKJD/PDDForms/AdminForms/PDDAdminForm.Designer.cs @@ -33,11 +33,12 @@ System.Windows.Forms.TreeNode treeNode3 = new System.Windows.Forms.TreeNode("产品数据库"); System.Windows.Forms.TreeNode treeNode4 = new System.Windows.Forms.TreeNode("SKU替换图"); System.Windows.Forms.TreeNode treeNode5 = new System.Windows.Forms.TreeNode("机会商品采集"); - System.Windows.Forms.TreeNode treeNode6 = new System.Windows.Forms.TreeNode("选品加价管理"); - System.Windows.Forms.TreeNode treeNode7 = new System.Windows.Forms.TreeNode("认领待上传"); - System.Windows.Forms.TreeNode treeNode8 = new System.Windows.Forms.TreeNode("库存上传"); - System.Windows.Forms.TreeNode treeNode9 = new System.Windows.Forms.TreeNode("商品核价"); - System.Windows.Forms.TreeNode treeNode10 = new System.Windows.Forms.TreeNode("超级权限管理", new System.Windows.Forms.TreeNode[] { + System.Windows.Forms.TreeNode treeNode6 = new System.Windows.Forms.TreeNode("厂家商品采集"); + System.Windows.Forms.TreeNode treeNode7 = new System.Windows.Forms.TreeNode("选品加价管理"); + System.Windows.Forms.TreeNode treeNode8 = new System.Windows.Forms.TreeNode("认领待上传"); + System.Windows.Forms.TreeNode treeNode9 = new System.Windows.Forms.TreeNode("库存上传"); + System.Windows.Forms.TreeNode treeNode10 = new System.Windows.Forms.TreeNode("商品核价"); + System.Windows.Forms.TreeNode treeNode11 = new System.Windows.Forms.TreeNode("超级权限管理", new System.Windows.Forms.TreeNode[] { treeNode1, treeNode2, treeNode3, @@ -46,7 +47,8 @@ treeNode6, treeNode7, treeNode8, - treeNode9}); + treeNode9, + treeNode10}); this.panel1 = new System.Windows.Forms.Panel(); this.panel3 = new System.Windows.Forms.Panel(); this.panel2 = new System.Windows.Forms.Panel(); @@ -147,18 +149,20 @@ treeNode4.Text = "SKU替换图"; treeNode5.Name = "机会商品采集"; treeNode5.Text = "机会商品采集"; - treeNode6.Name = "选品加价管理"; - treeNode6.Text = "选品加价管理"; - treeNode7.Name = "认领待上传"; - treeNode7.Text = "认领待上传"; - treeNode8.Name = "库存上传"; - treeNode8.Text = "库存上传"; - treeNode9.Name = "商品核价"; - treeNode9.Text = "商品核价"; - treeNode10.Name = "超级权限管理"; - treeNode10.Text = "超级权限管理"; + treeNode6.Name = "厂家商品采集"; + treeNode6.Text = "厂家商品采集"; + treeNode7.Name = "选品加价管理"; + treeNode7.Text = "选品加价管理"; + treeNode8.Name = "认领待上传"; + treeNode8.Text = "认领待上传"; + treeNode9.Name = "库存上传"; + treeNode9.Text = "库存上传"; + treeNode10.Name = "商品核价"; + treeNode10.Text = "商品核价"; + treeNode11.Name = "超级权限管理"; + treeNode11.Text = "超级权限管理"; this.tv.Nodes.AddRange(new System.Windows.Forms.TreeNode[] { - treeNode10}); + treeNode11}); this.tv.OverForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235))))); this.tv.Size = new System.Drawing.Size(140, 446); this.tv.TabIndex = 1; diff --git a/TEMUKJD/PDDForms/AdminForms/PDDAdminForm.cs b/TEMUKJD/PDDForms/AdminForms/PDDAdminForm.cs index 8eb498e..350026f 100644 --- a/TEMUKJD/PDDForms/AdminForms/PDDAdminForm.cs +++ b/TEMUKJD/PDDForms/AdminForms/PDDAdminForm.cs @@ -11,6 +11,7 @@ using System.Threading.Tasks; using System.Windows.Forms; using TemuKJD.BaseForms; using TemuKJD.PDDForms.ProductSelectForms; +using TemuKJD.ToolForms; //using TemuKJD.KJDForms.ProductSelectForms; //using TemuKJD.KJDForms.ProductThirdSelectForms; @@ -23,6 +24,7 @@ namespace TemuKJD.PDDForms.AdminForms public Lazy dbProdListForm = new Lazy(); public Lazy dbProdImgListForm = new Lazy(); public Lazy getChanceProdForm = new Lazy(); + public Lazy getJuShuitanProdForm = new Lazy(); //public Lazy dbPriceMarkUpForm = new Lazy(); //public Lazy dbProductSelectListManageForm = new Lazy(); //public Lazy productThirdSelectListManageForm = new Lazy(); @@ -93,18 +95,21 @@ namespace TemuKJD.PDDForms.AdminForms case "机会商品采集": SetForm(getChanceProdForm.Value); break; - //case "选品加价管理": - // SetForm(dbPriceMarkUpForm.Value); - // break; - //case "认领上传": - // SetForm(dbProductSelectListManageForm.Value); - // break; - //case "库存上传": - // SetForm(productThirdSelectListManageForm.Value); - // break; - //case "商品核价": - // SetForm(adminProductPriceCheckForm.Value); - // break; + case "厂家商品采集": + SetForm(getJuShuitanProdForm.Value); + break; + //case "选品加价管理": + // SetForm(dbPriceMarkUpForm.Value); + // break; + //case "认领上传": + // SetForm(dbProductSelectListManageForm.Value); + // break; + //case "库存上传": + // SetForm(productThirdSelectListManageForm.Value); + // break; + //case "商品核价": + // SetForm(adminProductPriceCheckForm.Value); + // break; } //})); //}).Start(); diff --git a/TEMUKJD/PDDForms/ProductSelectForms/PDDDBProdListForm.Designer.cs b/TEMUKJD/PDDForms/ProductSelectForms/PDDDBProdListForm.Designer.cs index c0af985..cb8a368 100644 --- a/TEMUKJD/PDDForms/ProductSelectForms/PDDDBProdListForm.Designer.cs +++ b/TEMUKJD/PDDForms/ProductSelectForms/PDDDBProdListForm.Designer.cs @@ -385,6 +385,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms this.cmbSourceType.Items.AddRange(new object[] { "", "母店采集", + "厂商直采", "机会商品", "外部数据"}); this.cmbSourceType.Location = new System.Drawing.Point(300, 43); diff --git a/TEMUKJD/ToolForms/GetJuShuitanProdForm.Designer.cs b/TEMUKJD/ToolForms/GetJuShuitanProdForm.Designer.cs new file mode 100644 index 0000000..47eb54d --- /dev/null +++ b/TEMUKJD/ToolForms/GetJuShuitanProdForm.Designer.cs @@ -0,0 +1,372 @@ + +namespace TemuKJD.ToolForms +{ + partial class GetJuShuitanProdForm + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.tabControl1 = new System.Windows.Forms.TabControl(); + this.tabPage1 = new System.Windows.Forms.TabPage(); + 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.splitContainer1 = new System.Windows.Forms.SplitContainer(); + this.pnlMultiLogin = new System.Windows.Forms.Panel(); + this.cmbMultiCookieName = new DevComponents.DotNetBar.Controls.ComboBoxEx(); + this.btnMultiLogin = new DevComponents.DotNetBar.PanelEx(); + this.btnDel = new DevComponents.DotNetBar.PanelEx(); + this.btnRefreshCookie = new DevComponents.DotNetBar.PanelEx(); + this.txtCookie = new System.Windows.Forms.TextBox(); + this.btnSaveCookie = new DevComponents.DotNetBar.PanelEx(); + this.btnImportCookie = new DevComponents.DotNetBar.PanelEx(); + this.tabPage2 = new System.Windows.Forms.TabPage(); + this.tabControl1.SuspendLayout(); + this.tabPage1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).BeginInit(); + this.splitContainer2.Panel1.SuspendLayout(); + this.splitContainer2.Panel2.SuspendLayout(); + this.splitContainer2.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); + this.splitContainer1.Panel1.SuspendLayout(); + this.splitContainer1.Panel2.SuspendLayout(); + this.splitContainer1.SuspendLayout(); + this.pnlMultiLogin.SuspendLayout(); + this.SuspendLayout(); + // + // tabControl1 + // + this.tabControl1.Controls.Add(this.tabPage1); + this.tabControl1.Controls.Add(this.tabPage2); + this.tabControl1.Dock = System.Windows.Forms.DockStyle.Fill; + this.tabControl1.Location = new System.Drawing.Point(0, 0); + this.tabControl1.Name = "tabControl1"; + this.tabControl1.SelectedIndex = 0; + this.tabControl1.Size = new System.Drawing.Size(1109, 558); + this.tabControl1.TabIndex = 0; + // + // tabPage1 + // + this.tabPage1.Controls.Add(this.splitContainer2); + this.tabPage1.Location = new System.Drawing.Point(4, 26); + this.tabPage1.Name = "tabPage1"; + this.tabPage1.Padding = new System.Windows.Forms.Padding(3); + this.tabPage1.Size = new System.Drawing.Size(1101, 528); + this.tabPage1.TabIndex = 0; + this.tabPage1.Text = "商品页面"; + this.tabPage1.UseVisualStyleBackColor = true; + // + // splitContainer2 + // + this.splitContainer2.BackColor = System.Drawing.Color.White; + this.splitContainer2.Dock = System.Windows.Forms.DockStyle.Fill; + this.splitContainer2.FixedPanel = System.Windows.Forms.FixedPanel.Panel1; + this.splitContainer2.Location = new System.Drawing.Point(3, 3); + this.splitContainer2.Name = "splitContainer2"; + this.splitContainer2.Orientation = System.Windows.Forms.Orientation.Horizontal; + // + // splitContainer2.Panel1 + // + this.splitContainer2.Panel1.Controls.Add(this.btnNext); + this.splitContainer2.Panel1.Controls.Add(this.btnPrev); + this.splitContainer2.Panel1.Controls.Add(this.txtAddress); + // + // splitContainer2.Panel2 + // + this.splitContainer2.Panel2.Controls.Add(this.splitContainer1); + this.splitContainer2.Size = new System.Drawing.Size(1095, 522); + this.splitContainer2.SplitterDistance = 26; + this.splitContainer2.TabIndex = 6; + // + // btnNext + // + this.btnNext.Location = new System.Drawing.Point(35, 3); + this.btnNext.Name = "btnNext"; + this.btnNext.Size = new System.Drawing.Size(32, 23); + this.btnNext.TabIndex = 9; + this.btnNext.Text = "→"; + this.btnNext.UseVisualStyleBackColor = true; + // + // btnPrev + // + this.btnPrev.Location = new System.Drawing.Point(3, 3); + this.btnPrev.Name = "btnPrev"; + this.btnPrev.Size = new System.Drawing.Size(32, 23); + this.btnPrev.TabIndex = 8; + this.btnPrev.Text = "←"; + this.btnPrev.UseVisualStyleBackColor = true; + // + // txtAddress + // + this.txtAddress.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.txtAddress.Location = new System.Drawing.Point(68, 3); + this.txtAddress.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); + this.txtAddress.Name = "txtAddress"; + this.txtAddress.Size = new System.Drawing.Size(1024, 23); + this.txtAddress.TabIndex = 7; + // + // splitContainer1 + // + this.splitContainer1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224))))); + this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill; + this.splitContainer1.FixedPanel = System.Windows.Forms.FixedPanel.Panel2; + this.splitContainer1.Location = new System.Drawing.Point(0, 0); + this.splitContainer1.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); + this.splitContainer1.Name = "splitContainer1"; + this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal; + // + // splitContainer1.Panel1 + // + this.splitContainer1.Panel1.Controls.Add(this.pnlMultiLogin); + // + // splitContainer1.Panel2 + // + this.splitContainer1.Panel2.BackColor = System.Drawing.Color.White; + this.splitContainer1.Panel2.Controls.Add(this.btnRefreshCookie); + this.splitContainer1.Panel2.Controls.Add(this.txtCookie); + this.splitContainer1.Panel2.Controls.Add(this.btnSaveCookie); + this.splitContainer1.Panel2.Controls.Add(this.btnImportCookie); + this.splitContainer1.Size = new System.Drawing.Size(1095, 492); + this.splitContainer1.SplitterDistance = 400; + this.splitContainer1.SplitterWidth = 3; + this.splitContainer1.TabIndex = 4; + // + // pnlMultiLogin + // + this.pnlMultiLogin.Controls.Add(this.cmbMultiCookieName); + this.pnlMultiLogin.Controls.Add(this.btnMultiLogin); + this.pnlMultiLogin.Controls.Add(this.btnDel); + this.pnlMultiLogin.Location = new System.Drawing.Point(5, 634); + this.pnlMultiLogin.Name = "pnlMultiLogin"; + this.pnlMultiLogin.Size = new System.Drawing.Size(251, 31); + this.pnlMultiLogin.TabIndex = 461; + this.pnlMultiLogin.Visible = false; + // + // cmbMultiCookieName + // + this.cmbMultiCookieName.DisplayMember = "Text"; + this.cmbMultiCookieName.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed; + this.cmbMultiCookieName.FormattingEnabled = true; + this.cmbMultiCookieName.ItemHeight = 18; + this.cmbMultiCookieName.Location = new System.Drawing.Point(3, 3); + this.cmbMultiCookieName.Name = "cmbMultiCookieName"; + this.cmbMultiCookieName.Size = new System.Drawing.Size(158, 24); + this.cmbMultiCookieName.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; + this.cmbMultiCookieName.TabIndex = 379; + this.cmbMultiCookieName.Text = "cookie1"; + // + // btnMultiLogin + // + this.btnMultiLogin.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.btnMultiLogin.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; + this.btnMultiLogin.Cursor = System.Windows.Forms.Cursors.Hand; + this.btnMultiLogin.DisabledBackColor = System.Drawing.Color.Empty; + this.btnMultiLogin.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.btnMultiLogin.Location = new System.Drawing.Point(185, 3); + this.btnMultiLogin.Name = "btnMultiLogin"; + this.btnMultiLogin.Size = new System.Drawing.Size(60, 24); + this.btnMultiLogin.Style.Alignment = System.Drawing.StringAlignment.Center; + this.btnMultiLogin.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); + this.btnMultiLogin.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); + this.btnMultiLogin.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder; + this.btnMultiLogin.Style.BorderDashStyle = System.Drawing.Drawing2D.DashStyle.Dash; + this.btnMultiLogin.Style.BorderSide = DevComponents.DotNetBar.eBorderSide.None; + this.btnMultiLogin.Style.ForeColor.Color = System.Drawing.Color.White; + this.btnMultiLogin.Style.GradientAngle = 90; + this.btnMultiLogin.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center; + this.btnMultiLogin.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255))))); + this.btnMultiLogin.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255))))); + this.btnMultiLogin.TabIndex = 460; + this.btnMultiLogin.Text = "多重登录"; + // + // btnDel + // + this.btnDel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.btnDel.CanvasColor = System.Drawing.SystemColors.Control; + this.btnDel.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; + this.btnDel.DisabledBackColor = System.Drawing.Color.Empty; + this.btnDel.Location = new System.Drawing.Point(163, 3); + this.btnDel.Name = "btnDel"; + this.btnDel.Size = new System.Drawing.Size(20, 24); + this.btnDel.Style.Alignment = System.Drawing.StringAlignment.Center; + this.btnDel.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(185)))), ((int)(((byte)(215)))), ((int)(((byte)(255))))); + this.btnDel.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(185)))), ((int)(((byte)(215)))), ((int)(((byte)(255))))); + this.btnDel.Style.Border = DevComponents.DotNetBar.eBorderType.SingleLine; + this.btnDel.Style.BorderColor.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); + this.btnDel.Style.ForeColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelText; + this.btnDel.Style.GradientAngle = 90; + this.btnDel.StyleMouseDown.Alignment = System.Drawing.StringAlignment.Center; + this.btnDel.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center; + this.btnDel.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); + this.btnDel.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); + this.btnDel.StyleMouseOver.ForeColor.Color = System.Drawing.Color.White; + this.btnDel.TabIndex = 409; + this.btnDel.Text = "删"; + // + // btnRefreshCookie + // + this.btnRefreshCookie.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.btnRefreshCookie.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; + this.btnRefreshCookie.Cursor = System.Windows.Forms.Cursors.Hand; + this.btnRefreshCookie.DisabledBackColor = System.Drawing.Color.Empty; + this.btnRefreshCookie.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.btnRefreshCookie.Location = new System.Drawing.Point(970, 3); + this.btnRefreshCookie.Name = "btnRefreshCookie"; + this.btnRefreshCookie.Size = new System.Drawing.Size(125, 25); + this.btnRefreshCookie.Style.Alignment = System.Drawing.StringAlignment.Center; + this.btnRefreshCookie.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); + this.btnRefreshCookie.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); + this.btnRefreshCookie.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder; + this.btnRefreshCookie.Style.BorderDashStyle = System.Drawing.Drawing2D.DashStyle.Dash; + this.btnRefreshCookie.Style.BorderSide = DevComponents.DotNetBar.eBorderSide.None; + this.btnRefreshCookie.Style.ForeColor.Color = System.Drawing.Color.White; + this.btnRefreshCookie.Style.GradientAngle = 90; + this.btnRefreshCookie.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center; + this.btnRefreshCookie.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255))))); + this.btnRefreshCookie.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255))))); + this.btnRefreshCookie.TabIndex = 776; + this.btnRefreshCookie.Text = "刷新cookie"; + this.btnRefreshCookie.Click += new System.EventHandler(this.btnRefreshCookie_Click); + // + // txtCookie + // + this.txtCookie.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.txtCookie.Location = new System.Drawing.Point(0, 4); + this.txtCookie.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); + this.txtCookie.Multiline = true; + this.txtCookie.Name = "txtCookie"; + this.txtCookie.Size = new System.Drawing.Size(711, 104); + this.txtCookie.TabIndex = 766; + // + // btnSaveCookie + // + this.btnSaveCookie.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.btnSaveCookie.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; + this.btnSaveCookie.Cursor = System.Windows.Forms.Cursors.Hand; + this.btnSaveCookie.DisabledBackColor = System.Drawing.Color.Empty; + this.btnSaveCookie.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.btnSaveCookie.Location = new System.Drawing.Point(842, 3); + this.btnSaveCookie.Name = "btnSaveCookie"; + this.btnSaveCookie.Size = new System.Drawing.Size(125, 25); + this.btnSaveCookie.Style.Alignment = System.Drawing.StringAlignment.Center; + this.btnSaveCookie.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); + this.btnSaveCookie.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); + this.btnSaveCookie.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder; + this.btnSaveCookie.Style.BorderDashStyle = System.Drawing.Drawing2D.DashStyle.Dash; + this.btnSaveCookie.Style.BorderSide = DevComponents.DotNetBar.eBorderSide.None; + this.btnSaveCookie.Style.ForeColor.Color = System.Drawing.Color.White; + this.btnSaveCookie.Style.GradientAngle = 90; + this.btnSaveCookie.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center; + this.btnSaveCookie.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255))))); + this.btnSaveCookie.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255))))); + this.btnSaveCookie.TabIndex = 765; + this.btnSaveCookie.Text = "保存网页cookie"; + this.btnSaveCookie.Click += new System.EventHandler(this.btnSaveCookie_Click); + // + // btnImportCookie + // + this.btnImportCookie.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.btnImportCookie.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; + this.btnImportCookie.Cursor = System.Windows.Forms.Cursors.Hand; + this.btnImportCookie.DisabledBackColor = System.Drawing.Color.Empty; + this.btnImportCookie.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.btnImportCookie.Location = new System.Drawing.Point(714, 3); + this.btnImportCookie.Name = "btnImportCookie"; + this.btnImportCookie.Size = new System.Drawing.Size(125, 25); + this.btnImportCookie.Style.Alignment = System.Drawing.StringAlignment.Center; + this.btnImportCookie.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); + this.btnImportCookie.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); + this.btnImportCookie.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder; + this.btnImportCookie.Style.BorderDashStyle = System.Drawing.Drawing2D.DashStyle.Dash; + this.btnImportCookie.Style.BorderSide = DevComponents.DotNetBar.eBorderSide.None; + this.btnImportCookie.Style.ForeColor.Color = System.Drawing.Color.White; + this.btnImportCookie.Style.GradientAngle = 90; + this.btnImportCookie.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center; + this.btnImportCookie.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255))))); + this.btnImportCookie.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255))))); + this.btnImportCookie.TabIndex = 761; + this.btnImportCookie.Text = "导入cookie并刷新"; + this.btnImportCookie.Click += new System.EventHandler(this.btnImportCookie_Click); + // + // tabPage2 + // + this.tabPage2.Location = new System.Drawing.Point(4, 22); + this.tabPage2.Name = "tabPage2"; + this.tabPage2.Padding = new System.Windows.Forms.Padding(3); + this.tabPage2.Size = new System.Drawing.Size(1101, 532); + this.tabPage2.TabIndex = 1; + this.tabPage2.Text = "商品列表"; + this.tabPage2.UseVisualStyleBackColor = true; + // + // GetJuShuitanProdForm + // + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; + this.ClientSize = new System.Drawing.Size(1109, 558); + this.Controls.Add(this.tabControl1); + this.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.Name = "GetJuShuitanProdForm"; + this.Text = "获取厂商产品"; + this.Load += new System.EventHandler(this.GetJuShuitanProdForm_Load); + this.tabControl1.ResumeLayout(false); + this.tabPage1.ResumeLayout(false); + 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.splitContainer1.Panel1.ResumeLayout(false); + this.splitContainer1.Panel2.ResumeLayout(false); + this.splitContainer1.Panel2.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit(); + this.splitContainer1.ResumeLayout(false); + this.pnlMultiLogin.ResumeLayout(false); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.TabControl tabControl1; + private System.Windows.Forms.TabPage tabPage1; + private System.Windows.Forms.TabPage tabPage2; + private System.Windows.Forms.SplitContainer splitContainer2; + private System.Windows.Forms.Button btnNext; + private System.Windows.Forms.Button btnPrev; + private System.Windows.Forms.TextBox txtAddress; + private System.Windows.Forms.SplitContainer splitContainer1; + private System.Windows.Forms.Panel pnlMultiLogin; + private DevComponents.DotNetBar.Controls.ComboBoxEx cmbMultiCookieName; + private DevComponents.DotNetBar.PanelEx btnMultiLogin; + private DevComponents.DotNetBar.PanelEx btnDel; + private System.Windows.Forms.TextBox txtCookie; + private DevComponents.DotNetBar.PanelEx btnSaveCookie; + private DevComponents.DotNetBar.PanelEx btnImportCookie; + private DevComponents.DotNetBar.PanelEx btnRefreshCookie; + } +} \ No newline at end of file diff --git a/TEMUKJD/ToolForms/GetJuShuitanProdForm.cs b/TEMUKJD/ToolForms/GetJuShuitanProdForm.cs new file mode 100644 index 0000000..5ec571a --- /dev/null +++ b/TEMUKJD/ToolForms/GetJuShuitanProdForm.cs @@ -0,0 +1,162 @@ +using AllBase; +using CefSharp; +using CefSharp.WinForms; +using NaiBa.CefHelper; +using NaiBa.CefHelper.Handler; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using System.Windows.Forms; +using TemuKJD.BaseForms; +using TemuKJD.Helper; +using Work; + +namespace TemuKJD.ToolForms +{ + public partial class GetJuShuitanProdForm : BaseForms.BaseForm + { + string InitUrl = "https://sc.scm121.com/suppliersManage/suppliersList/onlineSuppliers"; + public ChromiumWebBrowser cefWebBrowser = null; + private string currentUrl = ""; + + public GetJuShuitanProdForm() + { + InitializeComponent(); + } + + private void GetJuShuitanProdForm_Load(object sender, EventArgs e) + { + InitCef(); + } + + void InitCef() + { + if (cefWebBrowser == null) + { + cefWebBrowser = CEFBrowser.CreateChromiumWebBrowser(InitUrl, false); + + CustomResourceRequestHandlerLocal resourceRequestHandler = new CustomResourceRequestHandlerLocal(); + resourceRequestHandler.ResourceLoadCompleteEvent += RequestHandler_ResourceLoadComplete; + resourceRequestHandler.BeforeResourceLoadEvent += RequestHandler_BeforeResourceLoad; + cefWebBrowser.RequestHandler = new CustomRequestHandler(resourceRequestHandler); + var lifeSapnHandler = new LifeSpanHandlerLocal(PopWindowType.SelfWindow); + cefWebBrowser.LifeSpanHandler = lifeSapnHandler; + cefWebBrowser.KeyboardHandler = new KeyboardHandler(); + cefWebBrowser.FrameLoadEnd += CefWebBrowser_FrameLoadEnd; + cefWebBrowser.AddressChanged += CefWebBrowser_AddressChanged; + cefWebBrowser.LoadError += CefWebBrowser_LoadError; + cefWebBrowser.Dock = DockStyle.Fill; + + + Invoke(new Action(() => + { + splitContainer1.Panel1.Controls.Add(cefWebBrowser); + //cefWebBrowser.Load(shopMainUrl); + })); + } + + Task.Run(() => + { + string serverCookie = ""; + var url = BaseClass.BuildObjString("user/get_scm121_cookie"); + var data = UserLogin.GetSignaturex(); + var result = GetHtml.PostUtf8(url, data); + if (!result.Contains("\"code\":200")) + result = GetHtml.PostUtf8(url, data); + + List cookieLst = new List(); + try + { + serverCookie = JsonHelper.SerializeObject(JsonHelper.JObjectParse(result)["cookie"]); + cookieLst = JsonHelper.DeserializeJsonToList(serverCookie); + if (cookieLst == null) + cookieLst = new List(); + } + catch + { + } + + + // cef138必须init后方可设置或删除cookie + while (!cefWebBrowser.IsBrowserInitialized || !cefWebBrowser.GetBrowser().MainFrame.IsValid) + Thread.Sleep(20); + CEFBrowser.DeleteCookie(cefWebBrowser.GetCookieManager(null)); + + //cef 138 如果没有设置RequestContext 可能为空,直接getCookieManager + //if (this.openType != EnumOpenType.login) + { + //var t = CEFBrowser.SetCookieAsync(JsonHelper.SerializeObject(cookieLst), cefWebBrowser.GetCookieManager(null)); + foreach (var cook in cookieLst) + { + var t = CEFBrowser.SetCookieAsync(cook.Domain.Trim('.'), cook.Name + "=" + cook.Value + ";", cefWebBrowser.GetCookieManager(null)); + t.Wait(5000); + } + } + cefWebBrowser.Load(InitUrl); + }); + } + private void CefWebBrowser_FrameLoadEnd(object sender, CefSharp.FrameLoadEndEventArgs e) + { + } + + private void RequestHandler_ResourceLoadComplete(object sender, string url, string postData, string responseData, IRequest request) + { + } + + private bool RequestHandler_BeforeResourceLoad(object sender, string url, string postData, IRequest request) + { + return false; + } + private void CefWebBrowser_AddressChanged(object sender, CefSharp.AddressChangedEventArgs e) + { + if (this.Created && !this.Disposing && !this.IsDisposed) + Invoke(new Action(() => + { + currentUrl = e.Address; + txtAddress.Text = e.Address; + })); + } + private void CefWebBrowser_LoadError(object sender, CefSharp.LoadErrorEventArgs e) + { + } + + private void btnImportCookie_Click(object sender, EventArgs e) + { + Task.Run(() => + { + var t = CEFBrowser.SetCookieAsync("scm121.com", txtCookie.Text, cefWebBrowser.GetCookieManager(null)); + t.Wait(5000); + cefWebBrowser.Load(InitUrl); + }); + } + + private void btnSaveCookie_Click(object sender, EventArgs e) + { + List cookieList = CEFBrowser.GetCookieList(".scm121.com", cefWebBrowser.GetCookieManager(null)); + + var url = BaseClass.BuildObjString("user/update_scm121_cookie"); + var data = UserLogin.GetSignaturex(); + data += "&cookie=" + GetHtml.UrlEncodeUtf8(JsonHelper.SerializeObject(cookieList)); + var result = GetHtml.PostUtf8(url, data); + if (!result.Contains("\"code\":200")) + result = GetHtml.PostUtf8(url, data); + + if (result.Contains("\"code\":200")) + BaseMsgForm.ShowInfo("保存成功"); + else + BaseMsgForm.ShowInfo("保存失败,请重试"); + } + + private void btnRefreshCookie_Click(object sender, EventArgs e) + { + //var result = GetHtml.PostUtf8("https://api.weixin.qq.com/shop/ec/basics/img/upload?access_token=100_Kn3u6mev0uip-WUPSgxXWHrHldjOP0Ewjw8n18LmGcq2pWbjn4BJukPkGZt0gzgJ1Hd6bRM2TXUDTEhwM7VULSl_P-pVHSVPHlE6ZvdXfD6djB1f2WEibY7jWaZLaD24cBUxLM-mSGxjR7i7IBBeAHDOHH&upload_type=http://img.alicdn.com/imgextra/i2/2215107627344/O1CN01eM6hZu247bV94MWKH_!!2215107627344.jpg&resp_type=1", ""); + // + } + } +} diff --git a/TEMUKJD/ToolForms/GetJuShuitanProdForm.resx b/TEMUKJD/ToolForms/GetJuShuitanProdForm.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/TEMUKJD/ToolForms/GetJuShuitanProdForm.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/TEMUKJD/WXForms/ProductForms/WXDBProdUploadForm.Designer.cs b/TEMUKJD/WXForms/ProductForms/WXDBProdUploadForm.Designer.cs index e8c3f1a..e6e8fcc 100644 --- a/TEMUKJD/WXForms/ProductForms/WXDBProdUploadForm.Designer.cs +++ b/TEMUKJD/WXForms/ProductForms/WXDBProdUploadForm.Designer.cs @@ -32,12 +32,12 @@ namespace TemuKJD.WXForms.ProductForms private void InitializeComponent() { this.components = new System.ComponentModel.Container(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle6 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle7 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle8 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle9 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle10 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle11 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle12 = new System.Windows.Forms.DataGridViewCellStyle(); this.splitContainer1 = new System.Windows.Forms.SplitContainer(); this.ucGroupBoxEx2 = new TemuKJD.UserComponent.UcGroupBoxEx(this.components); this.label18 = new System.Windows.Forms.Label(); @@ -798,6 +798,7 @@ namespace TemuKJD.WXForms.ProductForms this.cmbSourceType.Items.AddRange(new object[] { "", "店铺采集", + "厂商直采", "机会商品", "外部数据"}); this.cmbSourceType.Location = new System.Drawing.Point(36, 68); @@ -1123,19 +1124,19 @@ namespace TemuKJD.WXForms.ProductForms // this.dgvShop.AllowUserToAddRows = false; this.dgvShop.AllowUserToDeleteRows = false; - dataGridViewCellStyle1.BackColor = System.Drawing.Color.WhiteSmoke; - this.dgvShop.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1; + dataGridViewCellStyle7.BackColor = System.Drawing.Color.WhiteSmoke; + this.dgvShop.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle7; 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; + dataGridViewCellStyle8.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle8.BackColor = System.Drawing.SystemColors.Control; + dataGridViewCellStyle8.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + dataGridViewCellStyle8.ForeColor = System.Drawing.SystemColors.WindowText; + dataGridViewCellStyle8.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle8.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle8.WrapMode = System.Windows.Forms.DataGridViewTriState.False; + this.dgvShop.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle8; this.dgvShop.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.dgvShop.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.colSelect, @@ -1237,19 +1238,19 @@ namespace TemuKJD.WXForms.ProductForms // this.dgvSelectProduct.AllowUserToAddRows = false; this.dgvSelectProduct.AllowUserToDeleteRows = false; - dataGridViewCellStyle3.BackColor = System.Drawing.Color.WhiteSmoke; - this.dgvSelectProduct.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle3; + dataGridViewCellStyle9.BackColor = System.Drawing.Color.WhiteSmoke; + this.dgvSelectProduct.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle9; this.dgvSelectProduct.AutoRowNumber = true; this.dgvSelectProduct.BackgroundColor = System.Drawing.Color.White; this.dgvSelectProduct.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); - dataGridViewCellStyle4.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; - dataGridViewCellStyle4.BackColor = System.Drawing.SystemColors.Control; - dataGridViewCellStyle4.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - dataGridViewCellStyle4.ForeColor = System.Drawing.SystemColors.WindowText; - dataGridViewCellStyle4.SelectionBackColor = System.Drawing.SystemColors.Highlight; - dataGridViewCellStyle4.SelectionForeColor = System.Drawing.SystemColors.HighlightText; - dataGridViewCellStyle4.WrapMode = System.Windows.Forms.DataGridViewTriState.False; - this.dgvSelectProduct.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle4; + dataGridViewCellStyle10.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle10.BackColor = System.Drawing.SystemColors.Control; + dataGridViewCellStyle10.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + dataGridViewCellStyle10.ForeColor = System.Drawing.SystemColors.WindowText; + dataGridViewCellStyle10.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle10.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle10.WrapMode = System.Windows.Forms.DataGridViewTriState.False; + this.dgvSelectProduct.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle10; this.dgvSelectProduct.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.dgvSelectProduct.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.colCheck, @@ -1309,8 +1310,8 @@ namespace TemuKJD.WXForms.ProductForms // // colSupplierName // - dataGridViewCellStyle5.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.colSupplierName.DefaultCellStyle = dataGridViewCellStyle5; + dataGridViewCellStyle11.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.colSupplierName.DefaultCellStyle = dataGridViewCellStyle11; this.colSupplierName.Frozen = true; this.colSupplierName.HeaderText = "店铺名称"; this.colSupplierName.Name = "colSupplierName"; @@ -1388,8 +1389,8 @@ namespace TemuKJD.WXForms.ProductForms // // colProductName // - dataGridViewCellStyle6.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.colProductName.DefaultCellStyle = dataGridViewCellStyle6; + dataGridViewCellStyle12.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.colProductName.DefaultCellStyle = dataGridViewCellStyle12; this.colProductName.HeaderText = "商品标题"; this.colProductName.Name = "colProductName"; this.colProductName.ReadOnly = true; @@ -1633,7 +1634,6 @@ namespace TemuKJD.WXForms.ProductForms this.colOnSaleNum.HeaderText = "在售"; this.colOnSaleNum.Name = "colOnSaleNum"; this.colOnSaleNum.ReadOnly = true; - this.colOnSaleNum.Visible = false; this.colOnSaleNum.Width = 38; // // colRemaining diff --git a/TEMUKJD/WXForms/ProductForms/WXDBProdUploadForm.cs b/TEMUKJD/WXForms/ProductForms/WXDBProdUploadForm.cs index abc9f86..5f810db 100644 --- a/TEMUKJD/WXForms/ProductForms/WXDBProdUploadForm.cs +++ b/TEMUKJD/WXForms/ProductForms/WXDBProdUploadForm.cs @@ -265,8 +265,8 @@ namespace TemuKJD.WXForms.ProductForms private void btnRefreshShop_Click(object sender, EventArgs e) { pbLoadingShop.Visible = true; - RefreshShop(); RefreshDbProd(); + RefreshShop(); } private void UserSelectDbProductForm_VisibleChanged(object sender, EventArgs e) @@ -276,6 +276,25 @@ namespace TemuKJD.WXForms.ProductForms RefreshShop(); RefreshDbProd(); + if (!isInit) + { + Task.Run(() => + { + foreach (var shop in GlobalConfig.ShopLoginList) + { + //if (shop.LoginStatus == "登录成功") + //{ + // var rst = WXUpload.scanProductPreview(shop); + // if (!rst.Contains("\"code\":0") && !rst.Contains("\"success\":true")) + // { + // WXShopListForm.Instance.CheckShopLogin(new string[] { shop.LoginName }, false); + // } + //} + } + + }); + } + isInit = true; } } @@ -286,6 +305,10 @@ namespace TemuKJD.WXForms.ProductForms { PDDDBProdListForm.GetPDDProductGroup(cmbGroupFilter); // 同时刷新下商品分组 GetPddProductCate(); + Invoke(new Action(() => + { + pbLoadingShop.Visible = false; + })); }); } @@ -364,7 +387,8 @@ namespace TemuKJD.WXForms.ProductForms canUse, dicShopUpload.ContainsKey(shopEntity.ShopId) && dicShopUpload[shopEntity.ShopId].DicDayUploadCount.ContainsKey(day) ? dicShopUpload[shopEntity.ShopId].DicDayUploadCount[day] : 0, - 0, + dicShopUpload.ContainsKey(shopEntity.ShopId) && dicShopUpload[shopEntity.ShopId].OnSaleRefreshDay == DateTime.Now.ToString("yyyyMMdd").ParseToInt() ? + dicShopUpload[shopEntity.ShopId].OnSaleCount : 0, shopEntity.AddProductRemaining, string.Empty ); @@ -379,6 +403,10 @@ namespace TemuKJD.WXForms.ProductForms row.Cells["colLoginStatus"].Style.ForeColor = canUse ? Color.Green : Color.Red; row.Cells["colCanUse"].Value = canUse; row.Cells["colRemaining"].Value = shopEntity.AddProductRemaining; + row.Cells["colUploadCount"].Value = dicShopUpload.ContainsKey(shopEntity.ShopId) && dicShopUpload[shopEntity.ShopId].DicDayUploadCount.ContainsKey(day) ? + dicShopUpload[shopEntity.ShopId].DicDayUploadCount[day] : 0; + row.Cells["colOnSaleNum"].Value = dicShopUpload.ContainsKey(shopEntity.ShopId) && dicShopUpload[shopEntity.ShopId].OnSaleRefreshDay == DateTime.Now.ToString("yyyyMMdd").ParseToInt() ? + dicShopUpload[shopEntity.ShopId].OnSaleCount : 0; } } @@ -2891,6 +2919,24 @@ Content-Type: application/octet-stream var result = WXHttpResponseBLL.WeiXinPostResponse(shop, url, body, referer); return result; } + + /// + /// 商品列表 + /// + /// + /// + /// + /// + /// + public static string scanProductPreview(ShopLoginInfo shop, string status = "5", int pageNum = 1, int pageSize = 20) + { + string url = "https://store.weixin.qq.com/shop-faas/mmchannelstradeproductcore/cgi/goods/scanProductPreview?token=&lang=zh_CN"; + string referer = "https://store.weixin.qq.com/shop/goods/list?currentTab=PRODUCT_STATUS_ALL"; + string body = @"{""pageSize"":" + pageSize + @",""productStatus"":[-1],""productSource"":""[1,16,32]"",""searchSource"":1,""useNew"":true,""pageNum"":" + pageNum + + @",""status"":[" + status + @"]}"; + var result = WXHttpResponseBLL.WeiXinPostResponse(shop, url, body, referer); + return result; + } } public class AddPriceRule