Esempio n. 1
0
        //取消关注事件
        public override AbstractResponse OnEvent_UnSubscribeRequest(UnSubscribeEventRequest unsubscribeEventRequest)
        {
            //string[] arrayEventKey = unsubscribeEventRequest.EventKey.Split('_');

            //爽爽挝啡需求,取消关注减少粉丝数(网aspnet_storefans表内插入一个subscribetype为1的数据,取消关注)
            try
            {
                //获取取消关注用户的openid
                string     openid      = unsubscribeEventRequest.FromUserName;
                MemberInfo unSubMember = MemberProcessor.GetOpenIdMember(openid);
                //插入取消关注数据
                if (unSubMember != null)
                {
                    ManagerHelper.addStoreFansCount(-1, unSubMember.UserId, 1);
                }
                //ManagerHelper.addStoreFansCount(storeId.ToInt(), member.UserId,1);
            }
            catch (Exception ex)
            {
                WriteLog("取消关注异常:" + ex.Message);
            }


            return(null);
        }
Esempio n. 2
0
        public override AbstractResponse OnEvent_UnSubscribeRequest(UnSubscribeEventRequest unSubscribeEventRequest)
        {
            string fromUserName = unSubscribeEventRequest.FromUserName;

            Globals.Debuglog("取消关注:" + fromUserName, "_DebugUnSubscribeEventRequestlog.txt");
            MemberProcessor.UpdateUserFollowStateByOpenId(fromUserName, 0);
            return(this.DefaultResponse(unSubscribeEventRequest));
        }
Esempio n. 3
0
        public override AbstractResponse OnEvent_UnSubscribeRequest(UnSubscribeEventRequest unSubscribeEventRequest)
        {
            string fromUserName = unSubscribeEventRequest.FromUserName;

            try
            {
                MemberProcessor.UpdateWXUserIsSubscribeStatus(fromUserName, false);
            }
            catch (Exception ex)
            {
                IDictionary <string, string> dictionary = new Dictionary <string, string>();
                dictionary.Add("openId", fromUserName);
                Globals.WriteExceptionLog(ex, dictionary, "UpdateWXUserIsSubscribeStatus");
            }
            return(base.OnEvent_UnSubscribeRequest(unSubscribeEventRequest));
        }
Esempio n. 4
0
 public virtual AbstractResponse OnEvent_UnSubscribeRequest(UnSubscribeEventRequest unSubscribeEventRequest)
 {
     return(this.DefaultResponse(unSubscribeEventRequest));
 }
Esempio n. 5
0
        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)
        {
            RequestMsgType  msgType     = MsgTypeHelper.GetMsgType(doc);
            AbstractRequest textRequest = null;

            switch (msgType)
            {
            case RequestMsgType.Text:
            {
                textRequest = new TextRequest();
                break;
            }

            case RequestMsgType.Image:
            {
                textRequest = new ImageRequest();
                break;
            }

            case RequestMsgType.Voice:
            {
                textRequest = new VoiceRequest();
                break;
            }

            case RequestMsgType.Video:
            {
                textRequest = new VideoRequest();
                break;
            }

            case RequestMsgType.Location:
            {
                textRequest = new LocationRequest();
                break;
            }

            case RequestMsgType.Link:
            {
                textRequest = new LinkRequest();
                break;
            }

            case RequestMsgType.Event:
            {
                switch (EventTypeHelper.GetEventType(doc))
                {
                case RequestEventType.Subscribe:
                {
                    textRequest = new SubscribeEventRequest();
                    break;
                }

                case RequestEventType.UnSubscribe:
                {
                    textRequest = new UnSubscribeEventRequest();
                    break;
                }

                case RequestEventType.Scan:
                {
                    textRequest = new ScanEventRequest();
                    break;
                }

                case RequestEventType.Location:
                {
                    textRequest = new LocationEventRequest();
                    break;
                }

                case RequestEventType.Click:
                {
                    textRequest = new ClickEventRequest();
                    break;
                }

                default:
                {
                    throw new ArgumentOutOfRangeException();
                }
                }
                break;
            }

            default:
            {
                throw new ArgumentOutOfRangeException();
            }
            }
            EntityHelper.FillEntityWithXml <AbstractRequest>(textRequest, doc);
            return(textRequest);

            throw new ArgumentOutOfRangeException();
        }
Esempio n. 7
0
        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_00C5;

                case RequestEventType.UnSubscribe:
                    entity = new UnSubscribeEventRequest();
                    goto Label_00C5;

                case RequestEventType.Scan:
                    entity = new ScanEventRequest();
                    goto Label_00C5;

                case RequestEventType.Location:
                    entity = new LocationEventRequest();
                    goto Label_00C5;

                case RequestEventType.Click:
                    entity = new ClickEventRequest();
                    goto Label_00C5;
                }
                throw new ArgumentOutOfRangeException();

            default:
                throw new ArgumentOutOfRangeException();
            }
Label_00C5:
            EntityHelper.FillEntityWithXml <AbstractRequest>(entity, doc);
            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;

                default:
                    throw new ArgumentOutOfRangeException();
                }
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
            EntityHelper.FillEntityWithXml <AbstractRequest>(abstractRequest, doc);
            return(abstractRequest);
        }
Esempio n. 9
0
        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);
        }
Esempio n. 10
0
        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;
        }