public virtual AbstractResponse OnEvent_ViewRequest(ViewEventRequest viewEventRequest) { return(this.DefaultResponse(viewEventRequest)); }
public override AbstractResponse OnEvent_ViewRequest(ViewEventRequest viewEventRequest) { ScanVisitDistributor(viewEventRequest, viewEventRequest.EventKey); return(null); }
public static AbstractRequest GetRequestEntity(XDocument doc) { RequestMsgType msgType = MsgTypeHelper.GetMsgType(doc); AbstractRequest entity = null; // System.IO.File.AppendAllText(@"E:\home\LocalUser\580442\www\humowang\api\type.txt", "msgType:" + msgType + "\r\n"); switch (msgType) { case RequestMsgType.Text: { entity = new TextRequest(); break; } case RequestMsgType.Image: { entity = new ImageRequest(); break; } case RequestMsgType.Voice: { entity = new VoiceRequest(); break; } case RequestMsgType.Video: { entity = new VideoRequest(); break; } case RequestMsgType.Location: { entity = new LocationRequest(); break; } case RequestMsgType.Link: { entity = new LinkRequest(); break; } case RequestMsgType.Event: { switch (EventTypeHelper.GetEventType(doc)) { case RequestEventType.Subscribe: { entity = new SubscribeEventRequest(); //goto Label_00C5; break; } case RequestEventType.UnSubscribe: { entity = new UnSubscribeEventRequest(); //goto Label_00C5; break; } case RequestEventType.Scan: { entity = new ScanEventRequest(); // goto Label_00C5; break; } case RequestEventType.Location: { entity = new LocationEventRequest(); // goto Label_00C5; break; } case RequestEventType.Click: { entity = new ClickEventRequest(); // goto Label_00C5; break; } case RequestEventType.VIEW: { entity = new ViewEventRequest(); break; } default: { throw new ArgumentOutOfRangeException(); // break; } } break; } default: { throw new ArgumentOutOfRangeException(); } } //Label_00C5: EntityHelper.FillEntityWithXml <AbstractRequest>(entity, doc); return(entity); }
public static AbstractRequest GetRequestEntity(XDocument doc) { RequestMsgType msgType = MsgTypeHelper.GetMsgType(doc); AbstractRequest entity = null; switch (msgType) { case RequestMsgType.Text: entity = new TextRequest(); break; case RequestMsgType.Image: entity = new ImageRequest(); break; case RequestMsgType.Voice: entity = new VoiceRequest(); break; case RequestMsgType.Video: entity = new VideoRequest(); break; case RequestMsgType.Location: entity = new LocationRequest(); break; case RequestMsgType.Link: entity = new LinkRequest(); break; case RequestMsgType.Event: //switch (EventTypeHelper.GetEventType(doc)) switch (doc.Root.Element("Event").Value.ToUpper()) { //case RequestEventType.Subscribe: case "SUBSCRIBE"://订阅(关注) entity = new SubscribeEventRequest(); goto Label_00D1; //case RequestEventType.UnSubscribe: case "UNSUBSCRIBE"://取消订阅(关注) entity = new UnSubscribeEventRequest(); goto Label_00D1; //case RequestEventType.Scan: case "SCAN"://二维码扫描 entity = new ScanEventRequest(); goto Label_00D1; //case RequestEventType.Location: case "LOCATION"://地理位置 entity = new LocationEventRequest(); goto Label_00D1; //case RequestEventType.Click: case "CLICK"://菜单点击 entity = new ClickEventRequest(); goto Label_00D1; //case RequestEventType.MASSSENDJOBFINISH: case "MASSSENDJOBFINISH": entity = new MassendJobFinishEventRequest(); goto Label_00D1; case "VIEW": entity = new ViewEventRequest(); goto Label_00D1; //default://其他意外类型(也可以选择抛出异常) // entity = new AbstractRequest(); // goto Label_00D1; } throw new ArgumentOutOfRangeException(); default: throw new ArgumentOutOfRangeException(); } Label_00D1: //EntityHelper.FillEntityWithXml<AbstractRequest>(entity, doc); //修改无法解析完整数据 2017.7.4 EntityHelper.FillEntityWithXml(entity, doc); new Regex(@"<MsgID>(?<url>\d+)</MsgID>"); if (entity.MsgId == 0L) { Match match = Regex.Match(doc.Root.ToString(), @"<MsgID>(?<msgid>\d+)</MsgID>", RegexOptions.IgnoreCase); if (match.Success) { entity.MsgId = long.Parse(match.Groups["msgid"].Value); entity.CreateTime = DateTime.Now; } } return entity; }