public override AbstractResponse OnEvent_MassendJobFinishEventRequest(MassendJobFinishEventRequest massendJobFinishEventRequest) { string returnjsondata = string.Concat(new object[] { "公众号的微信号(加密的):", massendJobFinishEventRequest.ToUserName, ",发送完成时间:", massendJobFinishEventRequest.CreateTime, ",过滤通过条数:", massendJobFinishEventRequest.FilterCount, ",发送失败的粉丝数:", massendJobFinishEventRequest.ErrorCount }); switch (massendJobFinishEventRequest.Status) { case "send success": returnjsondata = returnjsondata + "(发送成功)"; break; case "send fail": returnjsondata = returnjsondata + "(发送失败)"; break; case "err(10001)": returnjsondata = returnjsondata + "(涉嫌广告)"; break; case "err(20001)": returnjsondata = returnjsondata + "(涉嫌政治)"; break; case "err(20004)": returnjsondata = returnjsondata + "(涉嫌社会)"; break; case "err(20002)": returnjsondata = returnjsondata + "(涉嫌色情)"; break; case "err(20006)": returnjsondata = returnjsondata + "(涉嫌违法犯罪)"; break; case "err(20008)": returnjsondata = returnjsondata + "(涉嫌欺诈)"; break; case "err(20013)": returnjsondata = returnjsondata + "(涉嫌版权)"; break; case "err(22000)": returnjsondata = returnjsondata + "(涉嫌互相宣传)"; break; case "err(21000)": returnjsondata = returnjsondata + "(涉嫌其他)"; break; default: returnjsondata = returnjsondata + "(" + massendJobFinishEventRequest.Status + ")"; break; } WeiXinHelper.UpdateMsgId(0, massendJobFinishEventRequest.MsgId.ToString(), (massendJobFinishEventRequest.Status == "send success") ? 1 : 2, Globals.ToNum(massendJobFinishEventRequest.SentCount), Globals.ToNum(massendJobFinishEventRequest.TotalCount), returnjsondata); return(null); }
public virtual AbstractResponse OnEvent_MassendJobFinishEventRequest(MassendJobFinishEventRequest massendJobFinishEventRequest) { return(this.DefaultResponse(massendJobFinishEventRequest)); }
public override AbstractResponse OnEvent_MassendJobFinishEventRequest(MassendJobFinishEventRequest massendJobFinishEventRequest) { AbstractResponse result = null; string text = string.Concat(new object[] { "公众号的微信号(加密的):", massendJobFinishEventRequest.ToUserName, ",发送完成时间:", massendJobFinishEventRequest.CreateTime, ",过滤通过条数:", massendJobFinishEventRequest.FilterCount, ",发送失败的粉丝数:", massendJobFinishEventRequest.ErrorCount }); string status; switch (status = massendJobFinishEventRequest.Status) { case "send success": text += "(发送成功)"; goto IL_20C; case "send fail": text += "(发送失败)"; goto IL_20C; case "err(10001)": text += "(涉嫌广告)"; goto IL_20C; case "err(20001)": text += "(涉嫌政治)"; goto IL_20C; case "err(20004)": text += "(涉嫌社会)"; goto IL_20C; case "err(20002)": text += "(涉嫌色情)"; goto IL_20C; case "err(20006)": text += "(涉嫌违法犯罪)"; goto IL_20C; case "err(20008)": text += "(涉嫌欺诈)"; goto IL_20C; case "err(20013)": text += "(涉嫌版权)"; goto IL_20C; case "err(22000)": text += "(涉嫌互相宣传)"; goto IL_20C; case "err(21000)": text += "(涉嫌其他)"; goto IL_20C; } text = text + "(" + massendJobFinishEventRequest.Status + ")"; IL_20C: WeiXinHelper.UpdateMsgId(0, massendJobFinishEventRequest.MsgId.ToString(), (massendJobFinishEventRequest.Status == "send success") ? 1 : 2, Globals.ToNum(massendJobFinishEventRequest.SentCount), Globals.ToNum(massendJobFinishEventRequest.TotalCount), text); return(result); }
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)) { case RequestEventType.Subscribe: entity = new SubscribeEventRequest(); goto Label_00D7; case RequestEventType.UnSubscribe: entity = new UnSubscribeEventRequest(); goto Label_00D7; case RequestEventType.Scan: entity = new ScanEventRequest(); goto Label_00D7; case RequestEventType.Location: entity = new LocationEventRequest(); goto Label_00D7; case RequestEventType.Click: entity = new ClickEventRequest(); goto Label_00D7; case RequestEventType.MASSSENDJOBFINISH: entity = new MassendJobFinishEventRequest(); goto Label_00D7; } throw new ArgumentOutOfRangeException(); default: throw new ArgumentOutOfRangeException(); } Label_00D7: EntityHelper.FillEntityWithXml <AbstractRequest>(entity, doc); Regex regex = 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); }
public static AbstractRequest GetRequestEntity(XDocument doc) { AbstractRequest abstractRequest; switch (MsgTypeHelper.GetMsgType(doc)) { case RequestMsgType.Text: abstractRequest = new TextRequest(); break; case RequestMsgType.Image: abstractRequest = new ImageRequest(); break; case RequestMsgType.Voice: abstractRequest = new VoiceRequest(); break; case RequestMsgType.Video: abstractRequest = new VideoRequest(); break; case RequestMsgType.Location: abstractRequest = new LocationRequest(); break; case RequestMsgType.Link: abstractRequest = new LinkRequest(); break; case RequestMsgType.Event: switch (EventTypeHelper.GetEventType(doc)) { case RequestEventType.Subscribe: abstractRequest = new SubscribeEventRequest(); break; case RequestEventType.UnSubscribe: abstractRequest = new UnSubscribeEventRequest(); break; case RequestEventType.Scan: abstractRequest = new ScanEventRequest(); break; case RequestEventType.Location: abstractRequest = new LocationEventRequest(); break; case RequestEventType.Click: abstractRequest = new ClickEventRequest(); break; case RequestEventType.MASSSENDJOBFINISH: abstractRequest = new MassendJobFinishEventRequest(); break; default: throw new ArgumentOutOfRangeException(); } break; default: throw new ArgumentOutOfRangeException(); } EntityHelper.FillEntityWithXml <AbstractRequest>(abstractRequest, doc); Regex regex = new Regex("<MsgID>(?<url>\\d+)</MsgID>"); if (abstractRequest.MsgId == 0L) { Match match = Regex.Match(doc.Root.ToString(), "<MsgID>(?<msgid>\\d+)</MsgID>", RegexOptions.IgnoreCase); if (match.Success) { abstractRequest.MsgId = long.Parse(match.Groups["msgid"].Value); abstractRequest.CreateTime = DateTime.Now; } } return(abstractRequest); }
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; }