private void BindArticleCategory() { List <Hidistro.Entities.VShop.ReplyInfo> list = AliFuwuReplyHelper.GetAllReply().ToList <Hidistro.Entities.VShop.ReplyInfo>().FindAll(a => a.ReplyType < ReplyType.Wheel); this.rptList.DataSource = list; this.rptList.DataBind(); }
protected void rptList_ItemCommand(object source, System.Web.UI.WebControls.RepeaterCommandEventArgs e) { int num = Globals.ToNum(e.CommandArgument.ToString()); if (e.CommandName == "Delete") { AliFuwuReplyHelper.DeleteReply(num); this.BindArticleCategory(); this.ShowMsg("删除成功!", true); return; } if (e.CommandName == "Release") { AliFuwuReplyHelper.UpdateReplyRelease(num); base.Response.Redirect(System.Web.HttpContext.Current.Request.Url.ToString(), true); return; } if (e.CommandName == "Edit") { Hidistro.Entities.VShop.ReplyInfo reply = AliFuwuReplyHelper.GetReply(num); if (reply != null) { switch (reply.MessageType) { case MessageType.Text: base.Response.Redirect(string.Format("replyedit.aspx?id={0}", num)); break; case MessageType.News: base.Response.Redirect(string.Format("replyedit.aspx?id={0}", num)); return; case (MessageType)3: break; case MessageType.List: base.Response.Redirect(string.Format("replyedit.aspx?id={0}", num)); return; default: return; } } } }
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); }
protected string GetTitleShow(object messagetypename, object articleid, object responseid) { string text = string.Empty; int num = Globals.ToNum(articleid); int id = Globals.ToNum(responseid); string a; if ((a = messagetypename.ToString()) != null) { if (!(a == "多图文")) { if (!(a == "单图文")) { if (a == "文本") { TextReplyInfo textReplyInfo = AliFuwuReplyHelper.GetReply(id) as TextReplyInfo; if (textReplyInfo != null) { text = textReplyInfo.Text; text = System.Text.RegularExpressions.Regex.Replace(text, "<[^>]+>", ""); text = System.Text.RegularExpressions.Regex.Replace(text, "&[^;]+;", ""); text = Globals.SubStr(text, 100, "..."); if (string.IsNullOrEmpty(text) && textReplyInfo.Text.Contains("<img ")) { text = "<span style='color:green;'>图文内容</span>"; } } } } else if (num > 0) { ArticleInfo articleInfo = ArticleHelper.GetArticleInfo(num); if (articleInfo != null) { int num2 = 1; text = string.Concat(new object[] { "<p>[<span style='color:green;'>图文", num2, "</span>] ", Globals.SubStr(articleInfo.Title, 40, "..."), "</p>" }); } } else { NewsReplyInfo newsReplyInfo = AliFuwuReplyHelper.GetReply(id) as NewsReplyInfo; if (newsReplyInfo != null) { System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder(); if (newsReplyInfo.NewsMsg != null && newsReplyInfo.NewsMsg.Count > 0) { int num3 = 0; foreach (NewsMsgInfo current in newsReplyInfo.NewsMsg) { num3++; stringBuilder.Append(string.Concat(new object[] { "<p>[<span style='color:green;'>图文", num3, "</span>] ", Globals.SubStr(current.Title, 40, "..."), "</p>" })); } } text = stringBuilder.ToString(); } } } else { if (num > 0) { ArticleInfo articleInfo2 = ArticleHelper.GetArticleInfo(num); if (articleInfo2 == null) { return(text); } int num4 = 1; text = string.Concat(new object[] { "<p>[<span style='color:green;'>图文", num4, "</span>] ", Globals.SubStr(articleInfo2.Title, 40, "..."), "</p>" }); if (articleInfo2.ItemsInfo == null) { return(text); } using (System.Collections.Generic.IEnumerator <ArticleItemsInfo> enumerator2 = articleInfo2.ItemsInfo.GetEnumerator()) { while (enumerator2.MoveNext()) { ArticleItemsInfo current2 = enumerator2.Current; num4++; object obj = text; text = string.Concat(new object[] { obj, "<p>[<span style='color:green;'>图文", num4, "</span>] ", Globals.SubStr(current2.Title, 40, "..."), "</p>" }); } return(text); } } NewsReplyInfo newsReplyInfo2 = AliFuwuReplyHelper.GetReply(id) as NewsReplyInfo; if (newsReplyInfo2 != null) { System.Text.StringBuilder stringBuilder2 = new System.Text.StringBuilder(); if (newsReplyInfo2.NewsMsg != null && newsReplyInfo2.NewsMsg.Count > 0) { int num5 = 0; foreach (NewsMsgInfo current3 in newsReplyInfo2.NewsMsg) { num5++; stringBuilder2.Append(string.Concat(new object[] { "<p>[<span style='color:green;'>图文", num5, "</span>] ", Globals.SubStr(current3.Title, 40, "..."), "</p>" })); } } text = stringBuilder2.ToString(); } } } return(text); }
private void BindArticleCategory() { System.Collections.Generic.List <Hidistro.Entities.VShop.ReplyInfo> dataSource = AliFuwuReplyHelper.GetAllReply().ToList <Hidistro.Entities.VShop.ReplyInfo>().FindAll((Hidistro.Entities.VShop.ReplyInfo a) => a.ReplyType < ReplyType.Wheel); this.rptList.DataSource = dataSource; this.rptList.DataBind(); }
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); }
protected void btnSave_Click(object sender, EventArgs e) { NewsReplyInfo info; int num = Globals.ToNum(this.hdfMessageType.Value); int articleIDByOldArticle = Globals.ToNum(this.hdfArticleID.Value); MessageType msgtype = (MessageType)num; int num3 = Globals.ToNum(this.rbtlMatchType.SelectedValue); if (string.IsNullOrEmpty(this.txtKeys.Text.Trim()) && (this.type != "subscribe")) { this.ShowMsg("请输入关键词!", false); return; } if (this.txtKeys.Text.Trim().Length > 50) { this.ShowMsg("关键词必须少于50个字!", false); return; } if (num3 == 0) { this.ShowMsg("请选择匹配类型!", false); return; } if ((articleIDByOldArticle < 1) && (msgtype != MessageType.Text)) { if (this.hdfIsOldArticle.Value == "0") { this.ShowMsg("请先选择图文!", false); return; } if (this.replyID > 0) { articleIDByOldArticle = AliFuwuReplyHelper.GetArticleIDByOldArticle(this.replyID, msgtype); } } switch (msgtype) { case MessageType.Text: if (this.fkContent.Text.Length <= 0x3e8) { TextReplyInfo reply = new TextReplyInfo { Keys = this.txtKeys.Text.Trim(), MatchType = (num3 == 2) ? MatchType.Equal : MatchType.Like }; if (reply.Keys == "*") { reply.ReplyType = ReplyType.NoMatch; if (AliFuwuReplyHelper.GetNoMatchReplyID(this.replyID) > 0) { this.ShowMsg("无关键字回复回复内容已存在!", false); return; } } else if (this.type == "subscribe") { if (AliFuwuReplyHelper.GetSubscribeID(this.replyID) > 0) { this.ShowMsg("首次关注回复内容已存在!", false); return; } reply.ReplyType = ReplyType.Subscribe; reply.Keys = ""; } else { reply.ReplyType = ReplyType.Keys; if (AliFuwuReplyHelper.HasReplyKey(reply.Keys, this.replyID)) { this.ShowMsg("该关键词已存在!", false); return; } } reply.MessageType = msgtype; reply.IsDisable = false; reply.ArticleID = articleIDByOldArticle; string str = Regex.Replace(Regex.Replace(this.fkContent.Text, "</?([^>^a^p]*)>", ""), "<img([^>]*)>", "").Replace("<p>", "").Replace("</p>", "\r").Trim(new char[] { '\r' }).Replace("\r", "\r\n"); reply.Text = str; reply.Id = this.replyID; if (string.IsNullOrEmpty(reply.Text)) { this.ShowMsg("请填写文本内容!", false); return; } if (this.replyID > 0) { AliFuwuReplyHelper.UpdateReply(reply); } else { AliFuwuReplyHelper.SaveReply(reply); } goto Label_0406; } this.ShowMsg("回复内容必须1000字以内!", false); return; case MessageType.News: case MessageType.List: info = new NewsReplyInfo { Keys = this.txtKeys.Text.Trim(), MatchType = (num3 == 2) ? MatchType.Equal : MatchType.Like }; if (!(info.Keys == "*")) { if (this.type == "subscribe") { info.ReplyType = ReplyType.Subscribe; info.Keys = ""; if (AliFuwuReplyHelper.GetSubscribeID(this.replyID) > 0) { this.ShowMsg("首次关注回复已存在!", false); return; } } else { info.ReplyType = ReplyType.Keys; if (AliFuwuReplyHelper.HasReplyKey(info.Keys, this.replyID)) { this.ShowMsg("该关键词已存在!", false); return; } } break; } info.ReplyType = ReplyType.NoMatch; if (AliFuwuReplyHelper.GetNoMatchReplyID(this.replyID) <= 0) { break; } this.ShowMsg("无关键词回复已存在!", false); return; default: goto Label_0406; } info.MessageType = msgtype; info.IsDisable = false; info.ArticleID = articleIDByOldArticle; info.Id = this.replyID; if (num3 < 1) { this.ShowMsg("请选择类型!", false); return; } if (this.replyID > 0) { AliFuwuReplyHelper.UpdateReply(info); } else { AliFuwuReplyHelper.SaveReply(info); } Label_0406: if (this.replyID > 0) { this.ShowMsgAndReUrl("自动回复修改成功!", true, "replyonkey.aspx"); } else { this.ShowMsgAndReUrl("自动回复添加成功!", true, "replyonkey.aspx"); } }
protected void Page_Load(object sender, EventArgs e) { if (base.IsPostBack) { return; } if (!(this.type == "getarticleinfo")) { if ((this.type == "subscribe") && (this.replyID == 0)) { this.replyID = AliFuwuReplyHelper.GetSubscribeID(0); if (this.replyID > 0) { base.Response.Redirect("replyedit.aspx?type=subscribe&id=" + this.replyID); base.Response.End(); } this.rbtlMatchType.SelectedIndex = 0; if (string.IsNullOrEmpty(this.htmlInfo)) { this.htmlInfo = "<div class=\"exit-shop-info\">内容区</div>"; } this.litInfo.Text = this.htmlInfo; return; } if (this.replyID > 0) { this.htmlTitle = "修改自动回复"; Hidistro.Entities.VShop.ReplyInfo reply = AliFuwuReplyHelper.GetReply(this.replyID); if (reply == null) { base.Response.Redirect("replyonkey.aspx"); base.Response.End(); } else { MessageType messageType = reply.MessageType; if (ReplyType.NoMatch == reply.ReplyType) { this.txtKeys.Text = "*"; } else if (ReplyType.Subscribe == reply.ReplyType) { this.txtKeys.Text = ""; if (this.type != "subscribe") { base.Response.Redirect("replyedit.aspx?type=subscribe&id=" + this.replyID); base.Response.End(); } } else { this.txtKeys.Text = reply.Keys.Trim(); } for (int i = 0; i < this.rbtlMatchType.Items.Count; i++) { if (this.rbtlMatchType.Items[i].Value == ((int)reply.MatchType).ToString()) { this.rbtlMatchType.Items[i].Selected = true; break; } } this.hdfMessageType.Value = ((int)reply.MessageType).ToString(); this.hdfArticleID.Value = reply.ArticleID.ToString(); int articleID = reply.ArticleID; switch (messageType) { case MessageType.Text: { TextReplyInfo info7 = AliFuwuReplyHelper.GetReply(this.replyID) as TextReplyInfo; if (info7 != null) { string str2 = Regex.Replace(Regex.Replace(info7.Text, "</?([^>^a^p]*)>", ""), "<img([^>]*)>", "").Replace("</p>", "\r\n").Replace("<p>", ""); this.fkContent.Text = str2; } break; } case MessageType.News: if (articleID <= 0) { this.hdfIsOldArticle.Value = "1"; NewsReplyInfo info6 = AliFuwuReplyHelper.GetReply(this.replyID) as NewsReplyInfo; if (((info6 != null) && (info6.NewsMsg != null)) && (info6.NewsMsg.Count != 0)) { this.htmlInfo = "<div class=\"mate-inner\"><h3 id=\"singelTitle\">" + info6.NewsMsg[0].Title + "</h3><span>" + info6.LastEditDate.ToString("M月d日") + "</span><div class=\"mate-img\"><img id=\"img1\" src=\"" + info6.NewsMsg[0].PicUrl + "\" class=\"img-responsive\"></div><div class=\"mate-info\" id=\"Lbmsgdesc\">" + info6.NewsMsg[0].Description + "</div><div class=\"red-all clearfix\"><strong class=\"fl\">查看全文</strong><em class=\"fr\">></em></div></div>"; } } break; case MessageType.List: if (articleID <= 0) { this.hdfIsOldArticle.Value = "1"; NewsReplyInfo info4 = AliFuwuReplyHelper.GetReply(this.replyID) as NewsReplyInfo; if (info4 != null) { StringBuilder builder2 = new StringBuilder(); if ((info4.NewsMsg != null) && (info4.NewsMsg.Count > 0)) { int num4 = 0; foreach (NewsMsgInfo info5 in info4.NewsMsg) { num4++; if (num4 == 1) { builder2.Append("<div class=\"mate-inner top\"> <div class=\"mate-img\" > <img id=\"img1\" src=\"" + info5.PicUrl + "\" class=\"img-responsive\"> <div class=\"title\" id=\"title1\">" + info5.Title + "</div> </div> </div>"); } else { builder2.Append(" <div class=\"mate-inner\"> <div class=\"child-mate\"> <div class=\"child-mate-title clearfix\"> <div class=\"title\">" + info5.Title + "</div> <div class=\"img\"> <img src=\"" + info5.PicUrl + "\" class=\"img-responsive\"> </div> </div> </div> </div>"); } } this.htmlInfo = builder2.ToString(); } } } break; } } } if (string.IsNullOrEmpty(this.htmlInfo)) { this.htmlInfo = "<div class=\"exit-shop-info\">内容区</div>"; } this.litInfo.Text = this.htmlInfo; return; } base.Response.ContentType = "application/json"; string s = "{\"type\":\"0\",\"tips\":\"操作失败\"}"; int articleid = Globals.RequestFormNum("articleid"); if (articleid > 0) { ArticleInfo articleInfo = ArticleHelper.GetArticleInfo(articleid); if (articleInfo != null) { StringBuilder builder = new StringBuilder(); switch (articleInfo.ArticleType) { case ArticleType.News: s = string.Concat(new object[] { "{\"type\":\"1\",\"articletype\":", (int)articleInfo.ArticleType, ",\"title\":\"", String2Json(articleInfo.Title), "\",\"date\":\"", String2Json(articleInfo.PubTime.ToString("M月d日")), "\",\"imgurl\":\"", String2Json(articleInfo.ImageUrl), "\",\"memo\":\"", String2Json(articleInfo.Memo), "\"}" }); goto Label_0301; case ArticleType.List: foreach (ArticleItemsInfo info2 in articleInfo.ItemsInfo) { builder.Append("{\"title\":\"" + String2Json(info2.Title) + "\",\"imgurl\":\"" + String2Json(info2.ImageUrl) + "\"},"); } s = string.Concat(new object[] { "{\"type\":\"1\",\"articletype\":", (int)articleInfo.ArticleType, ",\"title\":\"", String2Json(articleInfo.Title), "\",\"date\":\"", String2Json(articleInfo.PubTime.ToString("M月d日")), "\",\"imgurl\":\"", String2Json(articleInfo.ImageUrl), "\",\"items\":[", builder.ToString().Trim(new char[] { ',' }), "]}" }); goto Label_0301; } s = string.Concat(new object[] { "{\"type\":\"1\",\"articletype\":", (int)articleInfo.ArticleType, ",\"title\":\"", String2Json(articleInfo.Title), "\",\"date\":\"", String2Json(articleInfo.PubTime.ToString("M月d日")), "\",\"imgurl\":\"", String2Json(articleInfo.ImageUrl), "\",\"memo\":\"", String2Json(articleInfo.Content), "\"}" }); } } Label_0301: base.Response.Write(s); base.Response.End(); }
protected string GetTitleShow(object messagetypename, object articleid, object responseid) { string str = string.Empty; int num = Globals.ToNum(articleid); int id = Globals.ToNum(responseid); string str2 = messagetypename.ToString(); if (str2 == null) { return(str); } if (!(str2 == "多图文")) { if (str2 == "单图文") { if (num > 0) { ArticleInfo articleInfo = ArticleHelper.GetArticleInfo(num); if (articleInfo != null) { int num5 = 1; str = string.Concat(new object[] { "<p>[<span style='color:green;'>图文", num5, "</span>] ", Globals.SubStr(articleInfo.Title, 40, "..."), "</p>" }); } return(str); } NewsReplyInfo info6 = AliFuwuReplyHelper.GetReply(id) as NewsReplyInfo; if (info6 == null) { return(str); } StringBuilder builder2 = new StringBuilder(); if ((info6.NewsMsg != null) && (info6.NewsMsg.Count > 0)) { int num6 = 0; foreach (NewsMsgInfo info7 in info6.NewsMsg) { num6++; builder2.Append(string.Concat(new object[] { "<p>[<span style='color:green;'>图文", num6, "</span>] ", Globals.SubStr(info7.Title, 40, "..."), "</p>" })); } } return(builder2.ToString()); } if (str2 == "文本") { TextReplyInfo info8 = AliFuwuReplyHelper.GetReply(id) as TextReplyInfo; if (info8 != null) { str = Globals.SubStr(Regex.Replace(Regex.Replace(info8.Text, "<[^>]+>", ""), "&[^;]+;", ""), 100, "..."); if (string.IsNullOrEmpty(str) && info8.Text.Contains("<img ")) { str = "<span style='color:green;'>图文内容</span>"; } } } return(str); } if (num > 0) { ArticleInfo info = ArticleHelper.GetArticleInfo(num); if (info != null) { int num3 = 1; str = string.Concat(new object[] { "<p>[<span style='color:green;'>图文", num3, "</span>] ", Globals.SubStr(info.Title, 40, "..."), "</p>" }); if (info.ItemsInfo == null) { return(str); } foreach (ArticleItemsInfo info2 in info.ItemsInfo) { num3++; object obj2 = str; str = string.Concat(new object[] { obj2, "<p>[<span style='color:green;'>图文", num3, "</span>] ", Globals.SubStr(info2.Title, 40, "..."), "</p>" }); } } return(str); } NewsReplyInfo reply = AliFuwuReplyHelper.GetReply(id) as NewsReplyInfo; if (reply == null) { return(str); } StringBuilder builder = new StringBuilder(); if ((reply.NewsMsg != null) && (reply.NewsMsg.Count > 0)) { int num4 = 0; foreach (NewsMsgInfo info4 in reply.NewsMsg) { num4++; builder.Append(string.Concat(new object[] { "<p>[<span style='color:green;'>图文", num4, "</span>] ", Globals.SubStr(info4.Title, 40, "..."), "</p>" })); } } return(builder.ToString()); }
protected void btnSave_Click(object sender, System.EventArgs e) { int num = Globals.ToNum(this.hdfMessageType.Value); int num2 = Globals.ToNum(this.hdfArticleID.Value); MessageType messageType = (MessageType)num; int num3 = Globals.ToNum(this.rbtlMatchType.SelectedValue); if (string.IsNullOrEmpty(this.txtKeys.Text.Trim()) && this.type != "subscribe") { this.ShowMsg("请输入关键词!", false); return; } if (this.txtKeys.Text.Trim().Length > 50) { this.ShowMsg("关键词必须少于50个字!", false); return; } if (num3 == 0) { this.ShowMsg("请选择匹配类型!", false); return; } if (num2 < 1 && messageType != MessageType.Text) { if (this.hdfIsOldArticle.Value == "0") { this.ShowMsg("请先选择图文!", false); return; } if (this.replyID > 0) { num2 = AliFuwuReplyHelper.GetArticleIDByOldArticle(this.replyID, messageType); } } switch (messageType) { case MessageType.Text: { if (this.fkContent.Text.Length > 1000) { this.ShowMsg("回复内容必须1000字以内!", false); return; } TextReplyInfo textReplyInfo = new TextReplyInfo(); textReplyInfo.Keys = this.txtKeys.Text.Trim(); textReplyInfo.MatchType = ((num3 == 2) ? MatchType.Equal : MatchType.Like); if (textReplyInfo.Keys == "*") { textReplyInfo.ReplyType = ReplyType.NoMatch; if (AliFuwuReplyHelper.GetNoMatchReplyID(this.replyID) > 0) { this.ShowMsg("无关键字回复回复内容已存在!", false); return; } } else if (this.type == "subscribe") { if (AliFuwuReplyHelper.GetSubscribeID(this.replyID) > 0) { this.ShowMsg("首次关注回复内容已存在!", false); return; } textReplyInfo.ReplyType = ReplyType.Subscribe; textReplyInfo.Keys = ""; } else { textReplyInfo.ReplyType = ReplyType.Keys; if (AliFuwuReplyHelper.HasReplyKey(textReplyInfo.Keys, this.replyID)) { this.ShowMsg("该关键词已存在!", false); return; } } textReplyInfo.MessageType = messageType; textReplyInfo.IsDisable = false; textReplyInfo.ArticleID = num2; string text = this.fkContent.Text; text = System.Text.RegularExpressions.Regex.Replace(text, "</?([^>^a^p]*)>", ""); text = System.Text.RegularExpressions.Regex.Replace(text, "<img([^>]*)>", ""); text = text.Replace("<p>", ""); text = text.Replace("</p>", "\r"); text = text.Trim(new char[] { '\r' }); text = text.Replace("\r", "\r\n"); textReplyInfo.Text = text; textReplyInfo.Id = this.replyID; if (string.IsNullOrEmpty(textReplyInfo.Text)) { this.ShowMsg("请填写文本内容!", false); return; } if (this.replyID > 0) { AliFuwuReplyHelper.UpdateReply(textReplyInfo); } else { AliFuwuReplyHelper.SaveReply(textReplyInfo); } break; } case MessageType.News: case MessageType.List: { NewsReplyInfo newsReplyInfo = new NewsReplyInfo(); newsReplyInfo.Keys = this.txtKeys.Text.Trim(); newsReplyInfo.MatchType = ((num3 == 2) ? MatchType.Equal : MatchType.Like); if (newsReplyInfo.Keys == "*") { newsReplyInfo.ReplyType = ReplyType.NoMatch; if (AliFuwuReplyHelper.GetNoMatchReplyID(this.replyID) > 0) { this.ShowMsg("无关键词回复已存在!", false); return; } } else if (this.type == "subscribe") { newsReplyInfo.ReplyType = ReplyType.Subscribe; newsReplyInfo.Keys = ""; if (AliFuwuReplyHelper.GetSubscribeID(this.replyID) > 0) { this.ShowMsg("首次关注回复已存在!", false); return; } } else { newsReplyInfo.ReplyType = ReplyType.Keys; if (AliFuwuReplyHelper.HasReplyKey(newsReplyInfo.Keys, this.replyID)) { this.ShowMsg("该关键词已存在!", false); return; } } newsReplyInfo.MessageType = messageType; newsReplyInfo.IsDisable = false; newsReplyInfo.ArticleID = num2; newsReplyInfo.Id = this.replyID; if (num3 < 1) { this.ShowMsg("请选择类型!", false); return; } if (this.replyID > 0) { AliFuwuReplyHelper.UpdateReply(newsReplyInfo); } else { AliFuwuReplyHelper.SaveReply(newsReplyInfo); } break; } } if (this.replyID > 0) { this.ShowMsgAndReUrl("自动回复修改成功!", true, "replyonkey.aspx"); return; } this.ShowMsgAndReUrl("自动回复添加成功!", true, "replyonkey.aspx"); }