/// <summary> /// 事件消息处理 /// </summary> /// <param name="msg"></param> /// <returns></returns> public IMessageHandler MessageRole(HandleMessage msg) { Dictionary<string, object> bugobj = new Dictionary<string, object>(); try { if (msg == null) { throw new ArgumentException("msg is null"); } var eventType = (Event)Enum.Parse(typeof(Event), msg.Element.Element("Event").Value, true); IMessageHandler imessageHandler = null; switch (eventType) { case Event.Subscribe: imessageHandler = new SubScribeEventMessageHandler(msg); break; case Event.Unsubscribe: imessageHandler = new UnSubScribeEventMessageHandler(msg); break; case Event.Scan: imessageHandler = new ScanEventMessageHandler(msg); break; case Event.Location: break; case Event.Click: imessageHandler = new ClickEventMessageHandler(msg); break; case Event.MASSSENDJOBFINISH: break; case Event.View: imessageHandler = new ViewEventMessageHandler(msg); break; case Event.Merchant_Order: break; case Event.TEMPLATESENDJOBFINISH: break; default: imessageHandler = new DefaultMessageHandler(msg); break; } return imessageHandler; } catch (Exception ex) { TxtLogHelper.WriteLog_Day(new TxtLogInfoObject() { LogType = EnumLogType.Error, LogMessage = string.Format("错误信息{0};堆栈信息{1}", ex.Message, ex.StackTrace), }); } finally { TxtLogHelper.WriteDebugLog(bugobj); } return new DefaultMessageHandler(msg); }
/// <summary> /// 事件消息处理 /// </summary> /// <param name="msg"></param> /// <returns></returns> public IMessageHandler MessageRole(HandleMessage msg) { Dictionary <string, object> bugobj = new Dictionary <string, object>(); try { if (msg == null) { throw new ArgumentException("msg is null"); } var eventType = (Event)Enum.Parse(typeof(Event), msg.Element.Element("Event").Value, true); IMessageHandler imessageHandler = null; switch (eventType) { case Event.Subscribe: imessageHandler = new SubScribeEventMessageHandler(msg); break; case Event.Unsubscribe: imessageHandler = new UnSubScribeEventMessageHandler(msg); break; case Event.Scan: imessageHandler = new ScanEventMessageHandler(msg); break; case Event.Location: break; case Event.Click: imessageHandler = new ClickEventMessageHandler(msg); break; case Event.MASSSENDJOBFINISH: break; case Event.View: imessageHandler = new ViewEventMessageHandler(msg); break; case Event.Merchant_Order: break; case Event.TEMPLATESENDJOBFINISH: break; default: imessageHandler = new DefaultMessageHandler(msg); break; } return(imessageHandler); } catch (Exception ex) { TxtLogHelper.WriteLog_Day(new TxtLogInfoObject() { LogType = EnumLogType.Error, LogMessage = string.Format("错误信息{0};堆栈信息{1}", ex.Message, ex.StackTrace), }); } finally { TxtLogHelper.WriteDebugLog(bugobj); } return(new DefaultMessageHandler(msg)); }