diff --git a/FLSystem/Forms/cps_manage_control.cs b/FLSystem/Forms/cps_manage_control.cs index ab02aa8..903a6a9 100644 --- a/FLSystem/Forms/cps_manage_control.cs +++ b/FLSystem/Forms/cps_manage_control.cs @@ -420,7 +420,7 @@ namespace FLSystem.Forms private void barButtonItem46_ItemClick(object sender, ItemClickEventArgs e) { //TODO 快手 - return; + //return; LoginCps(CpsType.快手联盟); } diff --git a/FLSystem/Forms/main.cs b/FLSystem/Forms/main.cs index 9e8ea7a..6dea30e 100644 --- a/FLSystem/Forms/main.cs +++ b/FLSystem/Forms/main.cs @@ -1333,7 +1333,7 @@ namespace FLSystem.Forms case "快手订单管理": { //TODO 快手 - throw new Exception("该功能尚未开发完成,请等待更新!"); + //throw new Exception("该功能尚未开发完成,请等待更新!"); control = new cps_order_kuaishou(username); break; } @@ -2569,7 +2569,7 @@ namespace FLSystem.Forms private void barButtonItem108_ItemClick(object sender, ItemClickEventArgs e) { //TODO 快手 - return; + //return; if (LoginCps(CpsType.快手联盟) != null) ItemClick(btn_cps_manage, e); } diff --git a/PCRobot/PCRobot.csproj b/PCRobot/PCRobot.csproj index 84e3799..4dd78fc 100644 --- a/PCRobot/PCRobot.csproj +++ b/PCRobot/PCRobot.csproj @@ -41,6 +41,9 @@ tencent_qqpim_72px_1127550_easyicon.net.ico + + Properties\app.manifest + ..\packages\FluentScheduler.5.5.1\lib\netstandard2.0\FluentScheduler.dll @@ -311,6 +314,7 @@ WechatUpdate.cs + SettingsSingleFileGenerator Settings.Designer.cs diff --git a/PCRobot/PCRobotForm.Designer.cs b/PCRobot/PCRobotForm.Designer.cs index 4368eea..fcb00ba 100644 --- a/PCRobot/PCRobotForm.Designer.cs +++ b/PCRobot/PCRobotForm.Designer.cs @@ -70,7 +70,6 @@ this.timer1 = new System.Windows.Forms.Timer(this.components); this.label5 = new System.Windows.Forms.Label(); this.timer2 = new System.Windows.Forms.Timer(this.components); - this.timer3 = new System.Windows.Forms.Timer(this.components); this.tabControl1.SuspendLayout(); this.tabPage1.SuspendLayout(); this.contextMenuStrip1.SuspendLayout(); @@ -279,9 +278,9 @@ this.checkBox1.AutoSize = true; this.checkBox1.Location = new System.Drawing.Point(35, 29); this.checkBox1.Name = "checkBox1"; - this.checkBox1.Size = new System.Drawing.Size(336, 16); + this.checkBox1.Size = new System.Drawing.Size(300, 16); this.checkBox1.TabIndex = 7; - this.checkBox1.Text = "开启防微信消息延迟功能(注:会模拟切换点击微信界面)"; + this.checkBox1.Text = "开启防微信消息延迟功能(注:模拟用户发送消息)"; this.checkBox1.UseVisualStyleBackColor = true; this.checkBox1.CheckedChanged += new System.EventHandler(this.checkBox1_CheckedChanged); // @@ -456,12 +455,6 @@ this.timer2.Interval = 6000; this.timer2.Tick += new System.EventHandler(this.timer2_Tick); // - // timer3 - // - this.timer3.Enabled = true; - this.timer3.Interval = 60000; - this.timer3.Tick += new System.EventHandler(this.timer3_Tick); - // // PCRobotForm // this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; @@ -479,6 +472,7 @@ this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.PCRobotForm_FormClosing); this.Load += new System.EventHandler(this.PCRobotForm_Load); this.SizeChanged += new System.EventHandler(this.PCRobotForm_SizeChanged); + this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.PCRobotForm_MouseDown); this.tabControl1.ResumeLayout(false); this.tabPage1.ResumeLayout(false); this.tabPage1.PerformLayout(); @@ -535,7 +529,6 @@ private System.Windows.Forms.Button button8; private System.Windows.Forms.Label label7; private System.Windows.Forms.ColumnHeader columnHeader1; - private System.Windows.Forms.Timer timer3; private System.Windows.Forms.CheckBox checkBox1; private System.Windows.Forms.GroupBox groupBox2; } diff --git a/PCRobot/PCRobotForm.cs b/PCRobot/PCRobotForm.cs index c4595f3..d1163e2 100644 --- a/PCRobot/PCRobotForm.cs +++ b/PCRobot/PCRobotForm.cs @@ -40,15 +40,7 @@ namespace PCRobot { try { - //var file = @"C:\Users\XianSenWu\Documents\WeChat Files\wxid_b9qk6hpmh0s812\config\AccInfo.dat"; - //var fileStream = File.ReadAllBytes(file); - - //var text = Encoding.UTF8.GetString(fileStream); - //Console.WriteLine(text); - - //var nickbyte = Encoding.UTF8.GetBytes("小张晚安"); - - //Console.WriteLine(); + //Common.MainExeHandle = this.Handle; try { @@ -61,6 +53,7 @@ namespace PCRobot files.Add(HttpExtend.MapFile(@"OnlineUpdate.exe")); //files.Add(Util.MapFile(@"WeiQ.Framework.dll", @"Assembly\apifile")); //files.Add(Util.MapFile(@"Browser.dll", @"Assembly\apifile\Library")); + foreach (var item in files) { try @@ -68,7 +61,8 @@ namespace PCRobot File.Delete(item); } catch (Exception ex) - { } + { + } } } catch (Exception) @@ -88,60 +82,195 @@ namespace PCRobot Wechat_Xiaoxie.ClickEvent += SystemLoginWechat; IniData(); + this.label5.Text = "版本:" + Common.CurVersion; //MessageBox.Show("版本:" + Common.CurVersion); + if (string.IsNullOrWhiteSpace(Config.GetValue("设置", "静态"))) + { + Config.SetValue("设置", "静态", "FALSE"); + } + + checkBox1.Checked = Config.GetValue("设置", "静态").ToUpper() != "TRUE"; + if (Config.GetValue("设置", "内部").ToUpper() == "TRUE") { #region 需要解析的微信消息 - var temp = "MT_USER_LOGIN,MT_USER_LOGOUT,MT_DATA_CHATROOM_MEMBERS_MSG,MT_DATA_CHATROOMS_MSG,MT_DATA_FRIENDS_MSG,MT_DATA_WXID_MSG"; + + var temp = + "MT_USER_LOGIN,MT_USER_LOGOUT,MT_DATA_CHATROOM_MEMBERS_MSG,MT_DATA_CHATROOMS_MSG,MT_DATA_FRIENDS_MSG,MT_DATA_WXID_MSG"; if (Common.AppConfig_ExistItem("AnalysisTypes")) temp = Common.AppConfig_Get("AnalysisTypes"); else Common.AppConfig_Add("AnalysisTypes", temp); - AnalysisTypes = temp.Replace(",", ",").Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries).Select(f => f.Trim().ToUpper()).ToList(); + AnalysisTypes = temp.Replace(",", ",") + .Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries) + .Select(f => f.Trim().ToUpper()).ToList(); richTextBox1.Text = Common.AppConfig_Get("AnalysisTypes"); + #endregion #region 自动处理会话已读 + var temp2 = "0"; if (Common.AppConfig_ExistItem("IsHaveRead")) temp2 = Common.AppConfig_Get("IsHaveRead"); else Common.AppConfig_Add("IsHaveRead", "0"); IsHaveRead = checkBox2.Checked = temp2 == "1"; + #endregion - if (!Common.AppConfig_ExistItem("RunAppName")) - Common.AppConfig_Add("RunAppName", "易转发"); + try + { + if (!Common.AppConfig_ExistItem("RunAppName")) + Common.AppConfig_Add("RunAppName", "易转发"); + } + catch (Exception exception) + { } } else tabPage3.Parent = null; - if (!Common.AppConfig_ExistItem("设置")) - Common.AppConfig_Add("设置", "静态"); - - checkBox1.Checked = Config.GetValue("设置", "静态").ToUpper() != "TRUE"; - ErrorMessAction = ErrorMess; //设置标题 - var title = Regex.Replace(Process.GetCurrentProcess().MainModule.ModuleName, ".exe", "", RegexOptions.IgnoreCase); + var title = Regex.Replace(Process.GetCurrentProcess().MainModule.ModuleName, ".exe", "", + RegexOptions.IgnoreCase); if (string.IsNullOrWhiteSpace(title) || title.Contains("易转发")) title = Util.GetRandomString(5); this.Text = title; //this.Text = Guid.NewGuid().ToString("N"); + } + catch (Exception ex) + { + MessageBox.Show("异常 = " + ex.Message + " --- " + ex.StackTrace); + } + try + { //自动切换聊天对象 var th = new Thread(OnHandle); th.IsBackground = true; th.Start(); + + //切换窗口 + var th1 = new Thread(OnActivationHandle); + th1.IsBackground = true; + th1.Start(); + + //发送消息 + var th2 = new Thread(OnSendHandle); + th2.IsBackground = true; + th2.Start(); } - catch (Exception ex) + catch { } } + List userNameList = new List() { /*"newsapp",*/ "gh_3dfda90e39d6", "weixin", "weixin", "weixin", "gh_7aac992b0363", "weixin"/*, "notifymessage"*/ }; + + private Dictionary PublicUserCache = new Dictionary(); + + private void OnSendHandle() + { + while (true) + { + Thread.Sleep(1000 * new Random(Guid.NewGuid().GetHashCode()).Next(50, 100)); + StringBuilder sb = new StringBuilder(); + try + { + if (Config.GetValue("设置", "静态").ToUpper() == "TRUE") + { + continue; + } + + sb.Append("开启激活;"); + var users = WechatClient.Users.Values.ToList(); + if (users.Count <= 0) + { + continue; + } + + sb.Append($"{users.Count}个微信;"); + + foreach (var user in users) + { + try + { + var client = WechatClient.GetApi(user); + if (client != null) + { + if (client.User.Type == WechatType.Xiaoxie_QY) + { + continue; + } + + var robot = client as Wechat_Xiaoxie; + if (robot != null) + { + var index = new Random(Guid.NewGuid().GetHashCode()).Next(0, userNameList.Count); + var username = userNameList[index]; + + if (username.StartsWith("gh_", StringComparison.CurrentCultureIgnoreCase)) + { + if (!PublicUserCache.ContainsKey(username)) + { + PublicUserCache[username] = true; + robot.AddPublicUser(username); + Thread.Sleep(1000); + } + } + + sb.Append($"{robot.User.Nickname}({robot.User.Wxid})执行发送"); + + robot.SendMessage(userNameList[index], + DateTime.Now + .AddSeconds( + -new Random(Guid.NewGuid().GetHashCode()).Next(1000000, 9000000)) + .ToString("HHmmssffffdd")); + } + } + } + catch (Exception ex) + { + LogHelper.GetSingleObj().Error("激活", ex.Message); + } + finally + { + LogHelper.GetSingleObj().Info("定时消息", sb.ToString()); + } + Thread.Sleep(500); + } + } + catch (Exception ex) + { + LogHelper.GetSingleObj().Error("激活", ex.Message); + } + } + } + + private void OnActivationHandle() + { + return; + while (true) + { + Thread.Sleep(1000 * 60); + try + { + if (Config.GetValue("设置", "静态").ToUpper() != "TRUE") + { + Common.ActivateWindow(); + } + } + catch (Exception ex) + { + LogHelper.GetSingleObj().Error("EnableError", $"{ex.Message} - {ex.StackTrace}"); + } + } + } + /// /// 切换聊天对象 /// @@ -1053,17 +1182,7 @@ namespace PCRobot private void timer3_Tick(object sender, EventArgs e) { - try - { - if (Config.GetValue("设置", "静态").ToUpper() != "TRUE") - { - Common.ActivateWindow(); - } - } - catch (Exception ex) - { - LogHelper.GetSingleObj().Error("EnableError", $"{ex.Message} - {ex.StackTrace}"); - } + } private void button9_Click(object sender, EventArgs e) @@ -1080,13 +1199,17 @@ namespace PCRobot { try { - Config.SetValue("设置", "静态", checkBox1.Checked ? "FALSE" : "TRUE"); + Config.SetValue("设置", "静态", (checkBox1.Checked ? "FALSE" : "TRUE")); } - catch (Exception exception) + catch (Exception ex) { - Console.WriteLine(exception); - throw; + LogHelper.GetSingleObj().Info("修改激活配置", $"{ex.Message}"); } } + + private void PCRobotForm_MouseDown(object sender, MouseEventArgs e) + { + LogHelper.GetSingleObj().Info("窗口被点击", $"主程序窗口被点击 => x:{e.X};y:{e.Y}"); + } } } diff --git a/PCRobot/PCRobotForm.resx b/PCRobot/PCRobotForm.resx index 7d1c911..3cc98a5 100644 --- a/PCRobot/PCRobotForm.resx +++ b/PCRobot/PCRobotForm.resx @@ -496,9 +496,6 @@ 342, 21 - - 432, 21 - 58 diff --git a/PCRobot/Properties/app.manifest b/PCRobot/Properties/app.manifest new file mode 100644 index 0000000..60a45a2 --- /dev/null +++ b/PCRobot/Properties/app.manifest @@ -0,0 +1,75 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/PCRobot/Utils/Common.cs b/PCRobot/Utils/Common.cs index 0ba69b8..cd47aec 100644 --- a/PCRobot/Utils/Common.cs +++ b/PCRobot/Utils/Common.cs @@ -400,18 +400,16 @@ namespace PCRobot.Utils [DllImport("user32.dll")] private static extern bool SetCursorPos(int x, int y); - [DllImport("user32.dll")] - public static extern bool ReleaseCapture(); - [DllImport("user32.dll", EntryPoint = "SendMessageA")] public static extern int SendMessage(IntPtr hwnd, int wMsg, IntPtr wParam, IntPtr lParam); [System.Runtime.InteropServices.DllImport("USER32.DLL")] private static extern bool SetForegroundWindow(IntPtr hWnd); + [System.Runtime.InteropServices.DllImport("USER32.dll")] private static extern int ShowWindow(IntPtr hwnd, uint nCmdShow); [System.Runtime.InteropServices.DllImport("user32.dll")] - private static extern IntPtr SetActiveWindow(IntPtr hWnd); + private static extern bool SetActiveWindow(IntPtr hWnd); [System.Runtime.InteropServices.DllImport("user32.dll", EntryPoint = "FindWindow")] //声明FindWindowAPI private static extern IntPtr FindWindow(string lpClassName, string lpWindowName); @@ -419,6 +417,9 @@ namespace PCRobot.Utils [System.Runtime.InteropServices.DllImport("user32.dll")] private static extern IntPtr FindWindowExA(IntPtr parentHandle, IntPtr childAfter, string lpClassName, string lpWindowName); + [DllImport("User32.dll", EntryPoint = "SendMessage")] + private static extern int SendMessage(IntPtr hWnd, int msg, int wParam, int lParam); + [System.Runtime.InteropServices.DllImport("user32")] private static extern int mouse_event(int dwFlags, int dx, int dy, int cButtons, int dwExtraInfo); @@ -434,14 +435,85 @@ namespace PCRobot.Utils private const int VM_NCLBUTTONDOWN = 0XA1;//定义鼠标左键按下 private const int HTCAPTION = 2; + + [System.Runtime.InteropServices.DllImport("User32.dll")] + private static extern bool ShowWindowAsync(IntPtr hWnd, int cmdShow); + + public const int SW_HIDE = 0; + public const int SW_SHOWNORMAL = 1; + public const int SW_NORMAL = 1; + public const int SW_SHOWMINIMIZED = 2; + public const int SW_SHOWMAXIMIZED = 3; + public const int SW_MAXIMIZE = 3; + public const int SW_SHOWNOACTIVATE = 4; + public const int SW_SHOW = 5; + public const int SW_MINIMIZE = 6; + public const int SW_SHOWMINNOACTIVE = 7; + public const int SW_SHOWNA = 8; + public const int SW_RESTORE = 9; + public const int SW_SHOWDEFAULT = 10; + public const int SW_FORCEMINIMIZE = 11; + public const int SW_MAX = 11; + + [DllImport("user32.dll")] + private static extern bool SetWindowPos(IntPtr hWnd, IntPtr hWndlnsertAfter, int X, int Y, int cx, int cy, uint Flags); + + /// + /// 关闭微信更新窗口 + /// + private static void CloseWeChatUpdateWindow() + { + //最多循环10次,一般不可能一台服务器登录超过10个机器人,我怕有BUG死循环 + for (int i = 0; i < 10; i++) + { + try + { + Thread.Sleep(1000); + var handle = IntPtr.Zero; + var rstHandlePtr = FindWindowExA(IntPtr.Zero, handle, "UpdateWnd", "升级"); + if (rstHandlePtr == IntPtr.Zero) + { + LogHelper.GetSingleObj().Info("更新窗口", "检测到更新窗口 => 没有升级"); + break; + } + + LogHelper.GetSingleObj().Info("更新窗口", "检测到更新窗口 => 升级"); + SendMessage(rstHandlePtr, 0x0010, 0, 0); + } + catch (Exception e) + { + LogHelper.GetSingleObj().Info("更新窗口", "检测到更新窗口 => 升级 异常"); + } + } + + for (int i = 0; i < 10; i++) + { + try + { + Thread.Sleep(1000); + var handle = IntPtr.Zero; + var rstHandlePtr = FindWindowExA(IntPtr.Zero, handle, "UpdateWnd", "新版本"); + if (rstHandlePtr == IntPtr.Zero) + { + LogHelper.GetSingleObj().Info("更新窗口", "检测到更新窗口 => 没有新版本"); + break; + } + + LogHelper.GetSingleObj().Info("更新窗口", "检测到更新窗口 => 新版本"); + SendMessage(rstHandlePtr, 0x0010, 0, 0); + } + catch (Exception e) + { + LogHelper.GetSingleObj().Info("更新窗口", "检测到更新窗口 => 新版本 异常"); + } + } + } + /// /// 激活个人微信窗口 /// - private static void ActivateWindow(String lpClassName, string lpWindowName) + private static void ActivateWindow(string lpClassName, string lpWindowName) { - - - try { //主窗口句柄 @@ -455,32 +527,20 @@ namespace PCRobot.Utils if (handleList.Contains(handle)) break; handleList.Add(handle); - //开始通过win32激活 - var showWindow = ShowWindow(handle, 9); - Thread.Sleep(500); - var setActiveWindow = SetActiveWindow(handle); - Thread.Sleep(new Random(Guid.NewGuid().GetHashCode()).Next(1000, 3000)); - var setForegroundWindow = SetForegroundWindow(handle); - Thread.Sleep(new Random(Guid.NewGuid().GetHashCode()).Next(2000, 5000)); + //显示窗口(最小化的也可以让显示出来) + var activateForm = ShowWindowAsync(handle, SW_SHOWNOACTIVATE);//显示 + Thread.Sleep(new Random(Guid.NewGuid().GetHashCode()).Next(10000, 20000)); - ////找窗口的坐标 - //Rect rect = new Rect(); - //var getWindowRect = GetWindowRect(handle, out var lpRect); + //设置窗体的位置 + var x = new Random(Guid.NewGuid().GetHashCode()).Next(100, 300); + var y = new Random(Guid.NewGuid().GetHashCode()).Next(200, 500); + var mobileForm = SetWindowPos(handle, IntPtr.Zero, x, y, 0, 0, 1); - ////设置鼠标的位置 - //var setCursorPos = SetCursorPos(lpRect.Left + new Random(Guid.NewGuid().GetHashCode()).Next(10, 30), lpRect.Top + new Random(Guid.NewGuid().GetHashCode()).Next(5, 12)); + LogHelper.GetSingleObj().Info("激活", $"激活窗口 => 显示窗口:{activateForm};位置=x:{x},y:{y} => {mobileForm};"); + Thread.Sleep(1000 * 30); - var release = ReleaseCapture(); - - int x = new Random(Guid.NewGuid().GetHashCode()).Next(10, 30); - int y = new Random(Guid.NewGuid().GetHashCode()).Next(5, 12); - var one = SendMessage(handle, 0x201, IntPtr.Zero, new IntPtr(x + (y << 16))); - Thread.Sleep(300); - var two = SendMessage(handle, 0x202, IntPtr.Zero, new IntPtr(x + (y << 16))); - - //LogHelper.GetSingleObj().Info("激活", $"激活窗口 => showWindow:{showWindow};setActiveWindow={setActiveWindow};setForegroundWindow={setForegroundWindow};getWindowRect={getWindowRect};{JsonConvert.SerializeObject(lpRect)};setCursorPos={setCursorPos};release={release};mouse={sendMessage}"); - LogHelper.GetSingleObj().Info("激活", $"激活窗口 => showWindow:{showWindow};setActiveWindow={setActiveWindow};setForegroundWindow={setForegroundWindow};release={release};x={x};y={y};one={one};two={two}"); - Thread.Sleep(2000); + //只操作一个微信窗体,看下会不会出问题 + break; } while (true); } catch (Exception e) @@ -489,23 +549,69 @@ namespace PCRobot.Utils } } + ///// + ///// 主窗体句柄 + ///// + //public static IntPtr MainExeHandle = IntPtr.Zero; + /// /// 激活windows窗口 /// public static void ActivateWindow() { - Task.Factory.StartNew(() => - { - //激活个人微信 - ActivateWindow("WeChatMainWndForPC", "微信"); - Thread.Sleep(new Random(Guid.NewGuid().GetHashCode()).Next(4000, 10000)); - //激活企业微信 - ActivateWindow("WeWorkWindow", "企业微信"); - }); + CloseWeChatUpdateWindow(); + + //激活个人微信 + ActivateWindow("WeChatMainWndForPC", "微信"); + //Thread.Sleep(new Random(Guid.NewGuid().GetHashCode()).Next(4000, 10000)); + //激活企业微信 + //ActivateWindow("WeWorkWindow", "企业微信"); + + //Thread.Sleep(new Random(Guid.NewGuid().GetHashCode()).Next(2000, 4000)); + //ActivateMainForm(); + } + + /// + /// 激活主窗体 + /// + private static void ActivateMainForm() + { + // try + // { + // if (MainExeHandle == IntPtr.Zero) + // { + // return; + // } + + // ////开始通过win32激活 + // //var showWindow = ShowWindow(MainExeHandle, 9); + // var activateForm = ShowWindowAsync(MainExeHandle, SW_SHOWNOACTIVATE);//显示 + // Thread.Sleep(new Random(Guid.NewGuid().GetHashCode()).Next(1000, 2000)); + // var setForegroundWindow = SetForegroundWindow(MainExeHandle); + // Thread.Sleep(new Random(Guid.NewGuid().GetHashCode()).Next(2000, 3000)); + + // int x = new Random(Guid.NewGuid().GetHashCode()).Next(10, 30); + // int y = new Random(Guid.NewGuid().GetHashCode()).Next(5, 10); + // var one = SendMessage(MainExeHandle, 0x201, IntPtr.Zero, new IntPtr(x + (y << 16))); + // Thread.Sleep(300); + // var two = SendMessage(MainExeHandle, 0x202, IntPtr.Zero, new IntPtr(x + (y << 16))); + + // Thread.Sleep(new Random(Guid.NewGuid().GetHashCode()).Next(2000, 3000)); + + // var minNoActive = ShowWindowAsync(MainExeHandle, SW_SHOWMINNOACTIVE);//最小化 + + // LogHelper.GetSingleObj().Info("激活", $"激活主程序窗口 => 显示窗口:{activateForm};置顶={setForegroundWindow};点击=>x={x};y={y};最小化窗口={minNoActive};one={one};two={two}"); + // } + // catch (Exception e) + // { + // Console.WriteLine($"ActivateMainForm Error:{e.Message}\r\n MainExeHandle => {MainExeHandle}"); + // } } #endregion + + private static string Device = string.Empty; /// /// 获取设备信息 diff --git a/应用/DYRebate/Class1.cs b/应用/DYRebate/Class1.cs index 82776d8..e4c0ed9 100644 --- a/应用/DYRebate/Class1.cs +++ b/应用/DYRebate/Class1.cs @@ -235,6 +235,12 @@ namespace DYRebate if (e.Member != null) { + //是否黑名单 + if (ApiClient.IsBlackFlMemberInfo(e.Member)) + { + return; + } + #region 订单变化通知消息 var robot_info = session.FindRobotInfo(e.Member.robot_name.Trim(), e.Member.robot_type); if (robot_info != null) diff --git a/应用/JDRebate/Class1.cs b/应用/JDRebate/Class1.cs index 0049f43..a6d73ec 100644 --- a/应用/JDRebate/Class1.cs +++ b/应用/JDRebate/Class1.cs @@ -104,6 +104,12 @@ namespace JDRebate if (order_jd == null) return; if (e.Member != null) { + //是否黑名单 + if (ApiClient.IsBlackFlMemberInfo(e.Member)) + { + return; + } + var robot_info = session.FindRobotInfo(e.Member.robot_name, e.Member.robot_type); if (robot_info != null) { diff --git a/应用/KSRebate/Class1.cs b/应用/KSRebate/Class1.cs index 25896a4..f890b90 100644 --- a/应用/KSRebate/Class1.cs +++ b/应用/KSRebate/Class1.cs @@ -97,6 +97,12 @@ namespace KSRebate if (e.Member != null) { + //是否黑名单 + if (ApiClient.IsBlackFlMemberInfo(e.Member)) + { + return; + } + #region 订单变化通知消息 var robot_info = session.FindRobotInfo(e.Member.robot_name.Trim(), e.Member.robot_type); if (robot_info != null) diff --git a/应用/MessageSupervises/Class1.cs b/应用/MessageSupervises/Class1.cs index eea3ecf..388a023 100644 --- a/应用/MessageSupervises/Class1.cs +++ b/应用/MessageSupervises/Class1.cs @@ -49,6 +49,11 @@ namespace MessageSupervises SDK.WXApplyGroupEvent += SDK_WXApplyGroupEvent; SDK.WXApplyFriendEvent += SDK_WXApplyFriendEvent; SDK.WXNewFriendEvent += SDK_WXNewFriendEvent; + + ApiClient.BlackMemberFunc = () => + { + return Config.FrequencyCloudBlack; + }; } catch (Exception ex) { @@ -193,6 +198,7 @@ namespace MessageSupervises { try { + ApiClient.BlackMemberFunc = null; if (mainForm != null) //关闭窗体 { mainForm.CloseForm(); diff --git a/应用/PDDRebate/Class1.cs b/应用/PDDRebate/Class1.cs index f6d3924..ad1c0c8 100644 --- a/应用/PDDRebate/Class1.cs +++ b/应用/PDDRebate/Class1.cs @@ -153,6 +153,12 @@ namespace PDDRebate if (e.Member != null) { + //是否黑名单 + if (ApiClient.IsBlackFlMemberInfo(e.Member)) + { + return; + } + var robot_info = session.FindRobotInfo(e.Member.robot_name, e.Member.robot_type); if (robot_info != null) @@ -577,6 +583,7 @@ namespace PDDRebate order.db_robottype = e.ChatType; order.msg_groupid = e.Groupid; order.db_userid = _member.id; + order.db_point = string.Empty; session.SaveOrUpdate(order); if (_member != null) diff --git a/应用/SNRebate/Class1.cs b/应用/SNRebate/Class1.cs index a34ba6e..ca797b7 100644 --- a/应用/SNRebate/Class1.cs +++ b/应用/SNRebate/Class1.cs @@ -99,6 +99,12 @@ namespace SNRebate { if (e.Member != null && e.ChatType == CpsType.苏宁易购) { + //是否黑名单 + if (ApiClient.IsBlackFlMemberInfo(e.Member)) + { + return; + } + var session = ApiClient.GetSession(); var order = e.Order as fl_order_suning; if (order == null) return; diff --git a/应用/TBRebate/Class1.cs b/应用/TBRebate/Class1.cs index 6ca1c7e..596e7ec 100644 --- a/应用/TBRebate/Class1.cs +++ b/应用/TBRebate/Class1.cs @@ -232,6 +232,12 @@ namespace TBRebate if (e.Member != null) { + //是否黑名单 + if (ApiClient.IsBlackFlMemberInfo(e.Member)) + { + return; + } + #region 订单变化通知消息 var robot_info = session.FindRobotInfo(e.Member.robot_name.Trim(), e.Member.robot_type); if (robot_info != null) diff --git a/应用/WPHRebate/Class1.cs b/应用/WPHRebate/Class1.cs index 52ff37f..27e4896 100644 --- a/应用/WPHRebate/Class1.cs +++ b/应用/WPHRebate/Class1.cs @@ -100,7 +100,11 @@ namespace WPHRebate { if (e.Member != null && e.ChatType == CpsType.唯品联盟) { - //this.OnLog("拼多多订单:" + HttpHelper.ObjectToJson(e)); + //是否黑名单 + if (ApiClient.IsBlackFlMemberInfo(e.Member)) + { + return; + } var session = ApiClient.GetSession(); var order = e.Order as fl_order_weipinhui; diff --git a/类库/Api.Framework/ApiClient.cs b/类库/Api.Framework/ApiClient.cs index d31cec2..16108bf 100644 --- a/类库/Api.Framework/ApiClient.cs +++ b/类库/Api.Framework/ApiClient.cs @@ -57,6 +57,26 @@ namespace Api.Framework /// public class ApiClient { + + public static Func BlackMemberFunc; + + public static bool IsBlackFlMemberInfo(fl_member_info member) + { + if (member.status != MemberType.白名单) + { + var isOnOff = BlackMemberFunc?.Invoke() ?? false; + if (isOnOff) + { + CloudBlack cloud = new CloudBlack(); + if (cloud.QueryBlack(member.username, member.robot_type) != null) + { + return true; + } + } + } + return false; + } + /// /// 插件列表显示的插件 /// @@ -3063,20 +3083,20 @@ namespace Api.Framework { if (!string.IsNullOrWhiteSpace(tousername)) { - var member = session.FindBlacklistMemberInfos().FirstOrDefault(f => f.username == tousername); - if (member != null) break; + //var member = session.FindBlacklistMemberInfos().FirstOrDefault(f => f.username == tousername); + //if (member != null) break; - var m = session.FindMemberInfoByUsername(tousername); - if (m.status != MemberType.白名单) - { - CloudBlack cloud = new CloudBlack(); - if (cloud.QueryBlack(tousername, item.Robot.type) != null) - break; - } + //var m = session.FindMemberInfoByUsername(tousername); + //if (m.status != MemberType.白名单) + //{ + // CloudBlack cloud = new CloudBlack(); + // if (cloud.QueryBlack(tousername, item.Robot.type) != null) + // break; + //} if (message.Contains("[昵称]")) { - member = session.FindSingle("select * from fl_member_info where robot_type = @robot_type and username = @username", new { username = tousername, robot_type = ChatType.QQ }); + var member = session.FindSingle("select * from fl_member_info where robot_type = @robot_type and username = @username", new { username = tousername, robot_type = ChatType.QQ }); if (member != null) message = message.Replace("[账号]", tousername).Replace("[昵称]", member.usernick); else @@ -3105,20 +3125,20 @@ namespace Api.Framework { if (!string.IsNullOrWhiteSpace(tousername)) { - var member = session.FindBlacklistMemberInfos().FirstOrDefault(f => f.username == tousername); - if (member != null) break; + //var member = session.FindBlacklistMemberInfos().FirstOrDefault(f => f.username == tousername); + //if (member != null) break; - var m = session.FindMemberInfoByUsername(tousername); - if (m.status != MemberType.白名单) - { - CloudBlack cloud = new CloudBlack(); - if (cloud.QueryBlack(tousername, item.Robot.type) != null) - break; - } + //var m = session.FindMemberInfoByUsername(tousername); + //if (m.status != MemberType.白名单) + //{ + // CloudBlack cloud = new CloudBlack(); + // if (cloud.QueryBlack(tousername, item.Robot.type) != null) + // break; + //} if (message.Contains("[昵称]")) { - member = session.FindSingle("select * from fl_member_info where robot_type = @robot_type and username = @username", new { username = tousername, robot_type = item.Robot.type }); + var member = session.FindSingle("select * from fl_member_info where robot_type = @robot_type and username = @username", new { username = tousername, robot_type = item.Robot.type }); message = message.Replace("[昵称]", member == null ? string.Empty : member.usernick); } message = message.Replace("[账号]", tousername); diff --git a/类库/Api.Framework/Cps/DouyinApi.cs b/类库/Api.Framework/Cps/DouyinApi.cs index a3b4e61..0870409 100644 --- a/类库/Api.Framework/Cps/DouyinApi.cs +++ b/类库/Api.Framework/Cps/DouyinApi.cs @@ -404,6 +404,10 @@ html = {html}"); Postdata = "", ResultType = ResultType.String }; + + item.Header.Add("Accept-Language", "zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2"); + item.Header.Add("Accept-Encoding", "deflate"); + HttpResult result = http.GetHtml(item); string html = result.Html; diff --git a/类库/Api.Framework/Timers/DownPinduoduoTimer.cs b/类库/Api.Framework/Timers/DownPinduoduoTimer.cs index d840239..47e8257 100644 --- a/类库/Api.Framework/Timers/DownPinduoduoTimer.cs +++ b/类库/Api.Framework/Timers/DownPinduoduoTimer.cs @@ -118,6 +118,12 @@ namespace Api.Framework.Timers var isFirstOrder = false;//是否获得用户首单奖励 var islotUserQuery = false;//订单是否为多人查询 + + if (isFrontData) + { + + } + //订单自动绑定 if (db_order.db_userid == 0 && ApiClient.Setting.SystemConfig.order_pinduoduo_bind == SwitchType.开启) {