private void button3_Click(object sender, EventArgs e) { // UpdatePwd | 修改用户密码 var url = "http://w.eydata.net/5ff969d2bef16403"; // 这里改成自己的地址 IDictionary <string, string> parameters = new Dictionary <string, string>(); try { // 这里改成自己的参数名称 parameters.Add("UserName", txtUpPwdUserName.Text); parameters.Add("UserPwd", txtUpPwd1.Text); parameters.Add("NewUserPwd", txtUpPwd2.Text); var ret = WebPost.ApiPost(url, parameters); if (int.Parse(ret) >= 1) { MessageBox.Show("修改密码成功!"); } else { MessageBox.Show("修改密码失败,错误代码: " + ret); } } catch (Exception e21) { MyLogUtil.ErrToLog("异常原因," + e21); MessageBox.Show("网络连接失败!"); } }
private void btnRetrieve_Click(object sender, EventArgs e) { // UpdatePwdByEmail | 用户密码找回 var url = "http://w.eydata.net/e82b0f76670b450a"; // 这里改成自己的地址 IDictionary <string, string> parameters = new Dictionary <string, string>(); try { // 这里改成自己的参数名称 parameters.Add("UserName", txtRetrieveUserName.Text); parameters.Add("Email", txtRetrieveEmail.Text); var ret = WebPost.ApiPost(url, parameters); if (int.Parse(ret) >= 1) { MessageBox.Show("找回密码成功,请注意邮箱查收!"); } else { MessageBox.Show("找回密码失败,错误代码: " + ret); } } catch (Exception e22) { MyLogUtil.ErrToLog("异常原因," + e22); MessageBox.Show("网络连接失败!"); } }
private void btnRecharge_Click(object sender, EventArgs e) { // UserRecharge | 用户充值 var url = "http://w.eydata.net/b6af9bff0a8a373c"; // 这里改成自己的地址 IDictionary <string, string> parameters = new Dictionary <string, string>(); try { // 这里改成自己的参数名称 parameters.Add("UserName", txtReUserName.Text.Trim()); parameters.Add("CardPwd", txtReCard.Text); parameters.Add("Referral", txtReReferral.Text); var ret = WebPost.ApiPost(url, parameters); if (int.Parse(ret) >= 1) { MessageBox.Show("充值成功!"); } else { MessageBox.Show("充值失败,错误代码: " + ret); } } catch (Exception e20) { MyLogUtil.ErrToLog("异常原因," + e20); MessageBox.Show("网络连接失败!"); } }
private void btnReg_Click(object sender, EventArgs e) { // UserRegin | 用户注册 url var url = "http://w.eydata.net/cfe22fbe2935fc5e"; // 这里改成自己的地址 IDictionary <string, string> parameters = new Dictionary <string, string>(); try { // 这里改成自己的参数名称 parameters.Add("UserName", txtRegUserName.Text.Trim()); parameters.Add("UserPwd", txtRegPwd.Text); parameters.Add("Email", txtRegEmail.Text); parameters.Add("Mac", ""); var ret = WebPost.ApiPost(url, parameters); if (ret == "1") { MessageBox.Show("注册成功!"); } else { MessageBox.Show("注册失败,错误代码: " + ret); } } catch (Exception e19) { MyLogUtil.ErrToLog("异常原因," + e19); MessageBox.Show("网络连接失败!"); } }
public MainPlugin(ICoolQApi coolQApi) : base(coolQApi) { try { //这里调用的话,会报authCode错误, /* * CacheData.LoginQQ = coolQApi.GetLoginQQ(); * CacheData.LoginNick = coolQApi.GetLoginNick(); * MyLogUtil.ToLogFotTest(CacheData.LoginQQ + "_" + CacheData.LoginNick); */ //先判断当前电脑是否有合适的.net版本 if (!MyDotNetFrameworkUtil.IsSupportedRuntimeVersion()) { IsSupportedRuntimeVersion = false; new RuntimeVerForm().Show(); return; } else { IsSupportedRuntimeVersion = true; CacheData.CoolQApi = coolQApi; //酷q登录成功后,进入软件登录页面 new login().Show(); } } catch (Exception ex) { MyLogUtil.ErrToLog("不可预知的异常,原因:" + ex); MessageBox.Show("不可预知的异常,请查看错误日志"); } }
private void UpdateDataGridView(SkinDataGridView skinDataGridView1, List <www_52bang_site_enjoy.MyModel.GroupInfo> groupList, Dictionary <long, int> checkedQQQun) { try { skinDataGridView1.Rows.Clear(); MyDictionaryUtil <long, int> myDictionaryUtil = new MyDictionaryUtil <long, int>(); for (int i = 0; i < groupList.Count; i++) { www_52bang_site_enjoy.MyModel.GroupInfo groupInfo = groupList[i]; int result = myDictionaryUtil.GetValue(checkedQQQun, groupInfo.GroupId); int index = skinDataGridView1.Rows.Add(); if (result == 1)//选中了 { skinDataGridView1.Rows[index].Cells[0].Value = true; } else//未选中 { skinDataGridView1.Rows[index].Cells[0].Value = false; } skinDataGridView1.Rows[index].Cells[1].Value = groupInfo.GroupName; skinDataGridView1.Rows[index].Cells[2].Value = groupInfo.GroupId; } }catch (Exception ex) { MyLogUtil.ErrToLog("错误信息:" + ex); } }
public QrCode(string title) { try { InitializeComponent(); this.Text = title; try { SQLiteHelper.CreateDataBase(); } catch (Exception ex) { MyLogUtil.ErrToLog("创建数据库出错,原因:" + ex); MessageBox.Show("创建数据库出错"); } try { SQLiteHelper.ExecuteNonQuery(@" CREATE TABLE peizhi(Id Integer NOT NULL PRIMARY KEY AUTOINCREMENT UNIQUE, '账单' varchar(0), '封盘前' varchar(0), '封盘' varchar(0), '开奖' varchar(0), '实时账单' varchar(0), '下注' varchar(0), '自定义1' varchar(0),'自定义2' varchar(0), '自定义3' varchar(0), '自定义4' varchar(0), '自定义5' varchar(0), '倍数' varchar(0), '最小' varchar(0), '最大' varchar(0), Time varchar(0));", "peizhi"); } catch (Exception ex) { MyLogUtil.ErrToLog("创建数据库表出错,原因:" + ex); MessageBox.Show("创建数据库表出错"); } DataTable dttabel = SQL.tabellist(); foreach (DataRow dr in dttabel.Rows) { if (dr[0].ToString().IndexOf("Friends_") != -1) { comboBox1.Items.Add(dr[0].ToString().Replace("Friends_", "")); } } if (comboBox1.Items.Count != 0) { comboBox1.SelectedIndex = 0; } } catch (Exception ex) { CacheData.CoolQApi.AddLog(40, Newbe.CQP.Framework.CoolQLogLevel.Debug, "QrCode 构造方法出错:" + ex.ToString()); MessageBox.Show(ex.Message); } }
public void initQunAndPaint() { try { CacheData.GroupList = CoolQApiExtend.GetGroupList(coolQApi); MyLogUtil.ErrToLog("获取的群列表大小:" + CacheData.GroupList.Count); MyLogUtil.ErrToLog("skinDataGridView2" + skinDataGridView2); MyLogUtil.ErrToLog("CacheData.GroupList" + CacheData.GroupList); MyLogUtil.ErrToLog("CacheData.BaseJson" + CacheData.BaseJson); //选中群列表中某些群 UpdateDataGridView(skinDataGridView2, CacheData.GroupList, CacheData.BaseJson.CheckedQQQun); //选中群列表中某些群 UpdateDataGridView(skinDataGridView1, CacheData.GroupList, CacheData.MovieConfig.CheckedQQQun); } catch (Exception eee) { MyLogUtil.ErrToLog("加载群信息失败,原因:" + eee); } }
/// <summary> /// 进入主界面 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void button3_Click(object sender, EventArgs e) { try { if (radioButton1.Checked) { CacheData.IsAutoAddGroupMemberJifen = true; } if (comboBox1.Text == "" || comboBox2.Text == "") { MessageBox.Show("请选择qq群和数据库!"); return; } //缓存当前选中的QQ群 CacheData.SelectedGroupIndex = comboBox2.SelectedIndex; //webChat.grox[comboBox2.SelectedIndex].seq = comboBox1.Text; CacheData.Seq = comboBox1.Text; //加载当前选中群的群员信息 label1.Text = "正在加载选中群的群员信息"; MyLogUtil.ToLogFotTest("选中的索引值:" + CacheData.SelectedGroupIndex); GroupInfo currentSelectedGroup = CacheData.CurrentGroupList[CacheData.SelectedGroupIndex]; CacheData.CurrentSelectedGroupId = currentSelectedGroup.GroupId; //MyLogUtil.ToLogFotTest("#####进入主界面前,选中的群:"+currentSelectedGroup.GroupName+"____"+currentSelectedGroup.GroupId + "___" + comboBox2.SelectedIndex); CoolQApiExtend.GetGroupMemberListAndCache(CacheData.CoolQApi, currentSelectedGroup.GroupId); Form1 qr = new Form1(currentSelectedGroup, this.Text); CacheData.MainFrom = qr; qr.Show(); Hide(); }catch (Exception ex) { CacheData.CoolQApi.AddLog(40, Newbe.CQP.Framework.CoolQLogLevel.Debug, "qrCode类中button3_Click方法出错,异常信息:" + ex); MyLogUtil.ErrToLog("进入主界面时出现错误,原因:" + ex); MessageBox.Show("进入主界面出现错误"); } }
//电影助手启动监听 private void skinButton1_Click(object sender, EventArgs e) { try { skinButton1.Enabled = false; if (string.IsNullOrWhiteSpace(skinTextBox2.Text)) { MessageBox.Show("搜索命令不能为空"); return; } //保存首页配置 UpdateAndSaveBaseJson(); //保存机器人配置 UpdateAndSaveMovieConfig(); CacheData.IsRunMovieRot = true; skinButton3.Enabled = true; RecordLog("更新配置完成,且启动监听..."); }catch (Exception e23) { MyLogUtil.ErrToLog("影音机器人启动监听失效,原因:" + e23); } }
/// <summary> /// 刷新群列表 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void button2_Click(object sender, EventArgs e) { button2.Enabled = false; try { label1.Text = "正在刷新群列表..."; //获取QQ群列表 List <GroupInfo> qqQunList = CoolQApiExtend.GetGroupList(CacheData.CoolQApi); //将群数据刷新到组件 RefreshQunListCom(qqQunList); //说明:加载选中群员的信息转移到了button3_Click //webChat.FriendsList(false); } catch (Exception ex) { label1.Text = "请重新获取"; MessageBox.Show("刷新群列表出现异常,原因:" + ex.Message); MyLogUtil.ErrToLog("刷新群列表出现异常,原因:" + ex); } button2.Enabled = true; }
private void button1_Click(object sender, EventArgs e) { //MyLogUtil.ToLog(""+coolQApi.GetCookies()); //CoolQApiExtend.GetGroupList2(coolQApi); try { CacheData.GroupList = new List <www_52bang_site_enjoy.MyModel.GroupInfo>(); IEnumerable <Newbe.CQP.Framework.Extensions.GroupInfo> list = ExtrasCoolApiExtensions.GetGroupList(coolQApi); foreach (Newbe.CQP.Framework.Extensions.GroupInfo obj in list) { CacheData.GroupList.Add(new www_52bang_site_enjoy.MyModel.GroupInfo(obj.GroupName, obj.GroupNumber, obj.OwnerNumber)); } }catch (Exception e23) { MyLogUtil.ErrToLog("空指针:" + e23); } try { }catch (Exception eeee) { MyLogUtil.ErrToLog("hahah:" + eeee); } }
//初始化基础配置 private void InitConfig() { try { //GetBulletin | 获取程序公告 String url1 = "http://w.eydata.net/a785c7d10885be26"; // 这里改成自己的地址 IDictionary <string, string> parameters1 = new Dictionary <string, string>(); // 这里改成自己的参数名称 parameters1.Add("UserName", loginUserName); String ret1 = WebPost.ApiPost(url1, parameters1); if (ret1.Length > 0) { CacheData.NotifyInfo = ret1; } // GetExpired | 获取用户的到期时间 String url = "http://w.eydata.net/1f6208e5b7cc9208"; // 这里改成自己的地址 IDictionary <string, string> parameters = new Dictionary <string, string>(); // 这里改成自己的参数名称 parameters.Add("UserName", loginUserName); ret = WebPost.ApiPost(url, parameters); if (ret.Length > 0) { this.Text = this.Text + " (" + loginUserName + ")过期时间:" + ret; } //加载解析接口 CacheData.resourceApiList = MySystemUtil.GetVipParserApiList(); this.skinComboBox1.ValueMember = "index"; this.skinComboBox1.DisplayMember = "moduleName"; this.skinComboBox1.DataSource = CacheData.linkList; this.skinComboBox2.ValueMember = "index"; this.skinComboBox2.DisplayMember = "moduleName"; this.skinComboBox2.DataSource = CacheData.resourceApiList; BaseJson baseJson = MySystemUtil.GetBaseJsonConfig(); MovieConfig movieConfig = MySystemUtil.GetMovieJsonConfig(); CacheData.BaseJson = baseJson; CacheData.MovieConfig = movieConfig; //MyLogUtil.ToLog("coolQApi:"+ coolQApi); //初始群列表 if (coolQApi == null) { CacheData.GroupList = new List <www_52bang_site_enjoy.MyModel.GroupInfo>(); } else { //由于在这调用获取群列表时酷q初始化未完成,会导致抛异常 //CacheData.GroupList = CoolQApiExtend.GetGroupList(coolQApi); CacheData.GroupList = new List <www_52bang_site_enjoy.MyModel.GroupInfo>(); /* * CacheData.GroupList = new List<www_52bang_site_enjoy.MyModel.GroupInfo>(); * IEnumerable<Newbe.CQP.Framework.Extensions.GroupInfo> list = ExtrasCoolApiExtensions.GetGroupList(coolQApi); * foreach (Newbe.CQP.Framework.Extensions.GroupInfo obj in list) * { * CacheData.GroupList.Add(new www_52bang_site_enjoy.MyModel.GroupInfo(obj.GroupName,obj.GroupNumber,obj.OwnerNumber)); * } */ } }catch (Exception e) { MyLogUtil.ErrToLog("初始化出现异常,原因:" + e); } }
/// <summary> /// 监听私聊事件 /// </summary> /// <param name="subType"></param> /// <param name="sendTime"></param> /// <param name="fromQQ"></param> /// <param name="msg"></param> /// <param name="font"></param> /// <returns></returns> public override int ProcessPrivateMessage(int subType, int sendTime, long fromQQ, string msg, int font) { try { if (CacheData.MovieConfig.IsCanPrivateMessage) { //用户发来的消息日志 //MyLogUtil.WriteQQDialogueLog(fromQQ, msg); //说明用户回复的是指定的关键词 string replayContent2 = null; try { replayContent2 = CacheData.BaseJson.Keys[msg + "-##-1-##-1"]; CoolQApi.SendPrivateMsg(fromQQ, replayContent2); return(base.ProcessPrivateMessage(subType, sendTime, fromQQ, msg, font)); } catch (KeyNotFoundException ke) { try { replayContent2 = CacheData.BaseJson.Keys[msg + "-##-0-##-1"]; CoolQApi.SendPrivateMsg(fromQQ, replayContent2); return(base.ProcessPrivateMessage(subType, sendTime, fromQQ, msg, font)); } catch (KeyNotFoundException ke2) { } } //判断用户是否是想搜取 if (msg.StartsWith(CacheData.MovieConfig.SearchCommand)) { String url = ""; try { string searchContent = msg.Substring(1); if (string.IsNullOrWhiteSpace(searchContent)) { //CoolQApi.SendPrivateMsg(fromQQ, "请输入要搜索的内容,例如:搜黑豹"); CoolQApi.SendPrivateMsg(fromQQ, CacheData.MovieConfig.NoSearchedMovie); return(base.ProcessPrivateMessage(subType, sendTime, fromQQ, msg, font)); } else { CoolQApi.SendPrivateMsg(fromQQ, "正在寻找资源,请稍等..."); List <KunyunInfo> list = KuYunSearch.Search(searchContent, CacheData.MovieConfig.ConvertLinkIndex); if (list == null || list.Count == 0) { //CoolQApi.SendPrivateMsg(fromQQ, "暂时未找到此资源"); CoolQApi.SendPrivateMsg(fromQQ, CacheData.MovieConfig.NoSearchedMovie); return(base.ProcessPrivateMessage(subType, sendTime, fromQQ, msg, font)); } else if (list.Count == 1)//说明找到了具体电影的链接 { string replayContent = CacheData.MovieConfig.HaveSearchedMovie; StringBuilder sb = new StringBuilder(" "); foreach (KunyunInfo k in list) { replayContent = replayContent.Replace("{电影名}", k.name); foreach (MovieInfo2 res in k.url) { if (k.resourceTYpe == 1)//m3u8 { sb.Append(res.MovieName + " " + MyLinkCoverter.CovertUrlInSuoIm(res.Url, true) + Environment.NewLine); } else//直接观看链接 { sb.Append(res.MovieName + " " + MyLinkCoverter.CovertUrlInSuoIm(res.Url, false) + Environment.NewLine); } } } replayContent = replayContent.Replace("{电影链接}", sb.ToString()); CoolQApi.SendPrivateMsg(fromQQ, replayContent); return(base.ProcessPrivateMessage(subType, sendTime, fromQQ, msg, font)); } else//说明找到了相关的好几个电影 { StringBuilder sb = new StringBuilder("我找到了多个相关资源,请聊天回复以下具体某个资源获取观影链接:" + Environment.NewLine); foreach (KunyunInfo k in list) { sb.Append(CacheData.MovieConfig.SearchCommand + k.name + Environment.NewLine); } CoolQApi.SendPrivateMsg(fromQQ, sb.ToString()); return(base.ProcessPrivateMessage(subType, sendTime, fromQQ, msg, font)); } } } catch (Exception e2) { MyLogUtil.ErrToLog("搜索出现问题,原因:" + e2); CoolQApi.SendPrivateMsg(fromQQ, "小喵出现问题,请过会再来尝试"); return(base.ProcessPrivateMessage(subType, sendTime, fromQQ, msg, font)); } } //判断是否是指定的视频平台链接 if (MyLinkCoverter.JugePlatform(msg)) { MyResponse <MovieInfo> myResponse = MyLinkCoverter.CovertInSuoIm(msg); //MyLogUtil.ToLog("看看日志:" + myResponse.Msg.MovieName + "_链接:" + myResponse.Msg.Url); if (myResponse.Code == 0)//获取成功了 { string temp = CacheData.MovieConfig.HaveSearchedMovie; temp = temp.Replace("{电影名}", myResponse.Msg.MovieName); temp = temp.Replace("{电影链接}", myResponse.Msg.Url); //给用户回复的信息日志 //MyLogUtil.WriteQQDialogueLogOfMe(fromQQ, myResponse.Msg.MovieName + " " + myResponse.Msg.Url); CoolQApi.SendPrivateMsg(fromQQ, temp); return(base.ProcessPrivateMessage(subType, sendTime, fromQQ, msg, font)); } else { //给用户回复的信息日志 //MyLogUtil.WriteQQDialogueLogOfMe(fromQQ, SystemConfig.NoConvertPlatform); CoolQApi.SendPrivateMsg(fromQQ, CacheData.MovieConfig.NoSearchedMovie); return(base.ProcessPrivateMessage(subType, sendTime, fromQQ, msg, font)); } } //解析分享过来的是不是指定平台的链接(拦截形如xxxhttp://www.baidu.comxxx,但是有些新闻也是这种格式的) MyResponse <string> sharedUrl = null; sharedUrl = MyLinkCoverter.ParsePlatform(msg); if (sharedUrl.Code == 0)//正常链接 { sharedUrl.Msg = MyLinkCoverter.CovertUrlInSuoIm(sharedUrl.Msg, true); //给用户回复的信息日志 //MyLogUtil.WriteQQDialogueLogOfMe(fromQQ, "主人,这是你的观影地址:" + " " + sharedUrl.Msg + ",由于需要加载影片,请耐心等待,如果不能播放,请刷新或换浏览器,更多好玩的电影跟班,关注微信公众号[电影信封]"); string temp = CacheData.MovieConfig.HaveSearchedMovie; temp = temp.Replace("{电影名}", ""); temp = temp.Replace("{电影链接}", sharedUrl.Msg); //CoolQApi.SendPrivateMsg(fromQQ, "主人,这是你的观影地址:" + " " + sharedUrl.Msg + ",由于需要加载影片,请耐心等待,如果不能播放,请刷新或换浏览器,更多好玩的电影跟班,关注微信公众号[电影信封]"); //CoolQApi.SendPrivateMsg(fromQQ, "请确保发送给我的是主流视频平台的http或https链接,不要带其他信息,否则不能正常观看呦"); CoolQApi.SendPrivateMsg(fromQQ, temp); return(base.ProcessPrivateMessage(subType, sendTime, fromQQ, msg, font)); } return(base.ProcessPrivateMessage(subType, sendTime, fromQQ, msg, font)); } else { return(base.ProcessPrivateMessage(subType, sendTime, fromQQ, msg, font)); } } catch (Exception e) { MyLogUtil.ErrToLog(fromQQ, "发生不被期待的异常:" + e); return(base.ProcessPrivateMessage(subType, sendTime, fromQQ, msg, font)); } }
private void btnLogin_Click(object sender, EventArgs e) { // 用户登录(UserLogin) url var url = "http://w.eydata.net/839c03e916a2a8e5"; // 这里改成自己的地址 IDictionary <string, string> parameters = new Dictionary <string, string>(); try { var code = site.yinliu.OperateIniFile.ReadIniData("root", "code", "", "config.ini"); var upName = site.yinliu.OperateIniFile.ReadIniData("root", "upName", "", "config.ini"); if (code.Length > 0 && upName.Length > 0) { // 退出登录(LogOut) url var logOutUrl = "http://w.eydata.net/61b3173a01089775"; // 这里改成自己的地址 // 这里改成自己的参数名称 parameters.Add("StatusCode", code); parameters.Add("UserName", upName); WebPost.ApiPost(logOutUrl, parameters); parameters.Clear(); } // 这里改成自己的参数名称 parameters.Add("UserName", txtLoginUserName.Text.Trim()); parameters.Add("UserPwd", txtLoginUserPwd.Text); parameters.Add("Version", "1.1"); parameters.Add("Mac", ""); var ret = WebPost.ApiPost(url, parameters); if (ret.Length == 32) { site.yinliu.OperateIniFile.WriteIniData("root", "code", ret, "config.ini"); site.yinliu.OperateIniFile.WriteIniData("root", "upName", txtLoginUserName.Text.Trim(), "config.ini"); if (ckbRememberMe.Checked) { site.yinliu.OperateIniFile.WriteIniData("root", "name", txtLoginUserName.Text, "config.ini"); site.yinliu.OperateIniFile.WriteIniData("root", "pwd", txtLoginUserPwd.Text, "config.ini"); } else { site.yinliu.OperateIniFile.WriteIniData("root", "name", "", "config.ini"); site.yinliu.OperateIniFile.WriteIniData("root", "pwd", "", "config.ini"); } //FrmMain frm = new FrmMain(ret,txtLoginUserName.Text.Trim()); this.Hide(); //frm.Show(); myPlugin.InitMainform(ret, txtLoginUserName.Text.Trim()); } else { String errInfo = YiYouCode.getValue(ret); if (string.IsNullOrWhiteSpace(errInfo)) { MessageBox.Show("登录失败,错误代码: " + ret); } else { MessageBox.Show(errInfo); } } } catch (Exception e18) { MyLogUtil.ErrToLog("异常原因," + e18); MessageBox.Show("网络连接失败!"); } }
/// <summary> /// 监听私聊事件 /// </summary> /// <param name="subType"></param> /// <param name="sendTime"></param> /// <param name="fromQQ"></param> /// <param name="msg"></param> /// <param name="font"></param> /// <returns></returns> public override int ProcessPrivateMessage(int subType, int sendTime, long fromQQ, string msg, int font) { try { mainForm.displayMsg2("处理私聊消息:" + subType + "," + sendTime + "," + msg + "," + font); MemberService memberService = new MemberService(); //用户发来的消息日志 MyLogUtil.WriteQQDialogueLog(fromQQ, msg); //获取的消息 mainForm.displayMsg(msg); //说明用户回复的是指定的关键词 Hashtable keywords = SystemConfig.keywords; string keywordsValue = (string)keywords[msg]; if (!string.IsNullOrWhiteSpace(keywordsValue)) { //给用户回复的信息日志 MyLogUtil.WriteQQDialogueLogOfMe(fromQQ, keywordsValue); //发送消息 CoolQApi.SendPrivateMsg(fromQQ, keywordsValue); return(base.ProcessPrivateMessage(subType, sendTime, fromQQ, msg, font)); } //判断用户是否是想搜取 if (msg.StartsWith("搜")) { Member member = memberService.GetMemberDate(fromQQ); if (member.Type == 3)// 1不是会员 2 会员过期 3 正常会员 { String url = ""; try { string searchContent = msg.Substring(1); if (string.IsNullOrWhiteSpace(searchContent)) { CoolQApi.SendPrivateMsg(fromQQ, "请输入要搜索的内容,例如:搜黑豹"); return(base.ProcessPrivateMessage(subType, sendTime, fromQQ, msg, font)); } else { CoolQApi.SendPrivateMsg(fromQQ, "正在寻找资源,请稍等..."); List <KunyunInfo> list = KuYunSearch.Search(searchContent); if (list == null || list.Count == 0) { CoolQApi.SendPrivateMsg(fromQQ, "暂时未找到此资源"); return(base.ProcessPrivateMessage(subType, sendTime, fromQQ, msg, font)); } else if (list.Count == 1)//说明找到了具体电影的链接 { StringBuilder sb = new StringBuilder("我找到了以下资源(电影含多个链接对应不同清晰度,电视剧不同集):"); foreach (KunyunInfo k in list) { sb.Append("《" + k.name + "》 "); foreach (string res in k.url) { if (k.resourceTYpe == 1)//m3u8 { sb.Append(MyLinkCoverter.CovertUrlInSuoIm(res, true) + " \r\n"); } else//直接观看链接 { sb.Append(MyLinkCoverter.CovertUrlInSuoIm(res, false) + " \r\n"); } } } CoolQApi.SendPrivateMsg(fromQQ, sb.ToString()); return(base.ProcessPrivateMessage(subType, sendTime, fromQQ, msg, font)); } else//说明找到了相关的好几个电影 { StringBuilder sb = new StringBuilder("我找到了多个相关资源,请聊天回复以下具体某个资源获取观影链接: \r\n"); foreach (KunyunInfo k in list) { sb.Append("搜" + k.name + " \r\n"); } CoolQApi.SendPrivateMsg(fromQQ, sb.ToString()); return(base.ProcessPrivateMessage(subType, sendTime, fromQQ, msg, font)); } } } catch (Exception e2) { CoolQApi.SendPrivateMsg(fromQQ, "小喵出现问题,请过会再来尝试"); return(base.ProcessPrivateMessage(subType, sendTime, fromQQ, msg, font)); } } else if (member.Type == 2) { CoolQApi.SendPrivateMsg(fromQQ, "你的会员已过期,会员价格:" + SystemConfig.MoneyForWeekPay + "元-7天," + SystemConfig.MoneyForMonthPay + "元30天,请转账给此QQ,进行充值(不收红包)"); return(base.ProcessPrivateMessage(subType, sendTime, fromQQ, msg, font)); } else { CoolQApi.SendPrivateMsg(fromQQ, "你还不是会员,会员价格:" + SystemConfig.MoneyForWeekPay + "元-7天," + SystemConfig.MoneyForMonthPay + "元30天,请转账给此QQ,进行充值(不收红包)"); return(base.ProcessPrivateMessage(subType, sendTime, fromQQ, msg, font)); } } //判断是否是指定的视频平台链接 if (MyLinkCoverter.JugePlatform(msg)) { MyResponse <MovieInfo> myResponse = MyLinkCoverter.CovertInSuoIm(msg); if (myResponse.Code == 0)//获取成功了 { //给用户回复的信息日志 MyLogUtil.WriteQQDialogueLogOfMe(fromQQ, myResponse.Msg.MovieName + " " + myResponse.Msg.Url); CoolQApi.SendPrivateMsg(fromQQ, "主人,这是你的观影地址:" + " " + myResponse.Msg.Url + ",由于需要加载影片,请耐心等待,如果不能播放,请刷新或换浏览器,更多好玩的电影跟班,关注微信公众号[电影信封]"); return(base.ProcessPrivateMessage(subType, sendTime, fromQQ, msg, font)); } else { //给用户回复的信息日志 MyLogUtil.WriteQQDialogueLogOfMe(fromQQ, SystemConfig.NoConvertPlatform); CoolQApi.SendPrivateMsg(fromQQ, SystemConfig.NoConvertPlatform); return(base.ProcessPrivateMessage(subType, sendTime, fromQQ, msg, font)); } } //判断是否收到转账 //充值会员 if (!string.IsNullOrWhiteSpace(msg) && msg.Contains("[转账]") && (msg.Contains("元已转账成功,请使用手机QQ查看。") || msg.Contains("元转账需收款,请使用手机QQ查看。"))) { try { string value = msg.Replace("[转账]", ""); value = value.Replace("元已转账成功,请使用手机QQ查看。", ""); value = value.Replace("元转账需收款,请使用手机QQ查看。", ""); value = value.Trim(); double money = Convert.ToDouble(value); if (money == SystemConfig.MoneyForWeekPay || money == SystemConfig.MoneyForMonthPay) { Member member = memberService.Recharge(money, fromQQ); MyLogUtil.WriteZhuanZhangLog(fromQQ, "用户充值" + money); CoolQApi.SendPrivateMsg(fromQQ, "充值成功,会员到期时间:" + member.DateDesp + ",QQ回复“会员”,查看会员到期日"); MyLogUtil.WriteQQDialogueLogOfMe(fromQQ, "充值成功,会员到期时间:" + member.DateDesp + ",QQ回复“会员”,查看会员到期日"); CoolQApi.SendPrivateMsg(fromQQ, "QQ回复“会员”或微信关注[电影信封],获得观看会员资源"); MyLogUtil.WriteQQDialogueLogOfMe(fromQQ, "QQ回复“会员”或微信关注[电影信封],获得观看会员资源"); return(base.ProcessPrivateMessage(subType, sendTime, fromQQ, msg, font)); } else { MyLogUtil.WriteZhuanZhangLog(fromQQ, "用户转账额度不符合," + money); MyLogUtil.WriteQQDialogueLogOfMe(fromQQ, "用户转账额度不符合," + money); CoolQApi.SendPrivateMsg(fromQQ, "主人,目前只支持" + SystemConfig.MoneyForWeekPay + "、" + SystemConfig.MoneyForMonthPay + "元的充值金额,更多好玩的电影跟班,关注微信公众号[电影信封]"); return(base.ProcessPrivateMessage(subType, sendTime, fromQQ, msg, font)); } } catch (Exception e) { //解析转账出现问题 MyLogUtil.ErrToLog(fromQQ, "转账失败,原因:" + e); MyLogUtil.WriteZhuanZhangLog(fromQQ, "转账失败" + e); MyLogUtil.WriteQQDialogueLogOfMe(fromQQ, "主人,不好意思,我现在生病啦,不能为你提供资源链接,转账金额1天后自动退还,更多好玩的电影跟班,关注微信公众号[电影信封]"); CoolQApi.SendPrivateMsg(fromQQ, "主人,不好意思,我现在生病啦,不能为你提供资源链接,转账金额1天后自动退还,更多好玩的电影跟班,关注微信公众号[电影信封]"); return(base.ProcessPrivateMessage(subType, sendTime, fromQQ, msg, font)); } } //会员到期日 if ("会员".Equals(msg)) { Member member = memberService.GetMemberDate(fromQQ); if (member.Type == 3)// 1不是会员 2 会员过期 3 正常会员 { CoolQApi.SendPrivateMsg(fromQQ, "会员过期时间:" + member.DateDesp + " \r\n常见命令:" + systemConfigJson.Command); CoolQApi.SendPrivateMsg(fromQQ, "会员价格:会员价格:" + SystemConfig.MoneyForWeekPay + "元-7天," + SystemConfig.MoneyForMonthPay + "元30天,请转账给此QQ,进行充值(不收红包,不支持其他金额)"); } else if (member.Type == 2) { CoolQApi.SendPrivateMsg(fromQQ, "你的会员已过期," + member.DateDesp + ",会员价格:会员价格:" + SystemConfig.MoneyForWeekPay + "元-7天," + SystemConfig.MoneyForMonthPay + "元30天,请转账给此QQ,进行充值(不收红包)"); } else { CoolQApi.SendPrivateMsg(fromQQ, "你还不是会员,会员价格:会员价格:" + SystemConfig.MoneyForWeekPay + "元-7天," + SystemConfig.MoneyForMonthPay + "元30天,请转账给此QQ,进行充值(不收红包)"); CoolQApi.SendPrivateMsg(fromQQ, "会员常见命令:" + systemConfigJson.Command); } return(base.ProcessPrivateMessage(subType, sendTime, fromQQ, msg, font)); } //资源列表 if ("资源".Equals(msg)) { //付费电影资源列表 CoolQApi.SendPrivateMsg(fromQQ, "查看所有资源资源码:" + systemConfigJson.ResourceUrl); CoolQApi.SendPrivateMsg(fromQQ, "也可以搜索指定电影哦,命令:搜+电影名,举例:搜黑豹"); return(base.ProcessPrivateMessage(subType, sendTime, fromQQ, msg, font)); } //解析分享过来的是不是指定平台的链接(拦截形如xxxhttp://www.baidu.comxxx,但是有些新闻也是这种格式的) MyResponse <string> sharedUrl = null; sharedUrl = MyLinkCoverter.ParsePlatform(msg); if (sharedUrl.Code == 0)//正常链接 { sharedUrl.Msg = MyLinkCoverter.CovertUrlInSuoIm(sharedUrl.Msg, true); //给用户回复的信息日志 MyLogUtil.WriteQQDialogueLogOfMe(fromQQ, "主人,这是你的观影地址:" + " " + sharedUrl.Msg + ",由于需要加载影片,请耐心等待,如果不能播放,请刷新或换浏览器,更多好玩的电影跟班,关注微信公众号[电影信封]"); CoolQApi.SendPrivateMsg(fromQQ, "主人,这是你的观影地址:" + " " + sharedUrl.Msg + ",由于需要加载影片,请耐心等待,如果不能播放,请刷新或换浏览器,更多好玩的电影跟班,关注微信公众号[电影信封]"); CoolQApi.SendPrivateMsg(fromQQ, "请确保发送给我的是主流视频平台的http或https链接,不要带其他信息,否则不能正常观看呦"); return(base.ProcessPrivateMessage(subType, sendTime, fromQQ, msg, font)); } //付费资源KeyNotFoundException //目前资源识别是4位数字 ResourceInfo resourceInfo = null; try { resourceInfo = (ResourceInfo)systemConfigJson.ResourceKl[msg]; } catch (KeyNotFoundException ke) { resourceInfo = null; } if (resourceInfo != null) { Member member = memberService.GetMemberDate(fromQQ); if (member.Type == 3)// 1不是会员 2 会员过期 3 正常会员 { String url = ""; try { if (resourceInfo.Type == 2)////资源类型 1 链接直接使用 2 需使用优酷转vip的接口 { url = SystemConfig.ResourceApi + resourceInfo.Url; } else { url = resourceInfo.Url; } url = MyLinkCoverter.CovertUrlInSuoIm(url); CoolQApi.SendPrivateMsg(fromQQ, "《" + resourceInfo.Name + "》" + " " + MyLinkCoverter.CovertUrlInSuoIm(resourceInfo.Url)); return(base.ProcessPrivateMessage(subType, sendTime, fromQQ, msg, font)); } catch (Exception e2) { CoolQApi.SendPrivateMsg(fromQQ, "小喵出现问题,请过会再来尝试"); return(base.ProcessPrivateMessage(subType, sendTime, fromQQ, msg, font)); } } else if (member.Type == 2) { CoolQApi.SendPrivateMsg(fromQQ, "你的会员已过期,会员价格:" + SystemConfig.MoneyForWeekPay + "元-7天," + SystemConfig.MoneyForMonthPay + "元30天,请转账给此QQ,进行充值(不收红包)"); return(base.ProcessPrivateMessage(subType, sendTime, fromQQ, msg, font)); } else { CoolQApi.SendPrivateMsg(fromQQ, "你还不是会员,会员价格:" + SystemConfig.MoneyForWeekPay + "元-7天," + SystemConfig.MoneyForMonthPay + "元30天,请转账给此QQ,进行充值(不收红包)"); return(base.ProcessPrivateMessage(subType, sendTime, fromQQ, msg, font)); } } else { //查看信息是否是4位数字 try { if (msg.Length == 4) { //如果是四位数字 int kl = Convert.ToInt32(msg); CoolQApi.SendPrivateMsg(fromQQ, "此口令资源不存在,更多资源电影码:" + systemConfigJson.ResourceUrl); return(base.ProcessPrivateMessage(subType, sendTime, fromQQ, msg, font)); } } catch (Exception e)//如果是4位非数字 { CoolQApi.SendPrivateMsg(fromQQ, "此口令资源不存在,更多资源电影码:" + systemConfigJson.ResourceUrl); return(base.ProcessPrivateMessage(subType, sendTime, fromQQ, msg, font)); } } //以上所有资源都不匹配 // return(base.ProcessPrivateMessage(subType, sendTime, fromQQ, msg, font)); } catch (Exception e) { MyLogUtil.ErrToLog(fromQQ, "发生不被期待的异常:" + e); return(base.ProcessPrivateMessage(subType, sendTime, fromQQ, msg, font)); } }
/// <summary> /// 处理群聊消息 /// </summary> /// <param name="subType">消息类型,目前固定为1</param> /// <param name="sendTime">消息发送时间的时间戳</param> /// <param name="fromGroup">消息来源群号</param> /// <param name="fromQq">发送此消息的QQ号码</param> /// <param name="fromAnonymous">发送此消息的匿名用户</param> /// <param name="msg">消息内容</param> /// <param name="font">消息所使用字体</param> /// <returns></returns> public override int ProcessGroupMessage(int subType, int sendTime, long fromGroup, long fromQq, string fromAnonymous, string msg, int font) { MyDictionaryUtil <long, int> myDictionaryUtil = new MyDictionaryUtil <long, int>(); int result = myDictionaryUtil.GetValue(CacheData.BaseJson.CheckedQQQun, fromGroup); //说明用户回复的是指定的关键词 string replayContent2 = null; if (result == 1)//监控此群 { try { replayContent2 = CacheData.BaseJson.Keys[msg + "-##-1-##-1"]; CoolQApi.SendGroupMsg(fromGroup, replayContent2); return(base.ProcessGroupMessage(subType, sendTime, fromGroup, fromQq, fromAnonymous, msg, font)); } catch (KeyNotFoundException ke) { try { replayContent2 = CacheData.BaseJson.Keys[msg + "-##-1-##-0"]; CoolQApi.SendGroupMsg(fromGroup, replayContent2); return(base.ProcessGroupMessage(subType, sendTime, fromGroup, fromQq, fromAnonymous, msg, font)); } catch (KeyNotFoundException ke2) { } } } result = myDictionaryUtil.GetValue(CacheData.MovieConfig.CheckedQQQun, fromGroup); if (result == 1) { // string contentStr = msg.Trim(); bool b = true; if (CacheData.MovieConfig.IsNeed) { string at = CoolQCode.At(CoolQApi.GetLoginQQ()); if (msg.StartsWith(at))//需@机器人触发指令 { contentStr = contentStr.Replace(at, ""); contentStr = contentStr.Trim(); } else { b = false; } } if (b) { if (contentStr.StartsWith(CacheData.MovieConfig.SearchCommand)) { String url = ""; try { string searchContent = contentStr.Substring(1); if (string.IsNullOrWhiteSpace(searchContent)) { //CoolQApi.SendPrivateMsg(fromQQ, "请输入要搜索的内容,例如:搜黑豹"); //CoolQApi.SendPrivateMsg(fromQQ, CacheData.MovieConfig.NoSearchedMovie); replayContent2 = CacheData.MovieConfig.NoSearchedMovieInQun; replayContent2 = replayContent2.Replace("{@用户}", CoolQCode.At(fromQq)); CoolQApi.SendGroupMsg(fromGroup, replayContent2); return(base.ProcessGroupMessage(subType, sendTime, fromGroup, fromQq, fromAnonymous, msg, font)); } else { //CoolQApi.SendPrivateMsg(fromQQ, "正在寻找资源,请稍等..."); List <KunyunInfo> list = KuYunSearch.Search(searchContent, CacheData.MovieConfig.ConvertLinkIndex); if (list == null || list.Count == 0) { //CoolQApi.SendPrivateMsg(fromQQ, "暂时未找到此资源"); string temp = CacheData.MovieConfig.NoSearchedMovieInQun; temp = temp.Replace("{@用户}", CoolQCode.At(fromQq)); CoolQApi.SendGroupMsg(fromGroup, temp); return(base.ProcessGroupMessage(subType, sendTime, fromGroup, fromQq, fromAnonymous, msg, font)); } else if (list.Count == 1)//说明找到了具体电影的链接 { string replayContent = CacheData.MovieConfig.HaveSearchedMovieInQun; StringBuilder sb = new StringBuilder(" "); foreach (KunyunInfo k in list) { replayContent = replayContent.Replace("{电影名}", k.name); foreach (MovieInfo2 res in k.url) { if (k.resourceTYpe == 1)//m3u8 { sb.Append(res.MovieName + " " + MyLinkCoverter.CovertUrlInSuoIm(res.Url, true) + Environment.NewLine); } else//直接观看链接 { sb.Append(res.MovieName + " " + MyLinkCoverter.CovertUrlInSuoIm(res.Url, false) + Environment.NewLine); } } } replayContent = replayContent.Replace("{电影链接}", sb.ToString()); replayContent = replayContent.Replace("{@用户}", CoolQCode.At(fromQq)); CoolQApi.SendGroupMsg(fromGroup, replayContent); return(base.ProcessGroupMessage(subType, sendTime, fromGroup, fromQq, fromAnonymous, msg, font)); } else//说明找到了相关的好几个电影 { StringBuilder sb = new StringBuilder("我找到了多个相关资源,请保持搜索格式,聊天回复以下具体某个资源获取观影链接:" + Environment.NewLine); foreach (KunyunInfo k in list) { sb.Append(CacheData.MovieConfig.SearchCommand + k.name + Environment.NewLine); } CoolQApi.SendGroupMsg(fromGroup, sb.ToString()); return(base.ProcessGroupMessage(subType, sendTime, fromGroup, fromQq, fromAnonymous, msg, font)); } } } catch (Exception e2) { //CoolQApi.SendPrivateMsg(fromQQ, "小喵出现问题,请过会再来尝试"); MyLogUtil.ErrToLog("接收群聊信息后处理过程出现异常,原因:" + e2); return(base.ProcessGroupMessage(subType, sendTime, fromGroup, fromQq, fromAnonymous, msg, font)); } } } } //mainForm.displayMsg2("处理群聊消息:" + subType + "," + sendTime + "," + fromGroup + "," + fromQq + "," + fromAnonymous + "," + msg + "," + font); return(base.ProcessGroupMessage(subType, sendTime, fromGroup, fromQq, fromAnonymous, msg, font)); }