diff --git a/AllBase/GetHtml.cs b/AllBase/GetHtml.cs index 4982ca2..6406e95 100644 --- a/AllBase/GetHtml.cs +++ b/AllBase/GetHtml.cs @@ -23,1136 +23,1136 @@ using System.Web; namespace AllBase { - public class GetHtml - { - /// - /// 加载远程图片 - /// - /// - /// - public static Image LoadImage(string url) - { - try - { - WebRequest webreq = WebRequest.Create(url); - WebResponse webres = webreq.GetResponse(); - Stream stream = webres.GetResponseStream(); - return Image.FromStream(stream); - } - catch - { - return null; - } - } + public class GetHtml + { + /// + /// 加载远程图片 + /// + /// + /// + public static Image LoadImage(string url) + { + try + { + WebRequest webreq = WebRequest.Create(url); + WebResponse webres = webreq.GetResponse(); + Stream stream = webres.GetResponseStream(); + return Image.FromStream(stream); + } + catch + { + return null; + } + } - /// - /// 读取网络图片转为Img以在DataGridView中显示,用于HttpWebRequest直接读取可能403的情况 - /// - /// - /// - /// - public static Image GetUrlImg(string imgUrl, out string rst) - { - rst = ""; - //return LoadImage(imgUrl); + /// + /// 读取网络图片转为Img以在DataGridView中显示,用于HttpWebRequest直接读取可能403的情况 + /// + /// + /// + /// + public static Image GetUrlImg(string imgUrl, out string rst) + { + rst = ""; + //return LoadImage(imgUrl); - if (imgUrl.Contains("wxapp") || imgUrl.Contains("mmecimage.cn")) - { - return ImageBuild.LoadBitmapLoadBitmipImageFromUrl(imgUrl, out rst); - } + if (imgUrl.Contains("wxapp") || imgUrl.Contains("mmecimage.cn")) + { + return ImageBuild.LoadBitmapLoadBitmipImageFromUrl(imgUrl, out rst); + } - Image image = null; - HttpWebResponse response = null; - try - { - HttpWebRequest request = (HttpWebRequest)WebRequest.Create(imgUrl); + Image image = null; + HttpWebResponse response = null; + try + { + HttpWebRequest request = (HttpWebRequest)WebRequest.Create(imgUrl); - request.KeepAlive = true; - request.Headers.Set(HttpRequestHeader.CacheControl, "max-age=0"); - request.Headers.Add("Upgrade-Insecure-Requests", @"1"); - request.UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36"; - request.Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7"; - request.Headers.Set(HttpRequestHeader.AcceptEncoding, "gzip, deflate"); - request.Headers.Set(HttpRequestHeader.AcceptLanguage, "zh-CN,zh;q=0.9"); - //request.IfModifiedSince = DateTime.Parse("Fri, 18 Jul 2025 06:00:49 GMT"); // 没改动不更新,CS程序无缓存不使用 + request.KeepAlive = true; + request.Headers.Set(HttpRequestHeader.CacheControl, "max-age=0"); + request.Headers.Add("Upgrade-Insecure-Requests", @"1"); + request.UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36"; + request.Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7"; + request.Headers.Set(HttpRequestHeader.AcceptEncoding, "gzip, deflate"); + request.Headers.Set(HttpRequestHeader.AcceptLanguage, "zh-CN,zh;q=0.9"); + //request.IfModifiedSince = DateTime.Parse("Fri, 18 Jul 2025 06:00:49 GMT"); // 没改动不更新,CS程序无缓存不使用 - response = (HttpWebResponse)request.GetResponse(); + response = (HttpWebResponse)request.GetResponse(); - using (Stream stream = response.GetResponseStream()) - { - image = Image.FromStream(stream); - } - } - catch (WebException ex) - { - if (ex.Status == WebExceptionStatus.ProtocolError) - { - response = (HttpWebResponse)ex.Response; - rst = GetProxyHtml.ReadResponse(response); - } - if (string.IsNullOrEmpty(rst)) - rst = ex.Message; - } - catch (Exception e) - { - rst = e.Message; - } - if (response != null) - { - response.Close(); - response.Dispose(); - } - return image; + using (Stream stream = response.GetResponseStream()) + { + image = Image.FromStream(stream); + } + } + catch (WebException ex) + { + if (ex.Status == WebExceptionStatus.ProtocolError) + { + response = (HttpWebResponse)ex.Response; + rst = GetProxyHtml.ReadResponse(response); + } + if (string.IsNullOrEmpty(rst)) + rst = ex.Message; + } + catch (Exception e) + { + rst = e.Message; + } + if (response != null) + { + response.Close(); + response.Dispose(); + } + return image; - //try - //{ - // if (!string.IsNullOrEmpty(prodSelect?.main_img)) - // { - // using (Stream stream = WebRequest.Create(prodSelect.main_img.Replace("https", "http")).GetResponse().GetResponseStream()) - // { - // image = Image.FromStream(stream); - // } - // } - //} - //catch (Exception ex) - //{ - //} - } + //try + //{ + // if (!string.IsNullOrEmpty(prodSelect?.main_img)) + // { + // using (Stream stream = WebRequest.Create(prodSelect.main_img.Replace("https", "http")).GetResponse().GetResponseStream()) + // { + // image = Image.FromStream(stream); + // } + // } + //} + //catch (Exception ex) + //{ + //} + } - public static Icon LoadIcon(string url) - { - try - { - Bitmap bmp = new Bitmap(LoadImage(url)); - IntPtr h = bmp.GetHicon(); - System.Drawing.Icon icon = System.Drawing.Icon.FromHandle(h); - DeleteObject(h); - return icon; - } - catch (Exception ex) - { - return null; - } - } - [DllImport("gdi32.dll")] - public static extern bool DeleteObject(IntPtr hObject); + public static Icon LoadIcon(string url) + { + try + { + Bitmap bmp = new Bitmap(LoadImage(url)); + IntPtr h = bmp.GetHicon(); + System.Drawing.Icon icon = System.Drawing.Icon.FromHandle(h); + DeleteObject(h); + return icon; + } + catch (Exception ex) + { + return null; + } + } + [DllImport("gdi32.dll")] + public static extern bool DeleteObject(IntPtr hObject); - /// - /// 代理抓取 - /// - /// - /// - public static string ByProxy(string url) - { - string html = "", newurl = GetProxyUrlx(url); - Random ro = new Random(); - int i = 0; - MultiThreadClient mc = new MultiThreadClient(); - ReTry: - html = mc.GetHtml(newurl); - if (IsError(ref html)) - { - Thread.Sleep(ro.Next(2000, 6000)); - if (i < 4) - { - i++; - goto ReTry; - } - newurl = GetProxyUrlx(url); - html = mc.GetHtml(newurl); - if (IsError(ref html)) - return mc.GetHtml(url); - return html; - } - Thread.Sleep(100 + BaseClass.WaitTime / 2 + ro.Next(BaseClass.WaitTime)); - Clear(ref html); - return html; - } - /// - /// 清理、处理代码 - /// - /// - private static void Clear(ref string html) - { - html = UrlDecode(html); - html = html.Replace("\\", ""); - } - /// - /// 是否错误 - /// - /// - /// - public static bool IsError(ref string html) - { - return String.IsNullOrEmpty(html) || html.Length < 100 || html.Contains("您的访问出错了") || - html.Contains("访问异常出错"); - } - /// - /// 获取代理地址 - /// - /// - /// - public static string GetProxyUrlx(string url) - { - if (String.IsNullOrEmpty(url)) - return null; - if (BaseClass.ProxyOut.Count == 0) - { - BaseClass.ViewCode += "代理异常"; - return url; - } - Random ra = new Random(); - string p = BaseClass.ProxyOut[ra.Next(BaseClass.ProxyOut.Count)]; - return "http://" + p + "/url=" + url.Replace(".google.", ".goo00gle.") - .Replace("?", "%3f").Replace("=", "%3d").Replace("&", "%26"); - } - /// - /// ascii码转译为汉字 - /// - /// 带ASCII码的字符串 - /// 还原字符串 - public static void AsciiToString(ref string temp) - { - if (String.IsNullOrEmpty(temp)) - return; - //return; - try - { - if (temp.Contains("&#")) - { - Regex reUnicode = new Regex(@"&#[x]([0-9A-Fa-f]{4,5});", RegexOptions.Compiled); - temp = reUnicode.Replace(temp, m => - { - short c; - if (Int16.TryParse(m.Groups[1].Value, NumberStyles.HexNumber, CultureInfo.InvariantCulture, out c)) - return "" + (char)c; - return m.Value; - }); - } - if (temp.Contains("\\u")) - { - Regex reUnicode = new Regex(@"\\u([0-9a-fA-F]{4,5})", RegexOptions.Compiled); - temp = reUnicode.Replace(temp, m => - { - short c; - if (Int16.TryParse(m.Groups[1].Value, NumberStyles.HexNumber, - CultureInfo.InvariantCulture, out c)) - return "" + (char)c; - return m.Value; - }); - } - } - catch - { - } - //string html = "´,´©,©>,>µ,µ®,®°,°¡,¡, »,»" + - // "¦,¦÷,÷¿,¿¬,¬§,§•,•½,½«,«¶,¶¨,¨" + - // "¸,¸¼,¼<,<±,±×,×¢,¢¾,¾¯,¯“,"" + - // "™,™€,€£,£¥,¥„,„…,…·,·›,›ª,ª" + - // "ˆ,ˆ“,“—,—’,’º,º†,†‹,‹–,–" + - // "‚,‚”,”‡,‡‘,‘‰,‰­,­˜,˜≈,≈" + - // "⁄,⁄←,←∂,∂♠,♠∩,∩≥,≥≤,≤″,″∑,∑♣,♣" + - // "↔,↔◊,◊′,′↑,↑↓,↓♥,♥−,−∏,∏‍,‍♦,♦" + - // "∞,∞≠,≠√,√‌,‌≡,≡∫,∫‾,‾→,→α,αη,η" + - // "μ,μπ,πθ,θβ,βγ,γν,νψ,ψυ,υχ,χι,ι" + - // "ω,ωρ,ρξ,ξδ,δκ,κο,οσ,σζ,ζε,ε" + - // "λ,λφ,φτ,τΑ,ΑΗ,ΗΜ,ΜΠ,ΠΘ,ΘΒ,ΒΓ,Γ" + - // "Ν,ΝΨ,ΨΥ,ΥΧ,ΧΙ,ΙΩ,ΩΡ,ΡΞ,ΞΔ,ΔΚ,Κ" + - // "Ο,ΟΣ,ΣΖ,ΖΕ,ΕΛ,ΛΦ,ΦΤ,Τς,ς&,&"; - //string[] h = html.Split(';'); - //string s1; - //string s2; - //foreach (string s in h) - //{ - // s2 = s.Substring(2, s.Length - 2) + ";"; - // if (!temp.Contains(s2)) - // continue; - // s1 = s.Substring(0, 1); - // temp = temp.Replace(s2, s1); - //} - //return temp; - } - /// - /// html解码,\u解码 - /// - /// - /// - public static string UrlDecode(string html) - { - if (html == null) - return html; + /// + /// 代理抓取 + /// + /// + /// + public static string ByProxy(string url) + { + string html = "", newurl = GetProxyUrlx(url); + Random ro = new Random(); + int i = 0; + MultiThreadClient mc = new MultiThreadClient(); + ReTry: + html = mc.GetHtml(newurl); + if (IsError(ref html)) + { + Thread.Sleep(ro.Next(2000, 6000)); + if (i < 4) + { + i++; + goto ReTry; + } + newurl = GetProxyUrlx(url); + html = mc.GetHtml(newurl); + if (IsError(ref html)) + return mc.GetHtml(url); + return html; + } + Thread.Sleep(100 + BaseClass.WaitTime / 2 + ro.Next(BaseClass.WaitTime)); + Clear(ref html); + return html; + } + /// + /// 清理、处理代码 + /// + /// + private static void Clear(ref string html) + { + html = UrlDecode(html); + html = html.Replace("\\", ""); + } + /// + /// 是否错误 + /// + /// + /// + public static bool IsError(ref string html) + { + return String.IsNullOrEmpty(html) || html.Length < 100 || html.Contains("您的访问出错了") || + html.Contains("访问异常出错"); + } + /// + /// 获取代理地址 + /// + /// + /// + public static string GetProxyUrlx(string url) + { + if (String.IsNullOrEmpty(url)) + return null; + if (BaseClass.ProxyOut.Count == 0) + { + BaseClass.ViewCode += "代理异常"; + return url; + } + Random ra = new Random(); + string p = BaseClass.ProxyOut[ra.Next(BaseClass.ProxyOut.Count)]; + return "http://" + p + "/url=" + url.Replace(".google.", ".goo00gle.") + .Replace("?", "%3f").Replace("=", "%3d").Replace("&", "%26"); + } + /// + /// ascii码转译为汉字 + /// + /// 带ASCII码的字符串 + /// 还原字符串 + public static void AsciiToString(ref string temp) + { + if (String.IsNullOrEmpty(temp)) + return; + //return; + try + { + if (temp.Contains("&#")) + { + Regex reUnicode = new Regex(@"&#[x]([0-9A-Fa-f]{4,5});", RegexOptions.Compiled); + temp = reUnicode.Replace(temp, m => + { + short c; + if (Int16.TryParse(m.Groups[1].Value, NumberStyles.HexNumber, CultureInfo.InvariantCulture, out c)) + return "" + (char)c; + return m.Value; + }); + } + if (temp.Contains("\\u")) + { + Regex reUnicode = new Regex(@"\\u([0-9a-fA-F]{4,5})", RegexOptions.Compiled); + temp = reUnicode.Replace(temp, m => + { + short c; + if (Int16.TryParse(m.Groups[1].Value, NumberStyles.HexNumber, + CultureInfo.InvariantCulture, out c)) + return "" + (char)c; + return m.Value; + }); + } + } + catch + { + } + //string html = "´,´©,©>,>µ,µ®,®°,°¡,¡, »,»" + + // "¦,¦÷,÷¿,¿¬,¬§,§•,•½,½«,«¶,¶¨,¨" + + // "¸,¸¼,¼<,<±,±×,×¢,¢¾,¾¯,¯“,"" + + // "™,™€,€£,£¥,¥„,„…,…·,·›,›ª,ª" + + // "ˆ,ˆ“,“—,—’,’º,º†,†‹,‹–,–" + + // "‚,‚”,”‡,‡‘,‘‰,‰­,­˜,˜≈,≈" + + // "⁄,⁄←,←∂,∂♠,♠∩,∩≥,≥≤,≤″,″∑,∑♣,♣" + + // "↔,↔◊,◊′,′↑,↑↓,↓♥,♥−,−∏,∏‍,‍♦,♦" + + // "∞,∞≠,≠√,√‌,‌≡,≡∫,∫‾,‾→,→α,αη,η" + + // "μ,μπ,πθ,θβ,βγ,γν,νψ,ψυ,υχ,χι,ι" + + // "ω,ωρ,ρξ,ξδ,δκ,κο,οσ,σζ,ζε,ε" + + // "λ,λφ,φτ,τΑ,ΑΗ,ΗΜ,ΜΠ,ΠΘ,ΘΒ,ΒΓ,Γ" + + // "Ν,ΝΨ,ΨΥ,ΥΧ,ΧΙ,ΙΩ,ΩΡ,ΡΞ,ΞΔ,ΔΚ,Κ" + + // "Ο,ΟΣ,ΣΖ,ΖΕ,ΕΛ,ΛΦ,ΦΤ,Τς,ς&,&"; + //string[] h = html.Split(';'); + //string s1; + //string s2; + //foreach (string s in h) + //{ + // s2 = s.Substring(2, s.Length - 2) + ";"; + // if (!temp.Contains(s2)) + // continue; + // s1 = s.Substring(0, 1); + // temp = temp.Replace(s2, s1); + //} + //return temp; + } + /// + /// html解码,\u解码 + /// + /// + /// + public static string UrlDecode(string html) + { + if (html == null) + return html; - string temp = HttpUtility.UrlDecode(html); - Regex reUnicode = new Regex(@"\\u([0-9a-fA-F]{4})", RegexOptions.Compiled); - return reUnicode.Replace(temp, m => - { - short c; - if (Int16.TryParse(m.Groups[1].Value, NumberStyles.HexNumber, CultureInfo.InvariantCulture, out c)) - return "" + (char)c; - return m.Value; - }); - } + string temp = HttpUtility.UrlDecode(html); + Regex reUnicode = new Regex(@"\\u([0-9a-fA-F]{4})", RegexOptions.Compiled); + return reUnicode.Replace(temp, m => + { + short c; + if (Int16.TryParse(m.Groups[1].Value, NumberStyles.HexNumber, CultureInfo.InvariantCulture, out c)) + return "" + (char)c; + return m.Value; + }); + } - /// - /// 本地+国内+美国 - /// - /// - /// - /// - public static string GetByMyself(string url, out bool isError, bool isServer) - { - MultiThreadClient mu = new MultiThreadClient(); - mu.TimeOut = isServer ? 40 : 20; - string Html = mu.GetHtml(url); - if (String.IsNullOrEmpty(Html) || mu.IsError) - Html = mu.GetHtml(ProxyIpInUrl(url)); - if (String.IsNullOrEmpty(Html) || mu.IsError) - Html = mu.GetHtml(ProxyIpOutUrl(url)); - if (String.IsNullOrEmpty(Html) || mu.IsError) - { - isError = true; - return null; - } - isError = false; - return Html; - } - /// - /// 国内+本地+美国 - /// - /// - /// - /// - public static string GetByIn(string url, out bool isError, bool isServer) - { - MultiThreadClient mu = new MultiThreadClient(); - mu.TimeOut = isServer ? 40 : 20; ; - string Html = mu.GetHtml(ProxyIpInUrl(url)); - if (String.IsNullOrEmpty(Html) || mu.IsError) - Html = mu.GetHtml(url); - if (String.IsNullOrEmpty(Html) || mu.IsError) - { - mu.TimeOut = 30; - Html = mu.GetHtml(ProxyIpOutUrl(url)); - } - if (String.IsNullOrEmpty(Html) || mu.IsError) - { - isError = true; - return null; - } - isError = false; - return Html; - } - /// - /// 国内+本地+美国 - /// - /// - /// - /// - public static string PostByIn(string url, out bool isError, bool isServer, string data) - { - MultiThreadClient mu = new MultiThreadClient(); - mu.TimeOut = isServer ? 40 : 20; ; - string Html = mu.GetHtml(ProxyIpInUrl(url), Encoding.UTF8.GetBytes(data)); - if (String.IsNullOrEmpty(Html) || mu.IsError) - Html = mu.GetHtml(url, Encoding.UTF8.GetBytes(data)); - if (String.IsNullOrEmpty(Html) || mu.IsError) - Html = mu.GetHtml(ProxyIpOutUrl(url), Encoding.UTF8.GetBytes(data)); - if (String.IsNullOrEmpty(Html) || mu.IsError) - { - isError = true; - return null; - } - isError = false; - return Html; - } - /// - /// 美国+国内+本地 - /// - /// - /// - /// - public static string GetByOut(string url, out bool isError, bool isServer) - { - MultiThreadClient mu = new MultiThreadClient(); - mu.TimeOut = isServer ? 60 : 30; ; - string Html = mu.GetHtml(ProxyIpOutUrl(url)); - if (String.IsNullOrEmpty(Html) || mu.IsError) - Html = mu.GetHtml(ProxyIpInUrl(url)); - if (String.IsNullOrEmpty(Html) || mu.IsError) - Html = mu.GetHtml(url); - if (String.IsNullOrEmpty(Html) || mu.IsError) - { - isError = true; - return null; - } - isError = false; - return Html; - } - /// - /// 美国服务器出口 - /// - /// - /// - public static string ByUsa(string url) - { - bool isError; - return ByUsa(url, out isError, false, false, false, false); - } - /// - /// 美国服务器出口 - /// - /// - /// - public static string ByUsa(string url, bool mobile) - { - bool isError; - return ByUsa(url, out isError, mobile, false, false, false); - } - /// - /// 美国服务器出口 - /// - /// - /// - public static string ByUsa(bool isUtf8, string url) - { - bool isError; - return ByUsa(url, out isError, false, false, isUtf8, false); - } - /// - /// 美国服务器出口 - /// - /// - /// - public static string ByUsa(string url, bool mobile, bool isGbk) - { - bool isError; - return ByUsa(url, out isError, mobile, isGbk, false, false); - } - /// - /// 美国服务器出口 - /// - /// - /// - public static string ByUsaWhoies(string domain) - { - bool isError; - return ByUsa(domain, out isError, false, false, false, true); - } + /// + /// 本地+国内+美国 + /// + /// + /// + /// + public static string GetByMyself(string url, out bool isError, bool isServer) + { + MultiThreadClient mu = new MultiThreadClient(); + mu.TimeOut = isServer ? 40 : 20; + string Html = mu.GetHtml(url); + if (String.IsNullOrEmpty(Html) || mu.IsError) + Html = mu.GetHtml(ProxyIpInUrl(url)); + if (String.IsNullOrEmpty(Html) || mu.IsError) + Html = mu.GetHtml(ProxyIpOutUrl(url)); + if (String.IsNullOrEmpty(Html) || mu.IsError) + { + isError = true; + return null; + } + isError = false; + return Html; + } + /// + /// 国内+本地+美国 + /// + /// + /// + /// + public static string GetByIn(string url, out bool isError, bool isServer) + { + MultiThreadClient mu = new MultiThreadClient(); + mu.TimeOut = isServer ? 40 : 20; ; + string Html = mu.GetHtml(ProxyIpInUrl(url)); + if (String.IsNullOrEmpty(Html) || mu.IsError) + Html = mu.GetHtml(url); + if (String.IsNullOrEmpty(Html) || mu.IsError) + { + mu.TimeOut = 30; + Html = mu.GetHtml(ProxyIpOutUrl(url)); + } + if (String.IsNullOrEmpty(Html) || mu.IsError) + { + isError = true; + return null; + } + isError = false; + return Html; + } + /// + /// 国内+本地+美国 + /// + /// + /// + /// + public static string PostByIn(string url, out bool isError, bool isServer, string data) + { + MultiThreadClient mu = new MultiThreadClient(); + mu.TimeOut = isServer ? 40 : 20; ; + string Html = mu.GetHtml(ProxyIpInUrl(url), Encoding.UTF8.GetBytes(data)); + if (String.IsNullOrEmpty(Html) || mu.IsError) + Html = mu.GetHtml(url, Encoding.UTF8.GetBytes(data)); + if (String.IsNullOrEmpty(Html) || mu.IsError) + Html = mu.GetHtml(ProxyIpOutUrl(url), Encoding.UTF8.GetBytes(data)); + if (String.IsNullOrEmpty(Html) || mu.IsError) + { + isError = true; + return null; + } + isError = false; + return Html; + } + /// + /// 美国+国内+本地 + /// + /// + /// + /// + public static string GetByOut(string url, out bool isError, bool isServer) + { + MultiThreadClient mu = new MultiThreadClient(); + mu.TimeOut = isServer ? 60 : 30; ; + string Html = mu.GetHtml(ProxyIpOutUrl(url)); + if (String.IsNullOrEmpty(Html) || mu.IsError) + Html = mu.GetHtml(ProxyIpInUrl(url)); + if (String.IsNullOrEmpty(Html) || mu.IsError) + Html = mu.GetHtml(url); + if (String.IsNullOrEmpty(Html) || mu.IsError) + { + isError = true; + return null; + } + isError = false; + return Html; + } + /// + /// 美国服务器出口 + /// + /// + /// + public static string ByUsa(string url) + { + bool isError; + return ByUsa(url, out isError, false, false, false, false); + } + /// + /// 美国服务器出口 + /// + /// + /// + public static string ByUsa(string url, bool mobile) + { + bool isError; + return ByUsa(url, out isError, mobile, false, false, false); + } + /// + /// 美国服务器出口 + /// + /// + /// + public static string ByUsa(bool isUtf8, string url) + { + bool isError; + return ByUsa(url, out isError, false, false, isUtf8, false); + } + /// + /// 美国服务器出口 + /// + /// + /// + public static string ByUsa(string url, bool mobile, bool isGbk) + { + bool isError; + return ByUsa(url, out isError, mobile, isGbk, false, false); + } + /// + /// 美国服务器出口 + /// + /// + /// + public static string ByUsaWhoies(string domain) + { + bool isError; + return ByUsa(domain, out isError, false, false, false, true); + } - /// - /// 美国服务器出口 - /// - /// - /// - /// - public static string ByUsa(string url, out bool isError, bool mobile, bool isGbk, bool isUtf8, bool isWhois) - { - MultiThreadClient mu = new MultiThreadClient(); - mu.TimeOut = 50; - mu.IsGbk = isGbk; - mu.IsUtf8 = isUtf8; - if (mobile) - mu.AddCookies = "Moblie"; - mu.IsWhoies = isWhois; - string Html = mu.GetHtml(GetProxyUrl(BaseClass.ProxyOut, url)); - if (String.IsNullOrEmpty(Html) || mu.IsError) - Html = mu.GetHtml(GetProxyUrl(BaseClass.ProxyOut, url)); - if (String.IsNullOrEmpty(Html) || mu.IsError) - { - isError = true; - return null; - } - isError = false; - return Html; - } + /// + /// 美国服务器出口 + /// + /// + /// + /// + public static string ByUsa(string url, out bool isError, bool mobile, bool isGbk, bool isUtf8, bool isWhois) + { + MultiThreadClient mu = new MultiThreadClient(); + mu.TimeOut = 50; + mu.IsGbk = isGbk; + mu.IsUtf8 = isUtf8; + if (mobile) + mu.AddCookies = "Moblie"; + mu.IsWhoies = isWhois; + string Html = mu.GetHtml(GetProxyUrl(BaseClass.ProxyOut, url)); + if (String.IsNullOrEmpty(Html) || mu.IsError) + Html = mu.GetHtml(GetProxyUrl(BaseClass.ProxyOut, url)); + if (String.IsNullOrEmpty(Html) || mu.IsError) + { + isError = true; + return null; + } + isError = false; + return Html; + } - /// - /// 局域网出口 - /// - /// - /// - /// - public static string ByLocation(string url) - { - MultiThreadClient mu = new MultiThreadClient(); - mu.TimeOut = 30; - string Html = mu.GetHtml(GetProxyUrl(BaseClass.ProxyIn, url)); - if (String.IsNullOrEmpty(Html) || mu.IsError) - Html = mu.GetHtml(GetProxyUrl(BaseClass.ProxyIn, url)); - if (String.IsNullOrEmpty(Html) || mu.IsError) - Html = mu.GetHtml(GetProxyUrl(BaseClass.ProxyIn, url)); - if (String.IsNullOrEmpty(Html) || mu.IsError) - { - return null; - } - return Html; - } + /// + /// 局域网出口 + /// + /// + /// + /// + public static string ByLocation(string url) + { + MultiThreadClient mu = new MultiThreadClient(); + mu.TimeOut = 30; + string Html = mu.GetHtml(GetProxyUrl(BaseClass.ProxyIn, url)); + if (String.IsNullOrEmpty(Html) || mu.IsError) + Html = mu.GetHtml(GetProxyUrl(BaseClass.ProxyIn, url)); + if (String.IsNullOrEmpty(Html) || mu.IsError) + Html = mu.GetHtml(GetProxyUrl(BaseClass.ProxyIn, url)); + if (String.IsNullOrEmpty(Html) || mu.IsError) + { + return null; + } + return Html; + } - /// - /// 远程下载文件 - /// - /// - /// - /// - public static bool ByUsaDownload(string url, string path) - { - string newUrl = GetProxyUrl(BaseClass.ProxyOut, url); - bool ok = DownloadFile(newUrl, path); - if (!ok) - DownloadFile(GetProxyUrl(BaseClass.ProxyOut, url), path); - if (!ok) - DownloadFile(GetProxyUrl(BaseClass.ProxyOut, url), path); - return ok; - } + /// + /// 远程下载文件 + /// + /// + /// + /// + public static bool ByUsaDownload(string url, string path) + { + string newUrl = GetProxyUrl(BaseClass.ProxyOut, url); + bool ok = DownloadFile(newUrl, path); + if (!ok) + DownloadFile(GetProxyUrl(BaseClass.ProxyOut, url), path); + if (!ok) + DownloadFile(GetProxyUrl(BaseClass.ProxyOut, url), path); + return ok; + } - /// - /// HTTPS专用出口 - /// - /// - /// - public static string ByHttps(string url) - { - bool isError; - return ByHttps(url, out isError, false); - } - /// - /// HTTPS专用出口 - /// - /// - /// - public static string ByHttps(string url, bool mobile) - { - bool isError; - return ByHttps(url, out isError, mobile); - } - /// - /// HTTPS专用出口 - /// - /// - /// - /// - public static string ByHttps(string url, out bool isError, bool mobile) - { - MultiThreadClient mu = new MultiThreadClient(); - mu.TimeOut = 60; - if (mobile) - mu.IsMoblie = true; - string urlx = GetProxyUrl(BaseClass.ProxyHttps, url); - string Html = mu.GetHtml(urlx); - if (String.IsNullOrEmpty(Html) || mu.IsError) - { - urlx = GetProxyUrl(BaseClass.ProxyHttps, url); - Html = mu.GetHtml(urlx); - } - if (String.IsNullOrEmpty(Html) || mu.IsError) - { - isError = true; - return null; - } - isError = false; - return Html; - } - /// - /// 转换URL - /// - /// - /// - /// - public static string GetProxyUrl(List ips, string url) - { - if (ips.Count == 0) - return url; - Random ra = new Random(Guid.NewGuid().GetHashCode()); - string ip = ips[ra.Next(ips.Count)]; + /// + /// HTTPS专用出口 + /// + /// + /// + public static string ByHttps(string url) + { + bool isError; + return ByHttps(url, out isError, false); + } + /// + /// HTTPS专用出口 + /// + /// + /// + public static string ByHttps(string url, bool mobile) + { + bool isError; + return ByHttps(url, out isError, mobile); + } + /// + /// HTTPS专用出口 + /// + /// + /// + /// + public static string ByHttps(string url, out bool isError, bool mobile) + { + MultiThreadClient mu = new MultiThreadClient(); + mu.TimeOut = 60; + if (mobile) + mu.IsMoblie = true; + string urlx = GetProxyUrl(BaseClass.ProxyHttps, url); + string Html = mu.GetHtml(urlx); + if (String.IsNullOrEmpty(Html) || mu.IsError) + { + urlx = GetProxyUrl(BaseClass.ProxyHttps, url); + Html = mu.GetHtml(urlx); + } + if (String.IsNullOrEmpty(Html) || mu.IsError) + { + isError = true; + return null; + } + isError = false; + return Html; + } + /// + /// 转换URL + /// + /// + /// + /// + public static string GetProxyUrl(List ips, string url) + { + if (ips.Count == 0) + return url; + Random ra = new Random(Guid.NewGuid().GetHashCode()); + string ip = ips[ra.Next(ips.Count)]; - return "http://" + (ip.Contains(":") ? ip : ip + ":6000") + "/url=" + ReplaceUrl(url); - } + return "http://" + (ip.Contains(":") ? ip : ip + ":6000") + "/url=" + ReplaceUrl(url); + } - /// - /// utf8 下载页面 - /// - /// - /// - public static string Utf8(string url) - { - if (String.IsNullOrEmpty(url)) - return ""; - try - { - WebClientx web = new WebClientx(); - web.Timeout = 60; - web.Headers.Add("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); - web.Headers.Add("Accept-Language", "zh-cn,zh;q=0.8,en-us;q=0.5,en;q=0.3"); - web.Headers.Add("User-Agent", "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0)"); - web.Proxy = null; - byte[] b = web.DownloadData(url); - return Encoding.UTF8.GetString(b); - } - catch - { - return ""; - } - } /// - /// utf8 下载页面 - /// - /// - /// - public static string Utf8(string url, int timeOut = 6) - { - if (String.IsNullOrEmpty(url)) - return ""; - try - { - WebClientx web = new WebClientx(); - web.Timeout = timeOut; - web.Headers.Add("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); - web.Headers.Add("Accept-Language", "zh-cn,zh;q=0.8,en-us;q=0.5,en;q=0.3"); - web.Headers.Add("User-Agent", "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0)"); - web.Proxy = null; - byte[] b = web.DownloadData(url); - return Encoding.UTF8.GetString(b); - } - catch - { - return ""; - } - } - /// - /// Whois 查询 - /// - /// - /// - public static string Whois(string url) - { - if (String.IsNullOrEmpty(url)) - return ""; - try - { - WebClientx web = new WebClientx(); - web.Timeout = 30; - web.Headers.Add("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); - web.Headers.Add("Accept-Language", "zh-cn,zh;q=0.8,en-us;q=0.5,en;q=0.3"); - web.Headers.Add("User-Agent", "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0)"); - web.Headers.Add("Add-Cookies", "whois"); - web.Proxy = null; - byte[] b = web.DownloadData(url); - return Encoding.UTF8.GetString(b); - } - catch - { - return ""; - } - } + /// + /// utf8 下载页面 + /// + /// + /// + public static string Utf8(string url) + { + if (String.IsNullOrEmpty(url)) + return ""; + try + { + WebClientx web = new WebClientx(); + web.Timeout = 60; + web.Headers.Add("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); + web.Headers.Add("Accept-Language", "zh-cn,zh;q=0.8,en-us;q=0.5,en;q=0.3"); + web.Headers.Add("User-Agent", "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0)"); + web.Proxy = null; + byte[] b = web.DownloadData(url); + return Encoding.UTF8.GetString(b); + } + catch + { + return ""; + } + } /// + /// utf8 下载页面 + /// + /// + /// + public static string Utf8(string url, int timeOut = 6) + { + if (String.IsNullOrEmpty(url)) + return ""; + try + { + WebClientx web = new WebClientx(); + web.Timeout = timeOut; + web.Headers.Add("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); + web.Headers.Add("Accept-Language", "zh-cn,zh;q=0.8,en-us;q=0.5,en;q=0.3"); + web.Headers.Add("User-Agent", "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0)"); + web.Proxy = null; + byte[] b = web.DownloadData(url); + return Encoding.UTF8.GetString(b); + } + catch + { + return ""; + } + } + /// + /// Whois 查询 + /// + /// + /// + public static string Whois(string url) + { + if (String.IsNullOrEmpty(url)) + return ""; + try + { + WebClientx web = new WebClientx(); + web.Timeout = 30; + web.Headers.Add("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); + web.Headers.Add("Accept-Language", "zh-cn,zh;q=0.8,en-us;q=0.5,en;q=0.3"); + web.Headers.Add("User-Agent", "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0)"); + web.Headers.Add("Add-Cookies", "whois"); + web.Proxy = null; + byte[] b = web.DownloadData(url); + return Encoding.UTF8.GetString(b); + } + catch + { + return ""; + } + } - /// - /// 模拟百度抓取 - /// - /// - /// - public static string ByBaidu(string url) - { - string userAgent = "Mozilla/5.0 (compatible; Baiduspider/2.0; +http://www.baidu.com/search/spider.html)"; - return ByBaidu(url, userAgent); - } - /// - /// 模拟百度蜘蛛下载页面 - /// - /// - /// - public static string ByBaidu(string url, bool redirect) - { - if (String.IsNullOrEmpty(url)) - return ""; - try - { - HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); - request.Method = "GET"; - request.Accept = "*/*"; - request.Headers.Add("Accept-Language", "zh-CN"); - request.Headers.Add("Accept-Encoding", "gzip,deflate"); - request.UserAgent = - "Mozilla/5.0 (iPhone; CPU iPhone OS 9_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13B143 Safari/601.1"; - request.AllowAutoRedirect = redirect; - request.Timeout = 20000; - request.ReadWriteTimeout = 20000; - if (!BaseClass.IsTest) - request.Proxy = null; - HttpWebResponse response = (HttpWebResponse)request.GetResponse(); - Stream receiveStream = response.GetResponseStream(); - MemoryStream ms = new MemoryStream(); - int num = 0; - byte[] buffer = new byte[10240]; - do - { - num = receiveStream.Read(buffer, 0, buffer.Length); - if (num > 0) - ms.Write(buffer, 0, num); - } while (num > 0); - byte[] b = ms.ToArray(); - ms.Close(); - b = ZipHelper.Decompress(b); - string contentType = response.Headers["Content-Type"]; - string newurl = response.Headers["Location"]; - if (!String.IsNullOrEmpty(newurl)) - return "重定向:" + newurl; - string html = ""; - if (!String.IsNullOrEmpty(contentType)) - { - string c = GetRegexString(contentType, "charset\\s*=\\s*(\\S+)").Trim(); - if (!String.IsNullOrEmpty(c)) - html = Encoding.GetEncoding(c).GetString(b); - } - if (String.IsNullOrEmpty(html)) - { - html = Encoding.GetEncoding("UTF-8").GetString(b); - string r = @"]*?charset=[""']*([\w-]+)[""']*"; - string c = GetRegexString(html.ToLower(), r); - if (c.IndexOf("'") > -1) - c = c.Substring(0, c.IndexOf("'")); - if (c.IndexOf("\"") > -1) - c = c.Substring(0, c.IndexOf("\"")); - if (c.IndexOf(" ") > -1) - c = c.Substring(0, c.IndexOf(" ")); - if (c.IndexOf(">") > -1) - c = c.Substring(0, c.IndexOf(">")); - if (c.ToLower() != "utf-8" && !String.IsNullOrEmpty(c)) - html = Encoding.GetEncoding(c).GetString(b); - else if (String.IsNullOrEmpty(c)) - html = Encoding.GetEncoding("gbk").GetString(b); - } - if (!String.IsNullOrEmpty(html)) - { - if (html.Substring(0, 1) == "锘") - html = Encoding.GetEncoding("UTF-8").GetString(b); - //if (html.Contains("�") && (html.Length - html.Replace("�", "").Length > 3)) - // html = Encoding.GetEncoding("gbk").GetString(b); - } - if (String.IsNullOrEmpty(html) && !String.IsNullOrEmpty(newurl)) - html = "重定向:" + newurl; - return html; - } - catch (Exception e) - { - return e.Message; - } - } + /// + /// 模拟百度抓取 + /// + /// + /// + public static string ByBaidu(string url) + { + string userAgent = "Mozilla/5.0 (compatible; Baiduspider/2.0; +http://www.baidu.com/search/spider.html)"; + return ByBaidu(url, userAgent); + } + /// + /// 模拟百度蜘蛛下载页面 + /// + /// + /// + public static string ByBaidu(string url, bool redirect) + { + if (String.IsNullOrEmpty(url)) + return ""; + try + { + HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); + request.Method = "GET"; + request.Accept = "*/*"; + request.Headers.Add("Accept-Language", "zh-CN"); + request.Headers.Add("Accept-Encoding", "gzip,deflate"); + request.UserAgent = + "Mozilla/5.0 (iPhone; CPU iPhone OS 9_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13B143 Safari/601.1"; + request.AllowAutoRedirect = redirect; + request.Timeout = 20000; + request.ReadWriteTimeout = 20000; + if (!BaseClass.IsTest) + request.Proxy = null; + HttpWebResponse response = (HttpWebResponse)request.GetResponse(); + Stream receiveStream = response.GetResponseStream(); + MemoryStream ms = new MemoryStream(); + int num = 0; + byte[] buffer = new byte[10240]; + do + { + num = receiveStream.Read(buffer, 0, buffer.Length); + if (num > 0) + ms.Write(buffer, 0, num); + } while (num > 0); + byte[] b = ms.ToArray(); + ms.Close(); + b = ZipHelper.Decompress(b); + string contentType = response.Headers["Content-Type"]; + string newurl = response.Headers["Location"]; + if (!String.IsNullOrEmpty(newurl)) + return "重定向:" + newurl; + string html = ""; + if (!String.IsNullOrEmpty(contentType)) + { + string c = GetRegexString(contentType, "charset\\s*=\\s*(\\S+)").Trim(); + if (!String.IsNullOrEmpty(c)) + html = Encoding.GetEncoding(c).GetString(b); + } + if (String.IsNullOrEmpty(html)) + { + html = Encoding.GetEncoding("UTF-8").GetString(b); + string r = @"]*?charset=[""']*([\w-]+)[""']*"; + string c = GetRegexString(html.ToLower(), r); + if (c.IndexOf("'") > -1) + c = c.Substring(0, c.IndexOf("'")); + if (c.IndexOf("\"") > -1) + c = c.Substring(0, c.IndexOf("\"")); + if (c.IndexOf(" ") > -1) + c = c.Substring(0, c.IndexOf(" ")); + if (c.IndexOf(">") > -1) + c = c.Substring(0, c.IndexOf(">")); + if (c.ToLower() != "utf-8" && !String.IsNullOrEmpty(c)) + html = Encoding.GetEncoding(c).GetString(b); + else if (String.IsNullOrEmpty(c)) + html = Encoding.GetEncoding("gbk").GetString(b); + } + if (!String.IsNullOrEmpty(html)) + { + if (html.Substring(0, 1) == "锘") + html = Encoding.GetEncoding("UTF-8").GetString(b); + //if (html.Contains("�") && (html.Length - html.Replace("�", "").Length > 3)) + // html = Encoding.GetEncoding("gbk").GetString(b); + } + if (String.IsNullOrEmpty(html) && !String.IsNullOrEmpty(newurl)) + html = "重定向:" + newurl; + return html; + } + catch (Exception e) + { + return e.Message; + } + } - /// - /// 自动识别代码模拟浏览器 - /// - /// - /// - public static string GetUrl(string getUrl, ref string cookies, ref string codeType) - { - if (String.IsNullOrEmpty(getUrl)) - return ""; - try - { - int retryTimes = 0; - GotoAgen: - if (String.IsNullOrEmpty(cookies)) - cookies = null; - HttpWebRequest request = (HttpWebRequest)WebRequest.Create(getUrl); - request.UserAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:19.0) Gecko/20100101 Firefox/19.0"; - request.Method = "GET"; - request.Accept = "*/*"; - request.Headers.Add("Accept-Language", "zh-cn,zh;q=0.8,en-us;q=0.5,en;q=0.3"); - request.Headers.Add("Accept-Encoding", "gzip,deflate"); - request.Headers.Add("Cookie", cookies); - if (!BaseClass.IsTest) - request.Proxy = null; - request.AllowAutoRedirect = false; - request.Timeout = 10000; - HttpWebResponse response = (HttpWebResponse)request.GetResponse(); - Stream receiveStream = response.GetResponseStream(); - MemoryStream ms = new MemoryStream(); - int num = 0; - byte[] buffer = new byte[20480]; - do - { - try - { - num = receiveStream.Read(buffer, 0, buffer.Length); - if (num > 0) - ms.Write(buffer, 0, num); - } - catch - { - num = 0; - } - } - while (num > 0); - byte[] b = ms.ToArray(); - ms.Close(); + /// + /// 自动识别代码模拟浏览器 + /// + /// + /// + public static string GetUrl(string getUrl, ref string cookies, ref string codeType) + { + if (String.IsNullOrEmpty(getUrl)) + return ""; + try + { + int retryTimes = 0; + GotoAgen: + if (String.IsNullOrEmpty(cookies)) + cookies = null; + HttpWebRequest request = (HttpWebRequest)WebRequest.Create(getUrl); + request.UserAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:19.0) Gecko/20100101 Firefox/19.0"; + request.Method = "GET"; + request.Accept = "*/*"; + request.Headers.Add("Accept-Language", "zh-cn,zh;q=0.8,en-us;q=0.5,en;q=0.3"); + request.Headers.Add("Accept-Encoding", "gzip,deflate"); + request.Headers.Add("Cookie", cookies); + if (!BaseClass.IsTest) + request.Proxy = null; + request.AllowAutoRedirect = false; + request.Timeout = 10000; + HttpWebResponse response = (HttpWebResponse)request.GetResponse(); + Stream receiveStream = response.GetResponseStream(); + MemoryStream ms = new MemoryStream(); + int num = 0; + byte[] buffer = new byte[20480]; + do + { + try + { + num = receiveStream.Read(buffer, 0, buffer.Length); + if (num > 0) + ms.Write(buffer, 0, num); + } + catch + { + num = 0; + } + } + while (num > 0); + byte[] b = ms.ToArray(); + ms.Close(); - b = ZipHelper.Decompress(b); - string cookies1 = response.Headers.Get("Set-Cookie"); - string location = response.Headers.Get("Location"); //跳转地址 - if (!String.IsNullOrEmpty(cookies1)) - cookies = UpCookies(cookies, cookies1); - string contentType = response.Headers["Content-Type"]; - string html = ""; - if (String.IsNullOrEmpty(location)) //不是跳转 - { - if (!String.IsNullOrEmpty(contentType)) - { - codeType = GetRegexString(contentType, "charset\\s*=\\s*(\\S+)").Trim(); - if (!String.IsNullOrEmpty(codeType)) - html = Encoding.GetEncoding(codeType).GetString(b); - } - if (String.IsNullOrEmpty(html)) - { - codeType = "UTF-8"; - html = Encoding.GetEncoding(codeType).GetString(b); - string r = @"<\s*meta.+charset\s*=\s*[""']*(\S+)[""'\s>]*"; - string c = GetRegexString(html, r).Trim(); - if (c.IndexOf("'") > -1) - c = c.Substring(0, c.IndexOf("'")); - if (c.IndexOf("\"") > -1) - c = c.Substring(0, c.IndexOf("\"")); - if (c.IndexOf(" ") > -1) - c = c.Substring(0, c.IndexOf(" ")); - if (c.IndexOf(">") > -1) - c = c.Substring(0, c.IndexOf(">")); - if (!String.IsNullOrEmpty(c) && c.ToLower() != "utf-8") - { - html = Encoding.GetEncoding(c).GetString(b); - codeType = c; - } - } - } - if (retryTimes < 4 && (!String.IsNullOrEmpty(location) || String.IsNullOrEmpty(html))) - { - //下面是支持301和302跳转部分 - if (location.Length > 8 && (location.Substring(0, 7) == "http://" || location.Substring(0, 8) == "https://" || location.Substring(0, 6) == "ftp://")) - { - getUrl = location; - } - else - { - if (location.Substring(0, 1) == "/") - { - string[] l = getUrl.Split('/'); - if (l.Length > 3) - { - getUrl = ""; - for (int i = 0; i < 3; i++) - getUrl += l[i] + "/"; - getUrl += location.Substring(1, location.Length - 1); - } - } - else - { - if (getUrl.Substring(getUrl.Length - 1, 1) == "/") - getUrl += location; - else - getUrl += "/" + location; - } - } - retryTimes++; - goto GotoAgen; - } - return html; - } - catch - { - return ""; - } - } - /// - /// 更新cookies - /// - /// - /// - /// - private static string UpCookies(string old, string newc) - { - if (String.IsNullOrEmpty(old)) - { - return newc; - } - if (String.IsNullOrEmpty(newc)) - { - return old; - } - int io = 0; - old = old.Trim(); - newc = newc.Trim(); - string[] o = old.Split(';'); - string[] n = newc.Split(';'); - List c = new List(); - for (int i = 0; i < o.Length; i++) - { - CoockiesValue cv = new CoockiesValue(); - io = o[i].IndexOf("="); - if (io > -1) - { - cv.Title = o[i].Substring(0, io).Trim(); - cv.Value = o[i].Substring(io + 1, o[i].Length - io - 1).Trim(); - } - else - { - if (!String.IsNullOrEmpty(o[i])) - cv.Title = o[i].Trim(); - } - if (!String.IsNullOrEmpty(cv.Title)) - c.Add(cv); - } - for (int i = 0; i < n.Length; i++) - { - CoockiesValue cv = new CoockiesValue(); - io = o[i].IndexOf("="); - if (io > -1) - { - cv.Title = o[i].Substring(0, io).Trim(); - cv.Value = o[i].Substring(io + 1, o[i].Length - io - 1).Trim(); - } - else - { - if (!String.IsNullOrEmpty(o[i])) - cv.Title = o[i].Trim(); - } - if (!String.IsNullOrEmpty(cv.Title)) - { - bool isHad = false; - for (int j = 0; j < c.Count; j++) - { - if (cv.Title == c[j].Title) - { - c[j].Value = cv.Value; - isHad = true; - break; - } - } - if (!isHad) - c.Add(cv); - } - } - string temp = ""; - for (int i = 0; i < c.Count; i++) - { - if (String.IsNullOrEmpty(c[i].Value)) - temp += c[i].Title + "; "; - else - temp += c[i].Title + "=" + c[i].Value + "; "; - } - return temp; - } - /// - /// cookies值 - /// - public class CoockiesValue - { - /// - /// 名称 - /// - public string Title { get; set; } - /// - /// 值 - /// - public string Value { get; set; } - } - /// - /// 模拟百度蜘蛛下载页面 - /// - /// - /// - public static string ByBaidu(string url, string userAgent) - { - if (String.IsNullOrEmpty(url)) - { - return ""; - } - try - { - HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); - request.Method = "GET"; - request.Accept = "*/*"; - request.Headers.Add("Accept-Language", "zh-CN"); - request.Headers.Add("Accept-Encoding", "gzip,deflate"); - request.UserAgent = userAgent; - request.AllowAutoRedirect = false; - request.Timeout = 10000; - request.ReadWriteTimeout = 10000; - if (!BaseClass.IsTest) - request.Proxy = null; - HttpWebResponse response = (HttpWebResponse)request.GetResponse(); - Stream receiveStream = response.GetResponseStream(); - MemoryStream ms = new MemoryStream(); - int num = 0; - byte[] buffer = new byte[0x400]; - do - { - num = receiveStream.Read(buffer, 0, buffer.Length); - if (num > 0) - ms.Write(buffer, 0, num); - } - while (num > 0); - byte[] b = ms.ToArray(); - ms.Close(); + b = ZipHelper.Decompress(b); + string cookies1 = response.Headers.Get("Set-Cookie"); + string location = response.Headers.Get("Location"); //跳转地址 + if (!String.IsNullOrEmpty(cookies1)) + cookies = UpCookies(cookies, cookies1); + string contentType = response.Headers["Content-Type"]; + string html = ""; + if (String.IsNullOrEmpty(location)) //不是跳转 + { + if (!String.IsNullOrEmpty(contentType)) + { + codeType = GetRegexString(contentType, "charset\\s*=\\s*(\\S+)").Trim(); + if (!String.IsNullOrEmpty(codeType)) + html = Encoding.GetEncoding(codeType).GetString(b); + } + if (String.IsNullOrEmpty(html)) + { + codeType = "UTF-8"; + html = Encoding.GetEncoding(codeType).GetString(b); + string r = @"<\s*meta.+charset\s*=\s*[""']*(\S+)[""'\s>]*"; + string c = GetRegexString(html, r).Trim(); + if (c.IndexOf("'") > -1) + c = c.Substring(0, c.IndexOf("'")); + if (c.IndexOf("\"") > -1) + c = c.Substring(0, c.IndexOf("\"")); + if (c.IndexOf(" ") > -1) + c = c.Substring(0, c.IndexOf(" ")); + if (c.IndexOf(">") > -1) + c = c.Substring(0, c.IndexOf(">")); + if (!String.IsNullOrEmpty(c) && c.ToLower() != "utf-8") + { + html = Encoding.GetEncoding(c).GetString(b); + codeType = c; + } + } + } + if (retryTimes < 4 && (!String.IsNullOrEmpty(location) || String.IsNullOrEmpty(html))) + { + //下面是支持301和302跳转部分 + if (location.Length > 8 && (location.Substring(0, 7) == "http://" || location.Substring(0, 8) == "https://" || location.Substring(0, 6) == "ftp://")) + { + getUrl = location; + } + else + { + if (location.Substring(0, 1) == "/") + { + string[] l = getUrl.Split('/'); + if (l.Length > 3) + { + getUrl = ""; + for (int i = 0; i < 3; i++) + getUrl += l[i] + "/"; + getUrl += location.Substring(1, location.Length - 1); + } + } + else + { + if (getUrl.Substring(getUrl.Length - 1, 1) == "/") + getUrl += location; + else + getUrl += "/" + location; + } + } + retryTimes++; + goto GotoAgen; + } + return html; + } + catch + { + return ""; + } + } + /// + /// 更新cookies + /// + /// + /// + /// + private static string UpCookies(string old, string newc) + { + if (String.IsNullOrEmpty(old)) + { + return newc; + } + if (String.IsNullOrEmpty(newc)) + { + return old; + } + int io = 0; + old = old.Trim(); + newc = newc.Trim(); + string[] o = old.Split(';'); + string[] n = newc.Split(';'); + List c = new List(); + for (int i = 0; i < o.Length; i++) + { + CoockiesValue cv = new CoockiesValue(); + io = o[i].IndexOf("="); + if (io > -1) + { + cv.Title = o[i].Substring(0, io).Trim(); + cv.Value = o[i].Substring(io + 1, o[i].Length - io - 1).Trim(); + } + else + { + if (!String.IsNullOrEmpty(o[i])) + cv.Title = o[i].Trim(); + } + if (!String.IsNullOrEmpty(cv.Title)) + c.Add(cv); + } + for (int i = 0; i < n.Length; i++) + { + CoockiesValue cv = new CoockiesValue(); + io = o[i].IndexOf("="); + if (io > -1) + { + cv.Title = o[i].Substring(0, io).Trim(); + cv.Value = o[i].Substring(io + 1, o[i].Length - io - 1).Trim(); + } + else + { + if (!String.IsNullOrEmpty(o[i])) + cv.Title = o[i].Trim(); + } + if (!String.IsNullOrEmpty(cv.Title)) + { + bool isHad = false; + for (int j = 0; j < c.Count; j++) + { + if (cv.Title == c[j].Title) + { + c[j].Value = cv.Value; + isHad = true; + break; + } + } + if (!isHad) + c.Add(cv); + } + } + string temp = ""; + for (int i = 0; i < c.Count; i++) + { + if (String.IsNullOrEmpty(c[i].Value)) + temp += c[i].Title + "; "; + else + temp += c[i].Title + "=" + c[i].Value + "; "; + } + return temp; + } + /// + /// cookies值 + /// + public class CoockiesValue + { + /// + /// 名称 + /// + public string Title { get; set; } + /// + /// 值 + /// + public string Value { get; set; } + } + /// + /// 模拟百度蜘蛛下载页面 + /// + /// + /// + public static string ByBaidu(string url, string userAgent) + { + if (String.IsNullOrEmpty(url)) + { + return ""; + } + try + { + HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); + request.Method = "GET"; + request.Accept = "*/*"; + request.Headers.Add("Accept-Language", "zh-CN"); + request.Headers.Add("Accept-Encoding", "gzip,deflate"); + request.UserAgent = userAgent; + request.AllowAutoRedirect = false; + request.Timeout = 10000; + request.ReadWriteTimeout = 10000; + if (!BaseClass.IsTest) + request.Proxy = null; + HttpWebResponse response = (HttpWebResponse)request.GetResponse(); + Stream receiveStream = response.GetResponseStream(); + MemoryStream ms = new MemoryStream(); + int num = 0; + byte[] buffer = new byte[0x400]; + do + { + num = receiveStream.Read(buffer, 0, buffer.Length); + if (num > 0) + ms.Write(buffer, 0, num); + } + while (num > 0); + byte[] b = ms.ToArray(); + ms.Close(); - b = ZipHelper.Decompress(b); - string contentType = response.Headers["Content-Type"]; - string html = ""; - if (!String.IsNullOrEmpty(contentType)) - { - string c = GetRegexString(contentType, "charset\\s*=\\s*(\\S+)").Trim(); - if (!String.IsNullOrEmpty(c)) - html = Encoding.GetEncoding(c).GetString(b); - } - if (String.IsNullOrEmpty(html)) - { - html = Encoding.GetEncoding("UTF-8").GetString(b); - string r = @"]*?charset=[""']*([\w-]+)[""']*"; - string c = GetRegexString(html.ToLower(), r); - if (c.IndexOf("'") > -1) - c = c.Substring(0, c.IndexOf("'")); - if (c.IndexOf("\"") > -1) - c = c.Substring(0, c.IndexOf("\"")); - if (c.IndexOf(" ") > -1) - c = c.Substring(0, c.IndexOf(" ")); - if (c.IndexOf(">") > -1) - c = c.Substring(0, c.IndexOf(">")); - if (c.ToLower() != "utf-8" && !String.IsNullOrEmpty(c)) - html = Encoding.GetEncoding(c).GetString(b); - else if (String.IsNullOrEmpty(c)) - html = Encoding.GetEncoding("gbk").GetString(b); - } - if (!String.IsNullOrEmpty(html)) - { - if (html.Substring(0, 1) == "锘") - html = Encoding.GetEncoding("UTF-8").GetString(b); - //if (html.Contains("�") && (html.Length - html.Replace("�", "").Length > 3)) - // html = Encoding.GetEncoding("gbk").GetString(b); - } - return html; - } - catch (Exception e) - { - return e.Message; - } - } - /// - /// 返回单个正则分析结果 - /// - /// - /// - /// - public static string GetRegexString(string HtmlString, string RegexString) - { - MatchCollection mc = Regex.Matches(HtmlString, RegexString, RegexOptions.IgnoreCase); - if (mc.Count > 0) - return mc[0].Groups[1].ToString(); - return ""; - } + b = ZipHelper.Decompress(b); + string contentType = response.Headers["Content-Type"]; + string html = ""; + if (!String.IsNullOrEmpty(contentType)) + { + string c = GetRegexString(contentType, "charset\\s*=\\s*(\\S+)").Trim(); + if (!String.IsNullOrEmpty(c)) + html = Encoding.GetEncoding(c).GetString(b); + } + if (String.IsNullOrEmpty(html)) + { + html = Encoding.GetEncoding("UTF-8").GetString(b); + string r = @"]*?charset=[""']*([\w-]+)[""']*"; + string c = GetRegexString(html.ToLower(), r); + if (c.IndexOf("'") > -1) + c = c.Substring(0, c.IndexOf("'")); + if (c.IndexOf("\"") > -1) + c = c.Substring(0, c.IndexOf("\"")); + if (c.IndexOf(" ") > -1) + c = c.Substring(0, c.IndexOf(" ")); + if (c.IndexOf(">") > -1) + c = c.Substring(0, c.IndexOf(">")); + if (c.ToLower() != "utf-8" && !String.IsNullOrEmpty(c)) + html = Encoding.GetEncoding(c).GetString(b); + else if (String.IsNullOrEmpty(c)) + html = Encoding.GetEncoding("gbk").GetString(b); + } + if (!String.IsNullOrEmpty(html)) + { + if (html.Substring(0, 1) == "锘") + html = Encoding.GetEncoding("UTF-8").GetString(b); + //if (html.Contains("�") && (html.Length - html.Replace("�", "").Length > 3)) + // html = Encoding.GetEncoding("gbk").GetString(b); + } + return html; + } + catch (Exception e) + { + return e.Message; + } + } + /// + /// 返回单个正则分析结果 + /// + /// + /// + /// + public static string GetRegexString(string HtmlString, string RegexString) + { + MatchCollection mc = Regex.Matches(HtmlString, RegexString, RegexOptions.IgnoreCase); + if (mc.Count > 0) + return mc[0].Groups[1].ToString(); + return ""; + } - /// - /// Gbk 下载页面 - /// - /// - /// - public static string Gbk(string url) - { - if (String.IsNullOrEmpty(url)) - return ""; - try - { - WebClientx web = new WebClientx(); - web.Headers.Add("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); - web.Headers.Add("Accept-Language", "zh-cn,zh;q=0.8,en-us;q=0.5,en;q=0.3"); - web.Headers.Add("User-Agent", "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0)"); - web.Proxy = null; - byte[] b = web.DownloadData(url); - return Encoding.GetEncoding("gbk").GetString(b); - } - catch - { - return ""; - } - } - /// - /// post 数据 - /// - /// - /// - /// - public static string PostUtf8(string url, StringBuilder postData) - { - try - { - WebClientx wc = new WebClientx(); - byte[] sendData = Encoding.GetEncoding("utf-8").GetBytes(postData.ToString()); - wc.Headers.Add("ContentLength", sendData.Length.ToString()); - wc.Headers.Add("Content-Type", "application/x-www-form-urlencoded"); - wc.Proxy = null; - return Encoding.UTF8.GetString(wc.UploadData(url, "POST", sendData)); - } - catch - { - return ""; - } - } - /// - /// post 数据 - /// - /// - /// - /// - public static string PostUtf8(string url, byte[] byteData, int time) - { - WebClientx webClient = new WebClientx(); - try - { - webClient.Timeout = time; - webClient.Headers.Add("Accept-Encoding", "gzip,deflate"); - webClient.Headers.Add("Accept-Language", "zh-cn,zh;q=0.8,en-us;q=0.5,en;q=0.3"); - webClient.Headers.Add("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0)"); - webClient.Proxy = null; - byte[] b = webClient.UploadData(url, byteData); - string contentType = webClient.ResponseHeaders["Content-Type"]; - webClient.Dispose(); - webClient = null; - string html = ""; - if (!String.IsNullOrEmpty(contentType)) - { - string c = BaseRegex.GetMatchRegexString(contentType, "charset\\s*=\\s*(\\S+)"); - if (!String.IsNullOrEmpty(c)) - { - c = c.Trim(); - html = Encoding.GetEncoding(c).GetString(b); - } - } - if (String.IsNullOrEmpty(html)) - { - html = Encoding.GetEncoding("UTF-8").GetString(b); - string r = @"<\s*meta.+charset\s*=\s*[""']*(\S+)[""'\s>]*"; - string temp = BaseRegex.GetMatchRegexString(html.ToLower(), r); - if (String.IsNullOrEmpty(temp)) - return html; - string c = temp.Trim(); - if (c.IndexOf("'") > -1) - c = c.Substring(0, c.IndexOf("'")); - if (c.IndexOf("\"") > -1) - c = c.Substring(0, c.IndexOf("\"")); - if (c.IndexOf(" ") > -1) - c = c.Substring(0, c.IndexOf(" ")); - if (c.IndexOf(">") > -1) - c = c.Substring(0, c.IndexOf(">")); - if (!String.IsNullOrEmpty(c) && c.ToLower() != "utf-8") - html = Encoding.GetEncoding(c).GetString(b); - } - return html; - } - catch - { - return ""; - } - } - /// - /// 浏览器标识 - /// - public static string UserAgent = @"Mozilla/5.0+(Windows+NT+10.0;+WOW64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/57.0.2987.133+Safari/537.36 + /// + /// Gbk 下载页面 + /// + /// + /// + public static string Gbk(string url) + { + if (String.IsNullOrEmpty(url)) + return ""; + try + { + WebClientx web = new WebClientx(); + web.Headers.Add("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); + web.Headers.Add("Accept-Language", "zh-cn,zh;q=0.8,en-us;q=0.5,en;q=0.3"); + web.Headers.Add("User-Agent", "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0)"); + web.Proxy = null; + byte[] b = web.DownloadData(url); + return Encoding.GetEncoding("gbk").GetString(b); + } + catch + { + return ""; + } + } + /// + /// post 数据 + /// + /// + /// + /// + public static string PostUtf8(string url, StringBuilder postData) + { + try + { + WebClientx wc = new WebClientx(); + byte[] sendData = Encoding.GetEncoding("utf-8").GetBytes(postData.ToString()); + wc.Headers.Add("ContentLength", sendData.Length.ToString()); + wc.Headers.Add("Content-Type", "application/x-www-form-urlencoded"); + wc.Proxy = null; + return Encoding.UTF8.GetString(wc.UploadData(url, "POST", sendData)); + } + catch + { + return ""; + } + } + /// + /// post 数据 + /// + /// + /// + /// + public static string PostUtf8(string url, byte[] byteData, int time) + { + WebClientx webClient = new WebClientx(); + try + { + webClient.Timeout = time; + webClient.Headers.Add("Accept-Encoding", "gzip,deflate"); + webClient.Headers.Add("Accept-Language", "zh-cn,zh;q=0.8,en-us;q=0.5,en;q=0.3"); + webClient.Headers.Add("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0)"); + webClient.Proxy = null; + byte[] b = webClient.UploadData(url, byteData); + string contentType = webClient.ResponseHeaders["Content-Type"]; + webClient.Dispose(); + webClient = null; + string html = ""; + if (!String.IsNullOrEmpty(contentType)) + { + string c = BaseRegex.GetMatchRegexString(contentType, "charset\\s*=\\s*(\\S+)"); + if (!String.IsNullOrEmpty(c)) + { + c = c.Trim(); + html = Encoding.GetEncoding(c).GetString(b); + } + } + if (String.IsNullOrEmpty(html)) + { + html = Encoding.GetEncoding("UTF-8").GetString(b); + string r = @"<\s*meta.+charset\s*=\s*[""']*(\S+)[""'\s>]*"; + string temp = BaseRegex.GetMatchRegexString(html.ToLower(), r); + if (String.IsNullOrEmpty(temp)) + return html; + string c = temp.Trim(); + if (c.IndexOf("'") > -1) + c = c.Substring(0, c.IndexOf("'")); + if (c.IndexOf("\"") > -1) + c = c.Substring(0, c.IndexOf("\"")); + if (c.IndexOf(" ") > -1) + c = c.Substring(0, c.IndexOf(" ")); + if (c.IndexOf(">") > -1) + c = c.Substring(0, c.IndexOf(">")); + if (!String.IsNullOrEmpty(c) && c.ToLower() != "utf-8") + html = Encoding.GetEncoding(c).GetString(b); + } + return html; + } + catch + { + return ""; + } + } + /// + /// 浏览器标识 + /// + public static string UserAgent = @"Mozilla/5.0+(Windows+NT+10.0;+WOW64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/57.0.2987.133+Safari/537.36 Mozilla/5.0+(Windows+NT+6.1)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/57.0.2987.133+Safari/537.36 Mozilla/5.0+(Windows+NT+10.0;+WOW64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/54.0.2840.99+Safari/537.36 Mozilla/5.0+(Windows+NT+5.1)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/31.0.1650.63+Safari/537.36 @@ -1166,96 +1166,103 @@ Mozilla/5.0+(Windows+NT+6.3;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+ Mozilla/5.0+(Windows+NT+6.1;+WOW64)+AppleWebKit/537.1+(KHTML,+like+Gecko)+Chrome/21.0.1180.89+Safari/537.1 Mozilla/5.0+(Windows+NT+6.1;+WOW64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/45.0.2454.101+Safari/537.36 Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.104 Safari/537.36 Core/1.53.2372.400 QQBrowser/9.5.10548.400"; + public static async Task PostJsonAsync(string url, object postData, int? timeOut = null) + { + return await PostUtf8Async(url, JsonHelper.SerializeObject(postData), contentType: "application/json", timeOut: timeOut); + } + public static async Task PostJsonAsync(string url, string postData, int? timeOut = null) + { + return await PostUtf8Async(url, postData, contentType: "application/json", timeOut: timeOut); + } + /// + /// post 数据 + /// + /// + /// + /// + public static string PostUtf8(string url, string postData, string contentType = "", int? timeOut = null) + { + //return PostUtf8(url, Encoding.UTF8.GetBytes(postData)); - /// - /// post 数据 - /// - /// - /// - /// - public static string PostUtf8(string url, string postData, string contentType = "", int? timeOut = null) - { - //return PostUtf8(url, Encoding.UTF8.GetBytes(postData)); + bool isError = false; + string[] l = UserAgent.Split('\n'); + reTry: + try + { + string codeType = "utf-8"; + HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); + request.UserAgent = l[new Random(Guid.NewGuid().GetHashCode()).Next(l.Length)].Trim(); + byte[] byteData = Encoding.GetEncoding(codeType).GetBytes(postData); + request.Method = "POST"; + request.Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"; + request.Timeout = BaseClass.TimeOut * 1000; + request.ReadWriteTimeout = BaseClass.TimeOut * 1000; + if (timeOut != null) + { + request.Timeout = timeOut.Value * 1000; + request.ReadWriteTimeout = timeOut.Value * 1000; + } + request.Proxy = null; + request.ContentType = "application/x-www-form-urlencoded; charset=" + codeType; + //if(BaseClass.SaLevel > 0) + { + //260306 采用GZip/deflate压缩 + //request.Headers.Set(HttpRequestHeader.AcceptEncoding, "gzip, deflate, br, zstd"); + request.Headers.Set(HttpRequestHeader.AcceptEncoding, "gzip, deflate"); + } + if (url.StartsWith("https://openapi.jinritemai.com/")) + { + request.Headers.Add("X-USE-BOE", "1"); + request.Headers.Add("Origin-From", "djt_prod"); + request.Headers.Add("djt_prod", "boe_time_sku"); + } + if (!string.IsNullOrEmpty(contentType)) + { + request.ContentType = contentType; + } + request.ContentLength = byteData.Length; + request.Referer = url; + request.CookieContainer = new CookieContainer(); + request.AllowAutoRedirect = false; + using (Stream requestStream = request.GetRequestStream()) + { + requestStream.Write(byteData, 0, byteData.Length); + } + HttpWebResponse response = (HttpWebResponse)request.GetResponse(); - bool isError = false; - string[] l = UserAgent.Split('\n'); - reTry: - try - { - string codeType = "utf-8"; - HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); - request.UserAgent = l[new Random(Guid.NewGuid().GetHashCode()).Next(l.Length)].Trim(); - byte[] byteData = Encoding.GetEncoding(codeType).GetBytes(postData); - request.Method = "POST"; - request.Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"; - request.Timeout = BaseClass.TimeOut * 1000; - request.ReadWriteTimeout = BaseClass.TimeOut * 1000; - if (timeOut != null) - { - request.Timeout = timeOut.Value * 1000; - request.ReadWriteTimeout = timeOut.Value * 1000; - } - request.Proxy = null; - request.ContentType = "application/x-www-form-urlencoded; charset=" + codeType; - //if(BaseClass.SaLevel > 0) - { - //260306 采用GZip/deflate压缩 - //request.Headers.Set(HttpRequestHeader.AcceptEncoding, "gzip, deflate, br, zstd"); - request.Headers.Set(HttpRequestHeader.AcceptEncoding, "gzip, deflate"); - } - if (url.StartsWith("https://openapi.jinritemai.com/")) - { - request.Headers.Add("X-USE-BOE", "1"); - request.Headers.Add("Origin-From", "djt_prod"); - request.Headers.Add("djt_prod", "boe_time_sku"); - } - if (!string.IsNullOrEmpty(contentType)) - { - request.ContentType = contentType; - } - request.ContentLength = byteData.Length; - request.Referer = url; - request.CookieContainer = new CookieContainer(); - request.AllowAutoRedirect = false; - using (Stream requestStream = request.GetRequestStream()) - { - requestStream.Write(byteData, 0, byteData.Length); - } - HttpWebResponse response = (HttpWebResponse)request.GetResponse(); + Stream receiveStream = response.GetResponseStream(); + StreamReader readStream = new StreamReader(receiveStream, Encoding.GetEncoding(codeType)); - Stream receiveStream = response.GetResponseStream(); - StreamReader readStream = new StreamReader(receiveStream, Encoding.GetEncoding(codeType)); + //if (BaseClass.SaLevel == 0) + //{ + // return readStream.ReadToEnd().Trim(); + //} + //else + { + //260306 超管采用GZip/deflate压缩 + //Thread.Sleep(50); + return GetProxyHtml.ReadResponse(response); + } + } + catch (Exception e) + { + LogSave.Add(e.ToString()); + //if (!isError) + //{ + // isError = true; + // goto reTry; + //} + Thread.Sleep(50); + return ""; + } - //if (BaseClass.SaLevel == 0) - //{ - // return readStream.ReadToEnd().Trim(); - //} - //else - { - //260306 超管采用GZip/deflate压缩 - //Thread.Sleep(50); - return GetProxyHtml.ReadResponse(response); - } - } - catch (Exception e) - { - LogSave.Add(e.ToString()); - //if (!isError) - //{ - // isError = true; - // goto reTry; - //} - Thread.Sleep(50); - return ""; - } - - } + } public static async Task PostUtf8Async(string url, string postData, string contentType = "", int? timeOut = null) { bool isError = false; string[] l = UserAgent.Split('\n'); - reTry: + reTry: try { string codeType = "utf-8"; @@ -1297,7 +1304,7 @@ Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrom { requestStream.Write(byteData, 0, byteData.Length); } - HttpWebResponse response = (HttpWebResponse) await request.GetResponseAsync(); + HttpWebResponse response = (HttpWebResponse)await request.GetResponseAsync(); Stream receiveStream = response.GetResponseStream(); StreamReader readStream = new StreamReader(receiveStream, Encoding.GetEncoding(codeType)); @@ -1333,808 +1340,808 @@ Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrom /// /// public static string PostUtf8(string url, byte[] byteData) - { - WebClientx webClient = new WebClientx(); - try - { - webClient.Timeout = 70; - webClient.Headers.Add("Accept-Encoding", "gzip,deflate"); - webClient.Headers.Add("Accept-Language", "zh-cn,zh;q=0.8,en-us;q=0.5,en;q=0.3"); - webClient.Headers.Add("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0)"); - webClient.Proxy = null; - byte[] b = webClient.UploadData(url, byteData); - string contentType = webClient.ResponseHeaders["Content-Type"]; - webClient.Dispose(); - webClient = null; - string html = ""; - if (!String.IsNullOrEmpty(contentType)) - { - string c = BaseRegex.GetMatchRegexString(contentType, "charset\\s*=\\s*(\\S+)"); - if (!String.IsNullOrEmpty(c)) - { - c = c.Trim(); - html = Encoding.GetEncoding(c).GetString(b); - } - } - if (String.IsNullOrEmpty(html)) - { - html = Encoding.GetEncoding("UTF-8").GetString(b); - string r = @"<\s*meta.+charset\s*=\s*[""']*(\S+)[""'\s>]*"; - string temp = BaseRegex.GetMatchRegexString(html.ToLower(), r); - if (String.IsNullOrEmpty(temp)) - return html; - string c = temp.Trim(); - if (c.IndexOf("'") > -1) - c = c.Substring(0, c.IndexOf("'")); - if (c.IndexOf("\"") > -1) - c = c.Substring(0, c.IndexOf("\"")); - if (c.IndexOf(" ") > -1) - c = c.Substring(0, c.IndexOf(" ")); - if (c.IndexOf(">") > -1) - c = c.Substring(0, c.IndexOf(">")); - if (!String.IsNullOrEmpty(c) && c.ToLower() != "utf-8") - html = Encoding.GetEncoding(c).GetString(b); - } - return html; - } - catch - { - return ""; - } - } + { + WebClientx webClient = new WebClientx(); + try + { + webClient.Timeout = 70; + webClient.Headers.Add("Accept-Encoding", "gzip,deflate"); + webClient.Headers.Add("Accept-Language", "zh-cn,zh;q=0.8,en-us;q=0.5,en;q=0.3"); + webClient.Headers.Add("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0)"); + webClient.Proxy = null; + byte[] b = webClient.UploadData(url, byteData); + string contentType = webClient.ResponseHeaders["Content-Type"]; + webClient.Dispose(); + webClient = null; + string html = ""; + if (!String.IsNullOrEmpty(contentType)) + { + string c = BaseRegex.GetMatchRegexString(contentType, "charset\\s*=\\s*(\\S+)"); + if (!String.IsNullOrEmpty(c)) + { + c = c.Trim(); + html = Encoding.GetEncoding(c).GetString(b); + } + } + if (String.IsNullOrEmpty(html)) + { + html = Encoding.GetEncoding("UTF-8").GetString(b); + string r = @"<\s*meta.+charset\s*=\s*[""']*(\S+)[""'\s>]*"; + string temp = BaseRegex.GetMatchRegexString(html.ToLower(), r); + if (String.IsNullOrEmpty(temp)) + return html; + string c = temp.Trim(); + if (c.IndexOf("'") > -1) + c = c.Substring(0, c.IndexOf("'")); + if (c.IndexOf("\"") > -1) + c = c.Substring(0, c.IndexOf("\"")); + if (c.IndexOf(" ") > -1) + c = c.Substring(0, c.IndexOf(" ")); + if (c.IndexOf(">") > -1) + c = c.Substring(0, c.IndexOf(">")); + if (!String.IsNullOrEmpty(c) && c.ToLower() != "utf-8") + html = Encoding.GetEncoding(c).GetString(b); + } + return html; + } + catch + { + return ""; + } + } - /// - /// POST读取详细 - /// - /// 提交地址 - /// 提交数据 - /// 浏览器头 - /// - public static string GetUtf8(string strUrl, string userAgen, string cookie = "", string accept = "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8") - { - try - { - WebClientx web = new WebClientx(); - web.Headers.Add("Accept", accept); - web.Headers.Add("Accept-Language", "zh-cn,zh;q=0.8,en-us;q=0.5,en;q=0.3"); - web.Headers.Add("User-Agent", userAgen); - if (!string.IsNullOrEmpty(cookie)) - web.Headers.Add("Cookie", cookie); - web.Proxy = null; - byte[] b = web.DownloadData(strUrl); - return Encoding.UTF8.GetString(b); - } - catch (Exception e) - { - return ""; - } - } + /// + /// POST读取详细 + /// + /// 提交地址 + /// 提交数据 + /// 浏览器头 + /// + public static string GetUtf8(string strUrl, string userAgen, string cookie = "", string accept = "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8") + { + try + { + WebClientx web = new WebClientx(); + web.Headers.Add("Accept", accept); + web.Headers.Add("Accept-Language", "zh-cn,zh;q=0.8,en-us;q=0.5,en;q=0.3"); + web.Headers.Add("User-Agent", userAgen); + if (!string.IsNullOrEmpty(cookie)) + web.Headers.Add("Cookie", cookie); + web.Proxy = null; + byte[] b = web.DownloadData(strUrl); + return Encoding.UTF8.GetString(b); + } + catch (Exception e) + { + return ""; + } + } - public static bool DownloadFileNew(string Urlstring, string FilePath, string cookies) - { - try - { - WebClientx wb = new WebClientx(); - if (File.Exists(FilePath)) - File.Delete(FilePath); - string userAgent = BaseClass.ChromeUserAgent; - wb.Timeout = 30; - wb.AllowAutoRedirect = true; - wb.Headers.Add("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8"); - wb.Headers.Add("X-Requested-With", "XMLHttpRequest"); - wb.Headers.Add("Accept-Encoding", "gzip,deflate"); - //if (!string.IsNullOrEmpty(cookies) && cookies.Contains("PDDAccessToken") && BaseClass.CookiesAll.ContainsKey("yangkeduo.com") && BaseClass.CookiesAll["yangkeduo.com"].ContainsKey("PDDAccessToken")) - // wb.Headers.Add("accesstoken", BaseClass.CookiesAll["yangkeduo.com"]["PDDAccessToken"]); - wb.Headers.Add("Accept-Language", "zh-cn,zh;q=0.8,en-us;q=0.5,en;q=0.3"); - wb.Headers.Add("User-Agent", userAgent); - wb.Proxy = null; - //if (!string.IsNullOrEmpty(refere)) - // wb.Headers.Add("Referer", refere); - cookies = GetCookies(Urlstring, cookies); - if (!String.IsNullOrEmpty(cookies)) - wb.Headers.Add("Cookie", cookies); - wb.DownloadFile(Urlstring, FilePath); - return true; - } - catch (Exception e) - { - return false; - } - } + public static bool DownloadFileNew(string Urlstring, string FilePath, string cookies) + { + try + { + WebClientx wb = new WebClientx(); + if (File.Exists(FilePath)) + File.Delete(FilePath); + string userAgent = BaseClass.ChromeUserAgent; + wb.Timeout = 30; + wb.AllowAutoRedirect = true; + wb.Headers.Add("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8"); + wb.Headers.Add("X-Requested-With", "XMLHttpRequest"); + wb.Headers.Add("Accept-Encoding", "gzip,deflate"); + //if (!string.IsNullOrEmpty(cookies) && cookies.Contains("PDDAccessToken") && BaseClass.CookiesAll.ContainsKey("yangkeduo.com") && BaseClass.CookiesAll["yangkeduo.com"].ContainsKey("PDDAccessToken")) + // wb.Headers.Add("accesstoken", BaseClass.CookiesAll["yangkeduo.com"]["PDDAccessToken"]); + wb.Headers.Add("Accept-Language", "zh-cn,zh;q=0.8,en-us;q=0.5,en;q=0.3"); + wb.Headers.Add("User-Agent", userAgent); + wb.Proxy = null; + //if (!string.IsNullOrEmpty(refere)) + // wb.Headers.Add("Referer", refere); + cookies = GetCookies(Urlstring, cookies); + if (!String.IsNullOrEmpty(cookies)) + wb.Headers.Add("Cookie", cookies); + wb.DownloadFile(Urlstring, FilePath); + return true; + } + catch (Exception e) + { + return false; + } + } - public static string Resove(string html, string prefix, string subfix) - { - int inl = html.IndexOf(prefix); - if (inl == -1) - { - prefix = prefix.Replace("\"", "'"); - subfix = subfix.Replace("\"", "'"); - inl = html.IndexOf(prefix); - } - if (inl == -1) - { - return null; - } - inl += prefix.Length; - if (!string.IsNullOrEmpty(subfix)) - { - int inl2 = html.IndexOf(subfix, inl); - if (inl2 == -1) - { - return null; - } - string result = html.Substring(inl, inl2 - inl); - return result; - } - else - { - string result = html.Substring(inl); - return result; - } - } + public static string Resove(string html, string prefix, string subfix) + { + int inl = html.IndexOf(prefix); + if (inl == -1) + { + prefix = prefix.Replace("\"", "'"); + subfix = subfix.Replace("\"", "'"); + inl = html.IndexOf(prefix); + } + if (inl == -1) + { + return null; + } + inl += prefix.Length; + if (!string.IsNullOrEmpty(subfix)) + { + int inl2 = html.IndexOf(subfix, inl); + if (inl2 == -1) + { + return null; + } + string result = html.Substring(inl, inl2 - inl); + return result; + } + else + { + string result = html.Substring(inl); + return result; + } + } - public static string GetCookies(string url, string cookies) - { - if (!String.IsNullOrEmpty(cookies)) - return cookies; - string mainDomain = GetHtml.GetMainDomain(GetHtml.GetDomain(url)); - if (BaseClass.CookiesAllString.ContainsKey(mainDomain)) - cookies = BaseClass.CookiesAllString[mainDomain]; - return cookies; - } + public static string GetCookies(string url, string cookies) + { + if (!String.IsNullOrEmpty(cookies)) + return cookies; + string mainDomain = GetHtml.GetMainDomain(GetHtml.GetDomain(url)); + if (BaseClass.CookiesAllString.ContainsKey(mainDomain)) + cookies = BaseClass.CookiesAllString[mainDomain]; + return cookies; + } - /// - /// URL GB2312转码 - /// - /// - /// - public static string UrlEncodeGb2312(string IndexKey) - { - if (String.IsNullOrEmpty(IndexKey)) - return ""; - return HttpUtility.UrlEncode(IndexKey, Encoding.GetEncoding("GB2312")); + /// + /// URL GB2312转码 + /// + /// + /// + public static string UrlEncodeGb2312(string IndexKey) + { + if (String.IsNullOrEmpty(IndexKey)) + return ""; + return HttpUtility.UrlEncode(IndexKey, Encoding.GetEncoding("GB2312")); - byte[] sarr = Encoding.GetEncoding("gb2312").GetBytes(IndexKey); - IndexKey = ""; - for (int i = 0; i < sarr.Length; i++) - { - IndexKey += "%"; - IndexKey += sarr[i].ToString("X2"); - } - return IndexKey; - } - /// - /// URL UTF-8转码 - /// - /// - /// - public static string UrlEncodeUtf8(string IndexKey) - { - if (String.IsNullOrEmpty(IndexKey)) - return ""; - return HttpUtility.UrlEncode(IndexKey, Encoding.UTF8); - byte[] sarr = Encoding.UTF8.GetBytes(IndexKey); - IndexKey = ""; - for (int i = 0; i < sarr.Length; i++) - { - IndexKey += "%"; - IndexKey += sarr[i].ToString("X2"); - } - return IndexKey; - } - /// - /// 用IE打开网址 - /// - /// - public static void OpenUrl(string url) - { - try - { - //if (url.Contains("http")) - // Process.Start("iexplore.exe", url); - //else - Process.Start(url); - } - catch - { - } - } + byte[] sarr = Encoding.GetEncoding("gb2312").GetBytes(IndexKey); + IndexKey = ""; + for (int i = 0; i < sarr.Length; i++) + { + IndexKey += "%"; + IndexKey += sarr[i].ToString("X2"); + } + return IndexKey; + } + /// + /// URL UTF-8转码 + /// + /// + /// + public static string UrlEncodeUtf8(string IndexKey) + { + if (String.IsNullOrEmpty(IndexKey)) + return ""; + return HttpUtility.UrlEncode(IndexKey, Encoding.UTF8); + byte[] sarr = Encoding.UTF8.GetBytes(IndexKey); + IndexKey = ""; + for (int i = 0; i < sarr.Length; i++) + { + IndexKey += "%"; + IndexKey += sarr[i].ToString("X2"); + } + return IndexKey; + } + /// + /// 用IE打开网址 + /// + /// + public static void OpenUrl(string url) + { + try + { + //if (url.Contains("http")) + // Process.Start("iexplore.exe", url); + //else + Process.Start(url); + } + catch + { + } + } - /// - /// 下载文件 - /// - /// 下载地址 - /// 保存目录 - /// - public static bool DownloadFile(string Urlstring, string FilePath) - { - try - { - WebClientx mywebclient = new WebClientx(); - mywebclient.Timeout = 300; - if (File.Exists(FilePath)) - File.Delete(FilePath); - mywebclient.DownloadFile(Urlstring, FilePath); - return true; - } - catch(Exception ex) - { - return false; - } - } - /// - /// 下载文件 - /// - /// 下载地址 - /// 保存目录 - /// - public static bool DownloadFile(string Urlstring, out byte[] b) - { - b = new byte[0]; - int times = 0; - Next: - try - { - WebClientx mywebclient = new WebClientx(); - b = mywebclient.DownloadData(Urlstring); - return true; - } - catch (Exception e) - { - if (e.Message.Contains("404")) - return false; - if (times < 4) - { - times++; - Thread.Sleep(3000); - goto Next; - } - return false; - } + /// + /// 下载文件 + /// + /// 下载地址 + /// 保存目录 + /// + public static bool DownloadFile(string Urlstring, string FilePath) + { + try + { + WebClientx mywebclient = new WebClientx(); + mywebclient.Timeout = 300; + if (File.Exists(FilePath)) + File.Delete(FilePath); + mywebclient.DownloadFile(Urlstring, FilePath); + return true; + } + catch (Exception ex) + { + return false; + } + } + /// + /// 下载文件 + /// + /// 下载地址 + /// 保存目录 + /// + public static bool DownloadFile(string Urlstring, out byte[] b) + { + b = new byte[0]; + int times = 0; + Next: + try + { + WebClientx mywebclient = new WebClientx(); + b = mywebclient.DownloadData(Urlstring); + return true; + } + catch (Exception e) + { + if (e.Message.Contains("404")) + return false; + if (times < 4) + { + times++; + Thread.Sleep(3000); + goto Next; + } + return false; + } - } + } - /// - /// 读取网址,兼容https,兼容任意编码 - /// - /// - /// - public static string GetUrl(string url) - { - WebClientx webClient = new WebClientx(); - try - { - webClient.Timeout = 30; - webClient.Headers.Add("Accept-Encoding", "gzip,deflate"); - webClient.Headers.Add("Accept-Language", "zh-cn,zh;q=0.8,en-us;q=0.5,en;q=0.3"); - webClient.Headers.Add("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0)"); - webClient.Proxy = null; - byte[] b = webClient.DownloadData(url); - b = ZipHelper.Decompress(b); - string contentType = webClient.ResponseHeaders["Content-Type"]; - webClient.Dispose(); - webClient = null; - string html = ""; - if (!String.IsNullOrEmpty(contentType)) - { - string c = BaseRegex.GetMatchRegexString(contentType, "charset\\s*=\\s*(\\S+)"); - if (!String.IsNullOrEmpty(c)) - { - c = c.Trim(); - html = Encoding.GetEncoding(c).GetString(b); - } - } - if (String.IsNullOrEmpty(html)) - { - html = Encoding.GetEncoding("UTF-8").GetString(b); - string r = @"<\s*meta.+charset\s*=\s*[""']*(\S+)[""'\s>]*"; - string c = BaseRegex.GetMatchRegexString(html.ToLower(), r).Trim(); - if (c.IndexOf("'") > -1) - c = c.Substring(0, c.IndexOf("'")); - if (c.IndexOf("\"") > -1) - c = c.Substring(0, c.IndexOf("\"")); - if (c.IndexOf(" ") > -1) - c = c.Substring(0, c.IndexOf(" ")); - if (c.IndexOf(">") > -1) - c = c.Substring(0, c.IndexOf(">")); - if (!String.IsNullOrEmpty(c) && c.ToLower() != "utf-8") - html = Encoding.GetEncoding(c).GetString(b); - } - return html; - } - catch (Exception e) - { - LogSave.AddView(url + " 错误:" + e.Message.Replace("\r\n", " ")); - return null; - } - finally - { - try - { - if (webClient != null) - { - webClient.Dispose(); - webClient = null; - } - } - catch - { - } - } - } + /// + /// 读取网址,兼容https,兼容任意编码 + /// + /// + /// + public static string GetUrl(string url) + { + WebClientx webClient = new WebClientx(); + try + { + webClient.Timeout = 30; + webClient.Headers.Add("Accept-Encoding", "gzip,deflate"); + webClient.Headers.Add("Accept-Language", "zh-cn,zh;q=0.8,en-us;q=0.5,en;q=0.3"); + webClient.Headers.Add("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0)"); + webClient.Proxy = null; + byte[] b = webClient.DownloadData(url); + b = ZipHelper.Decompress(b); + string contentType = webClient.ResponseHeaders["Content-Type"]; + webClient.Dispose(); + webClient = null; + string html = ""; + if (!String.IsNullOrEmpty(contentType)) + { + string c = BaseRegex.GetMatchRegexString(contentType, "charset\\s*=\\s*(\\S+)"); + if (!String.IsNullOrEmpty(c)) + { + c = c.Trim(); + html = Encoding.GetEncoding(c).GetString(b); + } + } + if (String.IsNullOrEmpty(html)) + { + html = Encoding.GetEncoding("UTF-8").GetString(b); + string r = @"<\s*meta.+charset\s*=\s*[""']*(\S+)[""'\s>]*"; + string c = BaseRegex.GetMatchRegexString(html.ToLower(), r).Trim(); + if (c.IndexOf("'") > -1) + c = c.Substring(0, c.IndexOf("'")); + if (c.IndexOf("\"") > -1) + c = c.Substring(0, c.IndexOf("\"")); + if (c.IndexOf(" ") > -1) + c = c.Substring(0, c.IndexOf(" ")); + if (c.IndexOf(">") > -1) + c = c.Substring(0, c.IndexOf(">")); + if (!String.IsNullOrEmpty(c) && c.ToLower() != "utf-8") + html = Encoding.GetEncoding(c).GetString(b); + } + return html; + } + catch (Exception e) + { + LogSave.AddView(url + " 错误:" + e.Message.Replace("\r\n", " ")); + return null; + } + finally + { + try + { + if (webClient != null) + { + webClient.Dispose(); + webClient = null; + } + } + catch + { + } + } + } - /// - /// 获取域名 - /// - /// - /// - public static string GetDomain(string url) - { - try - { - url = url.ToLower(); - string temp = BaseRegex.GetMatchRegexString(url, @"([a-z0-9-\.]+\.[a-z]{2,8})"); - if (!String.IsNullOrEmpty(temp) && temp.Length > 1 && (temp.Substring(0, 1) == "." || temp.Substring(0, 1) == "-")) - return null; - if (!String.IsNullOrEmpty(temp)) - return temp; - if (url.Contains("//") && url.IndexOf("//") + 2 < url.Length) - url = url.Substring(url.IndexOf("//") + 2, url.Length - url.IndexOf("//") - 2); - if (url.Contains("/") && url.IndexOf("/") > 0) - url = url.Substring(0, url.IndexOf("/")); - return url; - } - catch - { - return null; - } - } + /// + /// 获取域名 + /// + /// + /// + public static string GetDomain(string url) + { + try + { + url = url.ToLower(); + string temp = BaseRegex.GetMatchRegexString(url, @"([a-z0-9-\.]+\.[a-z]{2,8})"); + if (!String.IsNullOrEmpty(temp) && temp.Length > 1 && (temp.Substring(0, 1) == "." || temp.Substring(0, 1) == "-")) + return null; + if (!String.IsNullOrEmpty(temp)) + return temp; + if (url.Contains("//") && url.IndexOf("//") + 2 < url.Length) + url = url.Substring(url.IndexOf("//") + 2, url.Length - url.IndexOf("//") - 2); + if (url.Contains("/") && url.IndexOf("/") > 0) + url = url.Substring(0, url.IndexOf("/")); + return url; + } + catch + { + return null; + } + } - /// - /// 获取域名&ip - /// - /// - /// - public static string GetDomainIp(string url) - { - if (String.IsNullOrEmpty(url)) - return null; - url = url.ToLower(); - string temp = BaseRegex.GetMatchRegexString(url, @"http[s]{0,1}://([a-z0-9-\.]+\.[a-z]{2,8}|[\d]{1,3}\.[\d]{1,3}\.[\d]{1,3}\.[\d]{1,3})"); - if (!String.IsNullOrEmpty(temp) && temp.Length > 1 && (temp.Substring(0, 1) == "." || temp.Substring(0, 1) == "-")) - return null; - if (!String.IsNullOrEmpty(temp)) - return temp; - return null; - } + /// + /// 获取域名&ip + /// + /// + /// + public static string GetDomainIp(string url) + { + if (String.IsNullOrEmpty(url)) + return null; + url = url.ToLower(); + string temp = BaseRegex.GetMatchRegexString(url, @"http[s]{0,1}://([a-z0-9-\.]+\.[a-z]{2,8}|[\d]{1,3}\.[\d]{1,3}\.[\d]{1,3}\.[\d]{1,3})"); + if (!String.IsNullOrEmpty(temp) && temp.Length > 1 && (temp.Substring(0, 1) == "." || temp.Substring(0, 1) == "-")) + return null; + if (!String.IsNullOrEmpty(temp)) + return temp; + return null; + } - /// - /// 解析域名ip - /// - /// - /// - public static string GetIp(string domain) - { - try - { - for (int i = 0; i < 2; i++) - { - IPAddress[] aryIP = Dns.GetHostEntry(domain).AddressList; - if (aryIP.Length > 0) - return aryIP[0].ToString(); - Thread.Sleep(1000); //重试,防止DNS缓存 - } - return null; - } - catch - { - //SocketServer.ViewCode += "域名:" + domain + "无法解析\r\n"; - return null; - } - } - /// - /// 是否是域名 - /// - /// - /// - public static bool IsDomain(string domain) - { - string temp = BaseRegex.GetMatchRegexString(domain, @"([a-z0-9-\.]+\.[a-z]{2,8})"); - if (!String.IsNullOrEmpty(temp) && temp.Length > 1 && (temp.Substring(0, 1) == "." || temp.Substring(0, 1) == "-")) - return false; - if (temp == domain) - return true; - return false; - } + /// + /// 解析域名ip + /// + /// + /// + public static string GetIp(string domain) + { + try + { + for (int i = 0; i < 2; i++) + { + IPAddress[] aryIP = Dns.GetHostEntry(domain).AddressList; + if (aryIP.Length > 0) + return aryIP[0].ToString(); + Thread.Sleep(1000); //重试,防止DNS缓存 + } + return null; + } + catch + { + //SocketServer.ViewCode += "域名:" + domain + "无法解析\r\n"; + return null; + } + } + /// + /// 是否是域名 + /// + /// + /// + public static bool IsDomain(string domain) + { + string temp = BaseRegex.GetMatchRegexString(domain, @"([a-z0-9-\.]+\.[a-z]{2,8})"); + if (!String.IsNullOrEmpty(temp) && temp.Length > 1 && (temp.Substring(0, 1) == "." || temp.Substring(0, 1) == "-")) + return false; + if (temp == domain) + return true; + return false; + } - /// - /// 获取顶级域名 - /// - /// - /// - public static string GetMainDomain(string domain) - { - if (String.IsNullOrEmpty(domain)) - return ""; - domain = domain.ToLower(); - if (!domain.Contains(".") || domain.Length < 4) - return ""; - string[] d = domain.Split('.'); - string main = d[d.Length - 2] + "." + d[d.Length - 1]; //原始域名 - if (d.Length > 2 && - (d[d.Length - 2] == "com" || d[d.Length - 2] == "net" || d[d.Length - 2] == "org" || - d[d.Length - 2] == "gov" || d[d.Length - 2] == "edu" || d[d.Length - 2] == "co")) - main = d[d.Length - 3] + "." + main; - return main; - } - /// - /// 解密Jsion - /// - /// - /// - public static string Decode(string s) - { - s = WebUtility.HtmlDecode(s); - Regex reUnicode = new Regex(@"\\u([0-9a-fA-F]{4})", RegexOptions.Compiled); - return reUnicode.Replace(s, m => - { - short c; - if (Int16.TryParse(m.Groups[1].Value, NumberStyles.HexNumber, CultureInfo.InvariantCulture, out c)) - { - return "" + (char)c; - } - return m.Value; - }); - } + /// + /// 获取顶级域名 + /// + /// + /// + public static string GetMainDomain(string domain) + { + if (String.IsNullOrEmpty(domain)) + return ""; + domain = domain.ToLower(); + if (!domain.Contains(".") || domain.Length < 4) + return ""; + string[] d = domain.Split('.'); + string main = d[d.Length - 2] + "." + d[d.Length - 1]; //原始域名 + if (d.Length > 2 && + (d[d.Length - 2] == "com" || d[d.Length - 2] == "net" || d[d.Length - 2] == "org" || + d[d.Length - 2] == "gov" || d[d.Length - 2] == "edu" || d[d.Length - 2] == "co")) + main = d[d.Length - 3] + "." + main; + return main; + } + /// + /// 解密Jsion + /// + /// + /// + public static string Decode(string s) + { + s = WebUtility.HtmlDecode(s); + Regex reUnicode = new Regex(@"\\u([0-9a-fA-F]{4})", RegexOptions.Compiled); + return reUnicode.Replace(s, m => + { + short c; + if (Int16.TryParse(m.Groups[1].Value, NumberStyles.HexNumber, CultureInfo.InvariantCulture, out c)) + { + return "" + (char)c; + } + return m.Value; + }); + } - /// - /// 获取国内IP - /// - /// - public static string ProxyIpIn() - { - if (BaseClass.ProxyIn.Count == 0) - return ""; - Random ra = new Random(Guid.NewGuid().GetHashCode()); - return BaseClass.ProxyIn[ra.Next(BaseClass.ProxyIn.Count)]; - } - /// - /// 获取美国IP - /// - /// - public static string ProxyIpOut() - { - if (BaseClass.ProxyOut.Count == 0) - return ""; - Random ra = new Random(Guid.NewGuid().GetHashCode()); - return BaseClass.ProxyOut[ra.Next(BaseClass.ProxyOut.Count)]; - } - /// - /// 获取国内IP代理URL地址 - /// - /// - public static string ProxyIpInUrl(string url) - { - if (BaseClass.ProxyIn.Count == 0) - return url; - Random ra = new Random(Guid.NewGuid().GetHashCode()); - string ip = BaseClass.ProxyIn[ra.Next(BaseClass.ProxyIn.Count)]; - return "http://" + ip + ":6000/url=" + ReplaceUrl(url); - } - /// - /// 获取美国IP代理URL地址 - /// - /// - public static string ProxyIpOutUrl(string url) - { - if (BaseClass.ProxyOut.Count == 0) - return url; - Random ra = new Random(Guid.NewGuid().GetHashCode()); - string ip = BaseClass.ProxyOut[ra.Next(BaseClass.ProxyOut.Count)]; - return "http://" + ip + ":6000/url=" + ReplaceUrl(url); - } - /// - /// 替换链接,防止防火墙 - /// - /// - /// - public static string ReplaceUrl(string url) - { - if (String.IsNullOrEmpty(url)) - return ""; - string newurl = ""; - string[] l = url.Split('.'); - for (int i = 0; i < l.Length; i++) - { - if (l[i].Length > 2) - newurl += l[i].Substring(0, l[i].Length - 2) + "***ooo***" + l[i].Substring(l[i].Length - 2, 2); - else - newurl += l[i]; - if (i < l.Length - 1) - newurl += "."; - } - return newurl.Replace(".google.", ".goo00gle.").Replace("?", "%3f").Replace("=", "%3d").Replace("&", "%26"); - } - /// - /// 还原链接 - /// - /// - /// - public static string ReplaceUrlBak(string url) - { - if (String.IsNullOrEmpty(url)) - return ""; - string newurl = url.Replace("***ooo***", ""); - if (String.IsNullOrEmpty(newurl)) - return ""; - return newurl.Replace(".goo00gle.", ".google.").Replace("%3f", "?").Replace("%3d", "=").Replace("%26", "&"); - } - /// - /// 生成URL绝对地址 - /// - /// 新URL - /// 源地址 - /// - public static string BuildUrl(string url, string oldurl) - { - if (String.IsNullOrEmpty(url)) - return oldurl; - if (url.Contains("tencent:/")) - return url; - if (url.Length > 8 && url.Substring(0, 8).Contains("://")) - { - if (url.Length - url.Replace("/", "").Length == 2) - url += "/"; - return url; - } + /// + /// 获取国内IP + /// + /// + public static string ProxyIpIn() + { + if (BaseClass.ProxyIn.Count == 0) + return ""; + Random ra = new Random(Guid.NewGuid().GetHashCode()); + return BaseClass.ProxyIn[ra.Next(BaseClass.ProxyIn.Count)]; + } + /// + /// 获取美国IP + /// + /// + public static string ProxyIpOut() + { + if (BaseClass.ProxyOut.Count == 0) + return ""; + Random ra = new Random(Guid.NewGuid().GetHashCode()); + return BaseClass.ProxyOut[ra.Next(BaseClass.ProxyOut.Count)]; + } + /// + /// 获取国内IP代理URL地址 + /// + /// + public static string ProxyIpInUrl(string url) + { + if (BaseClass.ProxyIn.Count == 0) + return url; + Random ra = new Random(Guid.NewGuid().GetHashCode()); + string ip = BaseClass.ProxyIn[ra.Next(BaseClass.ProxyIn.Count)]; + return "http://" + ip + ":6000/url=" + ReplaceUrl(url); + } + /// + /// 获取美国IP代理URL地址 + /// + /// + public static string ProxyIpOutUrl(string url) + { + if (BaseClass.ProxyOut.Count == 0) + return url; + Random ra = new Random(Guid.NewGuid().GetHashCode()); + string ip = BaseClass.ProxyOut[ra.Next(BaseClass.ProxyOut.Count)]; + return "http://" + ip + ":6000/url=" + ReplaceUrl(url); + } + /// + /// 替换链接,防止防火墙 + /// + /// + /// + public static string ReplaceUrl(string url) + { + if (String.IsNullOrEmpty(url)) + return ""; + string newurl = ""; + string[] l = url.Split('.'); + for (int i = 0; i < l.Length; i++) + { + if (l[i].Length > 2) + newurl += l[i].Substring(0, l[i].Length - 2) + "***ooo***" + l[i].Substring(l[i].Length - 2, 2); + else + newurl += l[i]; + if (i < l.Length - 1) + newurl += "."; + } + return newurl.Replace(".google.", ".goo00gle.").Replace("?", "%3f").Replace("=", "%3d").Replace("&", "%26"); + } + /// + /// 还原链接 + /// + /// + /// + public static string ReplaceUrlBak(string url) + { + if (String.IsNullOrEmpty(url)) + return ""; + string newurl = url.Replace("***ooo***", ""); + if (String.IsNullOrEmpty(newurl)) + return ""; + return newurl.Replace(".goo00gle.", ".google.").Replace("%3f", "?").Replace("%3d", "=").Replace("%26", "&"); + } + /// + /// 生成URL绝对地址 + /// + /// 新URL + /// 源地址 + /// + public static string BuildUrl(string url, string oldurl) + { + if (String.IsNullOrEmpty(url)) + return oldurl; + if (url.Contains("tencent:/")) + return url; + if (url.Length > 8 && url.Substring(0, 8).Contains("://")) + { + if (url.Length - url.Replace("/", "").Length == 2) + url += "/"; + return url; + } - string homeurl = BaseRegex.GetMatchRegexString(oldurl.ToLower(), "(http://[^/]*?)/"); - if (String.IsNullOrEmpty(homeurl)) - { - homeurl = BaseRegex.GetMatchRegexString(oldurl.ToLower(), "(http://[^/]+)") + "/"; - if (String.IsNullOrEmpty(homeurl)) - { - //BaseClass.ViewCode += "网址:" + oldurl + "识别失败\r\n"; - return url; - } - } - if (url.Substring(0, 1) == "/") - { - string newurlx = homeurl + url; - newurlx = newurlx.Replace("//", "/").Replace("http:/", "http://"); - return newurlx; - } - string[] l = oldurl.Split('/'); - int cute = l.Length; - if (l.Length > 3) - cute--; - while (url.Contains("../")) - { - int s = url.IndexOf("../"); - if (s == 0) - url = url.Substring(3); - else - url = url.Substring(0, s) + url.Substring(s + 3); - cute--; - if (cute < 3) - cute = 3; - } - string newurl = ""; - for (int i = 0; i < cute; i++) - newurl += l[i] + "/"; - newurl = newurl + url; - return newurl.Replace("//", "/").Replace("http:/", "http://").Replace("/./", "/"); - } - /// - /// 获取代理地址 - /// - /// - /// - public static string GetProxyUrl(string url) - { - if (String.IsNullOrEmpty(url)) - return null; - if (BaseClass.Proxy.Count == 0) - { - BaseClass.ViewCode += "代理异常"; - return url; - } - Random ra = new Random(); - string p = BaseClass.Proxy[ra.Next(BaseClass.Proxy.Count)]; - return "http://" + p + "/url=" + url.Replace(".google.", ".goo00gle.") - .Replace("?", "%3f").Replace("=", "%3d").Replace("&", "%26"); - } + string homeurl = BaseRegex.GetMatchRegexString(oldurl.ToLower(), "(http://[^/]*?)/"); + if (String.IsNullOrEmpty(homeurl)) + { + homeurl = BaseRegex.GetMatchRegexString(oldurl.ToLower(), "(http://[^/]+)") + "/"; + if (String.IsNullOrEmpty(homeurl)) + { + //BaseClass.ViewCode += "网址:" + oldurl + "识别失败\r\n"; + return url; + } + } + if (url.Substring(0, 1) == "/") + { + string newurlx = homeurl + url; + newurlx = newurlx.Replace("//", "/").Replace("http:/", "http://"); + return newurlx; + } + string[] l = oldurl.Split('/'); + int cute = l.Length; + if (l.Length > 3) + cute--; + while (url.Contains("../")) + { + int s = url.IndexOf("../"); + if (s == 0) + url = url.Substring(3); + else + url = url.Substring(0, s) + url.Substring(s + 3); + cute--; + if (cute < 3) + cute = 3; + } + string newurl = ""; + for (int i = 0; i < cute; i++) + newurl += l[i] + "/"; + newurl = newurl + url; + return newurl.Replace("//", "/").Replace("http:/", "http://").Replace("/./", "/"); + } + /// + /// 获取代理地址 + /// + /// + /// + public static string GetProxyUrl(string url) + { + if (String.IsNullOrEmpty(url)) + return null; + if (BaseClass.Proxy.Count == 0) + { + BaseClass.ViewCode += "代理异常"; + return url; + } + Random ra = new Random(); + string p = BaseClass.Proxy[ra.Next(BaseClass.Proxy.Count)]; + return "http://" + p + "/url=" + url.Replace(".google.", ".goo00gle.") + .Replace("?", "%3f").Replace("=", "%3d").Replace("&", "%26"); + } - public static List ProxyIpList = new List(); + public static List ProxyIpList = new List(); - /// - /// 服务器代理采集 - /// - /// - /// - public static string GetProxyServer(string url, string needString) - { - string html = GetProxyServerx(url); - if (string.IsNullOrEmpty(html) || !html.Contains(needString)) - html = GetProxyServerx(url); - if (string.IsNullOrEmpty(html) || !html.Contains(needString)) - html = GetProxyServerx(url); - if (string.IsNullOrEmpty(html) || !html.Contains(needString)) - html = GetProxyServerx(url); - return html; - } + /// + /// 服务器代理采集 + /// + /// + /// + public static string GetProxyServer(string url, string needString) + { + string html = GetProxyServerx(url); + if (string.IsNullOrEmpty(html) || !html.Contains(needString)) + html = GetProxyServerx(url); + if (string.IsNullOrEmpty(html) || !html.Contains(needString)) + html = GetProxyServerx(url); + if (string.IsNullOrEmpty(html) || !html.Contains(needString)) + html = GetProxyServerx(url); + return html; + } - /// - /// 服务器代理采集 - /// - /// - /// - private static string GetProxyServerx(string url) - { - if (ProxyIpList.Count < 10) - return ""; - string ip = ProxyIpList[Randomx.GetId(ProxyIpList.Count)]; - WebClientx webClient = new WebClientx(); - try - { - webClient.Timeout = 10; - webClient.Headers.Add("Accept-Encoding", "gzip,deflate"); - webClient.Headers.Add("Accept-Language", "zh-cn,zh;q=0.8,en-us;q=0.5,en;q=0.3"); - webClient.Headers.Add("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0)"); - webClient.Proxy = new WebProxy(ip); - byte[] b = webClient.DownloadData(url); - b = ZipHelper.Decompress(b); - string html = Encoding.GetEncoding("UTF-8").GetString(b); - return html; - } - catch (Exception e) - { - LogSave.AddView(url + " 错误:" + e.Message.Replace("\r\n", " ")); - return null; - } - finally - { - try - { - webClient.Dispose(); - webClient = null; - } - catch - { - } - } - } - public static string RequestImg(string url, byte[] imgData) - { - HttpWebResponse response = null; - var responseText = ""; - try - { - HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); - request.KeepAlive = true; - request.Headers.Set(HttpRequestHeader.CacheControl, "max-age=0"); - request.Headers.Add("Origin", url); - request.Headers.Add("Upgrade-Insecure-Requests", @"1"); - request.ContentType = "multipart/form-data; boundary=----WebKitFormBoundaryg0ATB1h6Pa505OBi"; - request.UserAgent = "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.86 Safari/537.36"; - request.Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3"; - request.Headers.Set(HttpRequestHeader.AcceptEncoding, "gzip, deflate, br"); - request.Headers.Set(HttpRequestHeader.AcceptLanguage, "zh-CN,zh;q=0.9"); - request.Method = "POST"; - request.ServicePoint.Expect100Continue = false; - string body = "------WebKitFormBoundaryg0ATB1h6Pa505OBi\r\n" + + /// + /// 服务器代理采集 + /// + /// + /// + private static string GetProxyServerx(string url) + { + if (ProxyIpList.Count < 10) + return ""; + string ip = ProxyIpList[Randomx.GetId(ProxyIpList.Count)]; + WebClientx webClient = new WebClientx(); + try + { + webClient.Timeout = 10; + webClient.Headers.Add("Accept-Encoding", "gzip,deflate"); + webClient.Headers.Add("Accept-Language", "zh-cn,zh;q=0.8,en-us;q=0.5,en;q=0.3"); + webClient.Headers.Add("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0)"); + webClient.Proxy = new WebProxy(ip); + byte[] b = webClient.DownloadData(url); + b = ZipHelper.Decompress(b); + string html = Encoding.GetEncoding("UTF-8").GetString(b); + return html; + } + catch (Exception e) + { + LogSave.AddView(url + " 错误:" + e.Message.Replace("\r\n", " ")); + return null; + } + finally + { + try + { + webClient.Dispose(); + webClient = null; + } + catch + { + } + } + } + public static string RequestImg(string url, byte[] imgData) + { + HttpWebResponse response = null; + var responseText = ""; + try + { + HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); + request.KeepAlive = true; + request.Headers.Set(HttpRequestHeader.CacheControl, "max-age=0"); + request.Headers.Add("Origin", url); + request.Headers.Add("Upgrade-Insecure-Requests", @"1"); + request.ContentType = "multipart/form-data; boundary=----WebKitFormBoundaryg0ATB1h6Pa505OBi"; + request.UserAgent = "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.86 Safari/537.36"; + request.Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3"; + request.Headers.Set(HttpRequestHeader.AcceptEncoding, "gzip, deflate, br"); + request.Headers.Set(HttpRequestHeader.AcceptLanguage, "zh-CN,zh;q=0.9"); + request.Method = "POST"; + request.ServicePoint.Expect100Continue = false; + string body = "------WebKitFormBoundaryg0ATB1h6Pa505OBi\r\n" + "Content-Disposition: form-data; name=\"file\"; filename=\"search.jpg\"\r\n" + "Content-Type: image/jpeg\r\n\r\n" + "filedata\r\n" + "------WebKitFormBoundaryg0ATB1h6Pa505OBi--\r\n"; - WriteMultipartBodyToRequest(request, body, imgData); + WriteMultipartBodyToRequest(request, body, imgData); - response = (HttpWebResponse)request.GetResponse(); - } - catch (WebException e) - { - if (e.Status == WebExceptionStatus.ProtocolError) response = (HttpWebResponse)e.Response; - else return "error: " + e.Message; - } - catch (Exception ex) - { - if (response != null) response.Close(); - return "error: " + ex.Message; - } - if (response != null) - { - responseText = ReadResponse(response); - response.Close(); - } - return responseText; - } - /// - /// 读取返回值 - /// - /// - /// - private static string ReadResponse(HttpWebResponse response) - { - using (Stream responseStream = response.GetResponseStream()) - { - Stream streamToRead = responseStream; - if (response.ContentEncoding.ToLower().Contains("gzip")) - { - streamToRead = new GZipStream(streamToRead, CompressionMode.Decompress); - } - else if (response.ContentEncoding.ToLower().Contains("deflate")) - { - streamToRead = new DeflateStream(streamToRead, CompressionMode.Decompress); - } + response = (HttpWebResponse)request.GetResponse(); + } + catch (WebException e) + { + if (e.Status == WebExceptionStatus.ProtocolError) response = (HttpWebResponse)e.Response; + else return "error: " + e.Message; + } + catch (Exception ex) + { + if (response != null) response.Close(); + return "error: " + ex.Message; + } + if (response != null) + { + responseText = ReadResponse(response); + response.Close(); + } + return responseText; + } + /// + /// 读取返回值 + /// + /// + /// + private static string ReadResponse(HttpWebResponse response) + { + using (Stream responseStream = response.GetResponseStream()) + { + Stream streamToRead = responseStream; + if (response.ContentEncoding.ToLower().Contains("gzip")) + { + streamToRead = new GZipStream(streamToRead, CompressionMode.Decompress); + } + else if (response.ContentEncoding.ToLower().Contains("deflate")) + { + streamToRead = new DeflateStream(streamToRead, CompressionMode.Decompress); + } - using (StreamReader streamReader = new StreamReader(streamToRead, Encoding.UTF8)) - { - return streamReader.ReadToEnd(); - } - } - } + using (StreamReader streamReader = new StreamReader(streamToRead, Encoding.UTF8)) + { + return streamReader.ReadToEnd(); + } + } + } - private static void WriteMultipartBodyToRequest(HttpWebRequest request, string body, byte[] data) - { - string[] multiparts = Regex.Split(body, @""); - byte[] bytes; - using (MemoryStream ms = new MemoryStream()) - { - foreach (string part in multiparts) - { - if (part == "filedata") // 文件信息 - { - bytes = data; - } - else - { - bytes = System.Text.Encoding.UTF8.GetBytes(part.Replace("\r\n", "\n").Replace("\r", "\n").Replace("\n", "\r\n")); - } - ms.Write(bytes, 0, bytes.Length); - } + private static void WriteMultipartBodyToRequest(HttpWebRequest request, string body, byte[] data) + { + string[] multiparts = Regex.Split(body, @""); + byte[] bytes; + using (MemoryStream ms = new MemoryStream()) + { + foreach (string part in multiparts) + { + if (part == "filedata") // 文件信息 + { + bytes = data; + } + else + { + bytes = System.Text.Encoding.UTF8.GetBytes(part.Replace("\r\n", "\n").Replace("\r", "\n").Replace("\n", "\r\n")); + } + ms.Write(bytes, 0, bytes.Length); + } - request.ContentLength = ms.Length; - using (Stream stream = request.GetRequestStream()) - { - ms.WriteTo(stream); - } - } - } + request.ContentLength = ms.Length; + using (Stream stream = request.GetRequestStream()) + { + ms.WriteTo(stream); + } + } + } - /// - /// 字符串转Unicode - /// - /// 源字符串 - /// Unicode编码后的字符串 - public static string String2Unicode(string source) - { - var bytes = Encoding.Unicode.GetBytes(source); - var stringBuilder = new StringBuilder(); - for (var i = 0; i < bytes.Length; i += 2) - { - stringBuilder.AppendFormat("\\u{0}{1}", bytes[i + 1].ToString("x").PadLeft(2, '0'), bytes[i].ToString("x").PadLeft(2, '0')); - } - return stringBuilder.ToString(); - } + /// + /// 字符串转Unicode + /// + /// 源字符串 + /// Unicode编码后的字符串 + public static string String2Unicode(string source) + { + var bytes = Encoding.Unicode.GetBytes(source); + var stringBuilder = new StringBuilder(); + for (var i = 0; i < bytes.Length; i += 2) + { + stringBuilder.AppendFormat("\\u{0}{1}", bytes[i + 1].ToString("x").PadLeft(2, '0'), bytes[i].ToString("x").PadLeft(2, '0')); + } + return stringBuilder.ToString(); + } - /// - /// Unicode转字符串 - /// - /// 经过Unicode编码的字符串 - /// 正常字符串 - public static string Unicode2String(string source) - { - return new Regex(@"\\u([0-9A-F]{4})", RegexOptions.IgnoreCase | RegexOptions.Compiled).Replace(source, x => Convert.ToChar(Convert.ToUInt16(x.Result("$1"), 16)).ToString()); - } + /// + /// Unicode转字符串 + /// + /// 经过Unicode编码的字符串 + /// 正常字符串 + public static string Unicode2String(string source) + { + return new Regex(@"\\u([0-9A-F]{4})", RegexOptions.IgnoreCase | RegexOptions.Compiled).Replace(source, x => Convert.ToChar(Convert.ToUInt16(x.Result("$1"), 16)).ToString()); + } - public static string ReadResponse(HttpWebResponse response, Encoding encoding = null) - { - return GetProxyHtml.ReadResponse(response, encoding); - } - } + public static string ReadResponse(HttpWebResponse response, Encoding encoding = null) + { + return GetProxyHtml.ReadResponse(response, encoding); + } + } } diff --git a/TEMUKJD/WXForms/ShopForms/WXShopListForm.Designer.cs b/TEMUKJD/WXForms/ShopForms/WXShopListForm.Designer.cs index 29544fa..620f5da 100644 --- a/TEMUKJD/WXForms/ShopForms/WXShopListForm.Designer.cs +++ b/TEMUKJD/WXForms/ShopForms/WXShopListForm.Designer.cs @@ -28,765 +28,776 @@ /// private void InitializeComponent() { - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle(); - this.label1 = new System.Windows.Forms.Label(); - this.splitContainer1 = new System.Windows.Forms.SplitContainer(); - this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel(); - this.panel5 = new System.Windows.Forms.Panel(); - this.btnCheck = new DevComponents.DotNetBar.PanelEx(); - this.btnEdit = new DevComponents.DotNetBar.PanelEx(); - this.btnLoginSelect = new TemuKJD.UserControls.ButtonEx(); - this.panel4 = new System.Windows.Forms.Panel(); - this.btnBatchRenewal = new DevComponents.DotNetBar.PanelEx(); - this.btnOpenOrderPage = new DevComponents.DotNetBar.PanelEx(); - this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); - this.cmbGroup = new TemuKJD.UserComponent.UcComboBoxMutiSelect(); - this.label2 = new System.Windows.Forms.Label(); - this.cmbNotes = new TemuKJD.UserComponent.UcComboBoxMutiSelect(); - this.txtShopId = new System.Windows.Forms.TextBox(); - this.label3 = new System.Windows.Forms.Label(); - this.txtShopName = new System.Windows.Forms.TextBox(); - this.label4 = new System.Windows.Forms.Label(); - this.btnRefreshShop = new DevComponents.DotNetBar.PanelEx(); - this.btnEmpty = new DevComponents.DotNetBar.PanelEx(); - this.btnSearch = new DevComponents.DotNetBar.PanelEx(); - this.cmbSubAccount = new TemuKJD.UserComponent.UcComboBoxMutiSelect(); - this.label5 = new System.Windows.Forms.Label(); - this.label6 = new System.Windows.Forms.Label(); - this.btnAddShop = new TemuKJD.UserControls.ButtonEx(); - this.splitContainer2 = new System.Windows.Forms.SplitContainer(); - this.pnlTopUp = new System.Windows.Forms.Panel(); - this.txtPrice = new System.Windows.Forms.Label(); - this.lblShopId = new System.Windows.Forms.Label(); - this.lblShopInfo = new System.Windows.Forms.Label(); - this.panel2 = new System.Windows.Forms.Panel(); - this.label7 = new System.Windows.Forms.Label(); - this.numAddTopUp = new System.Windows.Forms.NumericUpDown(); - this.label8 = new System.Windows.Forms.Label(); - this.btnTopUpCancel = new DevComponents.DotNetBar.PanelEx(); - this.btnTopUpOK = new DevComponents.DotNetBar.PanelEx(); - this.btnRefreshAuth = new TemuKJD.UserControls.ButtonEx(); - this.pbLoading = new System.Windows.Forms.PictureBox(); - this.btnImport = new TemuKJD.UserControls.ButtonEx(); - this.dgvShop = new TemuKJD.UserComponent.DataGridViewEx(); - this.colSelect = new System.Windows.Forms.DataGridViewCheckBoxColumn(); - this.colLoginName = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.colShopId = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.colShopAccount = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.colAddTime = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.colExpireTime = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.colRenewal = new System.Windows.Forms.DataGridViewLinkColumn(); - this.colNotes = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.colGroupName = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.colCookie = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.colSubUser = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.colSubUserAccount = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.colUploadAccount = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.colBuyAccount = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.colChatAccount = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.colLoginStatus = new System.Windows.Forms.DataGridViewTextBoxColumn(); - 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(); - this.colApiAuth = new System.Windows.Forms.DataGridViewLinkColumn(); - this.colBuyApiAuth = new System.Windows.Forms.DataGridViewLinkColumn(); - this.colUpdateCookies = new System.Windows.Forms.DataGridViewLinkColumn(); - 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(); - this.splitContainer1.SuspendLayout(); - this.tableLayoutPanel2.SuspendLayout(); - this.panel5.SuspendLayout(); - this.panel4.SuspendLayout(); - this.tableLayoutPanel1.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).BeginInit(); - this.splitContainer2.Panel1.SuspendLayout(); - this.splitContainer2.Panel2.SuspendLayout(); - this.splitContainer2.SuspendLayout(); - this.pnlTopUp.SuspendLayout(); - this.panel2.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.numAddTopUp)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.pbLoading)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.dgvShop)).BeginInit(); - this.SuspendLayout(); - // - // label1 - // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(13, 13); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(201, 17); - this.label1.TabIndex = 0; - this.label1.Text = "这里显示店铺列表 -- ShopListForm"; - // - // splitContainer1 - // - this.splitContainer1.BackColor = System.Drawing.Color.White; - this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill; - this.splitContainer1.FixedPanel = System.Windows.Forms.FixedPanel.Panel1; - this.splitContainer1.Location = new System.Drawing.Point(0, 0); - this.splitContainer1.Name = "splitContainer1"; - this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal; - // - // splitContainer1.Panel1 - // - this.splitContainer1.Panel1.Controls.Add(this.tableLayoutPanel2); - // - // splitContainer1.Panel2 - // - this.splitContainer1.Panel2.Controls.Add(this.splitContainer2); - this.splitContainer1.Panel2.Margin = new System.Windows.Forms.Padding(4); - this.splitContainer1.Size = new System.Drawing.Size(1394, 622); - this.splitContainer1.SplitterDistance = 46; - this.splitContainer1.TabIndex = 33; - // - // tableLayoutPanel2 - // - this.tableLayoutPanel2.ColumnCount = 2; - this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); - this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); - this.tableLayoutPanel2.Controls.Add(this.panel5, 1, 0); - this.tableLayoutPanel2.Controls.Add(this.panel4, 0, 0); - this.tableLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Fill; - this.tableLayoutPanel2.Location = new System.Drawing.Point(0, 0); - this.tableLayoutPanel2.Name = "tableLayoutPanel2"; - this.tableLayoutPanel2.RowCount = 1; - this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); - this.tableLayoutPanel2.Size = new System.Drawing.Size(1394, 46); - this.tableLayoutPanel2.TabIndex = 37; - // - // panel5 - // - this.panel5.Controls.Add(this.btnCheck); - this.panel5.Controls.Add(this.btnEdit); - this.panel5.Controls.Add(this.btnLoginSelect); - this.panel5.Location = new System.Drawing.Point(1142, 3); - this.panel5.Name = "panel5"; - this.panel5.Size = new System.Drawing.Size(249, 40); - this.panel5.TabIndex = 1; - // - // btnCheck - // - this.btnCheck.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); - this.btnCheck.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; - this.btnCheck.Cursor = System.Windows.Forms.Cursors.Hand; - this.btnCheck.DisabledBackColor = System.Drawing.Color.Empty; - this.btnCheck.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.btnCheck.Location = new System.Drawing.Point(98, 10); - this.btnCheck.Margin = new System.Windows.Forms.Padding(0, 3, 0, 3); - this.btnCheck.Name = "btnCheck"; - this.btnCheck.Size = new System.Drawing.Size(60, 23); - this.btnCheck.Style.Alignment = System.Drawing.StringAlignment.Center; - this.btnCheck.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); - this.btnCheck.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); - this.btnCheck.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder; - this.btnCheck.Style.BorderDashStyle = System.Drawing.Drawing2D.DashStyle.Dash; - this.btnCheck.Style.BorderSide = DevComponents.DotNetBar.eBorderSide.None; - this.btnCheck.Style.ForeColor.Color = System.Drawing.Color.White; - this.btnCheck.Style.GradientAngle = 90; - this.btnCheck.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center; - this.btnCheck.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255))))); - this.btnCheck.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255))))); - this.btnCheck.TabIndex = 810; - this.btnCheck.Text = "检测选中"; - this.btnCheck.Click += new System.EventHandler(this.btnCheck_Click); - // - // btnEdit - // - this.btnEdit.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); - this.btnEdit.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; - this.btnEdit.Cursor = System.Windows.Forms.Cursors.Hand; - this.btnEdit.DisabledBackColor = System.Drawing.Color.Empty; - this.btnEdit.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.btnEdit.Location = new System.Drawing.Point(33, 10); - this.btnEdit.Margin = new System.Windows.Forms.Padding(0, 3, 0, 3); - this.btnEdit.Name = "btnEdit"; - this.btnEdit.Size = new System.Drawing.Size(60, 23); - this.btnEdit.Style.Alignment = System.Drawing.StringAlignment.Center; - this.btnEdit.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); - this.btnEdit.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); - this.btnEdit.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder; - this.btnEdit.Style.BorderDashStyle = System.Drawing.Drawing2D.DashStyle.Dash; - this.btnEdit.Style.BorderSide = DevComponents.DotNetBar.eBorderSide.None; - this.btnEdit.Style.ForeColor.Color = System.Drawing.Color.White; - this.btnEdit.Style.GradientAngle = 90; - this.btnEdit.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center; - this.btnEdit.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255))))); - this.btnEdit.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255))))); - this.btnEdit.TabIndex = 806; - this.btnEdit.Text = "编辑选中"; - this.btnEdit.Click += new System.EventHandler(this.btnEdit_Click); - // - // btnLoginSelect - // - this.btnLoginSelect.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); - this.btnLoginSelect.Cursor = System.Windows.Forms.Cursors.Hand; - this.btnLoginSelect.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.btnLoginSelect.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.btnLoginSelect.ForeColor = System.Drawing.Color.White; - this.btnLoginSelect.Location = new System.Drawing.Point(163, 9); - this.btnLoginSelect.Margin = new System.Windows.Forms.Padding(2); - this.btnLoginSelect.Name = "btnLoginSelect"; - this.btnLoginSelect.Size = new System.Drawing.Size(66, 25); - this.btnLoginSelect.TabIndex = 373; - this.btnLoginSelect.Text = "登录选中"; - this.btnLoginSelect.UseVisualStyleBackColor = false; - this.btnLoginSelect.Click += new System.EventHandler(this.btnLoginSelect_Click); - // - // panel4 - // - this.panel4.Controls.Add(this.btnBatchRenewal); - this.panel4.Controls.Add(this.btnOpenOrderPage); - this.panel4.Controls.Add(this.tableLayoutPanel1); - this.panel4.Controls.Add(this.btnAddShop); - this.panel4.Dock = System.Windows.Forms.DockStyle.Fill; - this.panel4.Location = new System.Drawing.Point(3, 3); - this.panel4.Name = "panel4"; - this.panel4.Size = new System.Drawing.Size(1133, 40); - this.panel4.TabIndex = 0; - // - // btnBatchRenewal - // - this.btnBatchRenewal.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.btnBatchRenewal.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; - this.btnBatchRenewal.Cursor = System.Windows.Forms.Cursors.Hand; - this.btnBatchRenewal.DisabledBackColor = System.Drawing.Color.Empty; - this.btnBatchRenewal.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.btnBatchRenewal.Location = new System.Drawing.Point(935, 9); - this.btnBatchRenewal.Margin = new System.Windows.Forms.Padding(0, 3, 0, 3); - this.btnBatchRenewal.Name = "btnBatchRenewal"; - this.btnBatchRenewal.Size = new System.Drawing.Size(79, 23); - this.btnBatchRenewal.Style.Alignment = System.Drawing.StringAlignment.Center; - this.btnBatchRenewal.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); - this.btnBatchRenewal.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); - this.btnBatchRenewal.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder; - this.btnBatchRenewal.Style.BorderDashStyle = System.Drawing.Drawing2D.DashStyle.Dash; - this.btnBatchRenewal.Style.BorderSide = DevComponents.DotNetBar.eBorderSide.None; - this.btnBatchRenewal.Style.ForeColor.Color = System.Drawing.Color.White; - this.btnBatchRenewal.Style.GradientAngle = 90; - this.btnBatchRenewal.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center; - this.btnBatchRenewal.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255))))); - this.btnBatchRenewal.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255))))); - this.btnBatchRenewal.TabIndex = 806; - this.btnBatchRenewal.Text = "批量续期"; - this.btnBatchRenewal.Visible = false; - this.btnBatchRenewal.Click += new System.EventHandler(this.btnBatchRenewal_Click); - // - // btnOpenOrderPage - // - this.btnOpenOrderPage.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.btnOpenOrderPage.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; - this.btnOpenOrderPage.Cursor = System.Windows.Forms.Cursors.Hand; - this.btnOpenOrderPage.DisabledBackColor = System.Drawing.Color.Empty; - this.btnOpenOrderPage.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.btnOpenOrderPage.Location = new System.Drawing.Point(1018, 9); - this.btnOpenOrderPage.Margin = new System.Windows.Forms.Padding(0, 3, 0, 3); - this.btnOpenOrderPage.Name = "btnOpenOrderPage"; - this.btnOpenOrderPage.Size = new System.Drawing.Size(106, 23); - this.btnOpenOrderPage.Style.Alignment = System.Drawing.StringAlignment.Center; - this.btnOpenOrderPage.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); - this.btnOpenOrderPage.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); - this.btnOpenOrderPage.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder; - this.btnOpenOrderPage.Style.BorderDashStyle = System.Drawing.Drawing2D.DashStyle.Dash; - this.btnOpenOrderPage.Style.BorderSide = DevComponents.DotNetBar.eBorderSide.None; - this.btnOpenOrderPage.Style.ForeColor.Color = System.Drawing.Color.White; - this.btnOpenOrderPage.Style.GradientAngle = 90; - this.btnOpenOrderPage.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center; - this.btnOpenOrderPage.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255))))); - this.btnOpenOrderPage.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255))))); - this.btnOpenOrderPage.TabIndex = 802; - this.btnOpenOrderPage.Text = "登录订单系统"; - this.btnOpenOrderPage.Click += new System.EventHandler(this.btnOpenOrder_Click); - // - // tableLayoutPanel1 - // - this.tableLayoutPanel1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle(); + this.label1 = new System.Windows.Forms.Label(); + this.splitContainer1 = new System.Windows.Forms.SplitContainer(); + this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel(); + this.panel5 = new System.Windows.Forms.Panel(); + this.btnCheck = new DevComponents.DotNetBar.PanelEx(); + this.btnEdit = new DevComponents.DotNetBar.PanelEx(); + this.btnLoginSelect = new TemuKJD.UserControls.ButtonEx(); + this.panel4 = new System.Windows.Forms.Panel(); + this.btnBatchRenewal = new DevComponents.DotNetBar.PanelEx(); + this.btnOpenOrderPage = new DevComponents.DotNetBar.PanelEx(); + this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); + this.cmbGroup = new TemuKJD.UserComponent.UcComboBoxMutiSelect(); + this.label2 = new System.Windows.Forms.Label(); + this.cmbNotes = new TemuKJD.UserComponent.UcComboBoxMutiSelect(); + this.txtShopId = new System.Windows.Forms.TextBox(); + this.label3 = new System.Windows.Forms.Label(); + this.txtShopName = new System.Windows.Forms.TextBox(); + this.label4 = new System.Windows.Forms.Label(); + this.btnRefreshShop = new DevComponents.DotNetBar.PanelEx(); + this.btnEmpty = new DevComponents.DotNetBar.PanelEx(); + this.btnSearch = new DevComponents.DotNetBar.PanelEx(); + this.cmbSubAccount = new TemuKJD.UserComponent.UcComboBoxMutiSelect(); + this.label5 = new System.Windows.Forms.Label(); + this.label6 = new System.Windows.Forms.Label(); + this.btnAddShop = new TemuKJD.UserControls.ButtonEx(); + this.splitContainer2 = new System.Windows.Forms.SplitContainer(); + this.pnlTopUp = new System.Windows.Forms.Panel(); + this.txtPrice = new System.Windows.Forms.Label(); + this.lblShopId = new System.Windows.Forms.Label(); + this.lblShopInfo = new System.Windows.Forms.Label(); + this.panel2 = new System.Windows.Forms.Panel(); + this.label7 = new System.Windows.Forms.Label(); + this.numAddTopUp = new System.Windows.Forms.NumericUpDown(); + this.label8 = new System.Windows.Forms.Label(); + this.btnTopUpCancel = new DevComponents.DotNetBar.PanelEx(); + this.btnTopUpOK = new DevComponents.DotNetBar.PanelEx(); + this.btnRefreshAuth = new TemuKJD.UserControls.ButtonEx(); + this.pbLoading = new System.Windows.Forms.PictureBox(); + this.btnImport = new TemuKJD.UserControls.ButtonEx(); + this.dgvShop = new TemuKJD.UserComponent.DataGridViewEx(); + this.colSelect = new System.Windows.Forms.DataGridViewCheckBoxColumn(); + this.colLoginName = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.colShopId = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.colShopAccount = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.colAddTime = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.colExpireTime = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.colRenewal = new System.Windows.Forms.DataGridViewLinkColumn(); + this.colNotes = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.colGroupName = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.colCookie = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.colSubUser = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.colSubUserAccount = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.colUploadAccount = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.colBuyAccount = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.colChatAccount = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.colLoginStatus = new System.Windows.Forms.DataGridViewTextBoxColumn(); + 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(); + this.colApiAuth = new System.Windows.Forms.DataGridViewLinkColumn(); + this.colBuyApiAuth = new System.Windows.Forms.DataGridViewLinkColumn(); + this.colUpdateCookies = new System.Windows.Forms.DataGridViewLinkColumn(); + 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(); + this.splitContainer1.SuspendLayout(); + this.tableLayoutPanel2.SuspendLayout(); + this.panel5.SuspendLayout(); + this.panel4.SuspendLayout(); + this.tableLayoutPanel1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).BeginInit(); + this.splitContainer2.Panel1.SuspendLayout(); + this.splitContainer2.Panel2.SuspendLayout(); + this.splitContainer2.SuspendLayout(); + this.pnlTopUp.SuspendLayout(); + this.panel2.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.numAddTopUp)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.pbLoading)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.dgvShop)).BeginInit(); + this.SuspendLayout(); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(13, 13); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(201, 17); + this.label1.TabIndex = 0; + this.label1.Text = "这里显示店铺列表 -- ShopListForm"; + // + // splitContainer1 + // + this.splitContainer1.BackColor = System.Drawing.Color.White; + this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill; + this.splitContainer1.FixedPanel = System.Windows.Forms.FixedPanel.Panel1; + this.splitContainer1.Location = new System.Drawing.Point(0, 0); + this.splitContainer1.Name = "splitContainer1"; + this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal; + // + // splitContainer1.Panel1 + // + this.splitContainer1.Panel1.Controls.Add(this.tableLayoutPanel2); + // + // splitContainer1.Panel2 + // + this.splitContainer1.Panel2.Controls.Add(this.splitContainer2); + this.splitContainer1.Panel2.Margin = new System.Windows.Forms.Padding(4); + this.splitContainer1.Size = new System.Drawing.Size(1394, 622); + this.splitContainer1.SplitterDistance = 46; + this.splitContainer1.TabIndex = 33; + // + // tableLayoutPanel2 + // + this.tableLayoutPanel2.ColumnCount = 2; + this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); + this.tableLayoutPanel2.Controls.Add(this.panel5, 1, 0); + this.tableLayoutPanel2.Controls.Add(this.panel4, 0, 0); + this.tableLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Fill; + this.tableLayoutPanel2.Location = new System.Drawing.Point(0, 0); + this.tableLayoutPanel2.Name = "tableLayoutPanel2"; + this.tableLayoutPanel2.RowCount = 1; + this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel2.Size = new System.Drawing.Size(1394, 46); + this.tableLayoutPanel2.TabIndex = 37; + // + // panel5 + // + this.panel5.Controls.Add(this.btnCheck); + this.panel5.Controls.Add(this.btnEdit); + this.panel5.Controls.Add(this.btnLoginSelect); + this.panel5.Location = new System.Drawing.Point(1142, 3); + this.panel5.Name = "panel5"; + this.panel5.Size = new System.Drawing.Size(249, 40); + this.panel5.TabIndex = 1; + // + // btnCheck + // + this.btnCheck.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); + this.btnCheck.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; + this.btnCheck.Cursor = System.Windows.Forms.Cursors.Hand; + this.btnCheck.DisabledBackColor = System.Drawing.Color.Empty; + this.btnCheck.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.btnCheck.Location = new System.Drawing.Point(98, 10); + this.btnCheck.Margin = new System.Windows.Forms.Padding(0, 3, 0, 3); + this.btnCheck.Name = "btnCheck"; + this.btnCheck.Size = new System.Drawing.Size(60, 23); + this.btnCheck.Style.Alignment = System.Drawing.StringAlignment.Center; + this.btnCheck.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); + this.btnCheck.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); + this.btnCheck.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder; + this.btnCheck.Style.BorderDashStyle = System.Drawing.Drawing2D.DashStyle.Dash; + this.btnCheck.Style.BorderSide = DevComponents.DotNetBar.eBorderSide.None; + this.btnCheck.Style.ForeColor.Color = System.Drawing.Color.White; + this.btnCheck.Style.GradientAngle = 90; + this.btnCheck.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center; + this.btnCheck.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255))))); + this.btnCheck.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255))))); + this.btnCheck.TabIndex = 810; + this.btnCheck.Text = "检测选中"; + this.btnCheck.Click += new System.EventHandler(this.btnCheck_Click); + // + // btnEdit + // + this.btnEdit.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); + this.btnEdit.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; + this.btnEdit.Cursor = System.Windows.Forms.Cursors.Hand; + this.btnEdit.DisabledBackColor = System.Drawing.Color.Empty; + this.btnEdit.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.btnEdit.Location = new System.Drawing.Point(33, 10); + this.btnEdit.Margin = new System.Windows.Forms.Padding(0, 3, 0, 3); + this.btnEdit.Name = "btnEdit"; + this.btnEdit.Size = new System.Drawing.Size(60, 23); + this.btnEdit.Style.Alignment = System.Drawing.StringAlignment.Center; + this.btnEdit.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); + this.btnEdit.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); + this.btnEdit.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder; + this.btnEdit.Style.BorderDashStyle = System.Drawing.Drawing2D.DashStyle.Dash; + this.btnEdit.Style.BorderSide = DevComponents.DotNetBar.eBorderSide.None; + this.btnEdit.Style.ForeColor.Color = System.Drawing.Color.White; + this.btnEdit.Style.GradientAngle = 90; + this.btnEdit.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center; + this.btnEdit.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255))))); + this.btnEdit.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255))))); + this.btnEdit.TabIndex = 806; + this.btnEdit.Text = "编辑选中"; + this.btnEdit.Click += new System.EventHandler(this.btnEdit_Click); + // + // btnLoginSelect + // + this.btnLoginSelect.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); + this.btnLoginSelect.Cursor = System.Windows.Forms.Cursors.Hand; + this.btnLoginSelect.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.btnLoginSelect.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.btnLoginSelect.ForeColor = System.Drawing.Color.White; + this.btnLoginSelect.Location = new System.Drawing.Point(163, 9); + this.btnLoginSelect.Margin = new System.Windows.Forms.Padding(2); + this.btnLoginSelect.Name = "btnLoginSelect"; + this.btnLoginSelect.Size = new System.Drawing.Size(66, 25); + this.btnLoginSelect.TabIndex = 373; + this.btnLoginSelect.Text = "登录选中"; + this.btnLoginSelect.UseVisualStyleBackColor = false; + this.btnLoginSelect.Click += new System.EventHandler(this.btnLoginSelect_Click); + // + // panel4 + // + this.panel4.Controls.Add(this.btnBatchRenewal); + this.panel4.Controls.Add(this.btnOpenOrderPage); + this.panel4.Controls.Add(this.tableLayoutPanel1); + this.panel4.Controls.Add(this.btnAddShop); + this.panel4.Dock = System.Windows.Forms.DockStyle.Fill; + this.panel4.Location = new System.Drawing.Point(3, 3); + this.panel4.Name = "panel4"; + this.panel4.Size = new System.Drawing.Size(1133, 40); + this.panel4.TabIndex = 0; + // + // btnBatchRenewal + // + this.btnBatchRenewal.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.btnBatchRenewal.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; + this.btnBatchRenewal.Cursor = System.Windows.Forms.Cursors.Hand; + this.btnBatchRenewal.DisabledBackColor = System.Drawing.Color.Empty; + this.btnBatchRenewal.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.btnBatchRenewal.Location = new System.Drawing.Point(935, 9); + this.btnBatchRenewal.Margin = new System.Windows.Forms.Padding(0, 3, 0, 3); + this.btnBatchRenewal.Name = "btnBatchRenewal"; + this.btnBatchRenewal.Size = new System.Drawing.Size(79, 23); + this.btnBatchRenewal.Style.Alignment = System.Drawing.StringAlignment.Center; + this.btnBatchRenewal.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); + this.btnBatchRenewal.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); + this.btnBatchRenewal.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder; + this.btnBatchRenewal.Style.BorderDashStyle = System.Drawing.Drawing2D.DashStyle.Dash; + this.btnBatchRenewal.Style.BorderSide = DevComponents.DotNetBar.eBorderSide.None; + this.btnBatchRenewal.Style.ForeColor.Color = System.Drawing.Color.White; + this.btnBatchRenewal.Style.GradientAngle = 90; + this.btnBatchRenewal.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center; + this.btnBatchRenewal.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255))))); + this.btnBatchRenewal.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255))))); + this.btnBatchRenewal.TabIndex = 806; + this.btnBatchRenewal.Text = "批量续期"; + this.btnBatchRenewal.Visible = false; + this.btnBatchRenewal.Click += new System.EventHandler(this.btnBatchRenewal_Click); + // + // btnOpenOrderPage + // + this.btnOpenOrderPage.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.btnOpenOrderPage.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; + this.btnOpenOrderPage.Cursor = System.Windows.Forms.Cursors.Hand; + this.btnOpenOrderPage.DisabledBackColor = System.Drawing.Color.Empty; + this.btnOpenOrderPage.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.btnOpenOrderPage.Location = new System.Drawing.Point(1018, 9); + this.btnOpenOrderPage.Margin = new System.Windows.Forms.Padding(0, 3, 0, 3); + this.btnOpenOrderPage.Name = "btnOpenOrderPage"; + this.btnOpenOrderPage.Size = new System.Drawing.Size(106, 23); + this.btnOpenOrderPage.Style.Alignment = System.Drawing.StringAlignment.Center; + this.btnOpenOrderPage.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); + this.btnOpenOrderPage.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); + this.btnOpenOrderPage.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder; + this.btnOpenOrderPage.Style.BorderDashStyle = System.Drawing.Drawing2D.DashStyle.Dash; + this.btnOpenOrderPage.Style.BorderSide = DevComponents.DotNetBar.eBorderSide.None; + this.btnOpenOrderPage.Style.ForeColor.Color = System.Drawing.Color.White; + this.btnOpenOrderPage.Style.GradientAngle = 90; + this.btnOpenOrderPage.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center; + this.btnOpenOrderPage.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255))))); + this.btnOpenOrderPage.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255))))); + this.btnOpenOrderPage.TabIndex = 802; + this.btnOpenOrderPage.Text = "登录订单系统"; + this.btnOpenOrderPage.Click += new System.EventHandler(this.btnOpenOrder_Click); + // + // tableLayoutPanel1 + // + this.tableLayoutPanel1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.tableLayoutPanel1.ColumnCount = 17; - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 20.00054F)); - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 20.00053F)); - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 20.00053F)); - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 19.99841F)); - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 20F)); - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 2F)); - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 60F)); - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 2F)); - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 60F)); - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 2F)); - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 60F)); - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); - this.tableLayoutPanel1.Controls.Add(this.cmbGroup, 7, 0); - this.tableLayoutPanel1.Controls.Add(this.label2, 0, 0); - this.tableLayoutPanel1.Controls.Add(this.cmbNotes, 5, 0); - this.tableLayoutPanel1.Controls.Add(this.txtShopId, 1, 0); - this.tableLayoutPanel1.Controls.Add(this.label3, 2, 0); - this.tableLayoutPanel1.Controls.Add(this.txtShopName, 3, 0); - this.tableLayoutPanel1.Controls.Add(this.label4, 4, 0); - this.tableLayoutPanel1.Controls.Add(this.btnRefreshShop, 11, 0); - this.tableLayoutPanel1.Controls.Add(this.btnEmpty, 15, 0); - this.tableLayoutPanel1.Controls.Add(this.btnSearch, 13, 0); - this.tableLayoutPanel1.Controls.Add(this.cmbSubAccount, 9, 0); - this.tableLayoutPanel1.Controls.Add(this.label5, 8, 0); - this.tableLayoutPanel1.Controls.Add(this.label6, 6, 0); - this.tableLayoutPanel1.Location = new System.Drawing.Point(94, 0); - this.tableLayoutPanel1.Name = "tableLayoutPanel1"; - this.tableLayoutPanel1.RowCount = 1; - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); - this.tableLayoutPanel1.Size = new System.Drawing.Size(767, 40); - this.tableLayoutPanel1.TabIndex = 375; - // - // cmbGroup - // - this.cmbGroup.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); - this.cmbGroup.DefaultText = "全部"; - this.cmbGroup.DropDownHeight = 1; - this.cmbGroup.DropDownWidth = 1; - this.cmbGroup.FormattingEnabled = true; - this.cmbGroup.IntegralHeight = false; - this.cmbGroup.Location = new System.Drawing.Point(385, 8); - this.cmbGroup.Margin = new System.Windows.Forms.Padding(0, 0, 0, 4); - this.cmbGroup.Name = "cmbGroup"; - this.cmbGroup.Size = new System.Drawing.Size(74, 25); - this.cmbGroup.TabIndex = 803; - this.cmbGroup.Text = "全部"; - // - // label2 - // - this.label2.Anchor = System.Windows.Forms.AnchorStyles.None; - this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(3, 11); - this.label2.Margin = new System.Windows.Forms.Padding(3, 3, 0, 3); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(43, 17); - this.label2.TabIndex = 373; - this.label2.Text = "店铺id"; - // - // cmbNotes - // - this.cmbNotes.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); - this.cmbNotes.DefaultText = "全部"; - this.cmbNotes.DropDownHeight = 1; - this.cmbNotes.DropDownWidth = 1; - this.cmbNotes.FormattingEnabled = true; - this.cmbNotes.IntegralHeight = false; - this.cmbNotes.Location = new System.Drawing.Point(276, 8); - this.cmbNotes.Margin = new System.Windows.Forms.Padding(0, 0, 0, 4); - this.cmbNotes.Name = "cmbNotes"; - this.cmbNotes.Size = new System.Drawing.Size(74, 25); - this.cmbNotes.TabIndex = 413; - this.cmbNotes.Text = "全部"; - // - // txtShopId - // - this.txtShopId.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); - this.txtShopId.Location = new System.Drawing.Point(46, 8); - this.txtShopId.Margin = new System.Windows.Forms.Padding(0, 3, 0, 3); - this.txtShopId.Name = "txtShopId"; - this.txtShopId.Size = new System.Drawing.Size(74, 23); - this.txtShopId.TabIndex = 372; - // - // label3 - // - this.label3.Anchor = System.Windows.Forms.AnchorStyles.None; - this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point(123, 11); - this.label3.Margin = new System.Windows.Forms.Padding(3, 3, 0, 3); - this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(44, 17); - this.label3.TabIndex = 375; - this.label3.Text = "店铺名"; - // - // txtShopName - // - this.txtShopName.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); - this.txtShopName.Location = new System.Drawing.Point(167, 8); - this.txtShopName.Margin = new System.Windows.Forms.Padding(0, 3, 0, 3); - this.txtShopName.Name = "txtShopName"; - this.txtShopName.Size = new System.Drawing.Size(74, 23); - this.txtShopName.TabIndex = 374; - // - // label4 - // - this.label4.Anchor = System.Windows.Forms.AnchorStyles.None; - this.label4.AutoSize = true; - this.label4.Location = new System.Drawing.Point(244, 11); - this.label4.Margin = new System.Windows.Forms.Padding(3, 3, 0, 3); - this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size(32, 17); - this.label4.TabIndex = 377; - this.label4.Text = "备注"; - // - // btnRefreshShop - // - this.btnRefreshShop.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); - this.btnRefreshShop.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; - this.btnRefreshShop.Cursor = System.Windows.Forms.Cursors.Hand; - this.btnRefreshShop.DisabledBackColor = System.Drawing.Color.Empty; - this.btnRefreshShop.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.btnRefreshShop.Location = new System.Drawing.Point(582, 8); - this.btnRefreshShop.Margin = new System.Windows.Forms.Padding(0, 3, 0, 3); - this.btnRefreshShop.Name = "btnRefreshShop"; - this.btnRefreshShop.Size = new System.Drawing.Size(60, 23); - this.btnRefreshShop.Style.Alignment = System.Drawing.StringAlignment.Center; - this.btnRefreshShop.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); - this.btnRefreshShop.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); - this.btnRefreshShop.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder; - this.btnRefreshShop.Style.BorderDashStyle = System.Drawing.Drawing2D.DashStyle.Dash; - this.btnRefreshShop.Style.BorderSide = DevComponents.DotNetBar.eBorderSide.None; - this.btnRefreshShop.Style.ForeColor.Color = System.Drawing.Color.White; - this.btnRefreshShop.Style.GradientAngle = 90; - this.btnRefreshShop.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center; - this.btnRefreshShop.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255))))); - this.btnRefreshShop.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255))))); - this.btnRefreshShop.TabIndex = 802; - this.btnRefreshShop.Text = "刷新店铺"; - this.btnRefreshShop.Click += new System.EventHandler(this.btnRefreshCookie_Click); - // - // btnEmpty - // - this.btnEmpty.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); - this.btnEmpty.CanvasColor = System.Drawing.SystemColors.Control; - this.btnEmpty.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; - this.btnEmpty.DisabledBackColor = System.Drawing.Color.Empty; - this.btnEmpty.Location = new System.Drawing.Point(706, 8); - this.btnEmpty.Margin = new System.Windows.Forms.Padding(0, 3, 0, 3); - this.btnEmpty.Name = "btnEmpty"; - this.btnEmpty.Size = new System.Drawing.Size(60, 23); - this.btnEmpty.Style.Alignment = System.Drawing.StringAlignment.Center; - this.btnEmpty.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(185)))), ((int)(((byte)(215)))), ((int)(((byte)(255))))); - this.btnEmpty.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(185)))), ((int)(((byte)(215)))), ((int)(((byte)(255))))); - this.btnEmpty.Style.Border = DevComponents.DotNetBar.eBorderType.SingleLine; - this.btnEmpty.Style.BorderColor.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); - this.btnEmpty.Style.ForeColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelText; - this.btnEmpty.Style.GradientAngle = 90; - this.btnEmpty.StyleMouseDown.Alignment = System.Drawing.StringAlignment.Center; - this.btnEmpty.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center; - this.btnEmpty.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); - this.btnEmpty.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); - this.btnEmpty.StyleMouseOver.ForeColor.Color = System.Drawing.Color.White; - this.btnEmpty.TabIndex = 409; - this.btnEmpty.Text = "清空条件"; - this.btnEmpty.Click += new System.EventHandler(this.btnEmpty_Click); - // - // btnSearch - // - this.btnSearch.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); - this.btnSearch.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; - this.btnSearch.Cursor = System.Windows.Forms.Cursors.Hand; - this.btnSearch.DisabledBackColor = System.Drawing.Color.Empty; - this.btnSearch.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.btnSearch.Location = new System.Drawing.Point(644, 8); - this.btnSearch.Margin = new System.Windows.Forms.Padding(0, 3, 0, 3); - this.btnSearch.Name = "btnSearch"; - this.btnSearch.Size = new System.Drawing.Size(60, 23); - this.btnSearch.Style.Alignment = System.Drawing.StringAlignment.Center; - this.btnSearch.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); - this.btnSearch.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); - this.btnSearch.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder; - this.btnSearch.Style.BorderDashStyle = System.Drawing.Drawing2D.DashStyle.Dash; - this.btnSearch.Style.BorderSide = DevComponents.DotNetBar.eBorderSide.None; - this.btnSearch.Style.ForeColor.Color = System.Drawing.Color.White; - this.btnSearch.Style.GradientAngle = 90; - this.btnSearch.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center; - this.btnSearch.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255))))); - this.btnSearch.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255))))); - this.btnSearch.TabIndex = 798; - this.btnSearch.Text = "筛选"; - this.btnSearch.Click += new System.EventHandler(this.btnSearch_Click); - // - // cmbSubAccount - // - this.cmbSubAccount.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); - this.cmbSubAccount.DefaultText = "全部"; - this.cmbSubAccount.DropDownHeight = 1; - this.cmbSubAccount.DropDownWidth = 1; - this.cmbSubAccount.FormattingEnabled = true; - this.cmbSubAccount.IntegralHeight = false; - this.cmbSubAccount.Location = new System.Drawing.Point(506, 8); - this.cmbSubAccount.Margin = new System.Windows.Forms.Padding(0, 0, 0, 4); - this.cmbSubAccount.Name = "cmbSubAccount"; - this.cmbSubAccount.Size = new System.Drawing.Size(74, 25); - this.cmbSubAccount.TabIndex = 415; - this.cmbSubAccount.Text = "全部"; - // - // label5 - // - this.label5.Anchor = System.Windows.Forms.AnchorStyles.None; - this.label5.AutoSize = true; - this.label5.Location = new System.Drawing.Point(462, 11); - this.label5.Margin = new System.Windows.Forms.Padding(3, 3, 0, 3); - this.label5.Name = "label5"; - this.label5.Size = new System.Drawing.Size(44, 17); - this.label5.TabIndex = 414; - this.label5.Text = "子账户"; - // - // label6 - // - this.label6.Anchor = System.Windows.Forms.AnchorStyles.None; - this.label6.AutoSize = true; - this.label6.Location = new System.Drawing.Point(353, 11); - this.label6.Margin = new System.Windows.Forms.Padding(3, 3, 0, 3); - this.label6.Name = "label6"; - this.label6.Size = new System.Drawing.Size(32, 17); - this.label6.TabIndex = 415; - this.label6.Text = "分组"; - // - // btnAddShop - // - this.btnAddShop.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); - this.btnAddShop.Cursor = System.Windows.Forms.Cursors.Hand; - this.btnAddShop.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.btnAddShop.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.btnAddShop.ForeColor = System.Drawing.Color.White; - this.btnAddShop.Location = new System.Drawing.Point(1, 9); - this.btnAddShop.Margin = new System.Windows.Forms.Padding(2); - this.btnAddShop.Name = "btnAddShop"; - this.btnAddShop.Size = new System.Drawing.Size(90, 25); - this.btnAddShop.TabIndex = 370; - this.btnAddShop.Text = "扫码添加店铺"; - this.btnAddShop.UseVisualStyleBackColor = false; - this.btnAddShop.Click += new System.EventHandler(this.btnAddShop_Click); - // - // splitContainer2 - // - this.splitContainer2.BackColor = System.Drawing.Color.White; - this.splitContainer2.Dock = System.Windows.Forms.DockStyle.Fill; - this.splitContainer2.Location = new System.Drawing.Point(0, 0); - this.splitContainer2.Name = "splitContainer2"; - this.splitContainer2.Orientation = System.Windows.Forms.Orientation.Horizontal; - // - // splitContainer2.Panel1 - // - this.splitContainer2.Panel1.BackColor = System.Drawing.Color.White; - this.splitContainer2.Panel1.Controls.Add(this.pnlTopUp); - this.splitContainer2.Panel1.Controls.Add(this.btnRefreshAuth); - this.splitContainer2.Panel1.Controls.Add(this.pbLoading); - this.splitContainer2.Panel1.Controls.Add(this.btnImport); - this.splitContainer2.Panel1.Controls.Add(this.dgvShop); - this.splitContainer2.Panel1.Padding = new System.Windows.Forms.Padding(4, 0, 4, 0); - // - // splitContainer2.Panel2 - // - this.splitContainer2.Panel2.Controls.Add(this.chkAutoDrag); - this.splitContainer2.Panel2.Controls.Add(this.statusBar); - this.splitContainer2.Size = new System.Drawing.Size(1394, 572); - this.splitContainer2.SplitterDistance = 540; - this.splitContainer2.TabIndex = 0; - // - // pnlTopUp - // - this.pnlTopUp.Anchor = System.Windows.Forms.AnchorStyles.None; - this.pnlTopUp.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.pnlTopUp.Controls.Add(this.txtPrice); - this.pnlTopUp.Controls.Add(this.lblShopId); - this.pnlTopUp.Controls.Add(this.lblShopInfo); - this.pnlTopUp.Controls.Add(this.panel2); - this.pnlTopUp.Location = new System.Drawing.Point(460, 197); - this.pnlTopUp.Name = "pnlTopUp"; - this.pnlTopUp.Size = new System.Drawing.Size(474, 146); - this.pnlTopUp.TabIndex = 375; - this.pnlTopUp.Visible = false; - // - // txtPrice - // - this.txtPrice.Location = new System.Drawing.Point(125, 115); - this.txtPrice.Name = "txtPrice"; - this.txtPrice.Size = new System.Drawing.Size(322, 17); - this.txtPrice.TabIndex = 457; - this.txtPrice.Text = "预计续费点数:0"; - this.txtPrice.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // - // lblShopId - // - this.lblShopId.AutoSize = true; - this.lblShopId.Location = new System.Drawing.Point(20, 115); - this.lblShopId.Name = "lblShopId"; - this.lblShopId.Size = new System.Drawing.Size(50, 17); - this.lblShopId.TabIndex = 456; - this.lblShopId.Text = "ShopId"; - this.lblShopId.Visible = false; - // - // lblShopInfo - // - this.lblShopInfo.AutoSize = true; - this.lblShopInfo.Location = new System.Drawing.Point(20, 19); - this.lblShopInfo.Name = "lblShopInfo"; - this.lblShopInfo.Size = new System.Drawing.Size(61, 17); - this.lblShopInfo.TabIndex = 455; - this.lblShopInfo.Text = "ShopInfo"; - // - // panel2 - // - this.panel2.Anchor = System.Windows.Forms.AnchorStyles.Top; - this.panel2.Controls.Add(this.label7); - this.panel2.Controls.Add(this.numAddTopUp); - this.panel2.Controls.Add(this.label8); - this.panel2.Controls.Add(this.btnTopUpCancel); - this.panel2.Controls.Add(this.btnTopUpOK); - this.panel2.Location = new System.Drawing.Point(23, 52); - this.panel2.Name = "panel2"; - this.panel2.Size = new System.Drawing.Size(424, 57); - this.panel2.TabIndex = 454; - // - // label7 - // - this.label7.AutoSize = true; - this.label7.Location = new System.Drawing.Point(191, 19); - this.label7.Name = "label7"; - this.label7.Size = new System.Drawing.Size(32, 17); - this.label7.TabIndex = 465; - this.label7.Text = "个月"; - // - // numAddTopUp - // - this.numAddTopUp.Location = new System.Drawing.Point(151, 16); - this.numAddTopUp.Maximum = new decimal(new int[] { + this.tableLayoutPanel1.ColumnCount = 17; + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 20.00054F)); + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 20.00053F)); + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 20.00053F)); + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 19.99841F)); + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 20F)); + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 2F)); + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 60F)); + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 2F)); + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 60F)); + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 2F)); + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 60F)); + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); + this.tableLayoutPanel1.Controls.Add(this.cmbGroup, 7, 0); + this.tableLayoutPanel1.Controls.Add(this.label2, 0, 0); + this.tableLayoutPanel1.Controls.Add(this.cmbNotes, 5, 0); + this.tableLayoutPanel1.Controls.Add(this.txtShopId, 1, 0); + this.tableLayoutPanel1.Controls.Add(this.label3, 2, 0); + this.tableLayoutPanel1.Controls.Add(this.txtShopName, 3, 0); + this.tableLayoutPanel1.Controls.Add(this.label4, 4, 0); + this.tableLayoutPanel1.Controls.Add(this.btnRefreshShop, 11, 0); + this.tableLayoutPanel1.Controls.Add(this.btnEmpty, 15, 0); + this.tableLayoutPanel1.Controls.Add(this.btnSearch, 13, 0); + this.tableLayoutPanel1.Controls.Add(this.cmbSubAccount, 9, 0); + this.tableLayoutPanel1.Controls.Add(this.label5, 8, 0); + this.tableLayoutPanel1.Controls.Add(this.label6, 6, 0); + this.tableLayoutPanel1.Location = new System.Drawing.Point(94, 0); + this.tableLayoutPanel1.Name = "tableLayoutPanel1"; + this.tableLayoutPanel1.RowCount = 1; + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel1.Size = new System.Drawing.Size(767, 40); + this.tableLayoutPanel1.TabIndex = 375; + // + // cmbGroup + // + this.cmbGroup.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); + this.cmbGroup.DefaultText = "全部"; + this.cmbGroup.DropDownHeight = 1; + this.cmbGroup.DropDownWidth = 1; + this.cmbGroup.FormattingEnabled = true; + this.cmbGroup.IntegralHeight = false; + this.cmbGroup.Location = new System.Drawing.Point(385, 5); + this.cmbGroup.Margin = new System.Windows.Forms.Padding(0, 0, 0, 4); + this.cmbGroup.Name = "cmbGroup"; + this.cmbGroup.Size = new System.Drawing.Size(74, 25); + this.cmbGroup.TabIndex = 803; + this.cmbGroup.Text = "全部"; + // + // label2 + // + this.label2.Anchor = System.Windows.Forms.AnchorStyles.None; + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(3, 11); + this.label2.Margin = new System.Windows.Forms.Padding(3, 3, 0, 3); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(43, 17); + this.label2.TabIndex = 373; + this.label2.Text = "店铺id"; + // + // cmbNotes + // + this.cmbNotes.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); + this.cmbNotes.DefaultText = "全部"; + this.cmbNotes.DropDownHeight = 1; + this.cmbNotes.DropDownWidth = 1; + this.cmbNotes.FormattingEnabled = true; + this.cmbNotes.IntegralHeight = false; + this.cmbNotes.Location = new System.Drawing.Point(276, 5); + this.cmbNotes.Margin = new System.Windows.Forms.Padding(0, 0, 0, 4); + this.cmbNotes.Name = "cmbNotes"; + this.cmbNotes.Size = new System.Drawing.Size(74, 25); + this.cmbNotes.TabIndex = 413; + this.cmbNotes.Text = "全部"; + // + // txtShopId + // + this.txtShopId.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); + this.txtShopId.Location = new System.Drawing.Point(46, 8); + this.txtShopId.Margin = new System.Windows.Forms.Padding(0, 3, 0, 3); + this.txtShopId.Name = "txtShopId"; + this.txtShopId.Size = new System.Drawing.Size(74, 23); + this.txtShopId.TabIndex = 372; + // + // label3 + // + this.label3.Anchor = System.Windows.Forms.AnchorStyles.None; + this.label3.AutoSize = true; + this.label3.Location = new System.Drawing.Point(123, 11); + this.label3.Margin = new System.Windows.Forms.Padding(3, 3, 0, 3); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(44, 17); + this.label3.TabIndex = 375; + this.label3.Text = "店铺名"; + // + // txtShopName + // + this.txtShopName.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); + this.txtShopName.Location = new System.Drawing.Point(167, 8); + this.txtShopName.Margin = new System.Windows.Forms.Padding(0, 3, 0, 3); + this.txtShopName.Name = "txtShopName"; + this.txtShopName.Size = new System.Drawing.Size(74, 23); + this.txtShopName.TabIndex = 374; + // + // label4 + // + this.label4.Anchor = System.Windows.Forms.AnchorStyles.None; + this.label4.AutoSize = true; + this.label4.Location = new System.Drawing.Point(244, 11); + this.label4.Margin = new System.Windows.Forms.Padding(3, 3, 0, 3); + this.label4.Name = "label4"; + this.label4.Size = new System.Drawing.Size(32, 17); + this.label4.TabIndex = 377; + this.label4.Text = "备注"; + // + // btnRefreshShop + // + this.btnRefreshShop.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); + this.btnRefreshShop.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; + this.btnRefreshShop.Cursor = System.Windows.Forms.Cursors.Hand; + this.btnRefreshShop.DisabledBackColor = System.Drawing.Color.Empty; + this.btnRefreshShop.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.btnRefreshShop.Location = new System.Drawing.Point(582, 8); + this.btnRefreshShop.Margin = new System.Windows.Forms.Padding(0, 3, 0, 3); + this.btnRefreshShop.Name = "btnRefreshShop"; + this.btnRefreshShop.Size = new System.Drawing.Size(60, 23); + this.btnRefreshShop.Style.Alignment = System.Drawing.StringAlignment.Center; + this.btnRefreshShop.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); + this.btnRefreshShop.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); + this.btnRefreshShop.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder; + this.btnRefreshShop.Style.BorderDashStyle = System.Drawing.Drawing2D.DashStyle.Dash; + this.btnRefreshShop.Style.BorderSide = DevComponents.DotNetBar.eBorderSide.None; + this.btnRefreshShop.Style.ForeColor.Color = System.Drawing.Color.White; + this.btnRefreshShop.Style.GradientAngle = 90; + this.btnRefreshShop.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center; + this.btnRefreshShop.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255))))); + this.btnRefreshShop.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255))))); + this.btnRefreshShop.TabIndex = 802; + this.btnRefreshShop.Text = "刷新店铺"; + this.btnRefreshShop.Click += new System.EventHandler(this.btnRefreshCookie_Click); + // + // btnEmpty + // + this.btnEmpty.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); + this.btnEmpty.CanvasColor = System.Drawing.SystemColors.Control; + this.btnEmpty.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; + this.btnEmpty.DisabledBackColor = System.Drawing.Color.Empty; + this.btnEmpty.Location = new System.Drawing.Point(706, 8); + this.btnEmpty.Margin = new System.Windows.Forms.Padding(0, 3, 0, 3); + this.btnEmpty.Name = "btnEmpty"; + this.btnEmpty.Size = new System.Drawing.Size(60, 23); + this.btnEmpty.Style.Alignment = System.Drawing.StringAlignment.Center; + this.btnEmpty.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(185)))), ((int)(((byte)(215)))), ((int)(((byte)(255))))); + this.btnEmpty.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(185)))), ((int)(((byte)(215)))), ((int)(((byte)(255))))); + this.btnEmpty.Style.Border = DevComponents.DotNetBar.eBorderType.SingleLine; + this.btnEmpty.Style.BorderColor.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); + this.btnEmpty.Style.ForeColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelText; + this.btnEmpty.Style.GradientAngle = 90; + this.btnEmpty.StyleMouseDown.Alignment = System.Drawing.StringAlignment.Center; + this.btnEmpty.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center; + this.btnEmpty.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); + this.btnEmpty.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); + this.btnEmpty.StyleMouseOver.ForeColor.Color = System.Drawing.Color.White; + this.btnEmpty.TabIndex = 409; + this.btnEmpty.Text = "清空条件"; + this.btnEmpty.Click += new System.EventHandler(this.btnEmpty_Click); + // + // btnSearch + // + this.btnSearch.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); + this.btnSearch.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; + this.btnSearch.Cursor = System.Windows.Forms.Cursors.Hand; + this.btnSearch.DisabledBackColor = System.Drawing.Color.Empty; + this.btnSearch.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.btnSearch.Location = new System.Drawing.Point(644, 8); + this.btnSearch.Margin = new System.Windows.Forms.Padding(0, 3, 0, 3); + this.btnSearch.Name = "btnSearch"; + this.btnSearch.Size = new System.Drawing.Size(60, 23); + this.btnSearch.Style.Alignment = System.Drawing.StringAlignment.Center; + this.btnSearch.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); + this.btnSearch.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); + this.btnSearch.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder; + this.btnSearch.Style.BorderDashStyle = System.Drawing.Drawing2D.DashStyle.Dash; + this.btnSearch.Style.BorderSide = DevComponents.DotNetBar.eBorderSide.None; + this.btnSearch.Style.ForeColor.Color = System.Drawing.Color.White; + this.btnSearch.Style.GradientAngle = 90; + this.btnSearch.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center; + this.btnSearch.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255))))); + this.btnSearch.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255))))); + this.btnSearch.TabIndex = 798; + this.btnSearch.Text = "筛选"; + this.btnSearch.Click += new System.EventHandler(this.btnSearch_Click); + // + // cmbSubAccount + // + this.cmbSubAccount.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); + this.cmbSubAccount.DefaultText = "全部"; + this.cmbSubAccount.DropDownHeight = 1; + this.cmbSubAccount.DropDownWidth = 1; + this.cmbSubAccount.FormattingEnabled = true; + this.cmbSubAccount.IntegralHeight = false; + this.cmbSubAccount.Location = new System.Drawing.Point(506, 5); + this.cmbSubAccount.Margin = new System.Windows.Forms.Padding(0, 0, 0, 4); + this.cmbSubAccount.Name = "cmbSubAccount"; + this.cmbSubAccount.Size = new System.Drawing.Size(74, 25); + this.cmbSubAccount.TabIndex = 415; + this.cmbSubAccount.Text = "全部"; + // + // label5 + // + this.label5.Anchor = System.Windows.Forms.AnchorStyles.None; + this.label5.AutoSize = true; + this.label5.Location = new System.Drawing.Point(462, 11); + this.label5.Margin = new System.Windows.Forms.Padding(3, 3, 0, 3); + this.label5.Name = "label5"; + this.label5.Size = new System.Drawing.Size(44, 17); + this.label5.TabIndex = 414; + this.label5.Text = "子账户"; + // + // label6 + // + this.label6.Anchor = System.Windows.Forms.AnchorStyles.None; + this.label6.AutoSize = true; + this.label6.Location = new System.Drawing.Point(353, 11); + this.label6.Margin = new System.Windows.Forms.Padding(3, 3, 0, 3); + this.label6.Name = "label6"; + this.label6.Size = new System.Drawing.Size(32, 17); + this.label6.TabIndex = 415; + this.label6.Text = "分组"; + // + // btnAddShop + // + this.btnAddShop.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); + this.btnAddShop.Cursor = System.Windows.Forms.Cursors.Hand; + this.btnAddShop.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.btnAddShop.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.btnAddShop.ForeColor = System.Drawing.Color.White; + this.btnAddShop.Location = new System.Drawing.Point(1, 9); + this.btnAddShop.Margin = new System.Windows.Forms.Padding(2); + this.btnAddShop.Name = "btnAddShop"; + this.btnAddShop.Size = new System.Drawing.Size(90, 25); + this.btnAddShop.TabIndex = 370; + this.btnAddShop.Text = "扫码添加店铺"; + this.btnAddShop.UseVisualStyleBackColor = false; + this.btnAddShop.Click += new System.EventHandler(this.btnAddShop_Click); + // + // splitContainer2 + // + this.splitContainer2.BackColor = System.Drawing.Color.White; + this.splitContainer2.Dock = System.Windows.Forms.DockStyle.Fill; + this.splitContainer2.Location = new System.Drawing.Point(0, 0); + this.splitContainer2.Name = "splitContainer2"; + this.splitContainer2.Orientation = System.Windows.Forms.Orientation.Horizontal; + // + // splitContainer2.Panel1 + // + this.splitContainer2.Panel1.BackColor = System.Drawing.Color.White; + this.splitContainer2.Panel1.Controls.Add(this.pnlTopUp); + this.splitContainer2.Panel1.Controls.Add(this.btnRefreshAuth); + this.splitContainer2.Panel1.Controls.Add(this.pbLoading); + this.splitContainer2.Panel1.Controls.Add(this.btnImport); + this.splitContainer2.Panel1.Controls.Add(this.dgvShop); + this.splitContainer2.Panel1.Padding = new System.Windows.Forms.Padding(4, 0, 4, 0); + // + // splitContainer2.Panel2 + // + this.splitContainer2.Panel2.Controls.Add(this.chkAutoDrag); + this.splitContainer2.Panel2.Controls.Add(this.statusBar); + this.splitContainer2.Size = new System.Drawing.Size(1394, 572); + this.splitContainer2.SplitterDistance = 540; + this.splitContainer2.TabIndex = 0; + // + // pnlTopUp + // + this.pnlTopUp.Anchor = System.Windows.Forms.AnchorStyles.None; + this.pnlTopUp.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.pnlTopUp.Controls.Add(this.txtPrice); + this.pnlTopUp.Controls.Add(this.lblShopId); + this.pnlTopUp.Controls.Add(this.lblShopInfo); + this.pnlTopUp.Controls.Add(this.panel2); + this.pnlTopUp.Location = new System.Drawing.Point(460, 197); + this.pnlTopUp.Name = "pnlTopUp"; + this.pnlTopUp.Size = new System.Drawing.Size(474, 146); + this.pnlTopUp.TabIndex = 375; + this.pnlTopUp.Visible = false; + // + // txtPrice + // + this.txtPrice.Location = new System.Drawing.Point(125, 115); + this.txtPrice.Name = "txtPrice"; + this.txtPrice.Size = new System.Drawing.Size(322, 17); + this.txtPrice.TabIndex = 457; + this.txtPrice.Text = "预计续费点数:0"; + this.txtPrice.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // lblShopId + // + this.lblShopId.AutoSize = true; + this.lblShopId.Location = new System.Drawing.Point(20, 115); + this.lblShopId.Name = "lblShopId"; + this.lblShopId.Size = new System.Drawing.Size(50, 17); + this.lblShopId.TabIndex = 456; + this.lblShopId.Text = "ShopId"; + this.lblShopId.Visible = false; + // + // lblShopInfo + // + this.lblShopInfo.AutoSize = true; + this.lblShopInfo.Location = new System.Drawing.Point(20, 19); + this.lblShopInfo.Name = "lblShopInfo"; + this.lblShopInfo.Size = new System.Drawing.Size(61, 17); + this.lblShopInfo.TabIndex = 455; + this.lblShopInfo.Text = "ShopInfo"; + // + // panel2 + // + this.panel2.Anchor = System.Windows.Forms.AnchorStyles.Top; + this.panel2.Controls.Add(this.label7); + this.panel2.Controls.Add(this.numAddTopUp); + this.panel2.Controls.Add(this.label8); + this.panel2.Controls.Add(this.btnTopUpCancel); + this.panel2.Controls.Add(this.btnTopUpOK); + this.panel2.Location = new System.Drawing.Point(23, 52); + this.panel2.Name = "panel2"; + this.panel2.Size = new System.Drawing.Size(424, 57); + this.panel2.TabIndex = 454; + // + // label7 + // + this.label7.AutoSize = true; + this.label7.Location = new System.Drawing.Point(191, 19); + this.label7.Name = "label7"; + this.label7.Size = new System.Drawing.Size(32, 17); + this.label7.TabIndex = 465; + this.label7.Text = "个月"; + // + // numAddTopUp + // + this.numAddTopUp.Location = new System.Drawing.Point(151, 16); + this.numAddTopUp.Maximum = new decimal(new int[] { 10000, 0, 0, 0}); - this.numAddTopUp.Name = "numAddTopUp"; - this.numAddTopUp.Size = new System.Drawing.Size(36, 23); - this.numAddTopUp.TabIndex = 1; - this.numAddTopUp.ValueChanged += new System.EventHandler(this.numAddTopUp_ValueChanged); - // - // label8 - // - this.label8.AutoSize = true; - this.label8.Location = new System.Drawing.Point(87, 19); - this.label8.Name = "label8"; - this.label8.Size = new System.Drawing.Size(68, 17); - this.label8.TabIndex = 456; - this.label8.Text = "店铺续费:"; - // - // btnTopUpCancel - // - this.btnTopUpCancel.CanvasColor = System.Drawing.SystemColors.Control; - this.btnTopUpCancel.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; - this.btnTopUpCancel.DisabledBackColor = System.Drawing.Color.Empty; - this.btnTopUpCancel.Location = new System.Drawing.Point(284, 16); - this.btnTopUpCancel.Name = "btnTopUpCancel"; - this.btnTopUpCancel.Size = new System.Drawing.Size(56, 23); - this.btnTopUpCancel.Style.Alignment = System.Drawing.StringAlignment.Center; - this.btnTopUpCancel.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(185)))), ((int)(((byte)(215)))), ((int)(((byte)(255))))); - this.btnTopUpCancel.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(185)))), ((int)(((byte)(215)))), ((int)(((byte)(255))))); - this.btnTopUpCancel.Style.Border = DevComponents.DotNetBar.eBorderType.SingleLine; - this.btnTopUpCancel.Style.BorderColor.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); - this.btnTopUpCancel.Style.ForeColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelText; - this.btnTopUpCancel.Style.GradientAngle = 90; - this.btnTopUpCancel.StyleMouseDown.Alignment = System.Drawing.StringAlignment.Center; - this.btnTopUpCancel.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center; - this.btnTopUpCancel.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); - this.btnTopUpCancel.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); - this.btnTopUpCancel.StyleMouseOver.ForeColor.Color = System.Drawing.Color.White; - this.btnTopUpCancel.TabIndex = 458; - this.btnTopUpCancel.Text = "取消"; - this.btnTopUpCancel.Click += new System.EventHandler(this.btnTopUpCancel_Click); - // - // btnTopUpOK - // - this.btnTopUpOK.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; - this.btnTopUpOK.Cursor = System.Windows.Forms.Cursors.Hand; - this.btnTopUpOK.DisabledBackColor = System.Drawing.Color.Empty; - this.btnTopUpOK.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.btnTopUpOK.Location = new System.Drawing.Point(225, 16); - this.btnTopUpOK.Name = "btnTopUpOK"; - this.btnTopUpOK.Size = new System.Drawing.Size(56, 23); - this.btnTopUpOK.Style.Alignment = System.Drawing.StringAlignment.Center; - this.btnTopUpOK.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); - this.btnTopUpOK.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); - this.btnTopUpOK.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder; - this.btnTopUpOK.Style.BorderDashStyle = System.Drawing.Drawing2D.DashStyle.Dash; - this.btnTopUpOK.Style.BorderSide = DevComponents.DotNetBar.eBorderSide.None; - this.btnTopUpOK.Style.ForeColor.Color = System.Drawing.Color.White; - this.btnTopUpOK.Style.GradientAngle = 90; - this.btnTopUpOK.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center; - this.btnTopUpOK.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255))))); - this.btnTopUpOK.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255))))); - this.btnTopUpOK.TabIndex = 453; - this.btnTopUpOK.Text = "确定"; - this.btnTopUpOK.Click += new System.EventHandler(this.btnTopUpOK_Click); - // - // btnRefreshAuth - // - this.btnRefreshAuth.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); - this.btnRefreshAuth.Cursor = System.Windows.Forms.Cursors.Hand; - this.btnRefreshAuth.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.btnRefreshAuth.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.btnRefreshAuth.ForeColor = System.Drawing.Color.White; - this.btnRefreshAuth.Location = new System.Drawing.Point(11, 35); - this.btnRefreshAuth.Margin = new System.Windows.Forms.Padding(2); - this.btnRefreshAuth.Name = "btnRefreshAuth"; - this.btnRefreshAuth.Size = new System.Drawing.Size(66, 26); - this.btnRefreshAuth.TabIndex = 374; - this.btnRefreshAuth.Text = "刷新授权"; - this.btnRefreshAuth.UseVisualStyleBackColor = false; - this.btnRefreshAuth.Visible = false; - this.btnRefreshAuth.Click += new System.EventHandler(this.btnRefreshAuth_Click); - // - // 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(672, 245); - this.pbLoading.Name = "pbLoading"; - this.pbLoading.Size = new System.Drawing.Size(50, 50); - this.pbLoading.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; - this.pbLoading.TabIndex = 6; - this.pbLoading.TabStop = false; - // - // btnImport - // - this.btnImport.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); - this.btnImport.Cursor = System.Windows.Forms.Cursors.Hand; - this.btnImport.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.btnImport.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.btnImport.ForeColor = System.Drawing.Color.White; - this.btnImport.Location = new System.Drawing.Point(81, 35); - this.btnImport.Margin = new System.Windows.Forms.Padding(2); - this.btnImport.Name = "btnImport"; - this.btnImport.Size = new System.Drawing.Size(66, 26); - this.btnImport.TabIndex = 371; - this.btnImport.Text = "导入店铺"; - this.btnImport.UseVisualStyleBackColor = false; - this.btnImport.Visible = false; - this.btnImport.Click += new System.EventHandler(this.btnImport_Click); - // - // 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.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill; - 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.numAddTopUp.Minimum = new decimal(new int[] { + 1, + 0, + 0, + 0}); + this.numAddTopUp.Name = "numAddTopUp"; + this.numAddTopUp.ReadOnly = true; + this.numAddTopUp.Size = new System.Drawing.Size(36, 23); + this.numAddTopUp.TabIndex = 1; + this.numAddTopUp.Value = new decimal(new int[] { + 1, + 0, + 0, + 0}); + this.numAddTopUp.ValueChanged += new System.EventHandler(this.numAddTopUp_ValueChanged); + // + // label8 + // + this.label8.AutoSize = true; + this.label8.Location = new System.Drawing.Point(87, 19); + this.label8.Name = "label8"; + this.label8.Size = new System.Drawing.Size(68, 17); + this.label8.TabIndex = 456; + this.label8.Text = "店铺续费:"; + // + // btnTopUpCancel + // + this.btnTopUpCancel.CanvasColor = System.Drawing.SystemColors.Control; + this.btnTopUpCancel.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; + this.btnTopUpCancel.DisabledBackColor = System.Drawing.Color.Empty; + this.btnTopUpCancel.Location = new System.Drawing.Point(284, 16); + this.btnTopUpCancel.Name = "btnTopUpCancel"; + this.btnTopUpCancel.Size = new System.Drawing.Size(56, 23); + this.btnTopUpCancel.Style.Alignment = System.Drawing.StringAlignment.Center; + this.btnTopUpCancel.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(185)))), ((int)(((byte)(215)))), ((int)(((byte)(255))))); + this.btnTopUpCancel.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(185)))), ((int)(((byte)(215)))), ((int)(((byte)(255))))); + this.btnTopUpCancel.Style.Border = DevComponents.DotNetBar.eBorderType.SingleLine; + this.btnTopUpCancel.Style.BorderColor.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); + this.btnTopUpCancel.Style.ForeColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelText; + this.btnTopUpCancel.Style.GradientAngle = 90; + this.btnTopUpCancel.StyleMouseDown.Alignment = System.Drawing.StringAlignment.Center; + this.btnTopUpCancel.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center; + this.btnTopUpCancel.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); + this.btnTopUpCancel.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); + this.btnTopUpCancel.StyleMouseOver.ForeColor.Color = System.Drawing.Color.White; + this.btnTopUpCancel.TabIndex = 458; + this.btnTopUpCancel.Text = "取消"; + this.btnTopUpCancel.Click += new System.EventHandler(this.btnTopUpCancel_Click); + // + // btnTopUpOK + // + this.btnTopUpOK.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; + this.btnTopUpOK.Cursor = System.Windows.Forms.Cursors.Hand; + this.btnTopUpOK.DisabledBackColor = System.Drawing.Color.Empty; + this.btnTopUpOK.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.btnTopUpOK.Location = new System.Drawing.Point(225, 16); + this.btnTopUpOK.Name = "btnTopUpOK"; + this.btnTopUpOK.Size = new System.Drawing.Size(56, 23); + this.btnTopUpOK.Style.Alignment = System.Drawing.StringAlignment.Center; + this.btnTopUpOK.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); + this.btnTopUpOK.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); + this.btnTopUpOK.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder; + this.btnTopUpOK.Style.BorderDashStyle = System.Drawing.Drawing2D.DashStyle.Dash; + this.btnTopUpOK.Style.BorderSide = DevComponents.DotNetBar.eBorderSide.None; + this.btnTopUpOK.Style.ForeColor.Color = System.Drawing.Color.White; + this.btnTopUpOK.Style.GradientAngle = 90; + this.btnTopUpOK.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center; + this.btnTopUpOK.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255))))); + this.btnTopUpOK.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255))))); + this.btnTopUpOK.TabIndex = 453; + this.btnTopUpOK.Text = "确定"; + this.btnTopUpOK.Click += new System.EventHandler(this.btnTopUpOK_Click); + // + // btnRefreshAuth + // + this.btnRefreshAuth.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); + this.btnRefreshAuth.Cursor = System.Windows.Forms.Cursors.Hand; + this.btnRefreshAuth.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.btnRefreshAuth.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.btnRefreshAuth.ForeColor = System.Drawing.Color.White; + this.btnRefreshAuth.Location = new System.Drawing.Point(11, 35); + this.btnRefreshAuth.Margin = new System.Windows.Forms.Padding(2); + this.btnRefreshAuth.Name = "btnRefreshAuth"; + this.btnRefreshAuth.Size = new System.Drawing.Size(66, 26); + this.btnRefreshAuth.TabIndex = 374; + this.btnRefreshAuth.Text = "刷新授权"; + this.btnRefreshAuth.UseVisualStyleBackColor = false; + this.btnRefreshAuth.Visible = false; + this.btnRefreshAuth.Click += new System.EventHandler(this.btnRefreshAuth_Click); + // + // 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(672, 245); + this.pbLoading.Name = "pbLoading"; + this.pbLoading.Size = new System.Drawing.Size(50, 50); + this.pbLoading.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; + this.pbLoading.TabIndex = 6; + this.pbLoading.TabStop = false; + // + // btnImport + // + this.btnImport.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); + this.btnImport.Cursor = System.Windows.Forms.Cursors.Hand; + this.btnImport.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.btnImport.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.btnImport.ForeColor = System.Drawing.Color.White; + this.btnImport.Location = new System.Drawing.Point(81, 35); + this.btnImport.Margin = new System.Windows.Forms.Padding(2); + this.btnImport.Name = "btnImport"; + this.btnImport.Size = new System.Drawing.Size(66, 26); + this.btnImport.TabIndex = 371; + this.btnImport.Text = "导入店铺"; + this.btnImport.UseVisualStyleBackColor = false; + this.btnImport.Visible = false; + this.btnImport.Click += new System.EventHandler(this.btnImport_Click); + // + // dgvShop + // + this.dgvShop.AllowUserToAddRows = false; + this.dgvShop.AllowUserToDeleteRows = false; + dataGridViewCellStyle3.BackColor = System.Drawing.Color.WhiteSmoke; + this.dgvShop.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle3; + this.dgvShop.AutoRowNumber = true; + this.dgvShop.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill; + this.dgvShop.BackgroundColor = System.Drawing.Color.White; + this.dgvShop.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.dgvShop.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle4; + this.dgvShop.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; + this.dgvShop.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.colSelect, this.colLoginName, this.colShopId, @@ -816,316 +827,316 @@ this.colCopyCookies, this.colEdit, this.colDelete}); - this.dgvShop.Dock = System.Windows.Forms.DockStyle.Fill; - this.dgvShop.Location = new System.Drawing.Point(4, 0); - this.dgvShop.MultiSelectCheckBox = true; - this.dgvShop.Name = "dgvShop"; - this.dgvShop.ReadOnly = true; - this.dgvShop.RowTemplate.Height = 23; - this.dgvShop.Size = new System.Drawing.Size(1386, 540); - this.dgvShop.TabIndex = 5; - this.dgvShop.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgvShop_CellContentClick); - // - // colSelect - // - this.colSelect.FillWeight = 26F; - 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; - // - // colLoginName - // - this.colLoginName.FillWeight = 70F; - this.colLoginName.HeaderText = "店铺登录号码"; - this.colLoginName.Name = "colLoginName"; - this.colLoginName.ReadOnly = true; - this.colLoginName.Visible = false; - // - // colShopId - // - this.colShopId.FillWeight = 70F; - this.colShopId.HeaderText = "店铺Id"; - this.colShopId.Name = "colShopId"; - this.colShopId.ReadOnly = true; - // - // colShopAccount - // - this.colShopAccount.FillWeight = 90F; - this.colShopAccount.HeaderText = "店铺账号"; - this.colShopAccount.Name = "colShopAccount"; - this.colShopAccount.ReadOnly = true; - // - // colAddTime - // - this.colAddTime.FillWeight = 65F; - this.colAddTime.HeaderText = "添加时间"; - this.colAddTime.Name = "colAddTime"; - this.colAddTime.ReadOnly = true; - // - // colExpireTime - // - this.colExpireTime.FillWeight = 65F; - this.colExpireTime.HeaderText = "到期时间"; - this.colExpireTime.Name = "colExpireTime"; - this.colExpireTime.ReadOnly = true; - this.colExpireTime.Visible = false; - // - // colRenewal - // - this.colRenewal.FillWeight = 35F; - this.colRenewal.HeaderText = "续期"; - this.colRenewal.Name = "colRenewal"; - this.colRenewal.ReadOnly = true; - this.colRenewal.Visible = false; - // - // colNotes - // - this.colNotes.FillWeight = 90F; - this.colNotes.HeaderText = "备注"; - this.colNotes.Name = "colNotes"; - this.colNotes.ReadOnly = true; - // - // colGroupName - // - this.colGroupName.FillWeight = 80F; - this.colGroupName.HeaderText = "店铺分组"; - this.colGroupName.Name = "colGroupName"; - this.colGroupName.ReadOnly = true; - // - // colCookie - // - this.colCookie.HeaderText = "店铺Cookie"; - this.colCookie.Name = "colCookie"; - this.colCookie.ReadOnly = true; - this.colCookie.Visible = false; - // - // colSubUser - // - this.colSubUser.FillWeight = 67F; - this.colSubUser.HeaderText = "子账户"; - this.colSubUser.Name = "colSubUser"; - this.colSubUser.ReadOnly = true; - // - // colSubUserAccount - // - this.colSubUserAccount.FillWeight = 75F; - this.colSubUserAccount.HeaderText = "子账户账号"; - this.colSubUserAccount.Name = "colSubUserAccount"; - this.colSubUserAccount.ReadOnly = true; - // - // colUploadAccount - // - this.colUploadAccount.FillWeight = 70F; - this.colUploadAccount.HeaderText = "上货账户"; - this.colUploadAccount.Name = "colUploadAccount"; - this.colUploadAccount.ReadOnly = true; - this.colUploadAccount.Visible = false; - // - // colBuyAccount - // - this.colBuyAccount.FillWeight = 70F; - this.colBuyAccount.HeaderText = "采购账户"; - this.colBuyAccount.Name = "colBuyAccount"; - this.colBuyAccount.ReadOnly = true; - this.colBuyAccount.Visible = false; - // - // colChatAccount - // - this.colChatAccount.FillWeight = 70F; - this.colChatAccount.HeaderText = "客服账户"; - this.colChatAccount.Name = "colChatAccount"; - this.colChatAccount.ReadOnly = true; - this.colChatAccount.Visible = false; - // - // colLoginStatus - // - this.colLoginStatus.HeaderText = "登录状态"; - this.colLoginStatus.Name = "colLoginStatus"; - this.colLoginStatus.ReadOnly = true; - this.colLoginStatus.Visible = false; - // - // colGotoShop - // - this.colGotoShop.FillWeight = 50F; - this.colGotoShop.HeaderText = "进入店铺"; - this.colGotoShop.Name = "colGotoShop"; - this.colGotoShop.ReadOnly = true; - this.colGotoShop.Resizable = System.Windows.Forms.DataGridViewTriState.True; - this.colGotoShop.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; - // - // colShopOperate - // - this.colShopOperate.FillWeight = 50F; - this.colShopOperate.HeaderText = "检测"; - this.colShopOperate.Name = "colShopOperate"; - this.colShopOperate.ReadOnly = true; - this.colShopOperate.Resizable = System.Windows.Forms.DataGridViewTriState.True; - this.colShopOperate.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; - this.colShopOperate.Visible = false; - // - // colRelogin - // - this.colRelogin.FillWeight = 50F; - this.colRelogin.HeaderText = "登录"; - this.colRelogin.Name = "colRelogin"; - this.colRelogin.ReadOnly = true; - this.colRelogin.Resizable = System.Windows.Forms.DataGridViewTriState.True; - this.colRelogin.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; - // - // colSwitchLogin - // - this.colSwitchLogin.FillWeight = 50F; - 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 = 50F; - this.colReLogin2.HeaderText = "国际版状态"; - this.colReLogin2.Name = "colReLogin2"; - this.colReLogin2.ReadOnly = true; - this.colReLogin2.Visible = false; - // - // colBuyApi - // - this.colBuyApi.FillWeight = 50F; - this.colBuyApi.HeaderText = "API购买"; - this.colBuyApi.Name = "colBuyApi"; - this.colBuyApi.ReadOnly = true; - this.colBuyApi.Resizable = System.Windows.Forms.DataGridViewTriState.True; - this.colBuyApi.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; - // - // colMultiLogin - // - this.colMultiLogin.FillWeight = 50F; - this.colMultiLogin.HeaderText = "多重登录"; - this.colMultiLogin.Name = "colMultiLogin"; - this.colMultiLogin.ReadOnly = true; - this.colMultiLogin.Resizable = System.Windows.Forms.DataGridViewTriState.True; - this.colMultiLogin.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; - this.colMultiLogin.Visible = false; - // - // colApiAuth - // - this.colApiAuth.FillWeight = 50F; - this.colApiAuth.HeaderText = "上货授权"; - this.colApiAuth.Name = "colApiAuth"; - this.colApiAuth.ReadOnly = true; - this.colApiAuth.Resizable = System.Windows.Forms.DataGridViewTriState.True; - this.colApiAuth.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; - this.colApiAuth.Visible = false; - // - // colBuyApiAuth - // - this.colBuyApiAuth.FillWeight = 50F; - this.colBuyApiAuth.HeaderText = "拍单授权"; - this.colBuyApiAuth.Name = "colBuyApiAuth"; - this.colBuyApiAuth.ReadOnly = true; - this.colBuyApiAuth.Resizable = System.Windows.Forms.DataGridViewTriState.True; - this.colBuyApiAuth.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; - this.colBuyApiAuth.Visible = false; - // - // colUpdateCookies - // - this.colUpdateCookies.FillWeight = 55F; - this.colUpdateCookies.HeaderText = "导入Cookie"; - this.colUpdateCookies.Name = "colUpdateCookies"; - this.colUpdateCookies.ReadOnly = true; - this.colUpdateCookies.Resizable = System.Windows.Forms.DataGridViewTriState.True; - this.colUpdateCookies.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; - // - // colCopyCookies - // - this.colCopyCookies.FillWeight = 55F; - this.colCopyCookies.HeaderText = "复制Cookie"; - this.colCopyCookies.Name = "colCopyCookies"; - this.colCopyCookies.ReadOnly = true; - this.colCopyCookies.Resizable = System.Windows.Forms.DataGridViewTriState.True; - this.colCopyCookies.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; - // - // colEdit - // - this.colEdit.FillWeight = 35F; - this.colEdit.HeaderText = "编辑"; - this.colEdit.Name = "colEdit"; - this.colEdit.ReadOnly = true; - this.colEdit.Resizable = System.Windows.Forms.DataGridViewTriState.True; - this.colEdit.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; - // - // colDelete - // - this.colDelete.FillWeight = 35F; - this.colDelete.HeaderText = "删除"; - 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(1238, 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(1394, 29); - this.statusBar.TabIndex = 1; - // - // WXShopListForm - // - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; - this.BackColor = System.Drawing.Color.White; - this.ClientSize = new System.Drawing.Size(1394, 622); - this.Controls.Add(this.splitContainer1); - this.Controls.Add(this.label1); - this.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.KeyPreview = true; - this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); - this.Name = "WXShopListForm"; - this.Text = "ShopListForm"; - this.Load += new System.EventHandler(this.ShopListForm_Load); - this.VisibleChanged += new System.EventHandler(this.ShopListForm_VisibleChanged); - this.splitContainer1.Panel1.ResumeLayout(false); - this.splitContainer1.Panel2.ResumeLayout(false); - ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit(); - this.splitContainer1.ResumeLayout(false); - this.tableLayoutPanel2.ResumeLayout(false); - this.panel5.ResumeLayout(false); - this.panel4.ResumeLayout(false); - this.tableLayoutPanel1.ResumeLayout(false); - this.tableLayoutPanel1.PerformLayout(); - this.splitContainer2.Panel1.ResumeLayout(false); - this.splitContainer2.Panel2.ResumeLayout(false); - this.splitContainer2.Panel2.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).EndInit(); - this.splitContainer2.ResumeLayout(false); - this.pnlTopUp.ResumeLayout(false); - this.pnlTopUp.PerformLayout(); - this.panel2.ResumeLayout(false); - this.panel2.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this.numAddTopUp)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.pbLoading)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.dgvShop)).EndInit(); - this.ResumeLayout(false); - this.PerformLayout(); + this.dgvShop.Dock = System.Windows.Forms.DockStyle.Fill; + this.dgvShop.Location = new System.Drawing.Point(4, 0); + this.dgvShop.MultiSelectCheckBox = true; + this.dgvShop.Name = "dgvShop"; + this.dgvShop.ReadOnly = true; + this.dgvShop.RowTemplate.Height = 23; + this.dgvShop.Size = new System.Drawing.Size(1386, 540); + this.dgvShop.TabIndex = 5; + this.dgvShop.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgvShop_CellContentClick); + // + // colSelect + // + this.colSelect.FillWeight = 26F; + 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; + // + // colLoginName + // + this.colLoginName.FillWeight = 70F; + this.colLoginName.HeaderText = "店铺登录号码"; + this.colLoginName.Name = "colLoginName"; + this.colLoginName.ReadOnly = true; + this.colLoginName.Visible = false; + // + // colShopId + // + this.colShopId.FillWeight = 70F; + this.colShopId.HeaderText = "店铺Id"; + this.colShopId.Name = "colShopId"; + this.colShopId.ReadOnly = true; + // + // colShopAccount + // + this.colShopAccount.FillWeight = 90F; + this.colShopAccount.HeaderText = "店铺账号"; + this.colShopAccount.Name = "colShopAccount"; + this.colShopAccount.ReadOnly = true; + // + // colAddTime + // + this.colAddTime.FillWeight = 65F; + this.colAddTime.HeaderText = "添加时间"; + this.colAddTime.Name = "colAddTime"; + this.colAddTime.ReadOnly = true; + // + // colExpireTime + // + this.colExpireTime.FillWeight = 65F; + this.colExpireTime.HeaderText = "到期时间"; + this.colExpireTime.Name = "colExpireTime"; + this.colExpireTime.ReadOnly = true; + this.colExpireTime.Visible = false; + // + // colRenewal + // + this.colRenewal.FillWeight = 35F; + this.colRenewal.HeaderText = "续期"; + this.colRenewal.Name = "colRenewal"; + this.colRenewal.ReadOnly = true; + this.colRenewal.Visible = false; + // + // colNotes + // + this.colNotes.FillWeight = 90F; + this.colNotes.HeaderText = "备注"; + this.colNotes.Name = "colNotes"; + this.colNotes.ReadOnly = true; + // + // colGroupName + // + this.colGroupName.FillWeight = 80F; + this.colGroupName.HeaderText = "店铺分组"; + this.colGroupName.Name = "colGroupName"; + this.colGroupName.ReadOnly = true; + // + // colCookie + // + this.colCookie.HeaderText = "店铺Cookie"; + this.colCookie.Name = "colCookie"; + this.colCookie.ReadOnly = true; + this.colCookie.Visible = false; + // + // colSubUser + // + this.colSubUser.FillWeight = 67F; + this.colSubUser.HeaderText = "子账户"; + this.colSubUser.Name = "colSubUser"; + this.colSubUser.ReadOnly = true; + // + // colSubUserAccount + // + this.colSubUserAccount.FillWeight = 75F; + this.colSubUserAccount.HeaderText = "子账户账号"; + this.colSubUserAccount.Name = "colSubUserAccount"; + this.colSubUserAccount.ReadOnly = true; + // + // colUploadAccount + // + this.colUploadAccount.FillWeight = 70F; + this.colUploadAccount.HeaderText = "上货账户"; + this.colUploadAccount.Name = "colUploadAccount"; + this.colUploadAccount.ReadOnly = true; + this.colUploadAccount.Visible = false; + // + // colBuyAccount + // + this.colBuyAccount.FillWeight = 70F; + this.colBuyAccount.HeaderText = "采购账户"; + this.colBuyAccount.Name = "colBuyAccount"; + this.colBuyAccount.ReadOnly = true; + this.colBuyAccount.Visible = false; + // + // colChatAccount + // + this.colChatAccount.FillWeight = 70F; + this.colChatAccount.HeaderText = "客服账户"; + this.colChatAccount.Name = "colChatAccount"; + this.colChatAccount.ReadOnly = true; + this.colChatAccount.Visible = false; + // + // colLoginStatus + // + this.colLoginStatus.HeaderText = "登录状态"; + this.colLoginStatus.Name = "colLoginStatus"; + this.colLoginStatus.ReadOnly = true; + this.colLoginStatus.Visible = false; + // + // colGotoShop + // + this.colGotoShop.FillWeight = 50F; + this.colGotoShop.HeaderText = "进入店铺"; + this.colGotoShop.Name = "colGotoShop"; + this.colGotoShop.ReadOnly = true; + this.colGotoShop.Resizable = System.Windows.Forms.DataGridViewTriState.True; + this.colGotoShop.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; + // + // colShopOperate + // + this.colShopOperate.FillWeight = 50F; + this.colShopOperate.HeaderText = "检测"; + this.colShopOperate.Name = "colShopOperate"; + this.colShopOperate.ReadOnly = true; + this.colShopOperate.Resizable = System.Windows.Forms.DataGridViewTriState.True; + this.colShopOperate.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; + this.colShopOperate.Visible = false; + // + // colRelogin + // + this.colRelogin.FillWeight = 50F; + this.colRelogin.HeaderText = "登录"; + this.colRelogin.Name = "colRelogin"; + this.colRelogin.ReadOnly = true; + this.colRelogin.Resizable = System.Windows.Forms.DataGridViewTriState.True; + this.colRelogin.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; + // + // colSwitchLogin + // + this.colSwitchLogin.FillWeight = 50F; + 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 = 50F; + this.colReLogin2.HeaderText = "国际版状态"; + this.colReLogin2.Name = "colReLogin2"; + this.colReLogin2.ReadOnly = true; + this.colReLogin2.Visible = false; + // + // colBuyApi + // + this.colBuyApi.FillWeight = 50F; + this.colBuyApi.HeaderText = "API购买"; + this.colBuyApi.Name = "colBuyApi"; + this.colBuyApi.ReadOnly = true; + this.colBuyApi.Resizable = System.Windows.Forms.DataGridViewTriState.True; + this.colBuyApi.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; + // + // colMultiLogin + // + this.colMultiLogin.FillWeight = 50F; + this.colMultiLogin.HeaderText = "多重登录"; + this.colMultiLogin.Name = "colMultiLogin"; + this.colMultiLogin.ReadOnly = true; + this.colMultiLogin.Resizable = System.Windows.Forms.DataGridViewTriState.True; + this.colMultiLogin.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; + this.colMultiLogin.Visible = false; + // + // colApiAuth + // + this.colApiAuth.FillWeight = 50F; + this.colApiAuth.HeaderText = "上货授权"; + this.colApiAuth.Name = "colApiAuth"; + this.colApiAuth.ReadOnly = true; + this.colApiAuth.Resizable = System.Windows.Forms.DataGridViewTriState.True; + this.colApiAuth.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; + this.colApiAuth.Visible = false; + // + // colBuyApiAuth + // + this.colBuyApiAuth.FillWeight = 50F; + this.colBuyApiAuth.HeaderText = "拍单授权"; + this.colBuyApiAuth.Name = "colBuyApiAuth"; + this.colBuyApiAuth.ReadOnly = true; + this.colBuyApiAuth.Resizable = System.Windows.Forms.DataGridViewTriState.True; + this.colBuyApiAuth.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; + this.colBuyApiAuth.Visible = false; + // + // colUpdateCookies + // + this.colUpdateCookies.FillWeight = 55F; + this.colUpdateCookies.HeaderText = "导入Cookie"; + this.colUpdateCookies.Name = "colUpdateCookies"; + this.colUpdateCookies.ReadOnly = true; + this.colUpdateCookies.Resizable = System.Windows.Forms.DataGridViewTriState.True; + this.colUpdateCookies.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; + // + // colCopyCookies + // + this.colCopyCookies.FillWeight = 55F; + this.colCopyCookies.HeaderText = "复制Cookie"; + this.colCopyCookies.Name = "colCopyCookies"; + this.colCopyCookies.ReadOnly = true; + this.colCopyCookies.Resizable = System.Windows.Forms.DataGridViewTriState.True; + this.colCopyCookies.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; + // + // colEdit + // + this.colEdit.FillWeight = 35F; + this.colEdit.HeaderText = "编辑"; + this.colEdit.Name = "colEdit"; + this.colEdit.ReadOnly = true; + this.colEdit.Resizable = System.Windows.Forms.DataGridViewTriState.True; + this.colEdit.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; + // + // colDelete + // + this.colDelete.FillWeight = 35F; + this.colDelete.HeaderText = "删除"; + 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(1238, 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(1394, 29); + this.statusBar.TabIndex = 1; + // + // WXShopListForm + // + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; + this.BackColor = System.Drawing.Color.White; + this.ClientSize = new System.Drawing.Size(1394, 622); + this.Controls.Add(this.splitContainer1); + this.Controls.Add(this.label1); + this.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.KeyPreview = true; + this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); + this.Name = "WXShopListForm"; + this.Text = "ShopListForm"; + this.Load += new System.EventHandler(this.ShopListForm_Load); + this.VisibleChanged += new System.EventHandler(this.ShopListForm_VisibleChanged); + this.splitContainer1.Panel1.ResumeLayout(false); + this.splitContainer1.Panel2.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit(); + this.splitContainer1.ResumeLayout(false); + this.tableLayoutPanel2.ResumeLayout(false); + this.panel5.ResumeLayout(false); + this.panel4.ResumeLayout(false); + this.tableLayoutPanel1.ResumeLayout(false); + this.tableLayoutPanel1.PerformLayout(); + this.splitContainer2.Panel1.ResumeLayout(false); + this.splitContainer2.Panel2.ResumeLayout(false); + this.splitContainer2.Panel2.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).EndInit(); + this.splitContainer2.ResumeLayout(false); + this.pnlTopUp.ResumeLayout(false); + this.pnlTopUp.PerformLayout(); + this.panel2.ResumeLayout(false); + this.panel2.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.numAddTopUp)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.pbLoading)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.dgvShop)).EndInit(); + this.ResumeLayout(false); + this.PerformLayout(); } diff --git a/TEMUKJD/WXForms/ShopForms/WXShopListForm.cs b/TEMUKJD/WXForms/ShopForms/WXShopListForm.cs index a7b245c..1709d32 100644 --- a/TEMUKJD/WXForms/ShopForms/WXShopListForm.cs +++ b/TEMUKJD/WXForms/ShopForms/WXShopListForm.cs @@ -3,14 +3,17 @@ using AllBase.Helper; using AllBase.Model.Result; using NaiBa.Util; using NaiBa.Util.Extension; +using Newtonsoft.Json; using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; using System.Data; using System.Drawing; +using System.Drawing.Printing; using System.Globalization; using System.IO; using System.Linq; +using System.Runtime.Remoting.Metadata.W3cXsd2001; using System.Threading; using System.Threading.Tasks; using System.Windows.Forms; @@ -18,1292 +21,1305 @@ using TemuKJD.BaseForms; using TemuKJD.BLL; using TemuKJD.Extension; using Work; +using static System.Windows.Forms.VisualStyles.VisualStyleElement; +using static System.Windows.Forms.VisualStyles.VisualStyleElement.StartPanel; //using TemuKJD.PDDForms.AdminForms; namespace TemuKJD.WXForms.ShopForms { - public partial class WXShopListForm : BaseForm - { - public static List LstShopListFormInatance = new List(); - private static WXShopListForm _instance = null; - public static WXShopListForm Instance { get { if (_instance == null) { _instance = new WXShopListForm(); } return _instance; } set { _instance = value; } } - public static bool IsOperate { get; set; } = false; - private bool isLoading { get; set; } = false; - - #region 服务端店铺管理 - public static void UpdateShop() - { - // 获取服务端店铺 - var serverShopList = WXShopListForm.GetServerShop(); - GlobalConfig.ShopLoginList.RemoveAll(s => !serverShopList.Any(ss => ss.LoginName == s.LoginName && ss.ShopId == s.ShopId)); - foreach (var serverShop in serverShopList) - { - - if (serverShop.ShopId == "wx2543ce37a0009883") - { - - } - - var localShop = GlobalConfig.ShopLoginList.FirstOrDefault(s => s.LoginName == serverShop.LoginName && s.ShopId == serverShop.ShopId); - if (localShop != null) - { - localShop.ShopAccount = serverShop.ShopAccount; - localShop.LoginName = serverShop.LoginName; - localShop.Password = serverShop.Password; - localShop.Cookies = serverShop.Cookies; - localShop.DbId = serverShop.DbId; - localShop.UserName = serverShop.UserName; - localShop.SubUserName = serverShop.SubUserName; - localShop.ApiAuthInfoList = new List(); - localShop.ApiAuthInfoList.AddRange(serverShop.ApiAuthInfoList); - localShop.BuyApiAuth.AccessToken = serverShop.BuyApiAuth.AccessToken; - localShop.BuyApiAuth.UpdateTime = serverShop.BuyApiAuth.UpdateTime; - localShop.BuyApiAuth.AppKey = serverShop.BuyApiAuth.AppKey; - localShop.BuyApiAuth.ExpiresTime = serverShop.BuyApiAuth.ExpiresTime; - localShop.BuyApiAuth.RefreshToken = serverShop.BuyApiAuth.RefreshToken; - localShop.PayStatus = serverShop.PayStatus; - localShop.GroupName = serverShop.GroupName; - localShop.Notes = serverShop.Notes; - localShop.LoginStatus = serverShop.LoginStatus; - localShop.LoginStatus2 = serverShop.LoginStatus2; - localShop.AntiContents = serverShop.AntiContents; - localShop.AddProductRemaining = serverShop.AddProductRemaining; - localShop.OperateSubSaName = serverShop.OperateSubSaName; - localShop.TrialUploadCount = Math.Max(0, serverShop.TrialUploadCount); - localShop.is_point_shop_expire = serverShop.is_point_shop_expire; - localShop.expire_time = serverShop.expire_time; - } - else - { - GlobalConfig.ShopLoginList.Add(serverShop); - } - } - } - - public static List GetServerShop() - { - List list = new List(); - - int page = 0; - int pageSize = 100; - while (true) - { - page++; - - var url = BaseClass.BuildObjString("shop/get_shop_list"); - var data = UserLogin.GetSignaturex() + "&page=" + page + "&page_size=" + pageSize; - var html = GetHtml.PostUtf8(url, data); - if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200")) - html = GetHtml.PostUtf8(url, data); - if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200")) - html = GetHtml.PostUtf8(url, data); - if (string.IsNullOrEmpty(html) - || !html.Contains("shop_id") || !html.Contains("shop_account") || !html.Contains("login_pass")) - { - //return list; - break; - } - - var count = BaseRegex.GetIntJson(ref html, "count"); - var totalPage = Math.Ceiling(1.0m * count / pageSize).ParseToInt(); - - try - { - list.AddRange(ShopBLL.DeserializationShop(html)); - } - catch - { - } - - if (page >= totalPage) - break; - } - return list; - } - - public static void UpdateShopTokens(List shops) - { - string shopIds = ""; - foreach (var shop in shops) - { - shopIds += shop.ShopId + ","; - } - - var shopTokens = GetServerShopTokens(shopIds); //{"code":200,"msg":"success","data":[{"shop_id":"9050819","app_key":"6876612657718691336","access_token":"fd818b94-b4e7-4707-8073-bebcd81d8e4c","refresh_token":"9a109ef3-2bef-4ca9-8f4e-18369a356255","add_time":"2021-07-09 10:54:56","expires_in":"2021-07-14 18:40:44"}]} - for (int i = 0; i < 10 && (string.IsNullOrEmpty(shopTokens) || !shopTokens.Contains("\"code\":200")); i++) - { - shopTokens = GetServerShopTokens(shopIds); - if (i > 0) - Thread.Sleep(100); - } - if (!string.IsNullOrEmpty(shopTokens) && shopTokens.Contains("\"code\":200")) - { - JObject jShopsObj = JObject.Parse(shopTokens); - foreach (JObject jShop in jShopsObj["data"]) - { - string shopStr = JsonHelper.SerializeObject(jShop); - string shop_id = BaseRegex.GetStringJson(ref shopStr, "shop_id"); - var shop = shops.FirstOrDefault(s => s.ShopId == shop_id); - if (shop != null) - { - var appkey = BaseRegex.GetStringJson(ref shopStr, "app_key"); - // 科尔搬家 - if (appkey == "7023294452517127719") - { - shop.ApiAuthInfoList.RemoveAll(a => a.AppKey == appkey); - shop.ApiAuthInfoList.Add(new AuthInfo - { - AppKey = appkey, - AccessToken = BaseRegex.GetStringJson(ref shopStr, "access_token"), - RefreshToken = BaseRegex.GetStringJson(ref shopStr, "refresh_token"), - UpdateTime = BaseRegex.GetStringJson(ref shopStr, "add_time").ParseToDateTime(), - ExpiresTime = BaseRegex.GetStringJson(ref shopStr, "expires_in").ParseToDateTime(), - }); - } - // 小奶兔工具 - else if (appkey == "6876612657718691336") // || shop.ShopName == "权益服务齐全的专营店") // 上货appkey,小奶猫工具 - { - shop.ApiAuthInfoList.RemoveAll(a => a.AppKey == appkey); - shop.ApiAuthInfoList.Add(new AuthInfo - { - AppKey = appkey, - AccessToken = BaseRegex.GetStringJson(ref shopStr, "access_token"), - RefreshToken = BaseRegex.GetStringJson(ref shopStr, "refresh_token"), - UpdateTime = BaseRegex.GetStringJson(ref shopStr, "add_time").ParseToDateTime(), - ExpiresTime = BaseRegex.GetStringJson(ref shopStr, "expires_in").ParseToDateTime(), - }); - } - else if (appkey == "7016502755254683171") // 拍单appkey,小奶兔打单 - { - shop.BuyApiAuth.AppKey = appkey; - shop.BuyApiAuth.AccessToken = BaseRegex.GetStringJson(ref shopStr, "access_token"); - shop.BuyApiAuth.RefreshToken = BaseRegex.GetStringJson(ref shopStr, "refresh_token"); - shop.BuyApiAuth.UpdateTime = BaseRegex.GetStringJson(ref shopStr, "add_time").ParseToDateTime(); - shop.BuyApiAuth.ExpiresTime = BaseRegex.GetStringJson(ref shopStr, "expires_in").ParseToDateTime(); - } - } - } - } - } - - public static void DelServerDouShop(string shopId) - { - var url = BaseClass.BuildObjString("shop/del_shop"); - var data = UserLogin.GetSignaturex() + "&login_name=" + shopId; - var result = GetHtml.PostUtf8(url, data); - } - #endregion - - #region 服务端店铺Cookie管理 - /// - /// 添加店铺Cookies - /// - /// 店铺名称 - /// cookies - /// 工具名称(可不填写) - public static string UpdateServerShopCookies(ShopLoginInfo shop, string fromTool = null, bool isShowProgress = true) - { - var fTool = string.IsNullOrEmpty(fromTool) ? "" : "&from_tool=" + fromTool; - var url = BaseClass.BuildObjString("shop/mdy_shop_cookie_and_login_status"); - var data = UserLogin.GetSignaturex() - + "&login_name=" + shop.LoginName - + "&login_status=" + shop.LoginStatus - + "&login_status2=" + shop.LoginStatus2 - + "&cookie=" + shop.Cookies.Replace("&", "&").Replace("%", "%").Replace("+", "+") - + "&cookie2=" + shop.Cookies2.Replace("&", "&").Replace("%", "%").Replace("+", "+") - + "&openid=" + shop.openid - + fTool; - var result = GetHtml.PostUtf8(url, data); - if (!result.Contains("\"code\":200")) - result = GetHtml.PostUtf8(url, data); - if (!result.Contains("\"code\":200")) - { - var errMsg = BaseRegex.GetStringJson(ref result, "msg"); - if (isShowProgress) - BaseMsgForm.ShowError("服务端登录状态保存失败!请检查网络连接。" + errMsg); - else - return "服务端登录状态保存失败!请检查网络连接。" + errMsg; - } - return ""; - } - ///// - ///// 获取店铺Cookies - ///// - ///// 店铺名称,逗号隔开 - //public static string GetServerShopCookies(string shopNames) - //{ - // var url = BaseClass.BuildObjString("shop&act=get_shop_cookie"); - // var data = UserLogin.GetSignaturex() + "&shop_name=" + shopNames.Trim(','); - // var result = GetHtml.PostUtf8(url, data); - // return result; - //} - #endregion - - public static string GetServerShopTokens(string shopLoginNames) - { - var url = BaseClass.BuildObjString("shop&act=get_shop_token"); - var data = UserLogin.GetSignaturex() + "&login_name=" + shopLoginNames.Trim(','); - var result = GetHtml.PostUtf8(url, data); - return result; - } - - public WXShopListForm() - { - InitializeComponent(); - - Instance = this; - - LstShopListFormInatance.Add(this); - } - - private void btnAddShop_Click(object sender, EventArgs e) - { - //WXShopAddEditForm sae = new WXShopAddEditForm(); - //sae.SaveCompleteWithDescribe += Sae_SaveComplete; - //sae.Show(); - WXShopLoginForm shopLoginForm = new WXShopLoginForm(null); - shopLoginForm.openType = EnumOpenType.login; - shopLoginForm.InitUrl = "https://store.weixin.qq.com/shop?redirect_url=%2Fhome"; - shopLoginForm.SaveComplete += shopLoginForm_SaveComplete; - shopLoginForm.ShowDialog(); - btnRefreshCookie_Click(null, null); - } - - private void Sae_SaveComplete(object obj, object isAdd, object sender) - { - WXShopAddEditForm saeForm = sender as WXShopAddEditForm; - var shopInfoLst = obj as List; - if (shopInfoLst != null) - { - this.pbLoading.Visible = true; - Task.Run(() => - { - if ((isAdd as bool?) == true) - { - int i = 1; - foreach (var shopInfo in shopInfoLst) - { - Invoke(new Action(() => { - this.statusBar.pgbTaskProgress.Value = i; - this.statusBar.pgbTaskProgress.Text = i + "/" + shopInfoLst.Count; - i++; - })); - var shop = GlobalConfig.ShopLoginList.FirstOrDefault(v => v.LoginName == shopInfo.LoginName); - if (shop != null) - { - BaseMsgForm.ShowError("店铺" + shopInfo.LoginName + "已存在!"); - } - else - { - ShopBLL.AddServerShop(shopInfo); - } - } - btnRefreshCookie_Click(null, null); - } - else - { - int i = 1; - foreach (var shopInfo in shopInfoLst) - { - Invoke(new Action(() => { - this.statusBar.pgbTaskProgress.Value = i; - this.statusBar.pgbTaskProgress.Text = i + "/" + shopInfoLst.Count; - this.statusBar.pgbTaskProgress.Maximum = shopInfoLst.Count; - i++; - })); - ShopBLL.MdyPDDWXServerShopSubInfo(shopInfo, saeForm.chkNotes.Checked, saeForm.chkShopGroup.Checked, saeForm.chkSubAccount.Checked); - } - RefreshDataGridView(false); - //btnRefreshCookie_Click(null, null); - } - Invoke(new Action(() => - { - this.pbLoading.Visible = false; - this.statusBar.pgbTaskProgress.Text = "准备就绪"; - })); - }); - } - } - - private void shopLoginForm_SaveComplete(object obj) - { - Task.Run(() => - { - //CheckShopListLogin(new string[] { (obj as DouShopLoginInfo).LoginName }); - }); - } - - private void UpdateCookieForm_SaveComplete(object obj) - { - Task.Run(() => - { - //CheckShopListLogin(new string[] { (obj as DouShopLoginInfo).LoginName }); - //StartUp.SaveLocalShopLoginInfo(); - Invoke(new Action(() => - { - btnRefreshCookie_Click(null, null); - })); - }); - } - - private void btnImport_Click(object sender, EventArgs e) - { - IsOperate = true; - ImportShop(); - btnRefreshCookie_Click(null, null); - } - - void ImportShop() - { - this.btnImport.Enabled = false; - string text = "店铺导入格式:\r\n\r\n1.店铺账号(手机/用户名/邮箱)-----店铺密码\r\n2.店铺账号-----密码-----备注\r\n\r\n多个店铺请每个店铺新起一行。"; - BaseMsgForm.ShowInfo(text, "", FormLevel.LARGE); - - OpenFileDialog openFileDialog = new OpenFileDialog(); - openFileDialog.Filter = "文本文件(*.txt)|*.txt"; - openFileDialog.RestoreDirectory = true; - openFileDialog.FilterIndex = 1; - if (openFileDialog.ShowDialog() == DialogResult.OK) - { - using (StreamReader sr = new StreamReader(openFileDialog.FileName, System.Text.Encoding.UTF8)) - { - string fileName = openFileDialog.FileName; - string importStr = sr.ReadToEnd().Trim(); - var strArr = importStr.Replace("\r", "").Split('\n'); - for (int i = 0; i < strArr.Length; i++) - { - if (IsOperate == false) - break; - try - { - // 通用格式 - if (strArr[i].Contains("-----")) - { - var productArr = strArr[i].Split(new string[] { "-----" }, StringSplitOptions.RemoveEmptyEntries); - if (productArr.Length > 1) - { - ShopLoginInfo shop = new ShopLoginInfo - { - LoginName = productArr[0], - Password = DataOpenSSL.EncryptString(productArr[1]), - }; - if (productArr.Length > 2) - { - shop.Notes = productArr[2]; - } - - //ShopLoginForm shopLoginForm = new ShopLoginForm(shop); - //shopLoginForm.SaveComplete += shopLoginForm_SaveComplete; - //shopLoginForm.ShowDialog(); - - //StartUp.SaveDouShopLoginInfo(); - var shopInfo = GlobalConfig.ShopLoginList.FirstOrDefault(v => v.LoginName == shop.LoginName); - if (shopInfo != null) - { - shopInfo.Password = shop.Password; - shopInfo.GroupName = shop.GroupName; - } - else - GlobalConfig.ShopLoginList.Add(shop); - ShopBLL.AddServerShop(shop); - } - } - } - catch (Exception ex) - { - } - } - } - } - IsOperate = false; - this.btnImport.Enabled = true; - } - - private void RefreshDataGridView(bool updateStatus=true, List shopUpdateLst = null) - { - if (isLoading) - { - //BaseMsgForm.ShowError("当前正在加载,请稍等"); - Thread.Sleep(100); - if (isLoading) - return; - } - - Task.Run(() => - { - isLoading = true; - while (StartUp.IsShopInit == false) - { - Thread.Sleep(1000); - } - - Invoke(new Action(() => - { - cmbNotes.Items.Clear(); - var notes = GlobalConfig.ShopLoginList.Select(s => s.Notes).Distinct(); - cmbNotes.Items.AddRange(notes.Where(n => !n.IsNullOrEmpty()).ToArray()); - - cmbGroup.Items.Clear(); - var groups = GlobalConfig.ShopLoginList.Select(s => s.GroupName).Distinct(); - cmbGroup.Items.AddRange(groups.Where(n => !n.IsNullOrEmpty()).ToArray()); - - cmbSubAccount.Items.Clear(); - var subAccountStr = string.Join(",", GlobalConfig.ShopLoginList.Select(s => s.SubUserName).Distinct()); - var subAccounts = subAccountStr.Split(',').Distinct(); - cmbSubAccount.Items.AddRange(subAccounts.Where(s => !s.IsNullOrEmpty()).ToArray()); - })); - - var shopList = GlobalConfig.ShopLoginList.Where(s => !string.IsNullOrEmpty(s.ShopId) - || GlobalConfig.ShopLoginList.Where(ss=>ss.LoginName == s.LoginName).Count() == 1) - /*.OrderBy(s=>s.LoginName)*/.ToList(); - - Invoke(new Action(() => - { - if (!string.IsNullOrWhiteSpace(cmbNotes.Text) && cmbNotes.Text.Trim() != "全部") - { - var notes = cmbNotes.Text.ToLower(); - var notesLst = cmbNotes.Text.ToLower().Split(new string[] { ";", ";", ",", " " }, StringSplitOptions.RemoveEmptyEntries); - shopList = shopList.Where(s => s.Notes.ParseToString().ToLower().Contains(notes) || notesLst.Contains(s.Notes.ParseToString().ToLower())).ToList(); - } - if (!string.IsNullOrWhiteSpace(cmbGroup.Text) && cmbGroup.Text.Trim() != "全部") - { - var group = cmbGroup.Text.ToLower(); - var groupLst = cmbGroup.Text.ToLower().Split(new string[] { ";", ";", ",", " " }, StringSplitOptions.RemoveEmptyEntries); - shopList = shopList.Where(s => s.GroupName.ParseToString().ToLower().Contains(group) || groupLst.Contains(s.GroupName.ParseToString().ToLower())).ToList(); - } - if (!string.IsNullOrWhiteSpace(cmbSubAccount.Text) && cmbSubAccount.Text.Trim() != "全部") - { - var subAccount = cmbSubAccount.Text.ToLower(); - var subAccountLst = cmbSubAccount.Text.ToLower().Split(new string[] { ";", ";", ",", " " }, StringSplitOptions.RemoveEmptyEntries); - shopList = shopList.Where(s => s.SubUserName.ParseToString().ToLower().Contains(subAccount) || subAccountLst.Any(sa => s.SubUserName.ParseToString().ToLower().Contains(sa))).ToList(); - } - if (!string.IsNullOrEmpty(txtShopId.Text)) - { - shopList = shopList.Where(s => s.ShopId.ParseToString().ToLower().Contains(txtShopId.Text.ToLower())).ToList(); - } - if (!string.IsNullOrEmpty(txtShopName.Text)) - { - shopList = shopList.Where(s => s.ShopAccount.ParseToString().ToLower().Contains(txtShopName.Text.ToLower()) || - txtShopName.Text.ToLower().Split(new string[] { ",", ",", ";", ";", " " }, StringSplitOptions.RemoveEmptyEntries) - .Contains(s.ShopAccount.ParseToString().ToLower())).ToList(); - } - })); - - List shopIdList = GetCheckedShopIdList(); - this.Invoke(new Action(() => - { - var rows = dgvShop.Rows.Cast().ToList(); - foreach (DataGridViewRow row in rows) - { - if (!shopList.Any(s => s.ShopId == row.Cells["colShopId"].Value.ParseToString())) - this.dgvShop.Rows.Remove(row); - } - if (updateStatus) - this.statusBar.pgbTaskProgress.Maximum = shopList.Count; // 显示总数 - })); - - for (int i = 0; i < shopList.Count; i++) - { - if (this.Created && updateStatus && (i % 5 == 0 || i == shopList.Count - 1)) - { - this.Invoke(new Action(() => - { - this.statusBar.lblTaskStatus.Text = "正在加载..."; - this.statusBar.pgbTaskProgress.Value = (i + 1); - this.statusBar.pgbTaskProgress.Text = (i + 1) + "/" + shopList.Count; - })); - } - - if (shopUpdateLst != null && !shopUpdateLst.Contains(shopList[i])) - continue; - - AddDataGridViewRow(shopList[i], true, shopIdList.Contains(shopList[i].ShopId)); - } - if (this.Created) - { - this.Invoke(new Action(() => - { - if (updateStatus) - this.statusBar.lblTaskStatus.Text = "加载完毕"; - this.pbLoading.Visible = false; - })); - } - isLoading = false; - }); - } - - private void AddDataGridViewRow(ShopLoginInfo param, bool isRefresh = false, bool isRowCheck = false) - { - if (!this.Created) - return; - this.Invoke(new Action(() => - { - DataGridViewRow dgvr = dgvShop.Rows.Cast().Where(p => - p.Cells.GetCellValueFromColumnName("colLoginName").ParseToString() == param.LoginName && - p.Cells.GetCellValueFromColumnName("colShopId").ParseToString() == param.ShopId).FirstOrDefault(); - if (dgvr != null) - { - UpdateDataGridViewRowToken(dgvr, param); - if (!isRefresh) - { - // help to scroll to checked - dgvShop.CurrentCell = dgvr.Cells[2]; - } - } - else - { - var subUserNames = param.SubUserName.Split(',').Where(su => !string.IsNullOrEmpty(su)); - var subUsers = WXSubAccountShopEditForm.lstAllSubAccount.Where(su => subUserNames.Contains(su.user_name)); - int rowIndex = this.dgvShop.Rows.Add( - isRowCheck, - param.LoginName, - param.ShopId, - param.ShopAccount, - param.AddTime.ToString("yy-MM-dd HH:mm"), - param.is_point_shop_expire ? "已过期" : BaseClass.StampToDateTime(param.expire_time.ParseToInt()).ToString("yy-MM-dd HH:mm"), - "续期", - param.Notes, - param.GroupName, - param.Cookies, - string.Join(",", subUsers.Select(s => s.nick_name)), - param.SubUserName, - param.UploadAccount, - param.BuyAccount, - param.ChatAccount, - "", - param.is_point_shop_expire ? "" : "进入", - param.is_point_shop_expire ? "" : "检测", - param.is_point_shop_expire ? "" : (string.IsNullOrWhiteSpace(param.LoginStatus) ? "未登录" : param.LoginStatus.Trim()), - param.is_point_shop_expire ? "" : "批量登录", - param.is_point_shop_expire ? "" : (string.IsNullOrWhiteSpace(param.LoginStatus2) ? "国际版未登录" : param.LoginStatus2.Trim()), - param.is_point_shop_expire ? "" : "购买", - param.is_point_shop_expire ? "" : "多重登录", - param.is_point_shop_expire ? "" : param.ApiAuthStatus, - param.is_point_shop_expire ? "" : param.BuyApiAuth.ApiAuthStatus, - param.is_point_shop_expire ? "" : "导入Cookie", - param.is_point_shop_expire ? "" : "复制Cookie", - param.is_point_shop_expire ? "" : "编辑", - param.is_point_shop_expire ? "删除" : "删除"); - if (!isRefresh) - { - // help to scroll to latest checked - dgvShop.CurrentCell = this.dgvShop.Rows[rowIndex].Cells[2]; - } - dgvr = this.dgvShop.Rows[rowIndex]; - dgvr.Cells["colExpireTime"].Style.ForeColor = dgvr.Cells["colExpireTime"].Value.ParseToString() == "已过期" ? Color.Red : Color.Blue; - } - })); - } - - private void UpdateDataGridViewRowToken(DataGridViewRow dgvr, ShopLoginInfo param) - { - if (dgvr == null || param == null) - return; - - var subUserNames = param.SubUserName.Split(',').Where(su => !string.IsNullOrEmpty(su)); - var subUsers = WXSubAccountShopEditForm.lstAllSubAccount.Where(su => subUserNames.Contains(su.user_name)); - dgvr.Cells["colLoginName"].Value = param.LoginName; - dgvr.Cells["colShopAccount"].Value = param.ShopAccount; - dgvr.Cells["colExpireTime"].Value = param.is_point_shop_expire ? "已过期" : BaseClass.StampToDateTime(param.expire_time.ParseToInt()).ToString("yy-MM-dd HH:mm"); - dgvr.Cells["colNotes"].Value = param.Notes; - dgvr.Cells["colGroupName"].Value = param.GroupName; - dgvr.Cells["colCookie"].Value = param.Cookies; - dgvr.Cells["colSubUser"].Value = string.Join(",", subUsers.Select(s => s.nick_name)); - dgvr.Cells["colSubUserAccount"].Value = param.SubUserName; - dgvr.Cells["colUploadAccount"].Value = param.UploadAccount; - dgvr.Cells["colBuyAccount"].Value = param.BuyAccount; - dgvr.Cells["colChatAccount"].Value = param.ChatAccount; - dgvr.Cells["colApiAuth"].Value = param.ApiAuthStatus; - dgvr.Cells["colBuyApiAuth"].Value = param.BuyApiAuth.ApiAuthStatus; - - dgvr.Cells["colGotoShop"].Value = param.is_point_shop_expire ? "" : "进入"; - dgvr.Cells["colShopOperate"].Value = param.is_point_shop_expire ? "" : "检测"; - dgvr.Cells["colRelogin"].Value = param.is_point_shop_expire ? "" : (string.IsNullOrWhiteSpace(param.LoginStatus) ? "未登录" : param.LoginStatus.Trim()); - dgvr.Cells["colSwitchLogin"].Value = param.is_point_shop_expire ? "" : "批量登录"; - dgvr.Cells["colReLogin2"].Value = param.is_point_shop_expire ? "" : (string.IsNullOrWhiteSpace(param.LoginStatus2) ? "国际版未登录" : param.LoginStatus2.Trim()); - dgvr.Cells["colBuyApi"].Value = param.is_point_shop_expire ? "" : "购买"; - dgvr.Cells["colMultiLogin"].Value = param.is_point_shop_expire ? "" : "多重登录"; - dgvr.Cells["colApiAuth"].Value = param.is_point_shop_expire ? "" : param.ApiAuthStatus; - dgvr.Cells["colBuyApiAuth"].Value = param.is_point_shop_expire ? "" : param.BuyApiAuth.ApiAuthStatus; - dgvr.Cells["colUpdateCookies"].Value = param.is_point_shop_expire ? "" : "导入Cookie"; - dgvr.Cells["colCopyCookies"].Value = param.is_point_shop_expire ? "" : "复制Cookie"; - dgvr.Cells["colEdit"].Value = param.is_point_shop_expire ? "" : "编辑"; - dgvr.Cells["colDelete"].Value = param.is_point_shop_expire ? "删除" : "删除"; - - - - dgvr.Cells["colExpireTime"].Style.ForeColor = dgvr.Cells["colExpireTime"].Value.ParseToString() == "已过期" ? Color.Red : Color.Blue; - } - - /// - /// 检测店铺登录状态 - /// - /// - /// - public void CheckShopListLogin(string[] shopNames, bool isShowProgress = true) - { - if (isShowProgress) - { - Invoke(new Action(() => - { - this.pbLoading.Visible = true; - this.statusBar.lblTaskStatus.Text = "正在检测..."; - this.statusBar.pgbTaskProgress.Value = 0; - this.statusBar.pgbTaskProgress.Maximum = shopNames.Length; - this.statusBar.pgbTaskProgress.Text = "0" + "/" + shopNames.Length; - })); - } - - CheckShopLogin(shopNames, isShowProgress); - - if (this.Created && isShowProgress) - { - this.Invoke(new Action(() => - { - this.pbLoading.Visible = true; - this.statusBar.lblTaskStatus.Text = "检测完毕"; - })); - } - } - - - public void CheckShopLogin(ShopLoginInfo[] shops, bool isShowProgress = true) - { - CheckShopLogin(shops.Select(s => s.ShopId).ToArray(), isShowProgress); - } - - public void CheckShopLogin(string[] shopNames, bool isShowProgress = true) - { - - for (int i = 0; i < shopNames.Length; i++) - { - var campanys = GlobalConfig.ShopLoginList.Where(v => v.LoginName == shopNames[i]).ToList(); - var shop = GlobalConfig.ShopLoginList.FirstOrDefault(v => v.LoginName == shopNames[i]); - - // 先从服务端取最新cookie - var serverCampanys = ShopBLL.AdminGetServerShopLstByIds(campanys.Select(c => c.ShopId).ToList()); - //var shopInfoTmp = string.Join(",", serverCampanys.Select(s => s.UserName + s.ShopAccount)); - var serverShop = serverCampanys.FirstOrDefault(); - if (shop != null && serverShop != null) - { - shop.Cookies = serverShop.Cookies; - shop.Cookies2 = serverShop.Cookies2; - foreach (var sc in campanys) - { - sc.Cookies = serverShop.Cookies; - sc.Cookies2 = serverShop.Cookies2; - } - } - - if (shop != null) - { - var loginResult = CheckShopLogin(shop); - if (!loginResult.Contains("\"code\":0")) - { - shop.Cookies = "[]"; - foreach (var sc in campanys) - { - sc.LoginStatus = "未登录"; - shop.Cookies = "[]"; - } - } - else - { - foreach(var sc in campanys) - { - sc.LoginStatus = "登录成功"; - sc.LastRefreshDate = DateTime.Now.ToString("yyyyMMdd"); - } - } - UpdateServerShopCookies(shop, null, isShowProgress); // 店铺cookie写入服务端,多店共用一个登录账号一组cookie - } - - if (this.Created && isShowProgress) - { - this.Invoke(new Action(() => - { - this.statusBar.lblTaskStatus.Text = "正在检测..."; - this.statusBar.pgbTaskProgress.Value = (i + 1); - this.statusBar.pgbTaskProgress.Text = (i + 1) + "/" + shopNames.Length; - })); - } - } - } - - public static string GetShopInfo(ShopLoginInfo shop) - { - string url = "https://store.weixin.qq.com/shop/home"; - string refere = ""; - var result = WXHttpResponseBLL.WeiXinGetResponse(shop, url, refere, true); - return result; - } - - public static string CheckShopLogin(ShopLoginInfo shop, string refere = "https://store.weixin.qq.com/shop/home") - { - string url = "https://store.weixin.qq.com/shop-faas/mmecnodebase/reachDiolog/getBizNotifyConfig?token=&lang=zh_CN"; - string body = @"{""path"":""https://store.weixin.qq.com/shop/home""}"; - return WXHttpResponseBLL.WeiXinPostResponse(shop, url, body, refere); - } - - - private void ShopListForm_VisibleChanged(object sender, EventArgs e) - { - if (this.Visible == true) - { - this.pbLoading.Visible = true; - RefreshDataGridView(true); - } - } - - private void ShopListForm_Load(object sender, EventArgs e) - { - this.dgvShop.Columns["colExpireTime"].Visible = false; - this.dgvShop.Columns["colRenewal"].Visible = false; - this.btnBatchRenewal.Visible = false; - - if (BaseClass.GroupId != 3) - { - //this.dgvShop.Columns["ColEdit"].Visible = false; - this.dgvShop.Columns["colDelete"].Visible = false; - this.dgvShop.Columns["colSubUser"].Visible = false; - this.dgvShop.Columns["colSubUserAccount"].Visible = false; - this.btnImport.Visible = false; - this.btnAddShop.Visible = false; - //this.btnEdit.Visible = false; - } - if (BaseClass.UserAuthority.Contains("充值用户") || BaseClass.ParentAuthority.Contains("充值用户")) - { - this.dgvShop.Columns["colExpireTime"].Visible = true; - if (BaseClass.GroupId == 3) - { - this.dgvShop.Columns["colRenewal"].Visible = true; - btnBatchRenewal.Visible = true; - } - } - - this.dgvShop.AddSelectorColumn("colSelect"); - this.chkAutoDrag.Checked = GlobalConfig.TemuShopSettingParam.IsAutoDragLogin; - this.splitContainer2.FixedPanel = FixedPanel.Panel2; - - foreach (var shop in GlobalConfig.ShopLoginList) - { - shop.ShopSubAccountList.Clear(); - if (!string.IsNullOrWhiteSpace(shop.SubUserName)) - { - UserSubAccountInfo subAccount = new UserSubAccountInfo(); - subAccount.sub_user_name = shop.SubUserName; - subAccount.user_name = shop.SubUserName; - subAccount.shop_login_name = shop.LoginName; - subAccount.group_id = "4"; - shop.ShopSubAccountList.Add(subAccount); - } - } - - pbLoading.Visible = true; - Task.Run(() => - { - WXSubAccountShopEditForm.GetServerSubUser(); - Invoke(new Action(() => - { - RefreshDataGridView(false); - pbLoading.Visible = false; - })); - }); - } - - private void dgvShop_CellContentClick(object sender, DataGridViewCellEventArgs e) - { - if (e.ColumnIndex < 0 || e.RowIndex < 0) - return; - string headerText = dgvShop.Columns[e.ColumnIndex].HeaderText; - string loginName = dgvShop.Rows[e.RowIndex].Cells["colLoginName"].Value.ParseToString(); - string accountId = dgvShop.Rows[e.RowIndex].Cells["colShopId"].Value.ParseToString(); - var shop = GlobalConfig.ShopLoginList.FirstOrDefault(v => v.LoginName == loginName && v.ShopId == accountId); - var row = dgvShop.Rows[e.RowIndex]; - - switch (headerText) - { - case "检测": - //CheckShopLoginAsync(new string[] { loginName }); - break; - case "进入店铺": - IsOperate = true; - { - WXShopLoginForm shopLoginForm = new WXShopLoginForm(shop); - shopLoginForm.openType = EnumOpenType.manage; - shopLoginForm.WindowState = FormWindowState.Maximized; - shopLoginForm.InitUrl = "https://store.weixin.qq.com/shop/home"; - shopLoginForm.Show(); - } - IsOperate = false; - break; - case "API购买": - { - WXShopLoginForm shopLoginForm = new WXShopLoginForm(shop); - shopLoginForm.openType = EnumOpenType.manage; - shopLoginForm.WindowState = FormWindowState.Maximized; - shopLoginForm.InitUrl = "https://store.weixin.qq.com/shop/servicemarket/detail?serviceId=3984039898079707139"; // 店统领 - shopLoginForm.InitUrl = "https://store.weixin.qq.com/shop/servicemarket/detail?serviceId=4431685489938137094"; - shopLoginForm.Show(); - } - break; - case "复制Cookie": - List cooks = null; - try { cooks = JsonHelper.DeserializeJsonToList(shop.Cookies); } catch (Exception ex) { } - if (cooks == null) - cooks = new List(); - - string cookJs = ""; - var keys = new string[] { "_qimei_uuid", "_qpsvr_localtk", "biz_magic", "biz_rand", "biz_ticket", "biz_token", "ptcz", "RK", "yyb_muid" }; - foreach (var shopCook in cooks) - { - var cookie = shopCook.Name + "=" + shopCook.Value; - if (!keys.Any(k=>cookie.StartsWith(k))) - continue; - cookJs += "\r\ndocument.cookie='" + cookie.Substring(0, Math.Max(0, cookie.IndexOf("="))) + "=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;';"; - } - foreach (var shopCook in cooks) - { - var cookie = shopCook.Name + "=" + shopCook.Value; - if (!keys.Any(k => cookie.StartsWith(k))) - continue; - if (!cookie.StartsWith("biz_magic") && !cookie.StartsWith("biz_rand") && !cookie.StartsWith("biz_ticket") && !cookie.StartsWith("biz_token")) - cookJs += "\r\ndocument.cookie='" + cookie + "; domain=.qq.com; expires=" + - DateTime.Now.AddMonths(1).ToUniversalTime().ToString("ddd, dd MMM yyyy HH:mm:ss 'UTC'", new DateTimeFormatInfo()) + "; path=/';"; - else - cookJs += "\r\ndocument.cookie='" + cookie + "; domain=store.weixin.qq.com; expires=" + - DateTime.Now.AddMonths(1).ToUniversalTime().ToString("ddd, dd MMM yyyy HH:mm:ss 'UTC'", new DateTimeFormatInfo()) + "; path=/';"; - } - cookJs += "\r\nsetTimeout(() => { window.location.href='https://store.weixin.qq.com/shop/goods/list'; }, 200)"; - Clipboard.SetDataObject(cookJs); - BaseMsgForm.ShowInfo("复制成功"); - break; - case "获取Cookie": - case "导入Cookie": - WXShopUpdateCookieForm updateCookieForm = new WXShopUpdateCookieForm(shop); - updateCookieForm.SaveComplete += UpdateCookieForm_SaveComplete; - updateCookieForm.ShowDialog(); - break; - case "删除": - if (BaseMsgForm.ShowConfirm("确定删除店铺吗?删除后不可恢复!").DialogResult == DialogResult.Cancel) - return; - DeleteShop(e.RowIndex); - DelServerDouShop(shop.LoginName); - break; - case "编辑": - WXShopAddEditForm editForm = new WXShopAddEditForm(new List { shop }); - editForm.SaveCompleteWithDescribe += Sae_SaveComplete; - editForm.ShowDialog(); - break; - case "登录": - IsOperate = true; - { - WXShopLoginForm shopLoginForm = new WXShopLoginForm(shop); - shopLoginForm.openType = EnumOpenType.login; - shopLoginForm.SaveComplete += shopLoginForm_SaveComplete; - shopLoginForm.ShowDialog(); - //btnRefreshCookie_Click(null, null); - RefreshDataGridView(true, new List() { shop }); - } - 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(); - RefreshDataGridView(true, shopMultiLoginForm.lstSwitchShop.ToList()); - } - } - break; - case "续期": - lblShopId.Text = shop.ShopId; - lblShopInfo.Text = shop.ShopAccount; - numAddTopUp.Value = 0; - pnlTopUp.Visible = true; - break; - //case "多重登录": - // IsOperate = true; - // ShopLoginForm shopMultiLoginForm = new ShopLoginForm(shop); - // shopMultiLoginForm.isMultiLogin = true; - // shopMultiLoginForm.SaveComplete += shopLoginForm_SaveComplete; - // shopMultiLoginForm.ShowDialog(); - // IsOperate = false; - // break; - //case "接口授权": - //case "上货授权": - // IsOperate = true; - // //GetHtml.OpenUrl("https://fuwu.jinritemai.com/authorize?service_id=815"); - // ShopAuthForm shopAuthForm = new ShopAuthForm(shop); - // shopAuthForm.SaveComplete += shopLoginForm_SaveComplete; - // shopAuthForm.ShowDialog(); - // IsOperate = false; - // break; - //case "拍单授权": - // IsOperate = true; - // //GetHtml.OpenUrl("https://fuwu.jinritemai.com/detail?from=fuwu_market_orderDetail&service_id=20896"); - // ShopAuthForm shopAuthForm1 = new ShopAuthForm(shop); - // shopAuthForm1.shopAuthUrl = "https://fuwu.jinritemai.com/authorize?service_id=20896"; - // shopAuthForm1.SaveComplete += shopLoginForm_SaveComplete; - // shopAuthForm1.ShowDialog(); - // IsOperate = false; - // break; - default: - dgvShop.Rows[e.RowIndex].Cells["colSelect"].Value = !(bool)dgvShop.Rows[e.RowIndex].Cells["colSelect"].Value; - break; - } - } - - private void DeleteShop(int rowIndex) - { - string shopLoginName = this.dgvShop.Rows[rowIndex].Cells["colLoginName"].Value.ParseToString(); - List dgvRows = dgvShop.Rows.Cast().Where(p => - p.Cells.GetCellValueFromColumnName("colLoginName").ParseToString() == shopLoginName).ToList(); - - foreach(var row in dgvRows) - dgvShop.Rows.Remove(row); - GlobalConfig.ShopLoginList.RemoveAll(v => v.LoginName == shopLoginName); - } - - private void btnCheck_Click(object sender, EventArgs e) - { - if (this.btnCheck.Text == "检测选中") - { - List shopNameList = GetCheckedList(); - if (!shopNameList.Any()) - { - BaseMsgForm.ShowError("请选择需要检测的店铺"); - return; - } - - this.pbLoading.Visible = true; - this.btnCheck.Enabled = false; - var t = Task.Run(() => - { - //UpdateShop(); - CheckShopListLogin(shopNameList.Distinct().ToArray()); - RefreshDataGridView(false); - }); - Task.Run(() => - { - while (true) - { - Thread.Sleep(1000); - if (t.IsCompleted || t.IsCanceled || t.IsFaulted) - { - Invoke(new Action(() => - { - this.pbLoading.Visible = false; - this.btnCheck.Enabled = true; - })); - break; - } - } - }); - } - } - - private void btnRefreshCookie_Click(object sender, EventArgs e) - { - this.pbLoading.Visible = true; - this.splitContainer1.Panel1.Enabled = false; - var t = Task.Run(() => - { - try - { - UpdateShop(); - WXSubAccountShopEditForm.GetServerSubUser(); - RefreshDataGridView(false); - } - catch (Exception ex) { BaseMsgForm.ShowError(ex.Message); } - }); - Task.Run(() => - { - while (true) - { - Thread.Sleep(1000); - if (t.IsCompleted || t.IsCanceled || t.IsFaulted) - { - Invoke(new Action(() => - { - this.pbLoading.Visible = false; - this.splitContainer1.Panel1.Enabled = true; - })); - break; - } - } - }); - } - - private List GetCheckedList() - { - List shopNameList = new List(); - for (int i = 0; i < dgvShop.Rows.Count; i++) - { - if (dgvShop.Rows[i].Cells["colSelect"].Value.ParseToBool()) - { - string shopName = dgvShop.Rows[i].Cells["colLoginName"].Value.ParseToString(); - shopNameList.Add(shopName); - } - } - return shopNameList; - } - - private List GetCheckedShopIdList() - { - List shopNameList = new List(); - for (int i = 0; i < dgvShop.Rows.Count; i++) - { - if (dgvShop.Rows[i].Cells["colSelect"].Value.ParseToBool()) - { - string shopName = dgvShop.Rows[i].Cells["colShopId"].Value.ParseToString(); - shopNameList.Add(shopName); - } - } - return shopNameList; - } - - private void btnLoginSelect_Click(object sender, EventArgs e) - { - WXShopListForm.IsOperate = true; - if (this.btnLoginSelect.Text == "登录选中") - { - List shopLoginNameList = GetCheckedList(); - if (!shopLoginNameList.Any()) - { - BaseMsgForm.ShowError("请选择需要登录的店铺"); - WXShopListForm.IsOperate = false; - return; - } - - shopLoginNameList = shopLoginNameList.Distinct().ToList(); - foreach (var loginName in shopLoginNameList) - { - if (WXShopListForm.IsOperate == false) - break; - - var shopInfo = GlobalConfig.ShopLoginList.FirstOrDefault(v => v.LoginName == loginName); - if (shopInfo != null && !string.IsNullOrEmpty(shopInfo.LoginName)) - { - WXShopLoginForm shopLoginForm = new WXShopLoginForm(shopInfo); - shopLoginForm.openType = EnumOpenType.login; - shopLoginForm.SaveComplete += shopLoginForm_SaveComplete; - shopLoginForm.ShowDialog(); - } - } - btnRefreshCookie_Click(null, null); - } - WXShopListForm.IsOperate = false; - } - - private void chkAutoDrag_Click(object sender, EventArgs e) - { - GlobalConfig.TemuShopSettingParam.IsAutoDragLogin = chkAutoDrag.Checked; - StartUp.SaveTemuShopSettingParam(); - foreach (var i in LstShopListFormInatance) - { - if (i != null && i.chkAutoDrag.Checked != GlobalConfig.TemuShopSettingParam.IsAutoDragLogin) - { - if (i.chkAutoDrag.InvokeRequired) - { - i.chkAutoDrag.Invoke(new Action(() => - { - i.chkAutoDrag.Checked = GlobalConfig.TemuShopSettingParam.IsAutoDragLogin; - })); - } - else - { - i.chkAutoDrag.Checked = GlobalConfig.TemuShopSettingParam.IsAutoDragLogin; - } - } - } - } - - private void btnRefreshAuth_Click(object sender, EventArgs e) - { - if (this.btnRefreshAuth.Text == "刷新授权") - { - List shopNameList = GetCheckedList(); - if (!shopNameList.Any()) - { - BaseMsgForm.ShowError("请选择需要刷新授权的店铺"); - return; - } - - UpdateShopTokens(GlobalConfig.ShopLoginList.Where(s => shopNameList.Contains(s.ShopAccount)).ToList()); - Task.Run(() => - { - CheckShopListLogin(shopNameList.ToArray()); - RefreshDataGridView(false); - }); - } - } - - private void btnSearch_Click(object sender, EventArgs e) - { - Task.Run(() => - { - RefreshDataGridView(false); - }); - - //this.pbLoading.Visible = true; - //this.splitContainer1.Panel1.Enabled = false; - //var t = Task.Run(() => - //{ - // try - // { - // UpdateShop(); - // RefreshDataGridView(false); - // } - // catch (Exception ex) { BaseMsgForm.ShowError(ex.Message); } - //}); - //Task.Run(() => - //{ - // while (true) - // { - // Thread.Sleep(1000); - // if (t.IsCompleted || t.IsCanceled || t.IsFaulted) - // { - // Invoke(new Action(() => - // { - // this.pbLoading.Visible = false; - // this.splitContainer1.Panel1.Enabled = true; - // })); - // break; - // } - // } - //}); - } - - private void btnEmpty_Click(object sender, EventArgs e) - { - this.cmbNotes.Text = "全部"; - this.cmbSubAccount.Text = "全部"; - this.cmbGroup.Text = "全部"; - this.txtShopId.Text = ""; - this.txtShopName.Text = ""; - } - - private void btnOpenOrder_Click(object sender, EventArgs e) - { - ShopLoginInfo shop = NaiBa.Util.Helper.ConfigHelper.LoadConfig("wx_dian_tong_ling_login_info"); - if (shop == null) - shop = new ShopLoginInfo(); - WXShopLoginForm shopLoginForm = new WXShopLoginForm(shop); - shopLoginForm.openType = EnumOpenType.manage; - shopLoginForm.WindowState = FormWindowState.Maximized; - shopLoginForm.txtUserName.ReadOnly = false; - shopLoginForm.txtPassWord.ReadOnly = false; - shopLoginForm.btnSaveUserInfo.Visible = true; - shopLoginForm.InitUrl = "https://po.e57.cn/login?redirect=%2Findex"; - shopLoginForm.Show(); - } - - private void btnEdit_Click(object sender, EventArgs e) - { - List shopNameList = GetCheckedList(); - List shops = GlobalConfig.ShopLoginList.Where(s => shopNameList.Contains(s.ShopId)).ToList(); - WXShopAddEditForm editForm = new WXShopAddEditForm(shops); - editForm.chkSubAccount.Checked = editForm.chkShopGroup.Checked = editForm.chkNotes.Checked = false; - editForm.SaveCompleteWithDescribe += Sae_SaveComplete; - editForm.ShowDialog(); - } - - private void btnTopUpCancel_Click(object sender, EventArgs e) - { - pnlTopUp.Visible = false; - } - - private void btnTopUpOK_Click(object sender, EventArgs e) - { - //var row = pnlTopUp.Tag as DataGridViewRow; - //if (row == null) - // return; - //var shopId = row.Cells["colShopId"].Value.ParseToString(); - //if (shopId == null) - // return; - //var shop = GlobalConfig.ShopLoginList.FirstOrDefault(s => s.ShopId == shopId); - //if (shop == null) - // return; - var shopIds = lblShopId.Text.Split(';'); - pbLoading.Visible = true; - pbLoading.BringToFront(); - string errMsg = ""; - Task.Run(() => - { - foreach (var shopId in shopIds) - { - var shop = GlobalConfig.ShopLoginList.FirstOrDefault(s => s.ShopId == shopId); - if (shop == null) - continue; - - string url = BaseClass.BuildObjString("user/update_user_points"); - string data = UserLogin.GetSignaturex(); - data += "&update_user_name=" + BaseClass.UserName; - data += "&update_user_nick=" + BaseClass.NickName; - data += "&option_type=" + "续费"; - data += "&operator_type=" + "用户"; - data += "&operator_name=" + BaseClass.UserName; - data += "&delta_points=" + (numAddTopUp.Value * BaseClass.ShopPointsPerMonth).ParseToInt(); - data += "&shop_id=" + shopId; - data += "&shop_account=" + shop.ShopAccount; - - string html = GetHtml.PostUtf8(url, data.ToString()).Trim(); - Thread.Sleep(100); - if (!html.Contains("\"code\":200")) - { - var msg = BaseRegex.GetStringJsonByRegs(ref html, html, "msg"); - errMsg += shop.ShopAccount + ":" + msg + " "; - continue; - } - - shop.expire_time = BaseRegex.GetIntJson(ref html, "newExpireTime"); - shop.is_point_shop_expire = false; - BaseClass.Points = BaseRegex.GetIntJson(ref html, "newUserPoints"); - Invoke(new Action(() => - { - MainForm.instance.lblPoints.Text = "账户积分:" + BaseClass.Points; - })); - RefreshDataGridView(true, new List() { shop }); - } - Invoke(new Action(() => - { - pnlTopUp.Visible = false; - pbLoading.Visible = false; - if (string.IsNullOrEmpty(errMsg)) - { - BaseMsgForm.ShowInfo("充值完成"); - } - else - { - BaseMsgForm.ShowInfo("充值完成 发生以下错误:\r\n" + errMsg); - } - })); - }); - } - - private void numAddTopUp_ValueChanged(object sender, EventArgs e) - { - this.txtPrice.Text = "预计续费点数:" + (numAddTopUp.Value * lblShopId.Text.Split(';').Length * BaseClass.ShopPointsPerMonth).ParseToString(); - } - - private void btnBatchRenewal_Click(object sender, EventArgs e) - { - List shopNameList = GetCheckedList(); - List shops = GlobalConfig.ShopLoginList.Where(s => shopNameList.Contains(s.ShopId)).ToList(); - - lblShopId.Text = string.Join(";", shops.Select(s => s.ShopId)); - lblShopInfo.Text = string.Join(" ", shops.Select(s => s.ShopAccount)); - numAddTopUp.Value = 0; - pnlTopUp.Visible = true; - } - } + public partial class WXShopListForm : BaseForm + { + public static List LstShopListFormInatance = new List(); + private static WXShopListForm _instance = null; + public static WXShopListForm Instance { get { if (_instance == null) { _instance = new WXShopListForm(); } return _instance; } set { _instance = value; } } + public static bool IsOperate { get; set; } = false; + private bool isLoading { get; set; } = false; + + #region 服务端店铺管理 + public static void UpdateShop() + { + // 获取服务端店铺 + var serverShopList = WXShopListForm.GetServerShop(); + GlobalConfig.ShopLoginList.RemoveAll(s => !serverShopList.Any(ss => ss.LoginName == s.LoginName && ss.ShopId == s.ShopId)); + foreach (var serverShop in serverShopList) + { + + if (serverShop.ShopId == "wx2543ce37a0009883") + { + + } + + var localShop = GlobalConfig.ShopLoginList.FirstOrDefault(s => s.LoginName == serverShop.LoginName && s.ShopId == serverShop.ShopId); + if (localShop != null) + { + localShop.ShopAccount = serverShop.ShopAccount; + localShop.LoginName = serverShop.LoginName; + localShop.Password = serverShop.Password; + localShop.Cookies = serverShop.Cookies; + localShop.DbId = serverShop.DbId; + localShop.UserName = serverShop.UserName; + localShop.SubUserName = serverShop.SubUserName; + localShop.ApiAuthInfoList = new List(); + localShop.ApiAuthInfoList.AddRange(serverShop.ApiAuthInfoList); + localShop.BuyApiAuth.AccessToken = serverShop.BuyApiAuth.AccessToken; + localShop.BuyApiAuth.UpdateTime = serverShop.BuyApiAuth.UpdateTime; + localShop.BuyApiAuth.AppKey = serverShop.BuyApiAuth.AppKey; + localShop.BuyApiAuth.ExpiresTime = serverShop.BuyApiAuth.ExpiresTime; + localShop.BuyApiAuth.RefreshToken = serverShop.BuyApiAuth.RefreshToken; + localShop.PayStatus = serverShop.PayStatus; + localShop.GroupName = serverShop.GroupName; + localShop.Notes = serverShop.Notes; + localShop.LoginStatus = serverShop.LoginStatus; + localShop.LoginStatus2 = serverShop.LoginStatus2; + localShop.AntiContents = serverShop.AntiContents; + localShop.AddProductRemaining = serverShop.AddProductRemaining; + localShop.OperateSubSaName = serverShop.OperateSubSaName; + localShop.TrialUploadCount = Math.Max(0, serverShop.TrialUploadCount); + localShop.is_point_shop_expire = serverShop.is_point_shop_expire; + localShop.expire_time = serverShop.expire_time; + } + else + { + GlobalConfig.ShopLoginList.Add(serverShop); + } + } + } + + public static List GetServerShop() + { + List list = new List(); + + int page = 0; + int pageSize = 100; + while (true) + { + page++; + + var url = BaseClass.BuildObjString("shop/get_shop_list"); + var data = UserLogin.GetSignaturex() + "&page=" + page + "&page_size=" + pageSize; + var html = GetHtml.PostUtf8(url, data); + if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200")) + html = GetHtml.PostUtf8(url, data); + if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200")) + html = GetHtml.PostUtf8(url, data); + if (string.IsNullOrEmpty(html) + || !html.Contains("shop_id") || !html.Contains("shop_account") || !html.Contains("login_pass")) + { + //return list; + break; + } + + var count = BaseRegex.GetIntJson(ref html, "count"); + var totalPage = Math.Ceiling(1.0m * count / pageSize).ParseToInt(); + + try + { + list.AddRange(ShopBLL.DeserializationShop(html)); + } + catch + { + } + + if (page >= totalPage) + break; + } + return list; + } + + public static void UpdateShopTokens(List shops) + { + string shopIds = ""; + foreach (var shop in shops) + { + shopIds += shop.ShopId + ","; + } + + var shopTokens = GetServerShopTokens(shopIds); //{"code":200,"msg":"success","data":[{"shop_id":"9050819","app_key":"6876612657718691336","access_token":"fd818b94-b4e7-4707-8073-bebcd81d8e4c","refresh_token":"9a109ef3-2bef-4ca9-8f4e-18369a356255","add_time":"2021-07-09 10:54:56","expires_in":"2021-07-14 18:40:44"}]} + for (int i = 0; i < 10 && (string.IsNullOrEmpty(shopTokens) || !shopTokens.Contains("\"code\":200")); i++) + { + shopTokens = GetServerShopTokens(shopIds); + if (i > 0) + Thread.Sleep(100); + } + if (!string.IsNullOrEmpty(shopTokens) && shopTokens.Contains("\"code\":200")) + { + JObject jShopsObj = JObject.Parse(shopTokens); + foreach (JObject jShop in jShopsObj["data"]) + { + string shopStr = JsonHelper.SerializeObject(jShop); + string shop_id = BaseRegex.GetStringJson(ref shopStr, "shop_id"); + var shop = shops.FirstOrDefault(s => s.ShopId == shop_id); + if (shop != null) + { + var appkey = BaseRegex.GetStringJson(ref shopStr, "app_key"); + // 科尔搬家 + if (appkey == "7023294452517127719") + { + shop.ApiAuthInfoList.RemoveAll(a => a.AppKey == appkey); + shop.ApiAuthInfoList.Add(new AuthInfo + { + AppKey = appkey, + AccessToken = BaseRegex.GetStringJson(ref shopStr, "access_token"), + RefreshToken = BaseRegex.GetStringJson(ref shopStr, "refresh_token"), + UpdateTime = BaseRegex.GetStringJson(ref shopStr, "add_time").ParseToDateTime(), + ExpiresTime = BaseRegex.GetStringJson(ref shopStr, "expires_in").ParseToDateTime(), + }); + } + // 小奶兔工具 + else if (appkey == "6876612657718691336") // || shop.ShopName == "权益服务齐全的专营店") // 上货appkey,小奶猫工具 + { + shop.ApiAuthInfoList.RemoveAll(a => a.AppKey == appkey); + shop.ApiAuthInfoList.Add(new AuthInfo + { + AppKey = appkey, + AccessToken = BaseRegex.GetStringJson(ref shopStr, "access_token"), + RefreshToken = BaseRegex.GetStringJson(ref shopStr, "refresh_token"), + UpdateTime = BaseRegex.GetStringJson(ref shopStr, "add_time").ParseToDateTime(), + ExpiresTime = BaseRegex.GetStringJson(ref shopStr, "expires_in").ParseToDateTime(), + }); + } + else if (appkey == "7016502755254683171") // 拍单appkey,小奶兔打单 + { + shop.BuyApiAuth.AppKey = appkey; + shop.BuyApiAuth.AccessToken = BaseRegex.GetStringJson(ref shopStr, "access_token"); + shop.BuyApiAuth.RefreshToken = BaseRegex.GetStringJson(ref shopStr, "refresh_token"); + shop.BuyApiAuth.UpdateTime = BaseRegex.GetStringJson(ref shopStr, "add_time").ParseToDateTime(); + shop.BuyApiAuth.ExpiresTime = BaseRegex.GetStringJson(ref shopStr, "expires_in").ParseToDateTime(); + } + } + } + } + } + + public static void DelServerDouShop(string shopId) + { + var url = BaseClass.BuildObjString("shop/del_shop"); + var data = UserLogin.GetSignaturex() + "&login_name=" + shopId; + var result = GetHtml.PostUtf8(url, data); + } + #endregion + + #region 服务端店铺Cookie管理 + /// + /// 添加店铺Cookies + /// + /// 店铺名称 + /// cookies + /// 工具名称(可不填写) + public static string UpdateServerShopCookies(ShopLoginInfo shop, string fromTool = null, bool isShowProgress = true) + { + var fTool = string.IsNullOrEmpty(fromTool) ? "" : "&from_tool=" + fromTool; + var url = BaseClass.BuildObjString("shop/mdy_shop_cookie_and_login_status"); + var data = UserLogin.GetSignaturex() + + "&login_name=" + shop.LoginName + + "&login_status=" + shop.LoginStatus + + "&login_status2=" + shop.LoginStatus2 + + "&cookie=" + shop.Cookies.Replace("&", "&").Replace("%", "%").Replace("+", "+") + + "&cookie2=" + shop.Cookies2.Replace("&", "&").Replace("%", "%").Replace("+", "+") + + "&openid=" + shop.openid + + fTool; + var result = GetHtml.PostUtf8(url, data); + if (!result.Contains("\"code\":200")) + result = GetHtml.PostUtf8(url, data); + if (!result.Contains("\"code\":200")) + { + var errMsg = BaseRegex.GetStringJson(ref result, "msg"); + if (isShowProgress) + BaseMsgForm.ShowError("服务端登录状态保存失败!请检查网络连接。" + errMsg); + else + return "服务端登录状态保存失败!请检查网络连接。" + errMsg; + } + return ""; + } + ///// + ///// 获取店铺Cookies + ///// + ///// 店铺名称,逗号隔开 + //public static string GetServerShopCookies(string shopNames) + //{ + // var url = BaseClass.BuildObjString("shop&act=get_shop_cookie"); + // var data = UserLogin.GetSignaturex() + "&shop_name=" + shopNames.Trim(','); + // var result = GetHtml.PostUtf8(url, data); + // return result; + //} + #endregion + + public static string GetServerShopTokens(string shopLoginNames) + { + var url = BaseClass.BuildObjString("shop&act=get_shop_token"); + var data = UserLogin.GetSignaturex() + "&login_name=" + shopLoginNames.Trim(','); + var result = GetHtml.PostUtf8(url, data); + return result; + } + + public WXShopListForm() + { + InitializeComponent(); + + Instance = this; + + LstShopListFormInatance.Add(this); + } + + private void btnAddShop_Click(object sender, EventArgs e) + { + //WXShopAddEditForm sae = new WXShopAddEditForm(); + //sae.SaveCompleteWithDescribe += Sae_SaveComplete; + //sae.Show(); + WXShopLoginForm shopLoginForm = new WXShopLoginForm(null); + shopLoginForm.openType = EnumOpenType.login; + shopLoginForm.InitUrl = "https://store.weixin.qq.com/shop?redirect_url=%2Fhome"; + shopLoginForm.SaveComplete += shopLoginForm_SaveComplete; + shopLoginForm.ShowDialog(); + btnRefreshCookie_Click(null, null); + } + + private void Sae_SaveComplete(object obj, object isAdd, object sender) + { + WXShopAddEditForm saeForm = sender as WXShopAddEditForm; + var shopInfoLst = obj as List; + if (shopInfoLst != null) + { + this.pbLoading.Visible = true; + Task.Run(() => + { + if ((isAdd as bool?) == true) + { + int i = 1; + foreach (var shopInfo in shopInfoLst) + { + Invoke(new Action(() => + { + this.statusBar.pgbTaskProgress.Value = i; + this.statusBar.pgbTaskProgress.Text = i + "/" + shopInfoLst.Count; + i++; + })); + var shop = GlobalConfig.ShopLoginList.FirstOrDefault(v => v.LoginName == shopInfo.LoginName); + if (shop != null) + { + BaseMsgForm.ShowError("店铺" + shopInfo.LoginName + "已存在!"); + } + else + { + ShopBLL.AddServerShop(shopInfo); + } + } + btnRefreshCookie_Click(null, null); + } + else + { + int i = 1; + foreach (var shopInfo in shopInfoLst) + { + Invoke(new Action(() => + { + this.statusBar.pgbTaskProgress.Value = i; + this.statusBar.pgbTaskProgress.Text = i + "/" + shopInfoLst.Count; + this.statusBar.pgbTaskProgress.Maximum = shopInfoLst.Count; + i++; + })); + ShopBLL.MdyPDDWXServerShopSubInfo(shopInfo, saeForm.chkNotes.Checked, saeForm.chkShopGroup.Checked, saeForm.chkSubAccount.Checked); + } + RefreshDataGridView(false); + //btnRefreshCookie_Click(null, null); + } + Invoke(new Action(() => + { + this.pbLoading.Visible = false; + this.statusBar.pgbTaskProgress.Text = "准备就绪"; + })); + }); + } + } + + private void shopLoginForm_SaveComplete(object obj) + { + Task.Run(() => + { + //CheckShopListLogin(new string[] { (obj as DouShopLoginInfo).LoginName }); + }); + } + + private void UpdateCookieForm_SaveComplete(object obj) + { + Task.Run(() => + { + //CheckShopListLogin(new string[] { (obj as DouShopLoginInfo).LoginName }); + //StartUp.SaveLocalShopLoginInfo(); + Invoke(new Action(() => + { + btnRefreshCookie_Click(null, null); + })); + }); + } + + private void btnImport_Click(object sender, EventArgs e) + { + IsOperate = true; + ImportShop(); + btnRefreshCookie_Click(null, null); + } + + void ImportShop() + { + this.btnImport.Enabled = false; + string text = "店铺导入格式:\r\n\r\n1.店铺账号(手机/用户名/邮箱)-----店铺密码\r\n2.店铺账号-----密码-----备注\r\n\r\n多个店铺请每个店铺新起一行。"; + BaseMsgForm.ShowInfo(text, "", FormLevel.LARGE); + + OpenFileDialog openFileDialog = new OpenFileDialog(); + openFileDialog.Filter = "文本文件(*.txt)|*.txt"; + openFileDialog.RestoreDirectory = true; + openFileDialog.FilterIndex = 1; + if (openFileDialog.ShowDialog() == DialogResult.OK) + { + using (StreamReader sr = new StreamReader(openFileDialog.FileName, System.Text.Encoding.UTF8)) + { + string fileName = openFileDialog.FileName; + string importStr = sr.ReadToEnd().Trim(); + var strArr = importStr.Replace("\r", "").Split('\n'); + for (int i = 0; i < strArr.Length; i++) + { + if (IsOperate == false) + break; + try + { + // 通用格式 + if (strArr[i].Contains("-----")) + { + var productArr = strArr[i].Split(new string[] { "-----" }, StringSplitOptions.RemoveEmptyEntries); + if (productArr.Length > 1) + { + ShopLoginInfo shop = new ShopLoginInfo + { + LoginName = productArr[0], + Password = DataOpenSSL.EncryptString(productArr[1]), + }; + if (productArr.Length > 2) + { + shop.Notes = productArr[2]; + } + + //ShopLoginForm shopLoginForm = new ShopLoginForm(shop); + //shopLoginForm.SaveComplete += shopLoginForm_SaveComplete; + //shopLoginForm.ShowDialog(); + + //StartUp.SaveDouShopLoginInfo(); + var shopInfo = GlobalConfig.ShopLoginList.FirstOrDefault(v => v.LoginName == shop.LoginName); + if (shopInfo != null) + { + shopInfo.Password = shop.Password; + shopInfo.GroupName = shop.GroupName; + } + else + GlobalConfig.ShopLoginList.Add(shop); + ShopBLL.AddServerShop(shop); + } + } + } + catch (Exception ex) + { + } + } + } + } + IsOperate = false; + this.btnImport.Enabled = true; + } + + private void RefreshDataGridView(bool updateStatus = true, List shopUpdateLst = null) + { + if (isLoading) + { + //BaseMsgForm.ShowError("当前正在加载,请稍等"); + Thread.Sleep(100); + if (isLoading) + return; + } + + Task.Run(() => + { + isLoading = true; + while (StartUp.IsShopInit == false) + { + Thread.Sleep(1000); + } + + Invoke(new Action(() => + { + cmbNotes.Items.Clear(); + var notes = GlobalConfig.ShopLoginList.Select(s => s.Notes).Distinct(); + cmbNotes.Items.AddRange(notes.Where(n => !n.IsNullOrEmpty()).ToArray()); + + cmbGroup.Items.Clear(); + var groups = GlobalConfig.ShopLoginList.Select(s => s.GroupName).Distinct(); + cmbGroup.Items.AddRange(groups.Where(n => !n.IsNullOrEmpty()).ToArray()); + + cmbSubAccount.Items.Clear(); + var subAccountStr = string.Join(",", GlobalConfig.ShopLoginList.Select(s => s.SubUserName).Distinct()); + var subAccounts = subAccountStr.Split(',').Distinct(); + cmbSubAccount.Items.AddRange(subAccounts.Where(s => !s.IsNullOrEmpty()).ToArray()); + })); + + var shopList = GlobalConfig.ShopLoginList.Where(s => !string.IsNullOrEmpty(s.ShopId) + || GlobalConfig.ShopLoginList.Where(ss => ss.LoginName == s.LoginName).Count() == 1) + /*.OrderBy(s=>s.LoginName)*/.ToList(); + + Invoke(new Action(() => + { + if (!string.IsNullOrWhiteSpace(cmbNotes.Text) && cmbNotes.Text.Trim() != "全部") + { + var notes = cmbNotes.Text.ToLower(); + var notesLst = cmbNotes.Text.ToLower().Split(new string[] { ";", ";", ",", " " }, StringSplitOptions.RemoveEmptyEntries); + shopList = shopList.Where(s => s.Notes.ParseToString().ToLower().Contains(notes) || notesLst.Contains(s.Notes.ParseToString().ToLower())).ToList(); + } + if (!string.IsNullOrWhiteSpace(cmbGroup.Text) && cmbGroup.Text.Trim() != "全部") + { + var group = cmbGroup.Text.ToLower(); + var groupLst = cmbGroup.Text.ToLower().Split(new string[] { ";", ";", ",", " " }, StringSplitOptions.RemoveEmptyEntries); + shopList = shopList.Where(s => s.GroupName.ParseToString().ToLower().Contains(group) || groupLst.Contains(s.GroupName.ParseToString().ToLower())).ToList(); + } + if (!string.IsNullOrWhiteSpace(cmbSubAccount.Text) && cmbSubAccount.Text.Trim() != "全部") + { + var subAccount = cmbSubAccount.Text.ToLower(); + var subAccountLst = cmbSubAccount.Text.ToLower().Split(new string[] { ";", ";", ",", " " }, StringSplitOptions.RemoveEmptyEntries); + shopList = shopList.Where(s => s.SubUserName.ParseToString().ToLower().Contains(subAccount) || subAccountLst.Any(sa => s.SubUserName.ParseToString().ToLower().Contains(sa))).ToList(); + } + if (!string.IsNullOrEmpty(txtShopId.Text)) + { + shopList = shopList.Where(s => s.ShopId.ParseToString().ToLower().Contains(txtShopId.Text.ToLower())).ToList(); + } + if (!string.IsNullOrEmpty(txtShopName.Text)) + { + shopList = shopList.Where(s => s.ShopAccount.ParseToString().ToLower().Contains(txtShopName.Text.ToLower()) || + txtShopName.Text.ToLower().Split(new string[] { ",", ",", ";", ";", " " }, StringSplitOptions.RemoveEmptyEntries) + .Contains(s.ShopAccount.ParseToString().ToLower())).ToList(); + } + })); + + List shopIdList = GetCheckedShopIdList(); + this.Invoke(new Action(() => + { + var rows = dgvShop.Rows.Cast().ToList(); + foreach (DataGridViewRow row in rows) + { + if (!shopList.Any(s => s.ShopId == row.Cells["colShopId"].Value.ParseToString())) + this.dgvShop.Rows.Remove(row); + } + if (updateStatus) + this.statusBar.pgbTaskProgress.Maximum = shopList.Count; // 显示总数 + })); + + for (int i = 0; i < shopList.Count; i++) + { + if (this.Created && updateStatus && (i % 5 == 0 || i == shopList.Count - 1)) + { + this.Invoke(new Action(() => + { + this.statusBar.lblTaskStatus.Text = "正在加载..."; + this.statusBar.pgbTaskProgress.Value = (i + 1); + this.statusBar.pgbTaskProgress.Text = (i + 1) + "/" + shopList.Count; + })); + } + + if (shopUpdateLst != null && !shopUpdateLst.Contains(shopList[i])) + continue; + + AddDataGridViewRow(shopList[i], true, shopIdList.Contains(shopList[i].ShopId)); + } + if (this.Created) + { + this.Invoke(new Action(() => + { + if (updateStatus) + this.statusBar.lblTaskStatus.Text = "加载完毕"; + this.pbLoading.Visible = false; + })); + } + isLoading = false; + }); + } + + private void AddDataGridViewRow(ShopLoginInfo param, bool isRefresh = false, bool isRowCheck = false) + { + if (!this.Created) + return; + this.Invoke(new Action(() => + { + DataGridViewRow dgvr = dgvShop.Rows.Cast().Where(p => + p.Cells.GetCellValueFromColumnName("colLoginName").ParseToString() == param.LoginName && + p.Cells.GetCellValueFromColumnName("colShopId").ParseToString() == param.ShopId).FirstOrDefault(); + if (dgvr != null) + { + UpdateDataGridViewRowToken(dgvr, param); + if (!isRefresh) + { + // help to scroll to checked + dgvShop.CurrentCell = dgvr.Cells[2]; + } + } + else + { + var subUserNames = param.SubUserName.Split(',').Where(su => !string.IsNullOrEmpty(su)); + var subUsers = WXSubAccountShopEditForm.lstAllSubAccount.Where(su => subUserNames.Contains(su.user_name)); + int rowIndex = this.dgvShop.Rows.Add( + isRowCheck, + param.LoginName, + param.ShopId, + param.ShopAccount, + param.AddTime.ToString("yy-MM-dd HH:mm"), + param.is_point_shop_expire ? "已过期" : BaseClass.StampToDateTime(param.expire_time.ParseToInt()).ToString("yy-MM-dd HH:mm"), + "续期", + param.Notes, + param.GroupName, + param.Cookies, + string.Join(",", subUsers.Select(s => s.nick_name)), + param.SubUserName, + param.UploadAccount, + param.BuyAccount, + param.ChatAccount, + "", + param.is_point_shop_expire ? "" : "进入", + param.is_point_shop_expire ? "" : "检测", + param.is_point_shop_expire ? "" : (string.IsNullOrWhiteSpace(param.LoginStatus) ? "未登录" : param.LoginStatus.Trim()), + param.is_point_shop_expire ? "" : "批量登录", + param.is_point_shop_expire ? "" : (string.IsNullOrWhiteSpace(param.LoginStatus2) ? "国际版未登录" : param.LoginStatus2.Trim()), + param.is_point_shop_expire ? "" : "购买", + param.is_point_shop_expire ? "" : "多重登录", + param.is_point_shop_expire ? "" : param.ApiAuthStatus, + param.is_point_shop_expire ? "" : param.BuyApiAuth.ApiAuthStatus, + param.is_point_shop_expire ? "" : "导入Cookie", + param.is_point_shop_expire ? "" : "复制Cookie", + param.is_point_shop_expire ? "" : "编辑", + param.is_point_shop_expire ? "删除" : "删除"); + if (!isRefresh) + { + // help to scroll to latest checked + dgvShop.CurrentCell = this.dgvShop.Rows[rowIndex].Cells[2]; + } + dgvr = this.dgvShop.Rows[rowIndex]; + dgvr.Cells["colExpireTime"].Style.ForeColor = dgvr.Cells["colExpireTime"].Value.ParseToString() == "已过期" ? Color.Red : Color.Blue; + } + })); + } + + private void UpdateDataGridViewRowToken(DataGridViewRow dgvr, ShopLoginInfo param) + { + if (dgvr == null || param == null) + return; + + var subUserNames = param.SubUserName.Split(',').Where(su => !string.IsNullOrEmpty(su)); + var subUsers = WXSubAccountShopEditForm.lstAllSubAccount.Where(su => subUserNames.Contains(su.user_name)); + dgvr.Cells["colLoginName"].Value = param.LoginName; + dgvr.Cells["colShopAccount"].Value = param.ShopAccount; + dgvr.Cells["colExpireTime"].Value = param.is_point_shop_expire ? "已过期" : BaseClass.StampToDateTime(param.expire_time.ParseToInt()).ToString("yy-MM-dd HH:mm"); + dgvr.Cells["colNotes"].Value = param.Notes; + dgvr.Cells["colGroupName"].Value = param.GroupName; + dgvr.Cells["colCookie"].Value = param.Cookies; + dgvr.Cells["colSubUser"].Value = string.Join(",", subUsers.Select(s => s.nick_name)); + dgvr.Cells["colSubUserAccount"].Value = param.SubUserName; + dgvr.Cells["colUploadAccount"].Value = param.UploadAccount; + dgvr.Cells["colBuyAccount"].Value = param.BuyAccount; + dgvr.Cells["colChatAccount"].Value = param.ChatAccount; + dgvr.Cells["colApiAuth"].Value = param.ApiAuthStatus; + dgvr.Cells["colBuyApiAuth"].Value = param.BuyApiAuth.ApiAuthStatus; + + dgvr.Cells["colGotoShop"].Value = param.is_point_shop_expire ? "" : "进入"; + dgvr.Cells["colShopOperate"].Value = param.is_point_shop_expire ? "" : "检测"; + dgvr.Cells["colRelogin"].Value = param.is_point_shop_expire ? "" : (string.IsNullOrWhiteSpace(param.LoginStatus) ? "未登录" : param.LoginStatus.Trim()); + dgvr.Cells["colSwitchLogin"].Value = param.is_point_shop_expire ? "" : "批量登录"; + dgvr.Cells["colReLogin2"].Value = param.is_point_shop_expire ? "" : (string.IsNullOrWhiteSpace(param.LoginStatus2) ? "国际版未登录" : param.LoginStatus2.Trim()); + dgvr.Cells["colBuyApi"].Value = param.is_point_shop_expire ? "" : "购买"; + dgvr.Cells["colMultiLogin"].Value = param.is_point_shop_expire ? "" : "多重登录"; + dgvr.Cells["colApiAuth"].Value = param.is_point_shop_expire ? "" : param.ApiAuthStatus; + dgvr.Cells["colBuyApiAuth"].Value = param.is_point_shop_expire ? "" : param.BuyApiAuth.ApiAuthStatus; + dgvr.Cells["colUpdateCookies"].Value = param.is_point_shop_expire ? "" : "导入Cookie"; + dgvr.Cells["colCopyCookies"].Value = param.is_point_shop_expire ? "" : "复制Cookie"; + dgvr.Cells["colEdit"].Value = param.is_point_shop_expire ? "" : "编辑"; + dgvr.Cells["colDelete"].Value = param.is_point_shop_expire ? "删除" : "删除"; + + + + dgvr.Cells["colExpireTime"].Style.ForeColor = dgvr.Cells["colExpireTime"].Value.ParseToString() == "已过期" ? Color.Red : Color.Blue; + } + + /// + /// 检测店铺登录状态 + /// + /// + /// + public void CheckShopListLogin(string[] shopNames, bool isShowProgress = true) + { + if (isShowProgress) + { + Invoke(new Action(() => + { + this.pbLoading.Visible = true; + this.statusBar.lblTaskStatus.Text = "正在检测..."; + this.statusBar.pgbTaskProgress.Value = 0; + this.statusBar.pgbTaskProgress.Maximum = shopNames.Length; + this.statusBar.pgbTaskProgress.Text = "0" + "/" + shopNames.Length; + })); + } + + CheckShopLogin(shopNames, isShowProgress); + + if (this.Created && isShowProgress) + { + this.Invoke(new Action(() => + { + this.pbLoading.Visible = true; + this.statusBar.lblTaskStatus.Text = "检测完毕"; + })); + } + } + + + public void CheckShopLogin(ShopLoginInfo[] shops, bool isShowProgress = true) + { + CheckShopLogin(shops.Select(s => s.ShopId).ToArray(), isShowProgress); + } + + public void CheckShopLogin(string[] shopNames, bool isShowProgress = true) + { + + for (int i = 0; i < shopNames.Length; i++) + { + var campanys = GlobalConfig.ShopLoginList.Where(v => v.LoginName == shopNames[i]).ToList(); + var shop = GlobalConfig.ShopLoginList.FirstOrDefault(v => v.LoginName == shopNames[i]); + + // 先从服务端取最新cookie + var serverCampanys = ShopBLL.AdminGetServerShopLstByIds(campanys.Select(c => c.ShopId).ToList()); + //var shopInfoTmp = string.Join(",", serverCampanys.Select(s => s.UserName + s.ShopAccount)); + var serverShop = serverCampanys.FirstOrDefault(); + if (shop != null && serverShop != null) + { + shop.Cookies = serverShop.Cookies; + shop.Cookies2 = serverShop.Cookies2; + foreach (var sc in campanys) + { + sc.Cookies = serverShop.Cookies; + sc.Cookies2 = serverShop.Cookies2; + } + } + + if (shop != null) + { + var loginResult = CheckShopLogin(shop); + if (!loginResult.Contains("\"code\":0")) + { + shop.Cookies = "[]"; + foreach (var sc in campanys) + { + sc.LoginStatus = "未登录"; + shop.Cookies = "[]"; + } + } + else + { + foreach (var sc in campanys) + { + sc.LoginStatus = "登录成功"; + sc.LastRefreshDate = DateTime.Now.ToString("yyyyMMdd"); + } + } + UpdateServerShopCookies(shop, null, isShowProgress); // 店铺cookie写入服务端,多店共用一个登录账号一组cookie + } + + if (this.Created && isShowProgress) + { + this.Invoke(new Action(() => + { + this.statusBar.lblTaskStatus.Text = "正在检测..."; + this.statusBar.pgbTaskProgress.Value = (i + 1); + this.statusBar.pgbTaskProgress.Text = (i + 1) + "/" + shopNames.Length; + })); + } + } + } + + public static string GetShopInfo(ShopLoginInfo shop) + { + string url = "https://store.weixin.qq.com/shop/home"; + string refere = ""; + var result = WXHttpResponseBLL.WeiXinGetResponse(shop, url, refere, true); + return result; + } + + public static string CheckShopLogin(ShopLoginInfo shop, string refere = "https://store.weixin.qq.com/shop/home") + { + string url = "https://store.weixin.qq.com/shop-faas/mmecnodebase/reachDiolog/getBizNotifyConfig?token=&lang=zh_CN"; + string body = @"{""path"":""https://store.weixin.qq.com/shop/home""}"; + return WXHttpResponseBLL.WeiXinPostResponse(shop, url, body, refere); + } + + + private void ShopListForm_VisibleChanged(object sender, EventArgs e) + { + if (this.Visible == true) + { + this.pbLoading.Visible = true; + RefreshDataGridView(true); + } + } + + private void ShopListForm_Load(object sender, EventArgs e) + { + this.dgvShop.Columns["colExpireTime"].Visible = false; + this.dgvShop.Columns["colRenewal"].Visible = false; + this.btnBatchRenewal.Visible = false; + + if (BaseClass.GroupId != 3) + { + //this.dgvShop.Columns["ColEdit"].Visible = false; + this.dgvShop.Columns["colDelete"].Visible = false; + this.dgvShop.Columns["colSubUser"].Visible = false; + this.dgvShop.Columns["colSubUserAccount"].Visible = false; + this.btnImport.Visible = false; + this.btnAddShop.Visible = false; + //this.btnEdit.Visible = false; + } + if (BaseClass.UserAuthority.Contains("充值用户") || BaseClass.ParentAuthority.Contains("充值用户")) + { + this.dgvShop.Columns["colExpireTime"].Visible = true; + if (BaseClass.GroupId == 3) + { + this.dgvShop.Columns["colRenewal"].Visible = true; + btnBatchRenewal.Visible = true; + } + } + + this.dgvShop.AddSelectorColumn("colSelect"); + this.chkAutoDrag.Checked = GlobalConfig.TemuShopSettingParam.IsAutoDragLogin; + this.splitContainer2.FixedPanel = FixedPanel.Panel2; + + foreach (var shop in GlobalConfig.ShopLoginList) + { + shop.ShopSubAccountList.Clear(); + if (!string.IsNullOrWhiteSpace(shop.SubUserName)) + { + UserSubAccountInfo subAccount = new UserSubAccountInfo(); + subAccount.sub_user_name = shop.SubUserName; + subAccount.user_name = shop.SubUserName; + subAccount.shop_login_name = shop.LoginName; + subAccount.group_id = "4"; + shop.ShopSubAccountList.Add(subAccount); + } + } + + pbLoading.Visible = true; + Task.Run(() => + { + WXSubAccountShopEditForm.GetServerSubUser(); + Invoke(new Action(() => + { + RefreshDataGridView(false); + pbLoading.Visible = false; + })); + }); + } + + private void dgvShop_CellContentClick(object sender, DataGridViewCellEventArgs e) + { + if (e.ColumnIndex < 0 || e.RowIndex < 0) + return; + string headerText = dgvShop.Columns[e.ColumnIndex].HeaderText; + string loginName = dgvShop.Rows[e.RowIndex].Cells["colLoginName"].Value.ParseToString(); + string accountId = dgvShop.Rows[e.RowIndex].Cells["colShopId"].Value.ParseToString(); + var shop = GlobalConfig.ShopLoginList.FirstOrDefault(v => v.LoginName == loginName && v.ShopId == accountId); + var row = dgvShop.Rows[e.RowIndex]; + + switch (headerText) + { + case "检测": + //CheckShopLoginAsync(new string[] { loginName }); + break; + case "进入店铺": + IsOperate = true; + { + WXShopLoginForm shopLoginForm = new WXShopLoginForm(shop); + shopLoginForm.openType = EnumOpenType.manage; + shopLoginForm.WindowState = FormWindowState.Maximized; + shopLoginForm.InitUrl = "https://store.weixin.qq.com/shop/home"; + shopLoginForm.Show(); + } + IsOperate = false; + break; + case "API购买": + { + WXShopLoginForm shopLoginForm = new WXShopLoginForm(shop); + shopLoginForm.openType = EnumOpenType.manage; + shopLoginForm.WindowState = FormWindowState.Maximized; + shopLoginForm.InitUrl = "https://store.weixin.qq.com/shop/servicemarket/detail?serviceId=3984039898079707139"; // 店统领 + shopLoginForm.InitUrl = "https://store.weixin.qq.com/shop/servicemarket/detail?serviceId=4431685489938137094"; + shopLoginForm.Show(); + } + break; + case "复制Cookie": + List cooks = null; + try { cooks = JsonHelper.DeserializeJsonToList(shop.Cookies); } catch (Exception ex) { } + if (cooks == null) + cooks = new List(); + + string cookJs = ""; + var keys = new string[] { "_qimei_uuid", "_qpsvr_localtk", "biz_magic", "biz_rand", "biz_ticket", "biz_token", "ptcz", "RK", "yyb_muid" }; + foreach (var shopCook in cooks) + { + var cookie = shopCook.Name + "=" + shopCook.Value; + if (!keys.Any(k => cookie.StartsWith(k))) + continue; + cookJs += "\r\ndocument.cookie='" + cookie.Substring(0, Math.Max(0, cookie.IndexOf("="))) + "=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;';"; + } + foreach (var shopCook in cooks) + { + var cookie = shopCook.Name + "=" + shopCook.Value; + if (!keys.Any(k => cookie.StartsWith(k))) + continue; + if (!cookie.StartsWith("biz_magic") && !cookie.StartsWith("biz_rand") && !cookie.StartsWith("biz_ticket") && !cookie.StartsWith("biz_token")) + cookJs += "\r\ndocument.cookie='" + cookie + "; domain=.qq.com; expires=" + + DateTime.Now.AddMonths(1).ToUniversalTime().ToString("ddd, dd MMM yyyy HH:mm:ss 'UTC'", new DateTimeFormatInfo()) + "; path=/';"; + else + cookJs += "\r\ndocument.cookie='" + cookie + "; domain=store.weixin.qq.com; expires=" + + DateTime.Now.AddMonths(1).ToUniversalTime().ToString("ddd, dd MMM yyyy HH:mm:ss 'UTC'", new DateTimeFormatInfo()) + "; path=/';"; + } + cookJs += "\r\nsetTimeout(() => { window.location.href='https://store.weixin.qq.com/shop/goods/list'; }, 200)"; + Clipboard.SetDataObject(cookJs); + BaseMsgForm.ShowInfo("复制成功"); + break; + case "获取Cookie": + case "导入Cookie": + WXShopUpdateCookieForm updateCookieForm = new WXShopUpdateCookieForm(shop); + updateCookieForm.SaveComplete += UpdateCookieForm_SaveComplete; + updateCookieForm.ShowDialog(); + break; + case "删除": + if (BaseMsgForm.ShowConfirm("确定删除店铺吗?删除后不可恢复!").DialogResult == DialogResult.Cancel) + return; + DeleteShop(e.RowIndex); + DelServerDouShop(shop.LoginName); + break; + case "编辑": + WXShopAddEditForm editForm = new WXShopAddEditForm(new List { shop }); + editForm.SaveCompleteWithDescribe += Sae_SaveComplete; + editForm.ShowDialog(); + break; + case "登录": + IsOperate = true; + { + WXShopLoginForm shopLoginForm = new WXShopLoginForm(shop); + shopLoginForm.openType = EnumOpenType.login; + shopLoginForm.SaveComplete += shopLoginForm_SaveComplete; + shopLoginForm.ShowDialog(); + //btnRefreshCookie_Click(null, null); + RefreshDataGridView(true, new List() { shop }); + } + 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(); + RefreshDataGridView(true, shopMultiLoginForm.lstSwitchShop.ToList()); + } + } + break; + case "续期": + lblShopId.Text = shop.ShopId; + lblShopInfo.Text = shop.ShopAccount; + numAddTopUp.Value = 1; + pnlTopUp.Visible = true; + break; + //case "多重登录": + // IsOperate = true; + // ShopLoginForm shopMultiLoginForm = new ShopLoginForm(shop); + // shopMultiLoginForm.isMultiLogin = true; + // shopMultiLoginForm.SaveComplete += shopLoginForm_SaveComplete; + // shopMultiLoginForm.ShowDialog(); + // IsOperate = false; + // break; + //case "接口授权": + //case "上货授权": + // IsOperate = true; + // //GetHtml.OpenUrl("https://fuwu.jinritemai.com/authorize?service_id=815"); + // ShopAuthForm shopAuthForm = new ShopAuthForm(shop); + // shopAuthForm.SaveComplete += shopLoginForm_SaveComplete; + // shopAuthForm.ShowDialog(); + // IsOperate = false; + // break; + //case "拍单授权": + // IsOperate = true; + // //GetHtml.OpenUrl("https://fuwu.jinritemai.com/detail?from=fuwu_market_orderDetail&service_id=20896"); + // ShopAuthForm shopAuthForm1 = new ShopAuthForm(shop); + // shopAuthForm1.shopAuthUrl = "https://fuwu.jinritemai.com/authorize?service_id=20896"; + // shopAuthForm1.SaveComplete += shopLoginForm_SaveComplete; + // shopAuthForm1.ShowDialog(); + // IsOperate = false; + // break; + default: + dgvShop.Rows[e.RowIndex].Cells["colSelect"].Value = !(bool)dgvShop.Rows[e.RowIndex].Cells["colSelect"].Value; + break; + } + } + + private void DeleteShop(int rowIndex) + { + string shopLoginName = this.dgvShop.Rows[rowIndex].Cells["colLoginName"].Value.ParseToString(); + List dgvRows = dgvShop.Rows.Cast().Where(p => + p.Cells.GetCellValueFromColumnName("colLoginName").ParseToString() == shopLoginName).ToList(); + + foreach (var row in dgvRows) + dgvShop.Rows.Remove(row); + GlobalConfig.ShopLoginList.RemoveAll(v => v.LoginName == shopLoginName); + } + + private void btnCheck_Click(object sender, EventArgs e) + { + if (this.btnCheck.Text == "检测选中") + { + List shopNameList = GetCheckedList(); + if (!shopNameList.Any()) + { + BaseMsgForm.ShowError("请选择需要检测的店铺"); + return; + } + + this.pbLoading.Visible = true; + this.btnCheck.Enabled = false; + var t = Task.Run(() => + { + //UpdateShop(); + CheckShopListLogin(shopNameList.Distinct().ToArray()); + RefreshDataGridView(false); + }); + Task.Run(() => + { + while (true) + { + Thread.Sleep(1000); + if (t.IsCompleted || t.IsCanceled || t.IsFaulted) + { + Invoke(new Action(() => + { + this.pbLoading.Visible = false; + this.btnCheck.Enabled = true; + })); + break; + } + } + }); + } + } + + private void btnRefreshCookie_Click(object sender, EventArgs e) + { + this.pbLoading.Visible = true; + this.splitContainer1.Panel1.Enabled = false; + var t = Task.Run(() => + { + try + { + UpdateShop(); + WXSubAccountShopEditForm.GetServerSubUser(); + RefreshDataGridView(false); + } + catch (Exception ex) { BaseMsgForm.ShowError(ex.Message); } + }); + Task.Run(() => + { + while (true) + { + Thread.Sleep(1000); + if (t.IsCompleted || t.IsCanceled || t.IsFaulted) + { + Invoke(new Action(() => + { + this.pbLoading.Visible = false; + this.splitContainer1.Panel1.Enabled = true; + })); + break; + } + } + }); + } + + private List GetCheckedList() + { + List shopNameList = new List(); + for (int i = 0; i < dgvShop.Rows.Count; i++) + { + if (dgvShop.Rows[i].Cells["colSelect"].Value.ParseToBool()) + { + string shopName = dgvShop.Rows[i].Cells["colLoginName"].Value.ParseToString(); + shopNameList.Add(shopName); + } + } + return shopNameList; + } + + private List GetCheckedShopIdList() + { + List shopNameList = new List(); + for (int i = 0; i < dgvShop.Rows.Count; i++) + { + if (dgvShop.Rows[i].Cells["colSelect"].Value.ParseToBool()) + { + string shopName = dgvShop.Rows[i].Cells["colShopId"].Value.ParseToString(); + shopNameList.Add(shopName); + } + } + return shopNameList; + } + + private void btnLoginSelect_Click(object sender, EventArgs e) + { + WXShopListForm.IsOperate = true; + if (this.btnLoginSelect.Text == "登录选中") + { + List shopLoginNameList = GetCheckedList(); + if (!shopLoginNameList.Any()) + { + BaseMsgForm.ShowError("请选择需要登录的店铺"); + WXShopListForm.IsOperate = false; + return; + } + + shopLoginNameList = shopLoginNameList.Distinct().ToList(); + foreach (var loginName in shopLoginNameList) + { + if (WXShopListForm.IsOperate == false) + break; + + var shopInfo = GlobalConfig.ShopLoginList.FirstOrDefault(v => v.LoginName == loginName); + if (shopInfo != null && !string.IsNullOrEmpty(shopInfo.LoginName)) + { + WXShopLoginForm shopLoginForm = new WXShopLoginForm(shopInfo); + shopLoginForm.openType = EnumOpenType.login; + shopLoginForm.SaveComplete += shopLoginForm_SaveComplete; + shopLoginForm.ShowDialog(); + } + } + btnRefreshCookie_Click(null, null); + } + WXShopListForm.IsOperate = false; + } + + private void chkAutoDrag_Click(object sender, EventArgs e) + { + GlobalConfig.TemuShopSettingParam.IsAutoDragLogin = chkAutoDrag.Checked; + StartUp.SaveTemuShopSettingParam(); + foreach (var i in LstShopListFormInatance) + { + if (i != null && i.chkAutoDrag.Checked != GlobalConfig.TemuShopSettingParam.IsAutoDragLogin) + { + if (i.chkAutoDrag.InvokeRequired) + { + i.chkAutoDrag.Invoke(new Action(() => + { + i.chkAutoDrag.Checked = GlobalConfig.TemuShopSettingParam.IsAutoDragLogin; + })); + } + else + { + i.chkAutoDrag.Checked = GlobalConfig.TemuShopSettingParam.IsAutoDragLogin; + } + } + } + } + + private void btnRefreshAuth_Click(object sender, EventArgs e) + { + if (this.btnRefreshAuth.Text == "刷新授权") + { + List shopNameList = GetCheckedList(); + if (!shopNameList.Any()) + { + BaseMsgForm.ShowError("请选择需要刷新授权的店铺"); + return; + } + + UpdateShopTokens(GlobalConfig.ShopLoginList.Where(s => shopNameList.Contains(s.ShopAccount)).ToList()); + Task.Run(() => + { + CheckShopListLogin(shopNameList.ToArray()); + RefreshDataGridView(false); + }); + } + } + + private void btnSearch_Click(object sender, EventArgs e) + { + Task.Run(() => + { + RefreshDataGridView(false); + }); + + //this.pbLoading.Visible = true; + //this.splitContainer1.Panel1.Enabled = false; + //var t = Task.Run(() => + //{ + // try + // { + // UpdateShop(); + // RefreshDataGridView(false); + // } + // catch (Exception ex) { BaseMsgForm.ShowError(ex.Message); } + //}); + //Task.Run(() => + //{ + // while (true) + // { + // Thread.Sleep(1000); + // if (t.IsCompleted || t.IsCanceled || t.IsFaulted) + // { + // Invoke(new Action(() => + // { + // this.pbLoading.Visible = false; + // this.splitContainer1.Panel1.Enabled = true; + // })); + // break; + // } + // } + //}); + } + + private void btnEmpty_Click(object sender, EventArgs e) + { + this.cmbNotes.Text = "全部"; + this.cmbSubAccount.Text = "全部"; + this.cmbGroup.Text = "全部"; + this.txtShopId.Text = ""; + this.txtShopName.Text = ""; + } + + private void btnOpenOrder_Click(object sender, EventArgs e) + { + ShopLoginInfo shop = NaiBa.Util.Helper.ConfigHelper.LoadConfig("wx_dian_tong_ling_login_info"); + if (shop == null) + shop = new ShopLoginInfo(); + WXShopLoginForm shopLoginForm = new WXShopLoginForm(shop); + shopLoginForm.openType = EnumOpenType.manage; + shopLoginForm.WindowState = FormWindowState.Maximized; + shopLoginForm.txtUserName.ReadOnly = false; + shopLoginForm.txtPassWord.ReadOnly = false; + shopLoginForm.btnSaveUserInfo.Visible = true; + shopLoginForm.InitUrl = "https://po.e57.cn/login?redirect=%2Findex"; + shopLoginForm.Show(); + } + + private void btnEdit_Click(object sender, EventArgs e) + { + List shopNameList = GetCheckedList(); + List shops = GlobalConfig.ShopLoginList.Where(s => shopNameList.Contains(s.ShopId)).ToList(); + WXShopAddEditForm editForm = new WXShopAddEditForm(shops); + editForm.chkSubAccount.Checked = editForm.chkShopGroup.Checked = editForm.chkNotes.Checked = false; + editForm.SaveCompleteWithDescribe += Sae_SaveComplete; + editForm.ShowDialog(); + } + + private void btnTopUpCancel_Click(object sender, EventArgs e) + { + pnlTopUp.Visible = false; + } + + private async void btnTopUpOK_Click(object sender, EventArgs e) + { + try + { + var shopIds = lblShopId.Text.Split(';'); + string errMsg = ""; + int renew_months = (int)numAddTopUp.Value;//续费月数 + renew_months = Math.Max(1, renew_months); + + if (BaseMsgForm.ShowConfirm($"[{lblShopInfo.Text}] 店铺续费:{renew_months}个月", "提示").DialogResult == DialogResult.Cancel) + { + return; + } + pbLoading.Visible = true; + pbLoading.BringToFront(); + + foreach (var shopId in shopIds) + { + var shop = GlobalConfig.ShopLoginList.FirstOrDefault(s => s.ShopId == shopId); + if (shop == null) + continue; + + string url = BaseClass.BuildObjString("user/shop_renew"); + var data = UserLogin.GetSignPostData(new + { + UserName = BaseClass.UserName, + ShopId = shopId, + RenewDuration = renew_months, + }); + string html = await GetHtml.PostJsonAsync(url, data); + var ret = JsonConvert.DeserializeObject>(html); + + if (ret.Code != 200) + { + errMsg += $"shop.ShopAccount:{ret.Msg}"; + continue; + } + + shop.expire_time = ret.Data.ExpireTime; + shop.is_point_shop_expire = false; + BaseClass.Points = ret.Data.UserPoints; + Invoke(new Action(() => + { + MainForm.instance.lblPoints.Text = "账户积分:" + BaseClass.Points; + })); + RefreshDataGridView(true, new List() { shop }); + } + Invoke(new Action(() => + { + pnlTopUp.Visible = false; + pbLoading.Visible = false; + if (string.IsNullOrEmpty(errMsg)) + { + BaseMsgForm.ShowInfo("充值完成"); + } + else + { + BaseMsgForm.ShowInfo("充值完成 发生以下错误:\r\n" + errMsg); + } + })); + } + catch (Exception ex) + { + + } + finally + { + pbLoading.Visible = false; + } + } + + private void numAddTopUp_ValueChanged(object sender, EventArgs e) + { + this.txtPrice.Text = "预计续费点数:" + (numAddTopUp.Value * lblShopId.Text.Split(';').Length * BaseClass.ShopPointsPerMonth).ParseToString(); + } + + private void btnBatchRenewal_Click(object sender, EventArgs e) + { + List shopNameList = GetCheckedList(); + List shops = GlobalConfig.ShopLoginList.Where(s => shopNameList.Contains(s.ShopId)).ToList(); + + lblShopId.Text = string.Join(";", shops.Select(s => s.ShopId)); + lblShopInfo.Text = string.Join(" ", shops.Select(s => s.ShopAccount)); + numAddTopUp.Value = 1; + pnlTopUp.Visible = true; + } + } + public class ShopRenewResponse + { + public string ShopId { get; set; } + public int ExpireTime‌ { get; set; } + public int UserPoints { get; set; } + } }