Ejemplo n.º 1
0
        /// <summary>
        /// 被动回复
        /// </summary>
        /// <param name="msg"></param>
        /// <param name="user"></param>
        /// <param name="msgType"></param>
        /// <returns></returns>
        public static string PassiveRecovery(XMLModel model)
        {
            Passive Reply = new Passive {
                Content = model.Content, FromUserName = model.ToUserName, ToUserName = model.FromUserName
            };

            return(Reply.ToString());
        }
Ejemplo n.º 2
0
        public string WatchEvent(XMLModel model)
        {
            switch (model.Event)
            {
            case "subscribe":
                RedisUtil.Instance.HashSet("WatchUser", model.FromUserName, JsonConvert.SerializeObject(new { NickName = "", WatchTime = model.CreateTime }));
                BaseD.UserList.Clear();
                Common.WriteLog($"{model.FromUserName} 关注了你");
                Passive Reply = new Passive {
                    Content = "您好!欢迎关注,有什么需求可以留言", FromUserName = model.ToUserName, ToUserName = model.FromUserName
                };
                return(Reply.ToString());

            case "unsubscribe":
                RedisUtil.Instance.RemoveHashItem("WatchUser", model.FromUserName);
                BaseD.UserList.Clear();
                Common.WriteLog($"{model.FromUserName} 取消关注了你");
                return("");

            default:
                return("");
            }
        }