Exemple #1
0
        private void replyAction(string FromUserId, string eventType, string textContent, string ActionParam)
        {
            Articles articles = new Articles
            {
                toUserId = FromUserId,
                msgType  = "text",
                text     = new MessageText
                {
                    content = "系统未找到相关信息!"
                }
            };

            if (eventType != "")
            {
                if ("follow".Equals(eventType))
                {
                    if (!string.IsNullOrEmpty(FromUserId))
                    {
                        MemberProcessor.AddFuwuFollowUser(FromUserId);
                    }
                    string aliOHFollowRelayTitle = this.siteSettings.AliOHFollowRelayTitle;
                    Hidistro.Entities.VShop.ReplyInfo subscribeReply = AliFuwuReplyHelper.GetSubscribeReply();
                    if (subscribeReply != null)
                    {
                        if (subscribeReply.MessageType == MessageType.Text)
                        {
                            TextReplyInfo textReplyInfo = subscribeReply as TextReplyInfo;
                            articles.text.content = textReplyInfo.Text;
                        }
                        else if (subscribeReply.ArticleID > 0)
                        {
                            ArticleInfo articleInfo = ArticleHelper.GetArticleInfo(subscribeReply.ArticleID);
                            if (articleInfo != null)
                            {
                                articles = this.GetAlipayArticlesFromArticleInfo(articleInfo, Globals.HostPath(System.Web.HttpContext.Current.Request.Url), FromUserId);
                            }
                            else
                            {
                                articles.text.content = aliOHFollowRelayTitle;
                            }
                        }
                    }
                    else
                    {
                        articles.text.content = aliOHFollowRelayTitle;
                    }
                }
                else if ("unfollow".Equals(eventType))
                {
                    if (!string.IsNullOrEmpty(FromUserId))
                    {
                        MemberProcessor.DelFuwuFollowUser(FromUserId);
                    }
                }
                else if ("click".Equals(eventType))
                {
                    int num = 0;
                    if (ActionParam != "" && int.TryParse(ActionParam, out num) && num > 0)
                    {
                        Hidistro.Entities.VShop.MenuInfo fuwuMenu = VShopHelper.GetFuwuMenu(num);
                        if (fuwuMenu != null)
                        {
                            Hidistro.Entities.VShop.ReplyInfo reply = AliFuwuReplyHelper.GetReply(fuwuMenu.ReplyId);
                            if (reply != null)
                            {
                                ArticleInfo articleInfo2 = ArticleHelper.GetArticleInfo(reply.ArticleID);
                                if (articleInfo2 != null)
                                {
                                    articles = this.GetAlipayArticlesFromArticleInfo(articleInfo2, Globals.HostPath(System.Web.HttpContext.Current.Request.Url), FromUserId);
                                }
                            }
                        }
                    }
                }
                else if ("enter".Equals(eventType))
                {
                    if (!string.IsNullOrEmpty(this.UserInfo))
                    {
                        MemberInfo openIdMember = MemberProcessor.GetOpenIdMember(FromUserId, "fuwu");
                        if (openIdMember != null && openIdMember.AlipayLoginId.StartsWith("FW*"))
                        {
                            JObject jObject       = JsonConvert.DeserializeObject(this.UserInfo) as JObject;
                            string  alipayLoginId = "";
                            string  text          = "";
                            if (jObject["logon_id"] != null)
                            {
                                alipayLoginId = jObject["logon_id"].ToString();
                            }
                            if (jObject["user_name"] != null)
                            {
                                text = jObject["user_name"].ToString();
                            }
                            if (text != "" && text != "")
                            {
                                openIdMember.AlipayLoginId  = alipayLoginId;
                                openIdMember.AlipayUsername = text;
                                MemberProcessor.SetAlipayInfos(openIdMember);
                            }
                        }
                    }
                    if (!ActionParam.Contains("sceneId"))
                    {
                        return;
                    }
                    JObject jObject2 = JsonConvert.DeserializeObject(ActionParam) as JObject;
                    if (jObject2["scene"]["sceneId"] != null)
                    {
                        string text2 = jObject2["scene"]["sceneId"].ToString();
                        if (text2.StartsWith("bind"))
                        {
                            if (AlipayFuwuConfig.BindAdmin.Count > 10)
                            {
                                AlipayFuwuConfig.BindAdmin.Clear();
                            }
                            if (AlipayFuwuConfig.BindAdmin.ContainsKey(text2))
                            {
                                AlipayFuwuConfig.BindAdmin[text2] = FromUserId;
                            }
                            else
                            {
                                AlipayFuwuConfig.BindAdmin.Add(text2, FromUserId);
                            }
                            articles.text.content = "您正在尝试绑定服务窗管理员身份!";
                        }
                    }
                }
            }
            else if (textContent != "")
            {
                articles = null;
                System.Collections.Generic.IList <Hidistro.Entities.VShop.ReplyInfo> replies = AliFuwuReplyHelper.GetReplies(ReplyType.Keys);
                if (replies != null && replies.Count > 0)
                {
                    foreach (Hidistro.Entities.VShop.ReplyInfo current in replies)
                    {
                        if (current != null)
                        {
                            if (current.MatchType == MatchType.Equal && current.Keys == textContent)
                            {
                                if (current.MessageType == MessageType.Text)
                                {
                                    articles = new Articles
                                    {
                                        toUserId = FromUserId,
                                        msgType  = "text",
                                        text     = new MessageText
                                        {
                                            content = ""
                                        }
                                    };
                                    TextReplyInfo textReplyInfo2 = current as TextReplyInfo;
                                    articles.text.content = textReplyInfo2.Text;
                                    break;
                                }
                                if (current.ArticleID > 0)
                                {
                                    ArticleInfo articleInfo3 = ArticleHelper.GetArticleInfo(current.ArticleID);
                                    if (articleInfo3 != null)
                                    {
                                        articles = this.GetAlipayArticlesFromArticleInfo(articleInfo3, Globals.HostPath(System.Web.HttpContext.Current.Request.Url), FromUserId);
                                        if (articles != null)
                                        {
                                            break;
                                        }
                                    }
                                }
                            }
                            if (current.MatchType == MatchType.Like && current.Keys.Contains(textContent))
                            {
                                if (current.MessageType == MessageType.Text)
                                {
                                    articles = new Articles
                                    {
                                        toUserId = FromUserId,
                                        msgType  = "text",
                                        text     = new MessageText
                                        {
                                            content = ""
                                        }
                                    };
                                    TextReplyInfo textReplyInfo3 = current as TextReplyInfo;
                                    articles.text.content = textReplyInfo3.Text;
                                    break;
                                }
                                if (current.ArticleID > 0)
                                {
                                    ArticleInfo articleInfo4 = ArticleHelper.GetArticleInfo(current.ArticleID);
                                    if (articleInfo4 != null)
                                    {
                                        articles = this.GetAlipayArticlesFromArticleInfo(articleInfo4, Globals.HostPath(System.Web.HttpContext.Current.Request.Url), FromUserId);
                                        if (articles != null)
                                        {
                                            break;
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            if (articles == null)
            {
                System.Collections.Generic.IList <Hidistro.Entities.VShop.ReplyInfo> replies2 = AliFuwuReplyHelper.GetReplies(ReplyType.NoMatch);
                if (replies2 != null && replies2.Count > 0)
                {
                    using (System.Collections.Generic.IEnumerator <Hidistro.Entities.VShop.ReplyInfo> enumerator2 = replies2.GetEnumerator())
                    {
                        while (enumerator2.MoveNext())
                        {
                            Hidistro.Entities.VShop.ReplyInfo current2 = enumerator2.Current;
                            if (current2.MessageType == MessageType.Text)
                            {
                                articles = new Articles
                                {
                                    toUserId = FromUserId,
                                    msgType  = "text",
                                    text     = new MessageText
                                    {
                                        content = ""
                                    }
                                };
                                TextReplyInfo textReplyInfo4 = current2 as TextReplyInfo;
                                articles.text.content = textReplyInfo4.Text;
                                break;
                            }
                            if (current2.ArticleID > 0)
                            {
                                ArticleInfo articleInfo5 = ArticleHelper.GetArticleInfo(current2.ArticleID);
                                if (articleInfo5 != null)
                                {
                                    articles = this.GetAlipayArticlesFromArticleInfo(articleInfo5, Globals.HostPath(System.Web.HttpContext.Current.Request.Url), FromUserId);
                                    if (articles != null)
                                    {
                                        break;
                                    }
                                }
                            }
                        }
                        goto IL_674;
                    }
                }
                articles = new Articles
                {
                    toUserId = FromUserId,
                    msgType  = "text",
                    text     = new MessageText
                    {
                        content = "系统未找到相关信息!"
                    }
                };
            }
IL_674:
            AliOHHelper.log(AliOHHelper.CustomSend(articles).Body);
        }
Exemple #2
0
        private void replyAction(string FromUserId, string eventType, string textContent, string ActionParam)
        {
            Articles articles6 = new Articles
            {
                toUserId = FromUserId,
                msgType  = "text"
            };
            MessageText text5 = new MessageText
            {
                content = "系统未找到相关信息!"
            };

            articles6.text = text5;
            Articles articles = articles6;

            if (eventType != "")
            {
                if ("follow".Equals(eventType))
                {
                    if (!string.IsNullOrEmpty(FromUserId))
                    {
                        MemberProcessor.AddFuwuFollowUser(FromUserId);
                    }
                    string aliOHFollowRelayTitle = this.siteSettings.AliOHFollowRelayTitle;
                    Hidistro.Entities.VShop.ReplyInfo subscribeReply = AliFuwuReplyHelper.GetSubscribeReply();
                    if (subscribeReply != null)
                    {
                        if (subscribeReply.MessageType == Hidistro.Entities.VShop.MessageType.Text)
                        {
                            TextReplyInfo info2 = subscribeReply as TextReplyInfo;
                            articles.text.content = info2.Text;
                        }
                        else if (subscribeReply.ArticleID > 0)
                        {
                            ArticleInfo articleInfo = ArticleHelper.GetArticleInfo(subscribeReply.ArticleID);
                            if (articleInfo != null)
                            {
                                articles = this.GetAlipayArticlesFromArticleInfo(articleInfo, Globals.HostPath(HttpContext.Current.Request.Url), FromUserId);
                            }
                            else
                            {
                                articles.text.content = aliOHFollowRelayTitle;
                            }
                        }
                    }
                    else
                    {
                        articles.text.content = aliOHFollowRelayTitle;
                    }
                }
                else if ("unfollow".Equals(eventType))
                {
                    if (!string.IsNullOrEmpty(FromUserId))
                    {
                        MemberProcessor.DelFuwuFollowUser(FromUserId);
                    }
                }
                else if ("click".Equals(eventType))
                {
                    int result = 0;
                    if (((ActionParam != "") && int.TryParse(ActionParam, out result)) && (result > 0))
                    {
                        Hidistro.Entities.VShop.MenuInfo fuwuMenu = VShopHelper.GetFuwuMenu(result);
                        if (fuwuMenu != null)
                        {
                            Hidistro.Entities.VShop.ReplyInfo reply = AliFuwuReplyHelper.GetReply(fuwuMenu.ReplyId);
                            if (reply != null)
                            {
                                ArticleInfo info6 = ArticleHelper.GetArticleInfo(reply.ArticleID);
                                if (info6 != null)
                                {
                                    articles = this.GetAlipayArticlesFromArticleInfo(info6, Globals.HostPath(HttpContext.Current.Request.Url), FromUserId);
                                }
                            }
                        }
                    }
                }
                else if ("enter".Equals(eventType))
                {
                    if (!string.IsNullOrEmpty(this.UserInfo))
                    {
                        MemberInfo openIdMember = MemberProcessor.GetOpenIdMember(FromUserId, "fuwu");
                        if ((openIdMember != null) && openIdMember.AlipayLoginId.StartsWith("FW*"))
                        {
                            JObject obj2 = JsonConvert.DeserializeObject(this.UserInfo) as JObject;
                            string  str2 = "";
                            string  str3 = "";
                            if (obj2["logon_id"] != null)
                            {
                                str2 = obj2["logon_id"].ToString();
                            }
                            if (obj2["user_name"] != null)
                            {
                                str3 = obj2["user_name"].ToString();
                            }
                            if ((str3 != "") && (str3 != ""))
                            {
                                openIdMember.AlipayLoginId  = str2;
                                openIdMember.AlipayUsername = str3;
                                MemberProcessor.SetAlipayInfos(openIdMember);
                            }
                        }
                    }
                    if (!ActionParam.Contains("sceneId"))
                    {
                        return;
                    }
                    JObject obj3 = JsonConvert.DeserializeObject(ActionParam) as JObject;
                    if (obj3["scene"]["sceneId"] != null)
                    {
                        string key = obj3["scene"]["sceneId"].ToString();
                        if (key.StartsWith("bind"))
                        {
                            if (AlipayFuwuConfig.BindAdmin.Count > 10)
                            {
                                AlipayFuwuConfig.BindAdmin.Clear();
                            }
                            if (AlipayFuwuConfig.BindAdmin.ContainsKey(key))
                            {
                                AlipayFuwuConfig.BindAdmin[key] = FromUserId;
                            }
                            else
                            {
                                AlipayFuwuConfig.BindAdmin.Add(key, FromUserId);
                            }
                            articles.text.content = "您正在尝试绑定服务窗管理员身份!";
                        }
                    }
                }
            }
            else if (textContent != "")
            {
                articles = null;
                IList <Hidistro.Entities.VShop.ReplyInfo> replies = AliFuwuReplyHelper.GetReplies(ReplyType.Keys);
                if ((replies != null) && (replies.Count > 0))
                {
                    foreach (Hidistro.Entities.VShop.ReplyInfo info8 in replies)
                    {
                        if (info8 != null)
                        {
                            if ((info8.MatchType == MatchType.Equal) && (info8.Keys == textContent))
                            {
                                if (info8.MessageType == Hidistro.Entities.VShop.MessageType.Text)
                                {
                                    Articles articles2 = new Articles
                                    {
                                        toUserId = FromUserId,
                                        msgType  = "text"
                                    };
                                    MessageText text = new MessageText
                                    {
                                        content = ""
                                    };
                                    articles2.text = text;
                                    articles       = articles2;
                                    TextReplyInfo info9 = info8 as TextReplyInfo;
                                    articles.text.content = info9.Text;
                                    break;
                                }
                                if (info8.ArticleID > 0)
                                {
                                    ArticleInfo info10 = ArticleHelper.GetArticleInfo(info8.ArticleID);
                                    if (info10 != null)
                                    {
                                        articles = this.GetAlipayArticlesFromArticleInfo(info10, Globals.HostPath(HttpContext.Current.Request.Url), FromUserId);
                                        if (articles != null)
                                        {
                                            break;
                                        }
                                    }
                                }
                            }
                            if ((info8.MatchType == MatchType.Like) && info8.Keys.Contains(textContent))
                            {
                                if (info8.MessageType == Hidistro.Entities.VShop.MessageType.Text)
                                {
                                    Articles articles3 = new Articles
                                    {
                                        toUserId = FromUserId,
                                        msgType  = "text"
                                    };
                                    MessageText text2 = new MessageText
                                    {
                                        content = ""
                                    };
                                    articles3.text = text2;
                                    articles       = articles3;
                                    TextReplyInfo info11 = info8 as TextReplyInfo;
                                    articles.text.content = info11.Text;
                                    break;
                                }
                                if (info8.ArticleID > 0)
                                {
                                    ArticleInfo info12 = ArticleHelper.GetArticleInfo(info8.ArticleID);
                                    if (info12 != null)
                                    {
                                        articles = this.GetAlipayArticlesFromArticleInfo(info12, Globals.HostPath(HttpContext.Current.Request.Url), FromUserId);
                                        if (articles != null)
                                        {
                                            break;
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            if (articles == null)
            {
                IList <Hidistro.Entities.VShop.ReplyInfo> list2 = AliFuwuReplyHelper.GetReplies(ReplyType.NoMatch);
                if ((list2 != null) && (list2.Count > 0))
                {
                    foreach (Hidistro.Entities.VShop.ReplyInfo info13 in list2)
                    {
                        if (info13.MessageType == Hidistro.Entities.VShop.MessageType.Text)
                        {
                            Articles articles4 = new Articles
                            {
                                toUserId = FromUserId,
                                msgType  = "text"
                            };
                            MessageText text3 = new MessageText
                            {
                                content = ""
                            };
                            articles4.text = text3;
                            articles       = articles4;
                            TextReplyInfo info14 = info13 as TextReplyInfo;
                            articles.text.content = info14.Text;
                            break;
                        }
                        if (info13.ArticleID > 0)
                        {
                            ArticleInfo info15 = ArticleHelper.GetArticleInfo(info13.ArticleID);
                            if (info15 != null)
                            {
                                articles = this.GetAlipayArticlesFromArticleInfo(info15, Globals.HostPath(HttpContext.Current.Request.Url), FromUserId);
                                if (articles != null)
                                {
                                    break;
                                }
                            }
                        }
                    }
                }
                else
                {
                    Articles articles5 = new Articles
                    {
                        toUserId = FromUserId,
                        msgType  = "text"
                    };
                    MessageText text4 = new MessageText
                    {
                        content = "系统未找到相关信息!"
                    };
                    articles5.text = text4;
                    articles       = articles5;
                }
            }
            AliOHHelper.log(AliOHHelper.CustomSend(articles).Body);
        }