Exemplo n.º 1
0
        internal static Replier Create(RequestData data)
        {
            var msg = data.ConvertBodyTo <PushObject>();

            if (msg == null)
            {
                return(null);
            }
            var reply = new Replier(msg.ToUserName, msg.FromUserName, data.Response);

            return(reply);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 处理微信推送的消息
        /// </summary>
        /// <param name="data"></param>
        private void ReceiveDataHandle(RequestData data)
        {
            var receiveInfo = data.ConvertBodyTo <EventArgsBase>();

            if (receiveInfo == null)
            {
                return;
            }

            var msgType   = Enums.GetInstance <MessageType>(receiveInfo.MsgType);
            var eventType = Enums.GetInstance(receiveInfo.Event, ReceiveEventType.None);

            var action = handlerList[msgType, eventType];

            if (action == null)
            {
                PassReply(data);
            }
            else
            {
                action.Invoke(data);
            }
        }