using System; using System.Collections.Generic; using System.Diagnostics; using System.Drawing; using System.Linq; using System.Runtime.InteropServices; using System.Threading; using System.Timers; using System.Windows.Forms; using System.Threading.Tasks; using CefSharp.WinForms; using DevComponents.DotNetBar; using AllBase; using Work; using TemuKJD.UserForm; using TemuKJD.BaseForms; using TemuKJD.KJDForms.ToolForms; using System.Reflection; using System.Net; using System.Collections; using TemuKJD.KJDForms.AdminForms; using TemuKJD.KJDForms.ShopForms; using TemuKJD.KJDForms.ProductForms; using TemuKJD.KJDForms.OrderForms; using TemuKJD.KJDForms.SystemForms; using Work.CollectClass; using Newtonsoft.Json; using System.Text; using System.IO; using CefSharp; using System.IO.Compression; using AllBase.Helper; using System.Drawing.Drawing2D; using NaiBa.CefHelper; using Newtonsoft.Json.Linq; using AllBase.Model.Result; using NaiBa.Util.Extension; using NaiBa.Util; using AllBase.Model.Param.ProductManage; using TemuKJD.KJDForms.SalesCenterForms; using NaiBa.CefHelper.Handler; using TemuKJD.PDDForms.AdminForms; using TemuKJD.PDDForms.ShopForms; using TemuKJD.PDDForms.ProductForms; using TemuKJD.KJDForms.JITForms; namespace TemuKJD { public partial class MainForm : BaseForm { public static string sCurrentModule = string.Empty; public static MainForm instance; public string LoginType; private Point mouseOffset;//记录鼠标指针的坐标 private bool isMouseDown;//记录鼠标左键是否按下 public delegate void delegateShow(Form nf); public delegate void delegateView(); const int Guying_HTLEFT = 10; const int Guying_HTRIGHT = 11; const int Guying_HTTOP = 12; const int Guying_HTTOPLEFT = 13; const int Guying_HTTOPRIGHT = 14; const int Guying_HTBOTTOM = 15; const int Guying_HTBOTTOMLEFT = 0x10; const int Guying_HTBOTTOMRIGHT = 17; protected override void WndProc(ref Message m) { switch (m.Msg) { case 0x0084: base.WndProc(ref m); Point vPoint = new Point((int)m.LParam & 0xFFFF, (int)m.LParam >> 16 & 0xFFFF); vPoint = PointToClient(vPoint); if (this.WindowState != FormWindowState.Maximized) { if (vPoint.X <= 5) if (vPoint.Y <= 5) m.Result = (IntPtr)Guying_HTTOPLEFT; else if (vPoint.Y >= ClientSize.Height - 5) m.Result = (IntPtr)Guying_HTBOTTOMLEFT; else m.Result = (IntPtr)Guying_HTLEFT; else if (vPoint.X >= ClientSize.Width - 5) if (vPoint.Y <= 5) m.Result = (IntPtr)Guying_HTTOPRIGHT; else if (vPoint.Y >= ClientSize.Height - 5) m.Result = (IntPtr)Guying_HTBOTTOMRIGHT; else m.Result = (IntPtr)Guying_HTRIGHT; else if (vPoint.Y <= 5) m.Result = (IntPtr)Guying_HTTOP; else if (vPoint.Y >= ClientSize.Height - 5) m.Result = (IntPtr)Guying_HTBOTTOM; } break; case 0x0201: //鼠标左键按下的消息 m.Msg = 0x00A1; //更改消息为非客户区按下鼠标 m.LParam = IntPtr.Zero; //默认值 m.WParam = new IntPtr(2);//鼠标放在标题栏内 base.WndProc(ref m); break; default: base.WndProc(ref m); break; } } /// /// 设置窗体的圆角矩形 /// /// 需要设置的窗体 /// 圆角矩形的半径 public static void SetFormRoundRectRgn(Form form, int rgnRadius) { int hRgn = 0; hRgn = CreateRoundRectRgn(0, 0, form.Width + 1, form.Height + 1, rgnRadius, rgnRadius); SetWindowRgn(form.Handle, hRgn, true); DeleteObject(hRgn); } [DllImport("gdi32.dll")] public static extern int CreateRoundRectRgn(int x1, int y1, int x2, int y2, int x3, int y3); [DllImport("user32.dll")] public static extern int SetWindowRgn(IntPtr hwnd, int hRgn, Boolean bRedraw); [DllImport("gdi32.dll", EntryPoint = "DeleteObject", CharSet = CharSet.Ansi)] public static extern int DeleteObject(int hObject); /// /// 窗体size发生改变时重新设置Region属性 /// /// /// private void MainForm_Resize(object sender, EventArgs e) { // 设置窗口圆角显示 //SetFormRoundRectRgn(this, 7); } public MainForm(string loginType = "Temu") { InitializeComponent(); LoginType = loginType; if (loginType == "Pdd") { BaseClass.MainPath = "binxixi"; this.pnlJit.Visible = false; } else if (loginType == "Dy") { BaseClass.MainPath = "douyin"; this.pnlJit.Visible = false; } instance = this; this.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height); //CefInit(); } public static void CefInit() { var initFormSettings = NaiBa.Util.Helper.ConfigHelper.LoadConfig("initFormSettings"); if (initFormSettings == null) initFormSettings = new InitFormSettings(); var usePddWorkbanch = NaiBa.Util.Helper.ConfigHelper.LoadConfig("use_pdd_workbanch"); if (usePddWorkbanch == null) usePddWorkbanch = true; BaseClass.UsePddWorkbanch = usePddWorkbanch.Value; //CefSharpSettings.LegacyJavascriptBindingEnabled = true;//cef 79 84以后:“CefSharpSettings”未包含“LegacyJavascriptBindingEnabled”的定义 CefSharpSettings.WcfEnabled = false; CefSettings settings = new CefSettings(); //settings.UserAgent = "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.79 Safari/537.36"; //settings.UserAgent = "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36"; //settings.UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.67 Safari/537.36"; //settings.UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36"; settings.UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36"; //if (BaseClass.MainPath == "binxixi" && BaseClass.UsePddWorkbanch) if (initFormSettings.LoginType.ToLower() == "pdd") settings.UserAgent = "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.5.40.8 Safari/537.36 PddWorkbench-Online PddBrowser pdd_windows_version/3.0.3.12"; settings.CefCommandLineArgs.Add("disable-gpu", "1"); // 禁止显卡加速 settings.IgnoreCertificateErrors = true; settings.Locale = "zh-CN"; settings.LogSeverity = LogSeverity.Disable; var pName = Process.GetCurrentProcess().ProcessName; var pCount = Process.GetProcesses().Count(p => p.ProcessName == pName); //138版cef自己不会分缓存,会因占用导致报错,手动分缓存 settings.CachePath = Path.Combine(Environment.CurrentDirectory, "Cache\\" + pCount); //settings.CachePath = null; //禁止缓存 //settings.CefCommandLineArgs.Add("enable-javascript", "1"); //settings.CefCommandLineArgs.Add("disable-features", "NetworkService,NetworkServiceInProcess"); settings.CefCommandLineArgs.Add("--disable-web-security", "1"); //settings.CefCommandLineArgs.Add("--disable-request-handling-for-testing", "1"); Cef.Initialize(settings); } private void MainForm_Load(object sender, EventArgs e) { //CefSettings settings = new CefSettings(); //settings.CefCommandLineArgs.Add("enable-media-stream", "1"); //settings.CefCommandLineArgs.Add("allow-running-insecure-content", "1"); //settings.CefCommandLineArgs.Add("use-fake-ui-for-media-stream", "1"); //settings.CefCommandLineArgs.Add("enable-speech-input", "1"); //settings.CefCommandLineArgs.Add("enable-usermedia-screen-capture", "1"); //settings.CefCommandLineArgs.Add("debug-plugin-loading", "1"); //settings.CefCommandLineArgs.Add("allow-outdated-plugins", "1"); //settings.CefCommandLineArgs.Add("always-authorize-plugins", "1"); //settings.CefCommandLineArgs.Add("disable-web-security", "1"); //settings.CefCommandLineArgs.Add("enable-npapi", "1"); //Cef.Initialize(settings); //var cef = new ChromiumWebBrowser("https://www.bilibili.com"); //this.Controls.Add(cef); //cef.BringToFront(); // //return; if (BaseClass.MainPath == "binxixi") { //this.pbLogo.Image = Properties.Resources.main_form_logo_pdd; BaseClass.LogoImage = Properties.Resources.main_form_logo_pdd; BaseClass.Ico = Icon.FromHandle(Properties.Resources.system_pdd.GetHicon()); } Rectangle rect = Screen.GetWorkingArea(this); int width = rect.Width; int height = rect.Height; if (width > 1920 && height > 1040) { this.Width = 1920; this.Height = 1080; } else if (width > 1600 && height > 900) { this.Width = 1600; this.Height = 900; } else if (width > 1366 && height > 768) { this.Width = 1366; this.Height = 768; } this.CenterToScreen(); if (BaseClass.LogoImage != null) pbLogo.Image = BaseClass.LogoImage; if (BaseClass.Ico != null) Icon = BaseClass.Ico; SetTitle(); PanelEx[] ps = { pnlMarket, pnlOrder, pnlShop, pnlUpload, pnlTools, pnlCollect, pnlSA, pnlJit}; foreach (PanelEx p in ps) p.BackgroundImage = p.Style.BackgroundImage; new Thread(Auto).Start(); new Thread(AutoGC).Start(); var backgroundScheduler = TaskScheduler.Default; var uiScheduler = TaskScheduler.FromCurrentSynchronizationContext(); //Task.Run(() => { DelCookies(); }) //.ContinueWith(delegate { new UploadPinduoduoMain("").LoadStock(); }, backgroundScheduler) //.ContinueWith(delegate { loadToken(); }, backgroundScheduler) //.ContinueWith(delegate { LoadUserAgent(); }, backgroundScheduler) //.ContinueWith(delegate { refreshPassId(); }, backgroundScheduler) //; // 是否显示联系客服按钮 //if (FileBase.Exists("locales/ig.pak") || FileBase.Exists("locales/wl.pak")) // lblContactSupport.Visible = false; //else // lblContactSupport.Visible = true; //Task.Run(() => //{ //抖音获取违规信息 //ViolateManageForm.GetAllViolateRuleName(); //GetShopViolation(); //}); } public void SetTitle() { lblVersionInfo.Text = BaseClass.ToolName + " V" + BaseClass.Varsion + " - " + BaseClass.NickName; lblVersionName.Text = "[" + BaseClass.UserVersionString + "]"; #if DEBUG lblVersionName.Visible = true; lblVersionName.Text = "[Debug]"; #endif if (BaseClass.LoginApiUrl.Contains("localhost") || BaseClass.LoginApiUrl.Contains("127.0.0.1")) { lblVersionName.Visible = true; lblVersionName.Text = "[Dev]"; } Text = (BaseClass.ShopName + "-" + BaseClass.ToolName).TrimStart('-'); } private void AutoGC() { if (PDDShopUpdateFddlCookieForm.instance == null || !PDDShopUpdateFddlCookieForm.instance.IsDisposed) { PDDShopUpdateFddlCookieForm.instance = new PDDShopUpdateFddlCookieForm(null); PDDShopUpdateFddlCookieForm.instance.fddlHelper.StartupFiddlerCore(); PDDShopUpdateFddlCookieForm.instance.fddlHelper.UninstallFiddler(); } DateTime lastClear = DateTime.Now; while (true) { //if (lastClear.AddSeconds(30) < DateTime.Now) if (lastClear.AddSeconds(60) < DateTime.Now) { lastClear = DateTime.Now; //ClearMemory(); } #if DEBUG #else AntiGrabbingMechanism(); #endif try { Thread.Sleep(3000); } catch { } } } private void LockUserAndKillProcess() { string url = BaseClass.BuildObjString("user&act=add_user_lock"); string data = UserLogin.GetSignaturex("", ""); string html = GetHtml.PostUtf8(url, data); Process.GetCurrentProcess().Kill(); } public static bool IsUseSystemProxy() { BindingFlags bindingAttr = BindingFlags.Instance | BindingFlags.NonPublic; IWebProxy systemWebProxy = WebRequest.GetSystemWebProxy(); FieldInfo field1 = systemWebProxy.GetType().GetField("webProxy", bindingAttr); if (field1 != (FieldInfo)null) { WebProxy webProxy = field1.GetValue((object)systemWebProxy) as WebProxy; FieldInfo field2 = webProxy.GetType().GetField("_ProxyHostAddresses", bindingAttr); if (field2 != (FieldInfo)null) { Hashtable hashtable = field2.GetValue((object)webProxy) as Hashtable; if (hashtable != null && hashtable.Count > 0) return true; } } return false; } private void AntiGrabbingMechanism() { //Gate 1 - Anti Proxy if (IsUseSystemProxy()) { if (PDDShopUpdateFddlCookieForm.instance == null || !PDDShopUpdateFddlCookieForm.instance.Created) LockUserAndKillProcess(); } //Gate 2 - Anti Special Processes System.Diagnostics.Process[] processList = System.Diagnostics.Process.GetProcesses(); foreach (System.Diagnostics.Process process in processList) { try { if (_AntiProcesses.Contains(process.ProcessName.ToUpper())) { process.Kill(); LockUserAndKillProcess(); } if (process.MainWindowTitle.Contains("正在捕获")) { process.Kill(); LockUserAndKillProcess(); } if (!IsWin23App(process)) { continue; } if (process.MainModule?.FileVersionInfo.FileDescription != null) { foreach (string antiProcess in _AntiProcesses) { if (process.MainModule.FileVersionInfo.FileDescription.ToUpper().Contains(antiProcess)) { process.Kill(); LockUserAndKillProcess(); } } } } catch (Exception e) { } } } private List _AntiProcesses = "WINRAR,WIRESHARK,FIDDLER,HTTPDEBUGGERPRO,IEHTTPANALYZER,CHARLES,HTTPWATCH,SMARTSNIFF,MINISNIFFER,PROXIFIER,HTTP ANALYZER,SNIFFER,WSOCKEXPERT,IPANALYSE,ANALYZER,HTTP ANALYZER STAND-ALONE EDITION".Split(',').ToList(); public bool IsWin23App(Process process) { if (Environment.Is64BitOperatingSystem) { IntPtr processHandle; bool retVal; try { processHandle = Process.GetProcessById(process.Id).Handle; } catch { return false; } return IsWow64Process(processHandle, out retVal) && retVal; } return true; } #region 内存回收 [DllImport("kernel32.dll", EntryPoint = "SetProcessWorkingSetSize")] public static extern int SetProcessWorkingSetSize(IntPtr process, int minSize, int maxSize); [DllImport("kernel32.dll", SetLastError = true, CallingConvention = CallingConvention.Winapi)] [return: MarshalAs(UnmanagedType.Bool)] internal static extern bool IsWow64Process([In] IntPtr process, [Out] out bool wow64Process); /// /// 释放内存 /// public static void ClearMemory() { GC.Collect(); GC.WaitForPendingFinalizers(); if (Environment.OSVersion.Platform == PlatformID.Win32NT) { SetProcessWorkingSetSize(System.Diagnostics.Process.GetCurrentProcess().Handle, -1, -1); } } #endregion /// /// 通过click事件初始化所有模块,避免首次用户点击一级模块时客户端出现卡顿现象 /// private void InitialAllModules() { pnlJit_Click(null, null); pnlUpload_Click(null, null); PnlSystem_Click(null, null); pnlMarket_Click(null, null); PnlSuNing_Click(null, null); PnlWeiDian_Click(null, null); pnlOrder_Click(null, null); pnlShop_Click(pnlShop, null); if (BaseClass.SaLevel > 0) { pnlSA.Visible = true; pnlSA_Click(pnlSA, null); } if (BaseClass.GroupId.Equals(10)) { pnlUpload.Location = pnlShop.Location; foreach (Control c in this.navPanel.Controls) { if (c is PanelEx || c is PictureBox) { if (c == pnlUpload || c == pbLogo) c.Visible = true; else c.Visible = false; } } pnlUpload_Click(pnlUpload, null); } bodyPanel.Visible = true; } private void Auto() { Thread.Sleep(200); if (InvokeRequired) Invoke(new Action(() => { AutoLogin(); })); else { Thread.Sleep(500); if (InvokeRequired) Invoke(new Action(() => { AutoLogin(); })); } } private void AutoLogin() { LoginForm login = new LoginForm(); login.mf = this; login.TopMost = true; Task.Run(() => { Thread.Sleep(1000); Invoke(new Action(() => { login.TopMost = false; })); }); login.ShowDialog(); } private void close_Click(object sender, EventArgs e) { if (BaseMsgForm.ShowConfirm("是否关闭客户端?", "系统提示", FormLevel.SMALL).DialogResult.Equals(DialogResult.Cancel)) return; Process.GetCurrentProcess().Kill(); } private void navPanel_MouseDown(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left) { mouseOffset = new Point(-e.X, -e.Y); isMouseDown = true; } } private void navPanel_MouseMove(object sender, MouseEventArgs e) { if (isMouseDown) { //获取鼠标的位置 Point mousePos = MousePosition; mousePos.Offset(mouseOffset.X, mouseOffset.Y); Location = mousePos; } } private void navPanel_MouseUp(object sender, MouseEventArgs e) { isMouseDown = false; } private void min_Click(object sender, EventArgs e) { //notifyIcon1.Text = BaseClass.ToolName+ "[" + BaseClass.ShopName+"]"; WindowState = FormWindowState.Minimized; ShowInTaskbar = true; //notifyIcon1.Visible = true; } private void logo_Click(object sender, EventArgs e) { // 代理商不跳转 if (BaseClass.IsMainCompany || BaseClass.Ico != null) return; //GetHtml.OpenUrl("http://tool.qixiaoke.com/"); //GetHtml.OpenUrl("http://www.qimake.cn/xnn/"); //http://agent-xnt.nai8.net/download/index.html } public void ShowTaobaoLoginAndInitModule() { //TaobaoLoginForm t = new TaobaoLoginForm(); //t.mf = this; //t.ShowDialog(); Invoke(new delegateView(InitialAllModules)); } private OrderForm orderForm; private void pnlOrder_Click(object sender, EventArgs e) { if (orderForm == null) { orderForm = new OrderForm(); } ShowMainPanel(orderForm, sender as Panel); } private void monitorPanel_Click(object sender, EventArgs e) { } /// /// 显示窗口 /// /// public void ShowFromPanel(Form f) { ShowMainPanel(f, null); } /// /// 显示窗口 /// /// 窗口 /// 切换层 marketPanel, fastCarPanel, marketCenterPanel, dataCollectPanel, topPanel, monitorPanel, manageToolsPanel public void ShowFromPanel(Form f, string pannelName) { Panel p = pnlMarket; switch (pannelName) { case "marketPanel": p = pnlMarket; break; } ShowMainPanel(f, p); } public void ShowMainPanel(Form show, Panel p) { show.TopLevel = false; show.Left = 0; show.Top = 0; show.FormBorderStyle = FormBorderStyle.None; show.Dock = DockStyle.Fill; bool had = false; for (int i = 0; i < bodyPanel.Controls.Count; i++) { if (bodyPanel.Controls[i].Name != show.Name) bodyPanel.Controls[i].Hide(); } for (int i = 0; i < bodyPanel.Controls.Count; i++) { if (bodyPanel.Controls[i].Name == show.Name) { bodyPanel.Controls[i].Show(); had = true; } } if (!had) { bodyPanel.Controls.Add(show); show.Show(); } if (p == null) return; PanelEx[] ps = { pnlMarket, pnlOrder, pnlShop, pnlUpload, pnlTools, pnlCollect, pnlSA, pnlJit }; foreach (var panel in ps) { if (p.Name == panel.Name) panel.Style.BackgroundImage = panel.StyleMouseOver.BackgroundImage; else { panel.Style.BackgroundImage = panel.BackgroundImage; } } } private SalesCenterForm salesCenterForm; private void pnlMarket_Click(object sender, EventArgs e) { if (salesCenterForm == null) { salesCenterForm = new SalesCenterForm(); } ShowMainPanel(salesCenterForm, sender as Panel); } private JITForm jitForm; private void pnlJit_Click(object sender, EventArgs e) { if (jitForm == null) { jitForm = new JITForm(); } ShowMainPanel(jitForm, sender as Panel); } //internal GoodsCollectForm gcf; private object shopForm; private void pnlShop_Click(object sender, EventArgs e) { if (BaseClass.MainPath == "kuajingda") { if (shopForm == null) { shopForm = new ShopForm(); } ShowMainPanel(shopForm as ShopForm, sender as Panel); } else if (BaseClass.MainPath == "binxixi") { if (shopForm == null) { shopForm = new A_PddShopForm(); } ShowMainPanel(shopForm as A_PddShopForm, sender as Panel); } } private object adminForm; private void pnlSA_Click(object sender, EventArgs e) { if (BaseClass.MainPath == "kuajingda") { if (adminForm == null) { adminForm = new AdminForm(); } ShowMainPanel(adminForm as AdminForm, sender as Panel); } else if (BaseClass.MainPath == "binxixi") { if (adminForm == null) { adminForm = new PDDAdminForm(); } ShowMainPanel(adminForm as PDDAdminForm, sender as Panel); } else if (BaseClass.MainPath == "douyin") { //if (adminForm == null) //{ // adminForm = new PDDAdminForm(); //} //ShowMainPanel(adminForm as PDDAdminForm, sender as Panel); } } private object uploadForm; public void pnlUpload_Click(object sender, EventArgs e) { if (BaseClass.MainPath == "kuajingda") { if (uploadForm == null) { uploadForm = new ProductForm(); } ShowMainPanel(uploadForm as ProductForm, sender as Panel); } else if (BaseClass.MainPath == "binxixi") { if (uploadForm == null) { uploadForm = new PDDProductForm(); } ShowMainPanel(uploadForm as PDDProductForm, sender as Panel); } } //private CollectForm collectForm; private void pnlCollect_Click(object sender, EventArgs e) { //if (collectForm == null) { //collectForm = new CollectForm(); } //ShowMainPanel(collectForm, sender as Panel); } private void max_Click(object sender, EventArgs e) { if (WindowState.Equals(FormWindowState.Normal)) { WindowState = FormWindowState.Maximized; max.Style.BackgroundImage = global::TemuKJD.Properties.Resources.normal; max.StyleMouseOver.BackgroundImage = global::TemuKJD.Properties.Resources.normal_hover; } else if (WindowState.Equals(FormWindowState.Maximized)) { WindowState = FormWindowState.Normal; max.Style.BackgroundImage = global::TemuKJD.Properties.Resources.max; max.StyleMouseOver.BackgroundImage = global::TemuKJD.Properties.Resources.max_hover; } } private void plTopRight_MouseDown(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left) { mouseOffset = new Point(-e.X - this.Width + this.plTopRight.Width, -e.Y); isMouseDown = true; } } private void plTopRight_MouseMove(object sender, MouseEventArgs e) { if (isMouseDown) {//获取鼠标的位置 Point mousePos = MousePosition; mousePos.Offset(mouseOffset.X, mouseOffset.Y); Location = mousePos; } } private void plTopRight_MouseUp(object sender, MouseEventArgs e) { isMouseDown = false; } /// /// 开启无边框Form任务栏图标点击最小化与还原功能 /// protected override CreateParams CreateParams { get { const int WS_MINIMIZEBOX = 0x00020000; // Winuser.h中定义 CreateParams cp = base.CreateParams; cp.Style = cp.Style | WS_MINIMIZEBOX; // 允许最小化操作 return cp; } } private void navPanel_DoubleClick(object sender, EventArgs e) { if (WindowState.Equals(FormWindowState.Normal)) { WindowState = FormWindowState.Maximized; return; } if (WindowState.Equals(FormWindowState.Maximized)) { WindowState = FormWindowState.Normal; } } private void plTopRight_DoubleClick(object sender, EventArgs e) { if (WindowState.Equals(FormWindowState.Normal)) { WindowState = FormWindowState.Maximized; return; } if (WindowState.Equals(FormWindowState.Maximized)) { WindowState = FormWindowState.Normal; } } private SystemForm systemForm; private void PnlSystem_Click(object sender, EventArgs e) { if (systemForm == null) { systemForm = new SystemForm(); } ShowMainPanel(systemForm, sender as Panel); } private void pbAnnouncement_MouseEnter(object sender, EventArgs e) { Cursor = Cursors.Hand; } private void pbAnnouncement_MouseLeave(object sender, EventArgs e) { Cursor = Cursors.Default; } private void pbAnnouncement_Click(object sender, EventArgs e) { //if (string.IsNullOrEmpty(BaseClass.Annoucement)) return; //AnnounceForm af = new AnnounceForm(); //af.ShowDialog(); } private void PicPinDuoDuoToken_Click(object sender, EventArgs e) { } //private SuNingForm suNingForm; public void PnlSuNing_Click(object sender, EventArgs e) { //if (suNingForm == null) //{ // suNingForm = new SuNingForm { mf = this }; //} //suNingForm.RefreshUploadQueue(); //ShowMainPanel(suNingForm, pnlSuNing); } private void lklbGetHwCode_Click(object sender, EventArgs e) { //BaseMsgForm.ShowInfo(BaseClass.HardWareCode + Environment.NewLine + BaseClass.HardWareCodeNew + Environment.NewLine + BaseClass.HardWareCodeV3); } private void MainForm_FormClosed(object sender, FormClosedEventArgs e) { Process.GetCurrentProcess().Kill(); } //private WeiDianForm weiDianForm; private void PnlWeiDian_Click(object sender, EventArgs e) { //if (weiDianForm == null) //{ // weiDianForm = new WeiDianForm { mf = this }; //} //ShowMainPanel(weiDianForm, pnlWeiDian); } public void DelCookies() { //var cookieManager = Cef.GetGlobalCookieManager(); //Task deleteTask = cookieManager.DeleteCookiesAsync("taobao.com", null); //deleteTask.Wait(); //cookieManager = Cef.GetGlobalCookieManager(); //deleteTask = cookieManager.DeleteCookiesAsync("tmall.com", null); //deleteTask.Wait(); } public void loadToken() { try { string filePath = AppDomain.CurrentDomain.BaseDirectory + "temp/pinduoduo_token"; if (File.Exists(filePath)) { string content = FileBase.ReadAllText(filePath, Encoding.UTF8); PinduoduoProductCollect.PinDuoDuoTokenList = JsonConvert.DeserializeObject>(content); } } catch { } if (PinduoduoProductCollect.PinDuoDuoTokenList == null) { PinduoduoProductCollect.PinDuoDuoTokenList = new List(); } } //window.byted_acrawler.sign('', '') //window.byted_acrawler.init({ // aid: e, // dfp: !0, // boe: !1, // intercept: !0, // enablePathList: ["/common/index", "/common/home", "/api/order", "/order/torder", "/order/writeoff", "/order/alarm", "/shopuser/aftersale", "/v1/aftersale", "/v1/order", "/shopuser/tshopuser", "/freight/template", "/shopuser/power", "/shop/promotion", "/product/tproduct", "/qualification/tqualification", "/spec/tspec", "/qualification/tqualification", "/byteshop"] // }) private void btnTest_Click(object sender, EventArgs e) { //IeForm i = new IeForm("https://fxg.jinritemai.com/login"); //i.Show(); MakeRequests(); } private void MakeRequests() { HttpWebResponse response; string responseText; if (Request_fxg_jinritemai_com(out response)) { responseText = ReadResponse(response); response.Close(); } } 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(); } } } private bool Request_fxg_jinritemai_com(out HttpWebResponse response) { response = null; try { //var jsonStr = JSON.stringify(f[1]) //var jsObj = JSON.parse(jsonStr); //byted_acrawler.sign('nonce', jsonStr); string url = "nonce"; string nonce = @"{""url"":""/product/tproduct/add?appid=1&__token=42da1e0147ed009626111ff00ea6ba59"",""body"":{""check_status"":2,""name"":""女装T恤2"",""description"":""


"",""market_price"":12900,""discount_price"":9900,""spec_id"":1693733391754247,""category_leaf_id"":20171,""pay_type"":1,""min_buy_num"":1,""product_type"":0,""delivery_delay_date"":0,""presell_type"":0,""spec_prices"":[{""spec_detail_ids"":[""1693733391754279""],""price"":9900,""stock_num"":99,""step_stock_num"":0,""code"":"""",""supplier_id"":"""",""customs_report_info"":{}}],""pic"":[{""url"":""https://sf6-ttcdn-tos.pstatp.com/obj/temai/c83a7a6711f19c975c761361cebc0ed0www800-800""}],""assoc_ids"":"""",""product_format"":{""面料材质"":""其他/others"",""成分含量"":""96%及以上""},""weight_unit"":0,""freight_id"":0,""reduce_type"":1,""quality_map"":{""3457058919409648559"":{""quality_key"":""3457058919409648559"",""quality_name"":""报关单"",""quality_attachments"":[]},""3457058936748903145"":{""quality_key"":""3457058936748903145"",""quality_name"":""委托进口协议"",""quality_attachments"":[]},""3457058945162709852"":{""quality_key"":""3457058945162709852"",""quality_name"":""质检报告"",""quality_attachments"":[]},""6924586049331085575"":{""quality_key"":""6924586049331085575"",""quality_name"":""人物肖像授权资质"",""quality_attachments"":[]}},""stone"":{""remark"":""""},""after_sale_service"":{""supply_7day_return"":""1"",""supply_red_ass_return"":""0"",""supply_allergy_return"":""0""},""delivery_delay_day"":2,""need_check_out"":false,""need_logistics"":true,""poi_resource"":{""condition"":"""",""service_num"":"""",""notification"":"""",""poi_ids"":[],""total_can_use_count"":1},""biz_kind"":0,""appid"":1,""__token"":""42da1e0147ed009626111ff00ea6ba59"",""_lid"":""704967559632""}}"; //{"url":"/product/tproduct/add?appid=1&__token=42da1e0147ed009626111ff00ea6ba59","body":{"check_status":2,"name":"女装T恤2","description":"


","market_price":12900,"discount_price":9900,"spec_id":1693733391754247,"category_leaf_id":20171,"pay_type":1,"min_buy_num":1,"product_type":0,"delivery_delay_date":0,"presell_type":0,"spec_prices":[{"spec_detail_ids":["1693733391754279"],"price":9900,"stock_num":99,"step_stock_num":0,"code":"","supplier_id":"","customs_report_info":{}}],"pic":[{"url":"https://sf6-ttcdn-tos.pstatp.com/obj/temai/c83a7a6711f19c975c761361cebc0ed0www800-800"}],"assoc_ids":"","product_format":{"面料材质":"其他/others","成分含量":"96%及以上"},"weight_unit":0,"freight_id":0,"reduce_type":1,"quality_map":{"3457058919409648559":{"quality_key":"3457058919409648559","quality_name":"报关单","quality_attachments":[]},"3457058936748903145":{"quality_key":"3457058936748903145","quality_name":"委托进口协议","quality_attachments":[]},"3457058945162709852":{"quality_key":"3457058945162709852","quality_name":"质检报告","quality_attachments":[]},"6924586049331085575":{"quality_key":"6924586049331085575","quality_name":"人物肖像授权资质","quality_attachments":[]}},"stone":{"remark":""},"after_sale_service":{"supply_7day_return":"1","supply_red_ass_return":"0","supply_allergy_return":"0"},"delivery_delay_day":2,"need_check_out":false,"need_logistics":true,"poi_resource":{"condition":"","service_num":"","notification":"","poi_ids":[],"total_can_use_count":1},"biz_kind":0,"appid":1,"__token":"42da1e0147ed009626111ff00ea6ba59","_lid":"704967559632"}} var sign = ""; sign = "_02B4Z6wo00101HGpX1gAAIDBpm9yItmSDRxxrFvAAHw0uanPHOY8X3-hFaU68iY57I07iRcjdYo.CNVqTMA-KMboPw9pT78-WEfOx4AoS-l2IPhl5cP4wWW9-6qvvq6fq0vTuuRQIrqb4vhE48"; sign = "_02B4Z6wo00101lsuefgAAIDDjOhUgdaR0RpbK31AAPabI9KWNJfMlPHN.65RxpWH0S4PPjESx01BmvKGVg7uKAgKxeJlwZYIzaDsn20k56iS862iX-S-asjc1ONPZAHC0PnJ4DaxwNttGAFG9f"; sign = "_02B4Z6wo001017T-p2AAAIDCYziKGdNyOWO026PAAI2BiSrzQ2gTaLSTiAEsi5LaVKIiGU3WtUNFRrICx8Xq7zbj1UdOwqvDHHWZtfNy8QMmlK.SlKv-X3eTKpp7idE6YBfxxrrCBI0pMaIT58"; //sign = GlobalConfig.DouShopLoginList.FirstOrDefault()?.Signature; string cookie = @"ttwid=1%7Cn--vVhfZ3AB5VnU0qJCRI6DEqVeEtvQU9yArHD7nu7A%7C1613981515%7C1128cd73944ddb001b658de05cbd92983db88bc78cc719bf48751da692dd76fa; passport_csrf_token=d7c5db20fc44456d0ec76d19dcb88b7d; passport_csrf_token_default=d7c5db20fc44456d0ec76d19dcb88b7d; gfpart_1.0.0.3845_37914=1; gfpart_1.0.0.1128_37936=1; SLARDAR_WEB_ID=4292110529608375; gfpart_1.0.0.451_38593=0; gfpart_1.0.0.456_38884=1; gfpart_1.0.0.3887_38898=0; gfpart_1.0.0.1192_40660=0; gfpart_1.0.0.3931_40707=0; gfpart_1.0.0.476_40795=0; passport_auth_status=fca3746fb0d9dda7757beacbbf73a128%2Cd05ebae2937af562c56e454a6058ddc9; passport_auth_status_ss=fca3746fb0d9dda7757beacbbf73a128%2Cd05ebae2937af562c56e454a6058ddc9; gfpart_1.0.0.3945_41144=0; gfpart_1.0.0.135_41188=0; n_mh=7LrrRmeUceh3vjPZWa4C3h7B_APxodsUr7zuYy75V90; uid_tt=5132d09c095375195717588b4a54ebc3; uid_tt_ss=5132d09c095375195717588b4a54ebc3; sid_tt=f05cfda2c3a3c03e61ab25636662fe29; sessionid=f05cfda2c3a3c03e61ab25636662fe29; sessionid_ss=f05cfda2c3a3c03e61ab25636662fe29; gftoken=ZjA1Y2ZkYTJjM3wxNjE0ODIzODI3Nzh8fDAGBgYGBgY; Hm_lvt_b6520b076191ab4b36812da4c90f7a5e=1614157148,1614591752,1614676343,1614910088; gfpart_1.0.0.1449_41890=1; gfpart_1.0.0.141_41910=0; gfpart_1.0.0.1459_42122=0; s_v_web_id=verify_km08bqd8_hidb5GiH_vrIJ_4NLS_BXbj_g7AQ3WRh0V7r; sid_guard=f05cfda2c3a3c03e61ab25636662fe29%7C1615186486%7C5183999%7CFri%2C+07-May-2021+06%3A54%3A45+GMT; odin_tt=374a9192927c18f56339e8b0573d5fef60340745618adcc8c76ad475795d56b0ae94e92a20ac764bc926e8e2836f4a0570290ead3758aeaddbb9b276212d0392; PHPSESSID=0b5f6b4a7d1edd33dc79856ea5177869; PHPSESSID_SS=0b5f6b4a7d1edd33dc79856ea5177869; gfpart_1.0.0.3971_42183=0; gfpart_1.0.0.142_42187=0; gfpart_1.0.0.13_42238=0; gfpart_1.0.0.13_42241=1; uidpasaddaehruigqreajf=0; Hm_lpvt_b6520b076191ab4b36812da4c90f7a5e=1615259674; MONITOR_WEB_ID=fa47cb48-5a51-433c-a1d6-efdbcacaa1fa; tt_scid=wpR1pmzjAcnZ70b7G-4H4cL9y1EUwJwHECT3twx.whlxUxoc.PTSTrVEf0POlOCT06b1"; //cookie = GlobalConfig.DouShopLoginList.FirstOrDefault()?.Cookies; HttpWebRequest request = (HttpWebRequest)WebRequest.Create("https://fxg.jinritemai.com/product/tproduct/add?appid=1&__token=42da1e0147ed009626111ff00ea6ba59&_signature=" + sign); request.KeepAlive = true; request.Accept = "application/json, text/plain, */*"; request.UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.83 Safari/537.36"; request.ContentType = "application/json;charset=UTF-8"; request.Headers.Add("Origin", @"https://fxg.jinritemai.com"); request.Headers.Add("Sec-Fetch-Site", @"same-origin"); request.Headers.Add("Sec-Fetch-Mode", @"cors"); request.Headers.Add("Sec-Fetch-Dest", @"empty"); request.Referer = "https://fxg.jinritemai.com/ffa/g/create"; request.Headers.Set(HttpRequestHeader.AcceptEncoding, "gzip, deflate, br"); request.Headers.Set(HttpRequestHeader.AcceptLanguage, "zh-CN,zh;q=0.9"); request.Headers.Set(HttpRequestHeader.Cookie, cookie); request.Method = "POST"; request.ServicePoint.Expect100Continue = false; string body = @"{""check_status"":2,""name"":""夏季女装上衣T恤修身靓丽潮牌短袖"",""description"":""


"",""market_price"":9800,""discount_price"":8800,""spec_id"":1693377644338235,""category_leaf_id"":20171,""pay_type"":1,""min_buy_num"":1,""product_type"":0,""delivery_delay_date"":0,""presell_type"":0,""spec_prices"":[{""spec_detail_ids"":[""1693377644339227"",""1693377644339259""],""price"":8800,""stock_num"":88,""step_stock_num"":0,""code"":"""",""supplier_id"":"""",""customs_report_info"":{}}],""pic"":[{""url"":""https://sf3-ttcdn-tos.pstatp.com/obj/temai/8f86b91cfdedd3898f6fef09c5791ccawww800-800""}],""assoc_ids"":"""",""product_format"":{""面料材质"":""其他/others"",""成分含量"":""96%及以上""},""weight_unit"":0,""freight_id"":0,""reduce_type"":1,""quality_map"":{""3457058919409648559"":{""quality_key"":""3457058919409648559"",""quality_name"":""报关单"",""quality_attachments"":[]},""3457058936748903145"":{""quality_key"":""3457058936748903145"",""quality_name"":""委托进口协议"",""quality_attachments"":[]},""3457058945162709852"":{""quality_key"":""3457058945162709852"",""quality_name"":""质检报告"",""quality_attachments"":[]},""6924586049331085575"":{""quality_key"":""6924586049331085575"",""quality_name"":""人物肖像授权资质"",""quality_attachments"":[]}},""stone"":{""remark"":""""},""after_sale_service"":{""supply_7day_return"":""1"",""supply_red_ass_return"":""0"",""supply_allergy_return"":""0""},""delivery_delay_day"":2,""need_check_out"":false,""need_logistics"":true,""poi_resource"":{""condition"":"""",""service_num"":"""",""notification"":"""",""poi_ids"":[],""total_can_use_count"":1},""biz_kind"":0,""appid"":1,""__token"":""42da1e0147ed009626111ff00ea6ba59"",""_lid"":""307675746717""}"; body = @"{""check_status"":2,""name"":""多彩发绳"",""description"":""


"",""market_price"":3600,""discount_price"":2600,""spec_id"":1693736247560215,""category_leaf_id"":20994,""pay_type"":1,""min_buy_num"":1,""product_type"":0,""delivery_delay_date"":0,""presell_type"":0,""spec_prices"":[{""spec_detail_ids"":[""1693736247560247""],""price"":2600,""stock_num"":99,""step_stock_num"":0,""code"":"""",""supplier_id"":"""",""customs_report_info"":{}}],""pic"":[{""url"":""https://sf6-ttcdn-tos.pstatp.com/obj/temai/52f1277d2099ed8ff8eacf38764c96ffwww800-800""}],""assoc_ids"":"""",""product_format"":{""材质"":""其他/others"",""镶嵌材质"":""未镶嵌"",""发饰分类"":""发绳""},""weight_unit"":0,""freight_id"":0,""reduce_type"":1,""quality_map"":{""3457058919409648559"":{""quality_key"":""3457058919409648559"",""quality_name"":""报关单"",""quality_attachments"":[]},""3457058936748903145"":{""quality_key"":""3457058936748903145"",""quality_name"":""委托进口协议"",""quality_attachments"":[]},""3457058945162709852"":{""quality_key"":""3457058945162709852"",""quality_name"":""质检报告"",""quality_attachments"":[]},""6924586049331085575"":{""quality_key"":""6924586049331085575"",""quality_name"":""人物肖像授权资质"",""quality_attachments"":[]}},""stone"":{""remark"":""""},""after_sale_service"":{""supply_7day_return"":""1"",""supply_red_ass_return"":""0"",""supply_allergy_return"":""0""},""delivery_delay_day"":2,""need_check_out"":false,""need_logistics"":true,""poi_resource"":{""condition"":"""",""service_num"":"""",""notification"":"""",""poi_ids"":[],""total_can_use_count"":1},""biz_kind"":0,""appid"":1,""__token"":""42da1e0147ed009626111ff00ea6ba59"",""_lid"":""727915279175""}"; byte[] postBytes = System.Text.Encoding.UTF8.GetBytes(body); request.ContentLength = postBytes.Length; Stream stream = request.GetRequestStream(); stream.Write(postBytes, 0, postBytes.Length); stream.Close(); response = (HttpWebResponse)request.GetResponse(); } catch (WebException e) { if (e.Status == WebExceptionStatus.ProtocolError) response = (HttpWebResponse)e.Response; else return false; } catch (Exception) { if (response != null) response.Close(); return false; } return true; } private void btnDyCollect_Click(object sender, EventArgs e) { ProductCollectBase pb = new ProductCollectBase(); pb.from_id = 3484334354522604433; pb.from = "抖音"; CollectDoyin cd = new CollectDoyin(pb); cd.GetProduct(); } private void lblContactSupport_Click(object sender, EventArgs e) { SupportQrCodeForm qrForm = new SupportQrCodeForm(); qrForm.ShowDialog(); } } }