public override AbstractResponse OnEvent_SubscribeRequest(SubscribeEventRequest subscribeEventRequest) { string text = ""; if (subscribeEventRequest.EventKey != null) { text = subscribeEventRequest.EventKey; } if (text.Contains("qrscene_")) { text = text.Replace("qrscene_", "").Trim(); if (text == "1") { if (WeiXinHelper.BindAdminOpenId.Count > 10) { WeiXinHelper.BindAdminOpenId.Clear(); } if (WeiXinHelper.BindAdminOpenId.ContainsKey(subscribeEventRequest.Ticket)) { WeiXinHelper.BindAdminOpenId[subscribeEventRequest.Ticket] = subscribeEventRequest.FromUserName; } else { WeiXinHelper.BindAdminOpenId.Add(subscribeEventRequest.Ticket, subscribeEventRequest.FromUserName); } return(new TextResponse { CreateTime = System.DateTime.Now, Content = "您正在扫描尝试绑定管理员身份,身份已识别", ToUserName = subscribeEventRequest.FromUserName, FromUserName = subscribeEventRequest.ToUserName }); } ScanInfos scanInfosByTicket = ScanHelp.GetScanInfosByTicket(subscribeEventRequest.Ticket); Globals.Debuglog(text + ":" + subscribeEventRequest.Ticket, "_Debuglog.txt"); if (!MemberProcessor.IsExitOpenId(subscribeEventRequest.FromUserName) && scanInfosByTicket != null && scanInfosByTicket.BindUserId > 0) { this.CreatMember(subscribeEventRequest.FromUserName, scanInfosByTicket.BindUserId); ScanHelp.updateScanInfosLastActiveTime(System.DateTime.Now, scanInfosByTicket.Sceneid); } } WeiXinHelper.UpdateRencentOpenID(subscribeEventRequest.FromUserName); Hidistro.Entities.VShop.ReplyInfo subscribeReply = ReplyHelper.GetSubscribeReply(); if (subscribeReply == null) { return(null); } subscribeReply.Keys = "登录"; AbstractResponse response = this.GetResponse(subscribeReply, subscribeEventRequest.FromUserName); if (response == null) { this.GotoManyCustomerService(subscribeEventRequest); } response.ToUserName = subscribeEventRequest.FromUserName; response.FromUserName = subscribeEventRequest.ToUserName; return(response); }
public override AbstractResponse OnEvent_ScanRequest(ScanEventRequest scanEventRequest) { string eventKey = scanEventRequest.EventKey; if (eventKey == "1") { if (WeiXinHelper.BindAdminOpenId.Count > 10) { WeiXinHelper.BindAdminOpenId.Clear(); } if (WeiXinHelper.BindAdminOpenId.ContainsKey(scanEventRequest.Ticket)) { WeiXinHelper.BindAdminOpenId[scanEventRequest.Ticket] = scanEventRequest.FromUserName; } else { WeiXinHelper.BindAdminOpenId.Add(scanEventRequest.Ticket, scanEventRequest.FromUserName); } return(new TextResponse { CreateTime = DateTime.Now, Content = "您正在扫描尝试绑定管理员身份,身份已识别", ToUserName = scanEventRequest.FromUserName, FromUserName = scanEventRequest.ToUserName }); } ScanInfos scanInfosByTicket = ScanHelp.GetScanInfosByTicket(scanEventRequest.Ticket); Globals.Debuglog(eventKey + ":" + scanEventRequest.Ticket, "_Debuglog.txt"); bool flag = MemberProcessor.IsExitOpenId(scanEventRequest.FromUserName); if ((!flag && (scanInfosByTicket != null)) && (scanInfosByTicket.BindUserId > 0)) { this.CreatMember(scanEventRequest.FromUserName, scanInfosByTicket.BindUserId); } if (scanInfosByTicket != null) { ScanHelp.updateScanInfosLastActiveTime(DateTime.Now, scanInfosByTicket.Sceneid); } if (flag) { return(new TextResponse { CreateTime = DateTime.Now, Content = "您刚扫描了分销商公众号二维码!", ToUserName = scanEventRequest.FromUserName, FromUserName = scanEventRequest.ToUserName }); } Hidistro.Entities.VShop.ReplyInfo subscribeReply = ReplyHelper.GetSubscribeReply(); if (subscribeReply == null) { return(null); } subscribeReply.Keys = "扫描"; AbstractResponse response = this.GetResponse(subscribeReply, scanEventRequest.FromUserName); response.ToUserName = scanEventRequest.FromUserName; response.FromUserName = scanEventRequest.ToUserName; return(response); }
public override AbstractResponse OnEvent_ScanRequest(ScanEventRequest scanEventRequest) { string eventKey = scanEventRequest.EventKey; if (eventKey == "1") { if (WeiXinHelper.BindAdminOpenId.Count > 10) { WeiXinHelper.BindAdminOpenId.Clear(); } if (WeiXinHelper.BindAdminOpenId.ContainsKey(scanEventRequest.Ticket)) { WeiXinHelper.BindAdminOpenId[scanEventRequest.Ticket] = scanEventRequest.FromUserName; } else { WeiXinHelper.BindAdminOpenId.Add(scanEventRequest.Ticket, scanEventRequest.FromUserName); } return(new TextResponse { CreateTime = System.DateTime.Now, Content = "您正在扫描尝试绑定管理员身份,身份已识别", ToUserName = scanEventRequest.FromUserName, FromUserName = scanEventRequest.ToUserName }); } ScanInfos scanInfosByTicket = ScanHelp.GetScanInfosByTicket(scanEventRequest.Ticket); Globals.Debuglog(eventKey + ":" + scanEventRequest.Ticket, "_Debuglog.txt"); bool flag = MemberProcessor.IsExitOpenId(scanEventRequest.FromUserName); if (!flag && scanInfosByTicket != null && scanInfosByTicket.BindUserId > 0) { this.CreatMember(scanEventRequest.FromUserName, scanInfosByTicket.BindUserId, ""); } if (scanInfosByTicket != null) { ScanHelp.updateScanInfosLastActiveTime(System.DateTime.Now, scanInfosByTicket.Sceneid); } string text = ""; System.Data.DataSet dataSet = new System.Data.DataSet(); string text2 = System.Web.HttpContext.Current.Server.MapPath("/config/WifiConfig.xml"); if (System.IO.File.Exists(text2)) { dataSet.ReadXml(text2); if (dataSet != null && dataSet.Tables.Count > 0) { foreach (System.Data.DataRow dataRow in dataSet.Tables[0].Rows) { if (dataRow["id"].ToString() == eventKey) { text = string.Concat(new string[] { dataRow["WifiDescribe"].ToString(), "\r\nWIFI帐号:", dataRow["WifiName"].ToString(), "\r\n WIFI密码:", dataRow["WifiPwd"].ToString() }); } } } } if (text != "") { return(new TextResponse { CreateTime = System.DateTime.Now, Content = text, ToUserName = scanEventRequest.FromUserName, FromUserName = scanEventRequest.ToUserName }); } if (flag) { return(new TextResponse { CreateTime = System.DateTime.Now, Content = "您刚扫描了分销商公众号二维码!", ToUserName = scanEventRequest.FromUserName, FromUserName = scanEventRequest.ToUserName }); } Hidistro.Entities.VShop.ReplyInfo subscribeReply = ReplyHelper.GetSubscribeReply(); if (subscribeReply == null) { return(null); } subscribeReply.Keys = "扫描"; AbstractResponse response = this.GetResponse(subscribeReply, scanEventRequest.FromUserName); response.ToUserName = scanEventRequest.FromUserName; response.FromUserName = scanEventRequest.ToUserName; return(response); }
public override AbstractResponse OnEvent_SubscribeRequest(SubscribeEventRequest subscribeEventRequest) { string text = ""; MemberProcessor.UpdateUserFollowStateByOpenId(subscribeEventRequest.FromUserName, 1); if (subscribeEventRequest.EventKey != null) { text = subscribeEventRequest.EventKey; } if (text.Contains("qrscene_")) { text = text.Replace("qrscene_", "").Trim(); if (text == "1") { if (WeiXinHelper.BindAdminOpenId.Count > 10) { WeiXinHelper.BindAdminOpenId.Clear(); } if (WeiXinHelper.BindAdminOpenId.ContainsKey(subscribeEventRequest.Ticket)) { WeiXinHelper.BindAdminOpenId[subscribeEventRequest.Ticket] = subscribeEventRequest.FromUserName; } else { WeiXinHelper.BindAdminOpenId.Add(subscribeEventRequest.Ticket, subscribeEventRequest.FromUserName); } return(new TextResponse { CreateTime = System.DateTime.Now, Content = "您正在扫描尝试绑定管理员身份,身份已识别", ToUserName = subscribeEventRequest.FromUserName, FromUserName = subscribeEventRequest.ToUserName }); } ScanInfos scanInfosByTicket = ScanHelp.GetScanInfosByTicket(subscribeEventRequest.Ticket); bool flag = MemberProcessor.IsExitOpenId(subscribeEventRequest.FromUserName); int num = scanInfosByTicket.BindUserId; if (num < 0) { num = 0; } if (!flag && scanInfosByTicket != null) { this.CreatMember(subscribeEventRequest.FromUserName, num, ""); ScanHelp.updateScanInfosLastActiveTime(System.DateTime.Now, scanInfosByTicket.Sceneid); } } else { bool flag2 = MemberProcessor.IsExitOpenId(subscribeEventRequest.FromUserName); Globals.Debuglog("关注公众号1", "_DebuglogConcern.txt"); int num2 = 0; if (num2 < 0) { num2 = 0; } if (!flag2) { Globals.Debuglog("关注公众号生成用户1", "_DebuglogConcern.txt"); this.CreatMember(subscribeEventRequest.FromUserName, num2, ""); } } WeiXinHelper.UpdateRencentOpenID(subscribeEventRequest.FromUserName); string text2 = ""; System.Data.DataSet dataSet = new System.Data.DataSet(); string text3 = System.Web.HttpContext.Current.Server.MapPath("/config/WifiConfig.xml"); if (System.IO.File.Exists(text3)) { dataSet.ReadXml(text3); if (dataSet != null && dataSet.Tables.Count > 0) { foreach (System.Data.DataRow dataRow in dataSet.Tables[0].Rows) { if (dataRow["id"].ToString() == text) { text2 = string.Concat(new string[] { dataRow["WifiDescribe"].ToString(), "\r\nWIFI帐号:", dataRow["WifiName"].ToString(), "\r\n WIFI密码:", dataRow["WifiPwd"].ToString() }); } } } } if (text2 != "") { return(new TextResponse { CreateTime = System.DateTime.Now, Content = text2, ToUserName = subscribeEventRequest.FromUserName, FromUserName = subscribeEventRequest.ToUserName }); } Hidistro.Entities.VShop.ReplyInfo subscribeReply = ReplyHelper.GetSubscribeReply(); if (subscribeReply == null) { return(null); } subscribeReply.Keys = "登录"; AbstractResponse response = this.GetResponse(subscribeReply, subscribeEventRequest.FromUserName); if (response == null) { this.GotoManyCustomerService(subscribeEventRequest); } response.ToUserName = subscribeEventRequest.FromUserName; response.FromUserName = subscribeEventRequest.ToUserName; return(response); }
public override AbstractResponse OnEvent_SubscribeRequest(SubscribeEventRequest subscribeEventRequest) { string eventKey = ""; if (subscribeEventRequest.EventKey != null) { eventKey = subscribeEventRequest.EventKey; } if (eventKey.Contains("qrscene_")) { eventKey = eventKey.Replace("qrscene_", "").Trim(); if (eventKey == "1") { if (WeiXinHelper.BindAdminOpenId.Count > 10) { WeiXinHelper.BindAdminOpenId.Clear(); } if (WeiXinHelper.BindAdminOpenId.ContainsKey(subscribeEventRequest.Ticket)) { WeiXinHelper.BindAdminOpenId[subscribeEventRequest.Ticket] = subscribeEventRequest.FromUserName; } else { WeiXinHelper.BindAdminOpenId.Add(subscribeEventRequest.Ticket, subscribeEventRequest.FromUserName); } return(new TextResponse { CreateTime = DateTime.Now, Content = "您正在扫描尝试绑定管理员身份,身份已识别", ToUserName = subscribeEventRequest.FromUserName, FromUserName = subscribeEventRequest.ToUserName }); } ScanInfos scanInfosByTicket = ScanHelp.GetScanInfosByTicket(subscribeEventRequest.Ticket); bool flag = MemberProcessor.IsExitOpenId(subscribeEventRequest.FromUserName); int bindUserId = scanInfosByTicket.BindUserId; if (bindUserId < 0) { bindUserId = 0; } if (!flag && (scanInfosByTicket != null)) { this.CreatMember(subscribeEventRequest.FromUserName, bindUserId, ""); ScanHelp.updateScanInfosLastActiveTime(DateTime.Now, scanInfosByTicket.Sceneid); } } else { bool flag2 = MemberProcessor.IsExitOpenId(subscribeEventRequest.FromUserName); Globals.Debuglog("关注公众号1", "_DebuglogConcern.txt"); int referralUserId = 0; if (referralUserId < 0) { referralUserId = 0; } if (!flag2) { Globals.Debuglog("关注公众号生成用户1", "_DebuglogConcern.txt"); this.CreatMember(subscribeEventRequest.FromUserName, referralUserId, ""); } } WeiXinHelper.UpdateRencentOpenID(subscribeEventRequest.FromUserName); string str2 = ""; DataSet set = new DataSet(); string path = HttpContext.Current.Server.MapPath("/config/WifiConfig.xml"); if (File.Exists(path)) { set.ReadXml(path); if ((set != null) && (set.Tables.Count > 0)) { foreach (DataRow row in set.Tables[0].Rows) { if (row["id"].ToString() == eventKey) { str2 = row["WifiDescribe"].ToString() + "\r\nWIFI帐号:" + row["WifiName"].ToString() + "\r\n WIFI密码:" + row["WifiPwd"].ToString(); } } } } if (str2 != "") { return(new TextResponse { CreateTime = DateTime.Now, Content = str2, ToUserName = subscribeEventRequest.FromUserName, FromUserName = subscribeEventRequest.ToUserName }); } Hidistro.Entities.VShop.ReplyInfo subscribeReply = ReplyHelper.GetSubscribeReply(); if (subscribeReply == null) { return(null); } subscribeReply.Keys = "登录"; AbstractResponse response = this.GetResponse(subscribeReply, subscribeEventRequest.FromUserName); if (response == null) { this.GotoManyCustomerService(subscribeEventRequest); } response.ToUserName = subscribeEventRequest.FromUserName; response.FromUserName = subscribeEventRequest.ToUserName; return(response); }