Exemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string s = base.Request.QueryString["ID"];

            int.TryParse(s, out this.articleID);
            if (this.articleID > 0)
            {
                ArticleInfo articleInfo = ArticleHelper.GetArticleInfo(this.articleID);
                if (articleInfo == null)
                {
                    this.GoBack();
                }
                else
                {
                    this.htmlTitle    = articleInfo.Title;
                    this.ArticleType  = articleInfo.ArticleType.ToString().ToLower();
                    this.htmlImageUrl = articleInfo.ImageUrl;
                    this.htmlUrl      = articleInfo.Url;
                    this.htmlPubTime  = articleInfo.PubTime.ToString("yyyy-MM-dd HH:mm");
                    this.htmlMemo     = articleInfo.Memo;
                    if (this.ArticleType == "list")
                    {
                        this.rptList.DataSource = articleInfo.ItemsInfo;
                        this.rptList.DataBind();
                    }
                }
            }
            else
            {
                this.GoBack();
            }
        }
Exemplo n.º 2
0
 protected override void AttachChildControls()
 {
     if (!int.TryParse(Globals.RequestQueryStr("id"), out this.MaterialID))
     {
         base.GotoResourceNotFound("");
     }
     else
     {
         ArticleInfo     articleInfo = ArticleHelper.GetArticleInfo(this.MaterialID);
         string          title       = articleInfo.Title;
         System.DateTime now         = System.DateTime.Now;
         this.TopCtx  = (System.Web.UI.WebControls.Repeater) this.FindControl("TopCtx");
         this.ItemCtx = (System.Web.UI.WebControls.Repeater) this.FindControl("ItemCtx");
         System.Collections.Generic.List <ArticleInfo> list = new System.Collections.Generic.List <ArticleInfo>();
         list.Add(articleInfo);
         this.TopCtx.DataSource = list;
         this.TopCtx.DataBind();
         if (articleInfo.ArticleType == ArticleType.List)
         {
             System.Collections.Generic.IList <ArticleItemsInfo> itemsInfo = articleInfo.ItemsInfo;
             this.ItemCtx.DataSource = itemsInfo;
             this.ItemCtx.DataBind();
         }
         PageTitle.AddSiteNameTitle(title);
     }
 }
Exemplo n.º 3
0
 protected override void AttachChildControls()
 {
     if (!int.TryParse(Globals.RequestQueryStr("id"), out this.MaterialID))
     {
         base.GotoResourceNotFound("");
     }
     else
     {
         string      title       = "";
         ArticleInfo articleInfo = ArticleHelper.GetArticleInfo(this.MaterialID);
         title = articleInfo.Title;
         DateTime now = DateTime.Now;
         this.TopCtx  = (Repeater)this.FindControl("TopCtx");
         this.ItemCtx = (Repeater)this.FindControl("ItemCtx");
         List <ArticleInfo> list = new List <ArticleInfo> {
             articleInfo
         };
         this.TopCtx.DataSource = list;
         this.TopCtx.DataBind();
         if (articleInfo.ArticleType == ArticleType.List)
         {
             IList <ArticleItemsInfo> itemsInfo = articleInfo.ItemsInfo;
             this.ItemCtx.DataSource = itemsInfo;
             this.ItemCtx.DataBind();
         }
         PageTitle.AddSiteNameTitle(title);
     }
 }
 protected override void AttachChildControls()
 {
     this.itemID     = Globals.RequestQueryNum("iid");
     this.singleID   = Globals.RequestQueryNum("sid");
     this.imgUrl     = (HiImage)this.FindControl("imgUrl");
     this.litContent = (Literal)this.FindControl("litContent");
     this.LitJs      = (Literal)this.FindControl("LitJs");
     if (this.singleID > 0)
     {
         ArticleInfo articleInfo = ArticleHelper.GetArticleInfo(this.singleID);
         if (articleInfo != null)
         {
             this.htmlTitle       = articleInfo.Title;
             this.imgUrl.ImageUrl = articleInfo.ImageUrl;
             this.litContent.Text = articleInfo.Content;
             string imageUrl = articleInfo.ImageUrl;
             if (!imageUrl.ToLower().StartsWith("http"))
             {
                 imageUrl = Globals.GetWebUrlStart() + imageUrl;
             }
             string str2 = Globals.ReplaceHtmlTag(articleInfo.Memo, 50);
             this.LitJs.Text = "<script>wxinshare_title ='" + this.Page.Server.HtmlEncode(this.htmlTitle.Replace("\n", "").Replace("\r", "")) + "';wxinshare_desc = '" + this.Page.Server.HtmlEncode(str2.Replace("\n", "").Replace("\r", "")) + "';wxinshare_link = location.href;wxinshare_imgurl = '" + imageUrl + "';</script>";
         }
         else
         {
             base.GotoResourceNotFound("");
         }
     }
     else if (this.itemID > 0)
     {
         ArticleItemsInfo articleItemsInfo = ArticleHelper.GetArticleItemsInfo(this.itemID);
         if (articleItemsInfo != null)
         {
             this.htmlTitle       = articleItemsInfo.Title;
             this.imgUrl.ImageUrl = articleItemsInfo.ImageUrl;
             this.litContent.Text = articleItemsInfo.Content;
             string str3 = articleItemsInfo.ImageUrl;
             if (!str3.ToLower().StartsWith("http"))
             {
                 str3 = Globals.GetWebUrlStart() + str3;
             }
             string str4 = Globals.ReplaceHtmlTag(articleItemsInfo.Content, 50);
             this.LitJs.Text = "<script>wxinshare_title ='" + this.Page.Server.HtmlEncode(this.htmlTitle.Replace("\n", "").Replace("\r", "")) + "';wxinshare_desc = '" + this.Page.Server.HtmlEncode(str4.Replace("\n", "").Replace("\r", "")) + "';wxinshare_link = location.href;wxinshare_imgurl = '" + str3 + "';</script>";
         }
         else
         {
             base.GotoResourceNotFound("");
         }
     }
     else
     {
         base.GotoResourceNotFound("");
     }
     PageTitle.AddSiteNameTitle(this.htmlTitle);
 }
Exemplo n.º 5
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!base.IsPostBack && (this.LocalArticleID > 0))
     {
         ArticleInfo articleInfo = ArticleHelper.GetArticleInfo(this.LocalArticleID);
         if (articleInfo != null)
         {
             this.htmlJs = string.Concat(new object[] { "closeModal('#MyPictureIframe', 'txtContent', '", articleInfo.Url, "', '", base.Server.HtmlEncode(articleInfo.Title), "', '", base.Server.HtmlEncode(articleInfo.Memo), "', '", base.Server.HtmlEncode(articleInfo.ImageUrl), "', ", articleInfo.ArticleId, ")" });
         }
     }
 }
Exemplo n.º 6
0
        protected override void AttachChildControls()
        {
            this.hdDesc     = (HtmlInputHidden)this.FindControl("hdDesc");
            this.MaterialID = Globals.RequestQueryNum("ID");
            if (this.MaterialID <= 0)
            {
                this.Page.Response.Redirect("/");
            }
            string      title       = "";
            ArticleInfo articleInfo = ArticleHelper.GetArticleInfo(this.MaterialID);

            if (articleInfo == null)
            {
                this.Page.Response.Redirect("/");
            }
            title = articleInfo.Title;
            DateTime now = DateTime.Now;

            this.TopCtx  = (Repeater)this.FindControl("TopCtx");
            this.ItemCtx = (Repeater)this.FindControl("ItemCtx");
            List <ArticleInfo> list = new List <ArticleInfo> {
                articleInfo
            };

            this.TopCtx.DataSource = list;
            this.TopCtx.DataBind();
            if (articleInfo.ArticleType == ArticleType.List)
            {
                string str2 = Globals.ReplaceHtmlTag(articleInfo.Content, 50);
                if (!string.IsNullOrEmpty(str2))
                {
                    this.hdDesc.Value = str2;
                }
                IList <ArticleItemsInfo> itemsInfo = articleInfo.ItemsInfo;
                this.ItemCtx.DataSource = itemsInfo;
                this.ItemCtx.DataBind();
            }
            else
            {
                string str3 = Globals.ReplaceHtmlTag(articleInfo.Memo, 50);
                if (!string.IsNullOrEmpty(str3))
                {
                    this.hdDesc.Value = str3;
                }
            }
            PageTitle.AddSiteNameTitle(title);
        }
Exemplo n.º 7
0
        protected override void AttachChildControls()
        {
            this.hdDesc     = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("hdDesc");
            this.MaterialID = Globals.RequestQueryNum("ID");
            if (this.MaterialID <= 0)
            {
                this.Page.Response.Redirect("/");
            }
            ArticleInfo articleInfo = ArticleHelper.GetArticleInfo(this.MaterialID);

            if (articleInfo == null)
            {
                this.Page.Response.Redirect("/");
            }
            string title = articleInfo.Title;

            System.DateTime now = System.DateTime.Now;
            this.TopCtx  = (System.Web.UI.WebControls.Repeater) this.FindControl("TopCtx");
            this.ItemCtx = (System.Web.UI.WebControls.Repeater) this.FindControl("ItemCtx");
            System.Collections.Generic.List <ArticleInfo> list = new System.Collections.Generic.List <ArticleInfo>();
            list.Add(articleInfo);
            this.TopCtx.DataSource = list;
            this.TopCtx.DataBind();
            if (articleInfo.ArticleType == ArticleType.List)
            {
                string value = Globals.ReplaceHtmlTag(articleInfo.Content, 50);
                if (!string.IsNullOrEmpty(value))
                {
                    this.hdDesc.Value = value;
                }
                System.Collections.Generic.IList <ArticleItemsInfo> itemsInfo = articleInfo.ItemsInfo;
                this.ItemCtx.DataSource = itemsInfo;
                this.ItemCtx.DataBind();
            }
            else
            {
                string value = Globals.ReplaceHtmlTag(articleInfo.Memo, 50);
                if (!string.IsNullOrEmpty(value))
                {
                    this.hdDesc.Value = value;
                }
            }
            PageTitle.AddSiteNameTitle(title);
        }
Exemplo n.º 8
0
 protected override void AttachChildControls()
 {
     this.itemID     = Globals.RequestQueryNum("iid");
     this.singleID   = Globals.RequestQueryNum("sid");
     this.imgUrl     = (HiImage)this.FindControl("imgUrl");
     this.litContent = (Literal)this.FindControl("litContent");
     if (this.singleID > 0)
     {
         ArticleInfo articleInfo = ArticleHelper.GetArticleInfo(this.singleID);
         if (articleInfo != null)
         {
             this.htmlTitle       = articleInfo.Title;
             this.imgUrl.ImageUrl = articleInfo.ImageUrl;
             this.litContent.Text = articleInfo.Content;
         }
         else
         {
             base.GotoResourceNotFound("");
         }
     }
     else if (this.itemID > 0)
     {
         ArticleItemsInfo articleItemsInfo = ArticleHelper.GetArticleItemsInfo(this.itemID);
         if (articleItemsInfo != null)
         {
             this.htmlTitle       = articleItemsInfo.Title;
             this.imgUrl.ImageUrl = articleItemsInfo.ImageUrl;
             this.litContent.Text = articleItemsInfo.Content;
         }
         else
         {
             base.GotoResourceNotFound("");
         }
     }
     else
     {
         base.GotoResourceNotFound("");
     }
     PageTitle.AddSiteNameTitle(this.htmlTitle);
 }
Exemplo n.º 9
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            if (!base.IsPostBack)
            {
                if (this.type == "getarticleinfo")
                {
                    base.Response.ContentType = "application/json";
                    string s   = "{\"type\":\"0\",\"tips\":\"操作失败\"}";
                    int    num = Globals.RequestFormNum("articleid");
                    if (num > 0)
                    {
                        ArticleInfo articleInfo3 = ArticleHelper.GetArticleInfo(num);
                        if (articleInfo3 != null)
                        {
                            System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder();
                            switch (articleInfo3.ArticleType)
                            {
                            case ArticleType.News:
                                s = string.Concat(new object[]
                                {
                                    "{\"type\":\"1\",\"articletype\":",
                                    (int)articleInfo3.ArticleType,
                                    ",\"title\":\"",
                                    this.String2Json(articleInfo3.Title),
                                    "\",\"date\":\"",
                                    this.String2Json(articleInfo3.PubTime.ToString("M月d日")),
                                    "\",\"imgurl\":\"",
                                    this.String2Json(articleInfo3.ImageUrl),
                                    "\",\"memo\":\"",
                                    this.String2Json(articleInfo3.Memo),
                                    "\"}"
                                });
                                goto IL_30E;

                            case ArticleType.List:
                            {
                                System.Collections.Generic.IList <ArticleItemsInfo> itemsInfo = articleInfo3.ItemsInfo;
                                foreach (ArticleItemsInfo current in itemsInfo)
                                {
                                    stringBuilder.Append(string.Concat(new string[]
                                        {
                                            "{\"title\":\"",
                                            this.String2Json(current.Title),
                                            "\",\"imgurl\":\"",
                                            this.String2Json(current.ImageUrl),
                                            "\"},"
                                        }));
                                }
                                s = string.Concat(new object[]
                                    {
                                        "{\"type\":\"1\",\"articletype\":",
                                        (int)articleInfo3.ArticleType,
                                        ",\"title\":\"",
                                        this.String2Json(articleInfo3.Title),
                                        "\",\"date\":\"",
                                        this.String2Json(articleInfo3.PubTime.ToString("M月d日")),
                                        "\",\"imgurl\":\"",
                                        this.String2Json(articleInfo3.ImageUrl),
                                        "\",\"items\":[",
                                        stringBuilder.ToString().Trim(new char[]
                                        {
                                            ','
                                        }),
                                        "]}"
                                    });
                                goto IL_30E;
                            }
                            }
                            s = string.Concat(new object[]
                            {
                                "{\"type\":\"1\",\"articletype\":",
                                (int)articleInfo3.ArticleType,
                                ",\"title\":\"",
                                this.String2Json(articleInfo3.Title),
                                "\",\"date\":\"",
                                this.String2Json(articleInfo3.PubTime.ToString("M月d日")),
                                "\",\"imgurl\":\"",
                                this.String2Json(articleInfo3.ImageUrl),
                                "\",\"memo\":\"",
                                this.String2Json(articleInfo3.Content),
                                "\"}"
                            });
                        }
                    }
IL_30E:
                    base.Response.Write(s);
                    base.Response.End();
                    return;
                }
                if (this.type == "postdata")
                {
                    base.Response.ContentType = "application/json";
                    string ReturnResult = "{\"type\":\"1\",\"tips\":\"操作成功\"}";
                    this.sendID = Globals.RequestFormNum("sendid");
                    int    num2         = Globals.RequestFormNum("sendtype");
                    int    num3         = Globals.RequestFormNum("msgtype");
                    int    articleid    = Globals.RequestFormNum("articleid");
                    string title        = Globals.RequestFormStr("title");
                    string content      = Globals.RequestFormStr("content");
                    int    isoldarticle = Globals.RequestFormNum("isoldarticle");
                    string text         = this.SavePostData(num3, articleid, title, content, isoldarticle, this.sendID, true);
                    if (string.IsNullOrEmpty(text))
                    {
                        MessageType  messageType    = (MessageType)num3;
                        string       text2          = string.Empty;
                        SiteSettings masterSettings = SettingsManager.GetMasterSettings(false);
                        string       access_token   = TokenApi.GetToken(masterSettings.WeixinAppId, masterSettings.WeixinAppSecret);
                        access_token = JsonConvert.DeserializeObject <Token>(access_token).access_token;
                        switch (messageType)
                        {
                        case MessageType.News:
                        case MessageType.List:
                        {
                            bool        flag        = true;
                            ArticleInfo articleInfo = ArticleHelper.GetArticleInfo(articleid);
                            if (articleInfo.MediaId.Length < 1)
                            {
                                string text3 = NewsApi.GetMedia_IDByPath(access_token, articleInfo.ImageUrl);
                                text3 = NewsApi.GetJsonValue(text3, "media_id");
                                if (!string.IsNullOrEmpty(text3))
                                {
                                    ArticleHelper.UpdateMedia_Id(0, articleInfo.ArticleId, text3);
                                }
                                else
                                {
                                    flag         = false;
                                    ReturnResult = "{\"type\":\"2\",\"tips\":\"" + NewsApi.GetErrorCodeMsg(NewsApi.GetJsonValue(text3, "errcode")) + "111111\"}";
                                }
                            }
                            if (messageType == MessageType.List)
                            {
                                foreach (ArticleItemsInfo current2 in articleInfo.ItemsInfo)
                                {
                                    if (current2.MediaId == null || current2.MediaId.Length < 1)
                                    {
                                        string media_IDByPath = NewsApi.GetMedia_IDByPath(access_token, current2.ImageUrl);
                                        string jsonValue      = NewsApi.GetJsonValue(media_IDByPath, "media_id");
                                        if (jsonValue.Length == 0)
                                        {
                                            this.errcode = NewsApi.GetJsonValue(media_IDByPath, "errcode");
                                            flag         = false;
                                            ReturnResult = "{\"type\":\"2\",\"tips\":\"" + NewsApi.GetErrorCodeMsg(this.errcode) + "\"}";
                                            break;
                                        }
                                        ArticleHelper.UpdateMedia_Id(1, current2.Id, jsonValue);
                                    }
                                }
                            }
                            if (!flag)
                            {
                                goto IL_91B;
                            }
                            string articlesJsonStr = this.GetArticlesJsonStr(articleInfo);
                            string msg             = NewsApi.UploadNews(access_token, articlesJsonStr);
                            this.sendID = Globals.ToNum(this.SavePostData(num3, articleid, title, content, isoldarticle, this.sendID, false));
                            string jsonValue2 = NewsApi.GetJsonValue(msg, "media_id");
                            if (jsonValue2.Length <= 0)
                            {
                                this.errcode = NewsApi.GetJsonValue(msg, "errcode");
                                ReturnResult = "{\"type\":\"2\",\"tips\":\"" + NewsApi.GetErrorCodeMsg(this.errcode) + "!\"}";
                                goto IL_91B;
                            }
                            if (num2 != 1)
                            {
                                System.Data.DataTable dt = WeiXinHelper.GetRencentOpenID(0);
                                int    icount            = dt.Rows.Count;
                                int    sendcount         = 0;
                                string retjson           = string.Empty;
                                Task.Factory.StartNew(delegate
                                    {
                                        try
                                        {
                                            for (int i = 0; i < dt.Rows.Count; i++)
                                            {
                                                string msg2  = NewsApi.KFSend(access_token, this.GetKFSendImageJson(dt.Rows[i][0].ToString(), articleInfo));
                                                this.errcode = NewsApi.GetJsonValue(msg2, "errcode");
                                                if (this.errcode == "0")
                                                {
                                                    sendcount++;
                                                }
                                                else
                                                {
                                                    retjson = NewsApi.GetErrorCodeMsg(this.errcode);
                                                }
                                            }
                                            int sendstate = (sendcount > 0) ? 1 : 2;
                                            WeiXinHelper.UpdateMsgId(this.sendID, "", sendstate, sendcount, icount, retjson);
                                        }
                                        catch (System.Exception ex)
                                        {
                                            Globals.Debuglog(ex.ToString(), "_DebuglogSendAllEdit.txt");
                                        }
                                    });
                                goto IL_91B;
                            }
                            text2 = NewsApi.SendAll(access_token, NewsApi.CreateImageNewsJson(jsonValue2));
                            if (string.IsNullOrWhiteSpace(text2))
                            {
                                ReturnResult = "{\"type\":\"2\",\"tips\":\"type参数错误\"}";
                                goto IL_91B;
                            }
                            string jsonValue3 = NewsApi.GetJsonValue(text2, "msg_id");
                            if (!string.IsNullOrEmpty(jsonValue3))
                            {
                                WeiXinHelper.UpdateMsgId(this.sendID, jsonValue3, 0, 0, 0, "");
                                goto IL_91B;
                            }
                            this.errcode = NewsApi.GetJsonValue(text2, "errcode");
                            string errorCodeMsg = NewsApi.GetErrorCodeMsg(this.errcode);
                            WeiXinHelper.UpdateMsgId(this.sendID, jsonValue3, 2, 0, 0, errorCodeMsg);
                            ReturnResult = "{\"type\":\"2\",\"tips\":\"" + errorCodeMsg + "!!\"}";
                            goto IL_91B;
                        }
                        }
                        this.sendID = Globals.ToNum(this.SavePostData(num3, articleid, title, content, isoldarticle, this.sendID, false));
                        if (num2 == 1)
                        {
                            text2 = NewsApi.SendAll(access_token, this.CreateTxtNewsJson(content));
                            if (!string.IsNullOrWhiteSpace(text2))
                            {
                                string jsonValue4 = NewsApi.GetJsonValue(text2, "msg_id");
                                if (jsonValue4.Length == 0)
                                {
                                    this.errcode = NewsApi.GetJsonValue(text2, "errcode");
                                    string errorCodeMsg2 = NewsApi.GetErrorCodeMsg(this.errcode);
                                    WeiXinHelper.UpdateMsgId(this.sendID, jsonValue4, 2, 0, 0, errorCodeMsg2);
                                    ReturnResult = "{\"type\":\"2\",\"tips\":\"" + errorCodeMsg2 + "\"}";
                                }
                                else
                                {
                                    WeiXinHelper.UpdateMsgId(this.sendID, jsonValue4, 0, 0, 0, "");
                                }
                            }
                            else
                            {
                                ReturnResult = "{\"type\":\"2\",\"tips\":\"type参数错误\"}";
                            }
                        }
                        else
                        {
                            System.Data.DataTable dt = WeiXinHelper.GetRencentOpenID(0);
                            int    icount            = dt.Rows.Count;
                            int    sendcount         = 0;
                            string retjson           = string.Empty;
                            Task.Factory.StartNew(delegate
                            {
                                try
                                {
                                    for (int i = 0; i < dt.Rows.Count; i++)
                                    {
                                        string msg2  = NewsApi.KFSend(access_token, NewsApi.CreateKFTxtNewsJson(dt.Rows[i][0].ToString(), this.String2Json(this.FormatSendContent(content))));
                                        this.errcode = NewsApi.GetJsonValue(msg2, "errcode");
                                        if (this.errcode == "0")
                                        {
                                            sendcount++;
                                        }
                                        else
                                        {
                                            retjson = NewsApi.GetErrorCodeMsg(this.errcode);
                                        }
                                    }
                                    int sendstate = (sendcount > 0) ? 1 : 2;
                                    WeiXinHelper.UpdateMsgId(this.sendID, "", sendstate, sendcount, icount, retjson);
                                    if (sendcount == 0)
                                    {
                                        ReturnResult = "{\"type\":\"0\",\"tips\":\"发送失败\"}";
                                    }
                                }
                                catch (System.Exception ex)
                                {
                                    Globals.Debuglog(ex.ToString(), "_DebuglogSendAllEdit.txt");
                                }
                            });
                        }
                    }
                    else
                    {
                        ReturnResult = "{\"type\":\"0\",\"tips\":\"" + text + "\"}";
                    }
IL_91B:
                    base.Response.Write(ReturnResult);
                    base.Response.End();
                    return;
                }
                if (this.sendID > 0)
                {
                    this.hdfSendID.Value = this.sendID.ToString();
                    SendAllInfo sendAllInfo = WeiXinHelper.GetSendAllInfo(this.sendID);
                    if (sendAllInfo != null)
                    {
                        MessageType messageType2 = sendAllInfo.MessageType;
                        this.hdfMessageType.Value = ((int)sendAllInfo.MessageType).ToString();
                        int articleID = sendAllInfo.ArticleID;
                        this.hdfArticleID.Value = articleID.ToString();
                        this.txtTitle.Text      = sendAllInfo.Title;
                        switch (messageType2)
                        {
                        case MessageType.Text:
                            this.fkContent.Text = sendAllInfo.Content;
                            break;

                        case MessageType.News:
                            if (articleID <= 0)
                            {
                                this.hdfIsOldArticle.Value = "1";
                                NewsReplyInfo newsReplyInfo = ReplyHelper.GetReply(this.sendID) as NewsReplyInfo;
                                if (newsReplyInfo != null && newsReplyInfo.NewsMsg != null && newsReplyInfo.NewsMsg.Count != 0)
                                {
                                    this.htmlInfo = string.Concat(new string[]
                                    {
                                        "<div class=\"mate-inner\"><h3 id=\"singelTitle\">",
                                        newsReplyInfo.NewsMsg[0].Title,
                                        "</h3><span>",
                                        newsReplyInfo.LastEditDate.ToString("M月d日"),
                                        "</span><div class=\"mate-img\"><img id=\"img1\" src=\"",
                                        newsReplyInfo.NewsMsg[0].PicUrl,
                                        "\" class=\"img-responsive\"></div><div class=\"mate-info\" id=\"Lbmsgdesc\">",
                                        newsReplyInfo.NewsMsg[0].Description,
                                        "</div><div class=\"red-all clearfix\"><strong class=\"fl\">查看全文</strong><em class=\"fr\">&gt;</em></div></div>"
                                    });
                                }
                            }
                            break;

                        case MessageType.List:
                            if (articleID <= 0)
                            {
                                this.hdfIsOldArticle.Value = "1";
                                NewsReplyInfo newsReplyInfo2 = ReplyHelper.GetReply(this.sendID) as NewsReplyInfo;
                                if (newsReplyInfo2 != null)
                                {
                                    System.Text.StringBuilder stringBuilder2 = new System.Text.StringBuilder();
                                    if (newsReplyInfo2.NewsMsg != null && newsReplyInfo2.NewsMsg.Count > 0)
                                    {
                                        int num4 = 0;
                                        foreach (NewsMsgInfo current3 in newsReplyInfo2.NewsMsg)
                                        {
                                            num4++;
                                            if (num4 == 1)
                                            {
                                                stringBuilder2.Append(string.Concat(new string[]
                                                {
                                                    "<div class=\"mate-inner top\">                 <div class=\"mate-img\" >                     <img id=\"img1\" src=\"",
                                                    current3.PicUrl,
                                                    "\" class=\"img-responsive\">                     <div class=\"title\" id=\"title1\">",
                                                    current3.Title,
                                                    "</div>                 </div>             </div>"
                                                }));
                                            }
                                            else
                                            {
                                                stringBuilder2.Append(string.Concat(new string[]
                                                {
                                                    "             <div class=\"mate-inner\">                 <div class=\"child-mate\">                     <div class=\"child-mate-title clearfix\">                         <div class=\"title\">",
                                                    current3.Title,
                                                    "</div>                         <div class=\"img\">                             <img src=\"",
                                                    current3.PicUrl,
                                                    "\" class=\"img-responsive\">                         </div>                     </div>                 </div>             </div>"
                                                }));
                                            }
                                        }
                                        this.htmlInfo = stringBuilder2.ToString();
                                    }
                                }
                            }
                            break;
                        }
                    }
                    else
                    {
                        base.Response.Redirect("sendalllist.aspx");
                        base.Response.End();
                    }
                }
                else if (this.LocalArticleID > 0)
                {
                    ArticleInfo articleInfo2 = ArticleHelper.GetArticleInfo(this.LocalArticleID);
                    if (articleInfo2 != null)
                    {
                        this.hdfArticleID.Value   = this.LocalArticleID.ToString();
                        this.hdfMessageType.Value = ((int)articleInfo2.ArticleType).ToString();
                    }
                }
                if (string.IsNullOrEmpty(this.htmlInfo))
                {
                    this.htmlInfo = "<div class=\"exit-shop-info\">内容区</div>";
                }
                this.litInfo.Text = this.htmlInfo;
            }
        }
Exemplo n.º 10
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            this.ReUrl = Globals.RequestQueryStr("reurl");
            if (string.IsNullOrEmpty(this.ReUrl))
            {
                this.ReUrl = "articles.aspx";
            }
            int.TryParse(Globals.RequestQueryStr("id"), out this.MaterialID);
            string a = Globals.RequestQueryStr("cmd");

            if (a == "add")
            {
                base.Response.ContentType = "application/json";
                string value = Globals.RequestFormStr("MultiArticle");
                string s     = "{\"type\":\"0\",\"tips\":\"操作失败\"}";
                System.Collections.Generic.List <ArticleList> list = JsonConvert.DeserializeObject <System.Collections.Generic.List <ArticleList> >(value);
                if (list != null && list.Count > 0)
                {
                    int         num         = 0;
                    ArticleInfo articleInfo = new ArticleInfo();
                    System.Collections.Generic.List <ArticleItemsInfo> list2 = new System.Collections.Generic.List <ArticleItemsInfo>();
                    System.DateTime now  = System.DateTime.Now;
                    string          text = string.Empty;
                    foreach (ArticleList current in list)
                    {
                        if (current.Title == "")
                        {
                            text = "标题不能为空!";
                            break;
                        }
                        if (current.ImageUrl == "")
                        {
                            text = "请选择一张封面!";
                            break;
                        }
                        if (current.LinkType == LinkType.ArticleDetail && current.Content == "")
                        {
                            text = "请输入内容!";
                            break;
                        }
                        if (current.LinkType != LinkType.ArticleDetail && current.Url == "")
                        {
                            text = "请选择或输入自定义链接!";
                            break;
                        }
                        if (current.Status != "del")
                        {
                            if (num == 0)
                            {
                                articleInfo.Title       = current.Title;
                                articleInfo.ArticleType = ArticleType.List;
                                articleInfo.Content     = current.Content;
                                articleInfo.ImageUrl    = current.ImageUrl;
                                articleInfo.Url         = current.Url;
                                articleInfo.LinkType    = current.LinkType;
                                articleInfo.Memo        = "";
                                articleInfo.ArticleId   = this.MaterialID;
                                articleInfo.PubTime     = now;
                                articleInfo.IsShare     = current.IsShare;
                                num++;
                            }
                            else
                            {
                                ArticleItemsInfo articleItemsInfo = current;
                                articleItemsInfo.PubTime = now;
                                list2.Add(articleItemsInfo);
                                num++;
                            }
                        }
                    }
                    if (!string.IsNullOrEmpty(text))
                    {
                        s = "{\"type\":\"0\",\"tips\":\"" + text + "\"}";
                        base.Response.Write(s);
                        base.Response.End();
                    }
                    articleInfo.ItemsInfo = list2;
                    if (articleInfo.ArticleId > 0)
                    {
                        bool flag = ArticleHelper.UpdateMultiArticle(articleInfo);
                        if (flag)
                        {
                            s = "{\"type\":\"1\",\"id\":\"" + articleInfo.ArticleId + "\",\"tips\":\"多图素材修改成功!\"}";
                        }
                    }
                    else
                    {
                        int num2 = ArticleHelper.AddMultiArticle(articleInfo);
                        if (num2 > 0)
                        {
                            s = "{\"type\":\"1\",\"id\":\"" + num2 + "\",\"tips\":\"多图素材新增成功!\"}";
                        }
                    }
                    base.Response.Write(s);
                    base.Response.End();
                    return;
                }
            }
            else if (this.MaterialID > 0)
            {
                this.htmlOperName = "编辑";
                ArticleInfo articleInfo2 = ArticleHelper.GetArticleInfo(this.MaterialID);
                if (articleInfo2 != null)
                {
                    if (articleInfo2.ArticleType == ArticleType.News)
                    {
                        base.Response.Redirect("articlesedit.aspx?id=" + this.MaterialID);
                        base.Response.End();
                        return;
                    }
                    System.Collections.Generic.IList <ArticleItemsInfo> itemsInfo = articleInfo2.ItemsInfo;
                    itemsInfo.Insert(0, new ArticleItemsInfo
                    {
                        ArticleId = this.MaterialID,
                        Title     = articleInfo2.Title,
                        ImageUrl  = articleInfo2.ImageUrl,
                        Url       = articleInfo2.Url,
                        Content   = articleInfo2.Content,
                        LinkType  = articleInfo2.LinkType,
                        Id        = 0,
                        IsShare   = articleInfo2.IsShare
                    });
                    this.IsShare.Checked = articleInfo2.IsShare;
                    this.htmlLinkType    = ((int)articleInfo2.LinkType).ToString();
                    if (this.htmlLinkType != "1")
                    {
                        this.htmlAddJs = "$('#urlData').show();";
                    }
                    this.htmlLinkTypeName = articleInfo2.LinkType.ToShowText();
                    System.Collections.Generic.List <ArticleList> list3 = new System.Collections.Generic.List <ArticleList>();
                    int num3 = 1;
                    foreach (ArticleItemsInfo current2 in itemsInfo)
                    {
                        list3.Add(new ArticleList
                        {
                            Id       = current2.Id,
                            Title    = current2.Title,
                            Url      = current2.Url,
                            ImageUrl = current2.ImageUrl,
                            Content  = current2.Content,
                            BoxId    = num3++.ToString(),
                            LinkType = current2.LinkType,
                            Status   = "",
                            IsShare  = current2.IsShare
                        });
                    }
                    this.articleJson = JsonConvert.SerializeObject(list3);
                    return;
                }
            }
            else
            {
                this.articleJson = "''";
            }
        }
Exemplo n.º 11
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            if (!base.IsPostBack)
            {
                if (this.type == "getarticleinfo")
                {
                    base.Response.ContentType = "application/json";
                    string s   = "{\"type\":\"0\",\"tips\":\"操作失败\"}";
                    int    num = Globals.RequestFormNum("articleid");
                    if (num > 0)
                    {
                        ArticleInfo articleInfo = ArticleHelper.GetArticleInfo(num);
                        if (articleInfo != null)
                        {
                            System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder();
                            switch (articleInfo.ArticleType)
                            {
                            case ArticleType.News:
                                s = string.Concat(new object[]
                                {
                                    "{\"type\":\"1\",\"articletype\":",
                                    (int)articleInfo.ArticleType,
                                    ",\"title\":\"",
                                    this.String2Json(articleInfo.Title),
                                    "\",\"date\":\"",
                                    this.String2Json(articleInfo.PubTime.ToString("M月d日")),
                                    "\",\"imgurl\":\"",
                                    this.String2Json(articleInfo.ImageUrl),
                                    "\",\"memo\":\"",
                                    this.String2Json(articleInfo.Memo),
                                    "\"}"
                                });
                                goto IL_30E;

                            case ArticleType.List:
                            {
                                System.Collections.Generic.IList <ArticleItemsInfo> itemsInfo = articleInfo.ItemsInfo;
                                foreach (ArticleItemsInfo current in itemsInfo)
                                {
                                    stringBuilder.Append(string.Concat(new string[]
                                        {
                                            "{\"title\":\"",
                                            this.String2Json(current.Title),
                                            "\",\"imgurl\":\"",
                                            this.String2Json(current.ImageUrl),
                                            "\"},"
                                        }));
                                }
                                s = string.Concat(new object[]
                                    {
                                        "{\"type\":\"1\",\"articletype\":",
                                        (int)articleInfo.ArticleType,
                                        ",\"title\":\"",
                                        this.String2Json(articleInfo.Title),
                                        "\",\"date\":\"",
                                        this.String2Json(articleInfo.PubTime.ToString("M月d日")),
                                        "\",\"imgurl\":\"",
                                        this.String2Json(articleInfo.ImageUrl),
                                        "\",\"items\":[",
                                        stringBuilder.ToString().Trim(new char[]
                                        {
                                            ','
                                        }),
                                        "]}"
                                    });
                                goto IL_30E;
                            }
                            }
                            s = string.Concat(new object[]
                            {
                                "{\"type\":\"1\",\"articletype\":",
                                (int)articleInfo.ArticleType,
                                ",\"title\":\"",
                                this.String2Json(articleInfo.Title),
                                "\",\"date\":\"",
                                this.String2Json(articleInfo.PubTime.ToString("M月d日")),
                                "\",\"imgurl\":\"",
                                this.String2Json(articleInfo.ImageUrl),
                                "\",\"memo\":\"",
                                this.String2Json(articleInfo.Content),
                                "\"}"
                            });
                        }
                    }
IL_30E:
                    base.Response.Write(s);
                    base.Response.End();
                    return;
                }
                if (this.type == "postdata")
                {
                    base.Response.ContentType = "application/json";
                    this.sendID = Globals.RequestFormNum("sendid");
                    int    num2         = Globals.RequestFormNum("sendtype");
                    int    num3         = Globals.RequestFormNum("msgtype");
                    int    articleid    = Globals.RequestFormNum("articleid");
                    string title        = Globals.RequestFormStr("title");
                    string content      = Globals.RequestFormStr("content");
                    int    isoldarticle = Globals.RequestFormNum("isoldarticle");
                    string text         = this.SavePostData(num3, articleid, title, content, isoldarticle, this.sendID, true);
                    string s2;
                    if (string.IsNullOrEmpty(text))
                    {
                        MessageType messageType = (MessageType)num3;
                        string      arg_3DF_0   = string.Empty;
                        Articles    Articles    = new Articles();
                        Articles.msgType = "text";
                        string storeUrl = Globals.HostPath(System.Web.HttpContext.Current.Request.Url);
                        if (messageType == MessageType.List || messageType == MessageType.News)
                        {
                            this.sendID = Globals.ToNum(this.SavePostData(num3, articleid, title, content, isoldarticle, this.sendID, false));
                            ArticleInfo articleInfo2 = ArticleHelper.GetArticleInfo(articleid);
                            if (articleInfo2 == null)
                            {
                                s2 = "{\"type\":\"0\",\"tips\":\"素材不存在了\"}";
                                base.Response.Write(s2);
                                base.Response.End();
                            }
                            Articles = this.GetAlipayArticlesFromArticleInfo(articleInfo2, storeUrl);
                        }
                        else
                        {
                            this.sendID   = Globals.ToNum(this.SavePostData(num3, articleid, title, content, isoldarticle, this.sendID, false));
                            Articles.text = new MessageText
                            {
                                content = Globals.StripHtmlXmlTags(content)
                            };
                        }
                        SiteSettings masterSettings = SettingsManager.GetMasterSettings(true);
                        if (AlipayFuwuConfig.appId.Length < 15)
                        {
                            AlipayFuwuConfig.CommSetConfig(masterSettings.AlipayAppid, base.Server.MapPath("~/"), "GBK");
                        }
                        if (num2 == 1)
                        {
                            AlipayMobilePublicMessageTotalSendResponse alipayMobilePublicMessageTotalSendResponse = AliOHHelper.TotalSend(Articles);
                            if (!alipayMobilePublicMessageTotalSendResponse.IsError && alipayMobilePublicMessageTotalSendResponse.Code == "200")
                            {
                                s2 = "{\"type\":\"1\",\"tips\":\"服务窗群发成功,请于一天后到服务窗后台查询送达结果!\"}";
                                string msgid = "";
                                if (!string.IsNullOrEmpty(alipayMobilePublicMessageTotalSendResponse.Data) && alipayMobilePublicMessageTotalSendResponse.Data.Length > 50)
                                {
                                    msgid = alipayMobilePublicMessageTotalSendResponse.Data.Substring(0, 49);
                                }
                                int alypayUserNum = WeiXinHelper.getAlypayUserNum();
                                WeiXinHelper.UpdateMsgId(this.sendID, msgid, 1, alypayUserNum, alypayUserNum, "");
                            }
                            else
                            {
                                s2 = "{\"type\":\"0\",\"tips\":\"" + alipayMobilePublicMessageTotalSendResponse.Msg + "\"}";
                                WeiXinHelper.UpdateMsgId(this.sendID, "", 2, 0, 0, alipayMobilePublicMessageTotalSendResponse.Body);
                            }
                        }
                        else
                        {
                            System.Collections.Generic.List <string> sendList = new System.Collections.Generic.List <string>();
                            System.Data.DataTable rencentAliOpenID            = WeiXinHelper.GetRencentAliOpenID();
                            if (rencentAliOpenID != null)
                            {
                                for (int i = 0; i < rencentAliOpenID.Rows.Count; i++)
                                {
                                    sendList.Add(rencentAliOpenID.Rows[i][0].ToString());
                                }
                            }
                            if (sendList.Count > 0)
                            {
                                WeiXinHelper.UpdateMsgId(this.sendID, "", 0, 0, sendList.Count, "");
                                new System.Threading.Thread(() =>
                                {
                                    try
                                    {
                                        bool flag = false;
                                        foreach (string current3 in sendList)
                                        {
                                            if (current3.Length > 16)
                                            {
                                                Articles.toUserId = current3;
                                                AlipayMobilePublicMessageCustomSendResponse alipayMobilePublicMessageCustomSendResponse = AliOHHelper.CustomSend(Articles);
                                                if (alipayMobilePublicMessageCustomSendResponse != null && alipayMobilePublicMessageCustomSendResponse.IsError)
                                                {
                                                    AliOHHelper.log(alipayMobilePublicMessageCustomSendResponse.Body);
                                                }
                                                else
                                                {
                                                    flag = true;
                                                    WeiXinHelper.UpdateAddSendCount(this.sendID, 1, -1);
                                                }
                                                System.Threading.Thread.Sleep(10);
                                            }
                                        }
                                        if (flag)
                                        {
                                            WeiXinHelper.UpdateAddSendCount(this.sendID, 0, 1);
                                        }
                                        else
                                        {
                                            WeiXinHelper.UpdateAddSendCount(this.sendID, 0, 2);
                                        }
                                        System.Threading.Thread.Sleep(10);
                                    }
                                    catch (System.Exception ex)
                                    {
                                        AliOHHelper.log(ex.Message.ToString());
                                    }
                                }).Start();
                                s2 = "{\"type\":\"1\",\"tips\":\"信息正在后台推送中,请稍后刷新群发列表查看结果\"}";
                            }
                            else
                            {
                                s2 = "{\"type\":\"0\",\"tips\":\"暂时没有关注的用户可以发送信息\"}";
                            }
                        }
                    }
                    else
                    {
                        s2 = "{\"type\":\"0\",\"tips\":\"" + text + "\"}";
                    }
                    base.Response.Write(s2);
                    base.Response.End();
                    return;
                }
                if (this.sendID > 0)
                {
                    this.hdfSendID.Value = this.sendID.ToString();
                    SendAllInfo sendAllInfo = WeiXinHelper.GetSendAllInfo(this.sendID);
                    if (sendAllInfo != null)
                    {
                        MessageType messageType2 = sendAllInfo.MessageType;
                        this.hdfMessageType.Value = ((int)sendAllInfo.MessageType).ToString();
                        int articleID = sendAllInfo.ArticleID;
                        this.hdfArticleID.Value = articleID.ToString();
                        this.txtTitle.Text      = sendAllInfo.Title;
                        switch (messageType2)
                        {
                        case MessageType.Text:
                            this.fkContent.Text = sendAllInfo.Content;
                            break;

                        case MessageType.News:
                            if (articleID <= 0)
                            {
                                this.hdfIsOldArticle.Value = "1";
                                NewsReplyInfo newsReplyInfo = ReplyHelper.GetReply(this.sendID) as NewsReplyInfo;
                                if (newsReplyInfo != null && newsReplyInfo.NewsMsg != null && newsReplyInfo.NewsMsg.Count != 0)
                                {
                                    this.htmlInfo = string.Concat(new string[]
                                    {
                                        "<div class=\"mate-inner\"><h3 id=\"singelTitle\">",
                                        newsReplyInfo.NewsMsg[0].Title,
                                        "</h3><span>",
                                        newsReplyInfo.LastEditDate.ToString("M月d日"),
                                        "</span><div class=\"mate-img\"><img id=\"img1\" src=\"",
                                        newsReplyInfo.NewsMsg[0].PicUrl,
                                        "\" class=\"img-responsive\"></div><div class=\"mate-info\" id=\"Lbmsgdesc\">",
                                        newsReplyInfo.NewsMsg[0].Description,
                                        "</div><div class=\"red-all clearfix\"><strong class=\"fl\">查看全文</strong><em class=\"fr\">&gt;</em></div></div>"
                                    });
                                }
                            }
                            break;

                        case MessageType.List:
                            if (articleID <= 0)
                            {
                                this.hdfIsOldArticle.Value = "1";
                                NewsReplyInfo newsReplyInfo2 = ReplyHelper.GetReply(this.sendID) as NewsReplyInfo;
                                if (newsReplyInfo2 != null)
                                {
                                    System.Text.StringBuilder stringBuilder2 = new System.Text.StringBuilder();
                                    if (newsReplyInfo2.NewsMsg != null && newsReplyInfo2.NewsMsg.Count > 0)
                                    {
                                        int num4 = 0;
                                        foreach (NewsMsgInfo current2 in newsReplyInfo2.NewsMsg)
                                        {
                                            num4++;
                                            if (num4 == 1)
                                            {
                                                stringBuilder2.Append(string.Concat(new string[]
                                                {
                                                    "<div class=\"mate-inner top\">                 <div class=\"mate-img\" >                     <img id=\"img1\" src=\"",
                                                    current2.PicUrl,
                                                    "\" class=\"img-responsive\">                     <div class=\"title\" id=\"title1\">",
                                                    current2.Title,
                                                    "</div>                 </div>             </div>"
                                                }));
                                            }
                                            else
                                            {
                                                stringBuilder2.Append(string.Concat(new string[]
                                                {
                                                    "             <div class=\"mate-inner\">                 <div class=\"child-mate\">                     <div class=\"child-mate-title clearfix\">                         <div class=\"title\">",
                                                    current2.Title,
                                                    "</div>                         <div class=\"img\">                             <img src=\"",
                                                    current2.PicUrl,
                                                    "\" class=\"img-responsive\">                         </div>                     </div>                 </div>             </div>"
                                                }));
                                            }
                                        }
                                        this.htmlInfo = stringBuilder2.ToString();
                                    }
                                }
                            }
                            break;
                        }
                    }
                    else
                    {
                        base.Response.Redirect("sendalllist.aspx");
                        base.Response.End();
                    }
                }
                else if (this.LocalArticleID > 0)
                {
                    ArticleInfo articleInfo3 = ArticleHelper.GetArticleInfo(this.LocalArticleID);
                    if (articleInfo3 != null)
                    {
                        this.hdfArticleID.Value   = this.LocalArticleID.ToString();
                        this.hdfMessageType.Value = ((int)articleInfo3.ArticleType).ToString();
                    }
                }
                if (string.IsNullOrEmpty(this.htmlInfo))
                {
                    this.htmlInfo = "<div class=\"exit-shop-info\">内容区</div>";
                }
                this.litInfo.Text = this.htmlInfo;
            }
        }
Exemplo n.º 12
0
 protected void Page_Load(object sender, EventArgs e)
 {
     wid = GetCurWebId();
     if (string.IsNullOrEmpty(wid))
     {
         return;
     }
     this.ReUrl = Globals.RequestQueryStr("reurl");
     if (string.IsNullOrEmpty(this.ReUrl))
     {
         this.ReUrl = "articles.aspx";
     }
     int.TryParse(Globals.RequestQueryStr("id"), out this.MaterialID);
     if (!(Globals.RequestQueryStr("cmd") == "add"))
     {
         if (this.MaterialID > 0)
         {
             this.htmlOperName = "编辑";
             ArticleInfo articleInfo = ArticleHelper.GetArticleInfo(this.MaterialID);
             if (articleInfo != null)
             {
                 if (articleInfo.ArticleType == ArticleType.News)
                 {
                     base.Response.Redirect("articlesedit.aspx?id=" + this.MaterialID);
                     base.Response.End();
                 }
                 else
                 {
                     IList <ArticleItemsInfo> itemsInfo = articleInfo.ItemsInfo;
                     ArticleItemsInfo         item      = new ArticleItemsInfo {
                         ArticleId = this.MaterialID,
                         Title     = articleInfo.Title,
                         ImageUrl  = articleInfo.ImageUrl,
                         Url       = articleInfo.Url,
                         Content   = articleInfo.Content,
                         LinkType  = articleInfo.LinkType,
                         Id        = 0
                     };
                     itemsInfo.Insert(0, item);
                     this.htmlLinkType = ((int)articleInfo.LinkType).ToString();
                     if (this.htmlLinkType != "1")
                     {
                         this.htmlAddJs = "$('#divContent').hide();$('#urlData').show();";
                     }
                     this.htmlLinkTypeName = articleInfo.LinkType.ToShowText();
                     List <ArticleList> list5 = new List <ArticleList>();
                     int num3 = 1;
                     foreach (ArticleItemsInfo info5 in itemsInfo)
                     {
                         ArticleList list6 = new ArticleList {
                             Id       = info5.Id,
                             Title    = info5.Title,
                             Url      = info5.Url,
                             ImageUrl = info5.ImageUrl,
                             Content  = info5.Content
                         };
                         list6.BoxId    = num3++.ToString();
                         list6.LinkType = info5.LinkType;
                         list6.Status   = "";
                         list5.Add(list6);
                     }
                     this.articleJson = JsonConvert.SerializeObject(list5);
                 }
             }
         }
         else
         {
             this.articleJson = "''";
         }
     }
     else
     {
         base.Response.ContentType = "application/json";
         string             str2 = Globals.RequestFormStr("MultiArticle");
         string             s    = "{\"type\":\"0\",\"tips\":\"操作失败\"}";
         List <ArticleList> list = JsonConvert.DeserializeObject <List <ArticleList> >(str2);
         if ((list != null) && (list.Count > 0))
         {
             int                     num     = 0;
             ArticleInfo             article = new ArticleInfo();
             List <ArticleItemsInfo> list2   = new List <ArticleItemsInfo>();
             DateTime                now     = DateTime.Now;
             string                  str4    = string.Empty;
             foreach (ArticleList list3 in list)
             {
                 if (list3.Title == "")
                 {
                     str4 = "标题不能为空!";
                     break;
                 }
                 if (list3.ImageUrl == "")
                 {
                     str4 = "请选择一张封面!";
                     break;
                 }
                 if ((list3.LinkType == LinkType.ArticleDetail) && (list3.Content == ""))
                 {
                     str4 = "请输入内容!";
                     break;
                 }
                 if ((list3.LinkType != LinkType.ArticleDetail) && (list3.Url == ""))
                 {
                     str4 = "请选择或输入自定义链接!";
                     break;
                 }
                 if (list3.Status != "del")
                 {
                     if (num == 0)
                     {
                         article.Title       = list3.Title;
                         article.ArticleType = ArticleType.List;
                         article.Content     = list3.Content;
                         article.ImageUrl    = list3.ImageUrl;
                         article.Url         = list3.Url;
                         article.LinkType    = list3.LinkType;
                         article.Memo        = "";
                         article.ArticleId   = this.MaterialID;
                         article.PubTime     = now;
                         article.wid         = this.wid;
                         num++;
                     }
                     else
                     {
                         ArticleItemsInfo info2 = list3;
                         info2.PubTime = now;
                         list2.Add(info2);
                         num++;
                     }
                 }
             }
             if (!string.IsNullOrEmpty(str4))
             {
                 s = "{\"type\":\"0\",\"tips\":\"" + str4 + "\"}";
                 base.Response.Write(s);
                 base.Response.End();
             }
             article.ItemsInfo = list2;
             if (article.ArticleId > 0)
             {
                 if (ArticleHelper.UpdateMultiArticle(article))
                 {
                     s = "{\"type\":\"1\",\"id\":\"" + article.ArticleId + "\",\"tips\":\"多图素材修改成功!\"}";
                 }
             }
             else
             {
                 int num2 = ArticleHelper.AddMultiArticle(article);
                 if (num2 > 0)
                 {
                     s = "{\"type\":\"1\",\"id\":\"" + num2 + "\",\"tips\":\"多图素材新增成功!\"}";
                 }
             }
             base.Response.Write(s);
             base.Response.End();
         }
     }
 }
Exemplo n.º 13
0
        public AbstractResponse GetResponse(Hidistro.Entities.VShop.ReplyInfo reply, string openId)
        {
            string log = string.Concat(new string[]
            {
                reply.MessageType.ToString(),
                "||",
                reply.MessageType.ToString(),
                "||",
                reply.MessageTypeName
            });

            Globals.Debuglog(log, "_DebuglogYY.txt");
            if (reply.MessageType == MessageType.Text)
            {
                TextReplyInfo textReplyInfo = reply as TextReplyInfo;
                TextResponse  textResponse  = new TextResponse();
                textResponse.CreateTime = System.DateTime.Now;
                textResponse.Content    = Globals.FormatWXReplyContent(textReplyInfo.Text);
                if (reply.Keys == "登录")
                {
                    string arg = Globals.GetWebUrlStart() + "/Vshop/MemberCenter.aspx";
                    textResponse.Content = textResponse.Content.Replace("$login$", string.Format("<a href=\"{0}\">一键登录</a>", arg));
                }
                return(textResponse);
            }
            NewsResponse newsResponse = new NewsResponse();

            newsResponse.CreateTime = System.DateTime.Now;
            newsResponse.Articles   = new System.Collections.Generic.List <Article>();
            if (reply.ArticleID > 0)
            {
                ArticleInfo articleInfo = ArticleHelper.GetArticleInfo(reply.ArticleID);
                if (articleInfo.ArticleType == ArticleType.News)
                {
                    Article item = new Article
                    {
                        Description = articleInfo.Memo,
                        PicUrl      = this.FormatImgUrl(articleInfo.ImageUrl),
                        Title       = articleInfo.Title,
                        Url         = (string.IsNullOrEmpty(articleInfo.Url) ? string.Format("http://{0}/Vshop/ArticleDetail.aspx?sid={1}", System.Web.HttpContext.Current.Request.Url.Host, articleInfo.ArticleId) : articleInfo.Url)
                    };
                    newsResponse.Articles.Add(item);
                    return(newsResponse);
                }
                if (articleInfo.ArticleType != ArticleType.List)
                {
                    return(newsResponse);
                }
                Article item2 = new Article
                {
                    Description = articleInfo.Memo,
                    PicUrl      = this.FormatImgUrl(articleInfo.ImageUrl),
                    Title       = articleInfo.Title,
                    Url         = (string.IsNullOrEmpty(articleInfo.Url) ? string.Format("http://{0}/Vshop/ArticleDetail.aspx?sid={1}", System.Web.HttpContext.Current.Request.Url.Host, articleInfo.ArticleId) : articleInfo.Url)
                };
                newsResponse.Articles.Add(item2);
                using (System.Collections.Generic.IEnumerator <ArticleItemsInfo> enumerator = articleInfo.ItemsInfo.GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        ArticleItemsInfo current = enumerator.Current;
                        item2 = new Article
                        {
                            Description = "",
                            PicUrl      = this.FormatImgUrl(current.ImageUrl),
                            Title       = current.Title,
                            Url         = (string.IsNullOrEmpty(current.Url) ? string.Format("http://{0}/Vshop/ArticleDetail.aspx?iid={1}", System.Web.HttpContext.Current.Request.Url.Host, current.Id) : current.Url)
                        };
                        newsResponse.Articles.Add(item2);
                    }
                    return(newsResponse);
                }
            }
            foreach (NewsMsgInfo current2 in (reply as NewsReplyInfo).NewsMsg)
            {
                Article item3 = new Article
                {
                    Description = current2.Description,
                    PicUrl      = string.Format("http://{0}{1}", System.Web.HttpContext.Current.Request.Url.Host, current2.PicUrl),
                    Title       = current2.Title,
                    Url         = (string.IsNullOrEmpty(current2.Url) ? string.Format("http://{0}/Vshop/ImageTextDetails.aspx?messageId={1}", System.Web.HttpContext.Current.Request.Url.Host, current2.Id) : current2.Url)
                };
                newsResponse.Articles.Add(item3);
            }
            return(newsResponse);
        }
Exemplo n.º 14
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);
        }
Exemplo n.º 15
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);
        }
Exemplo n.º 16
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            if (!base.IsPostBack)
            {
                if (this.type == "getarticleinfo")
                {
                    base.Response.ContentType = "application/json";
                    string str1 = "{\"type\":\"0\",\"tips\":\"操作失败\"}";
                    int    num  = Globals.RequestFormNum("articleid");
                    if (num > 0)
                    {
                        ArticleInfo articleInfo = ArticleHelper.GetArticleInfo(num);
                        if (articleInfo != null)
                        {
                            StringBuilder stringBuilder = new StringBuilder();
                            switch (articleInfo.ArticleType)
                            {
                            case ArticleType.News:
                            {
                                object[] articleType = new object[] { "{\"type\":\"1\",\"articletype\":", (int)articleInfo.ArticleType, ",\"title\":\"", this.String2Json(articleInfo.Title), "\",\"date\":\"", null, null, null, null, null, null };
                                DateTime pubTime     = articleInfo.PubTime;
                                articleType[5]  = this.String2Json(pubTime.ToString("M月d日"));
                                articleType[6]  = "\",\"imgurl\":\"";
                                articleType[7]  = this.String2Json(articleInfo.ImageUrl);
                                articleType[8]  = "\",\"memo\":\"";
                                articleType[9]  = this.String2Json(articleInfo.Memo);
                                articleType[10] = "\"}";
                                str1            = string.Concat(articleType);
                                break;
                            }

                            case ArticleType.Text | ArticleType.News:
                            {
                                object[] objArray = new object[] { "{\"type\":\"1\",\"articletype\":", (int)articleInfo.ArticleType, ",\"title\":\"", this.String2Json(articleInfo.Title), "\",\"date\":\"", null, null, null, null, null, null };
                                DateTime dateTime = articleInfo.PubTime;
                                objArray[5]  = this.String2Json(dateTime.ToString("M月d日"));
                                objArray[6]  = "\",\"imgurl\":\"";
                                objArray[7]  = this.String2Json(articleInfo.ImageUrl);
                                objArray[8]  = "\",\"memo\":\"";
                                objArray[9]  = this.String2Json(articleInfo.Content);
                                objArray[10] = "\"}";
                                str1         = string.Concat(objArray);
                                break;
                            }

                            case ArticleType.List:
                            {
                                foreach (ArticleItemsInfo itemsInfo in articleInfo.ItemsInfo)
                                {
                                    string[] strArrays = new string[] { "{\"title\":\"", this.String2Json(itemsInfo.Title), "\",\"imgurl\":\"", this.String2Json(itemsInfo.ImageUrl), "\"}," };
                                    stringBuilder.Append(string.Concat(strArrays));
                                }
                                object[] articleType1 = new object[] { "{\"type\":\"1\",\"articletype\":", (int)articleInfo.ArticleType, ",\"title\":\"", this.String2Json(articleInfo.Title), "\",\"date\":\"", null, null, null, null, null, null };
                                DateTime pubTime1     = articleInfo.PubTime;
                                articleType1[5] = this.String2Json(pubTime1.ToString("M月d日"));
                                articleType1[6] = "\",\"imgurl\":\"";
                                articleType1[7] = this.String2Json(articleInfo.ImageUrl);
                                articleType1[8] = "\",\"items\":[";
                                string str2     = stringBuilder.ToString();
                                char[] chrArray = new char[] { ',' };
                                articleType1[9]  = str2.Trim(chrArray);
                                articleType1[10] = "]}";
                                str1             = string.Concat(articleType1);
                                break;
                            }

                            default:
                            {
                                goto case ArticleType.Text | ArticleType.News;
                            }
                            }
                        }
                    }
                    base.Response.Write(str1);
                    base.Response.End();
                    return;
                }
                if (this.type == "postdata")
                {
                    base.Response.ContentType = "application/json";
                    string str3 = "{\"type\":\"1\",\"tips\":\"操作成功\"}";
                    this.sendID = Globals.RequestFormNum("sendid");
                    int    num1 = Globals.RequestFormNum("sendtype");
                    int    num2 = Globals.RequestFormNum("msgtype");
                    int    num3 = Globals.RequestFormNum("articleid");
                    string str4 = Globals.RequestFormStr("title");
                    string str5 = Globals.RequestFormStr("content");
                    int    num4 = Globals.RequestFormNum("isoldarticle");
                    string str6 = this.SavePostData(num2, num3, str4, str5, num4, this.sendID, true);
                    if (!string.IsNullOrEmpty(str6))
                    {
                        str3 = string.Concat("{\"type\":\"0\",\"tips\":\"", str6, "\"}");
                    }
                    else
                    {
                        MessageType messageType = (MessageType)num2;
                        string      empty       = string.Empty;
                        Articles    article     = new Articles()
                        {
                            msgType = "text"
                        };
                        string str7 = Globals.HostPath(HttpContext.Current.Request.Url);
                        if (messageType == MessageType.List || messageType == MessageType.News)
                        {
                            this.sendID = Globals.ToNum(this.SavePostData(num2, num3, str4, str5, num4, this.sendID, false));
                            ArticleInfo articleInfo1 = ArticleHelper.GetArticleInfo(num3);
                            if (articleInfo1 == null)
                            {
                                str3 = "{\"type\":\"0\",\"tips\":\"素材不存在了\"}";
                                base.Response.Write(str3);
                                base.Response.End();
                            }
                            article = this.GetAlipayArticlesFromArticleInfo(articleInfo1, str7);
                        }
                        else
                        {
                            this.sendID = Globals.ToNum(this.SavePostData(num2, num3, str4, str5, num4, this.sendID, false));
                            Articles    article1    = article;
                            MessageText messageText = new MessageText()
                            {
                                content = Globals.StripHtmlXmlTags(str5)
                            };
                            article1.text = messageText;
                        }
                        SiteSettings masterSettings = SettingsManager.GetMasterSettings(true);
                        if (AlipayFuwuConfig.appId.Length < 15)
                        {
                            AlipayFuwuConfig.CommSetConfig(masterSettings.AlipayAppid, base.Server.MapPath("~/"), "GBK");
                        }
                        if (num1 != 1)
                        {
                            List <string> strs             = new List <string>();
                            DataTable     rencentAliOpenID = WeiXinHelper.GetRencentAliOpenID();
                            if (rencentAliOpenID != null)
                            {
                                for (int i = 0; i < rencentAliOpenID.Rows.Count; i++)
                                {
                                    strs.Add(rencentAliOpenID.Rows[i][0].ToString());
                                }
                            }
                            if (strs.Count <= 0)
                            {
                                str3 = "{\"type\":\"0\",\"tips\":\"暂时没有关注的用户可以发送信息\"}";
                            }
                            else
                            {
                                WeiXinHelper.UpdateMsgId(this.sendID, "", 0, 0, strs.Count, "");
                                (new Thread(() =>
                                {
                                    try
                                    {
                                        bool flag = false;
                                        foreach (string str in strs)
                                        {
                                            if (str.Length <= 16)
                                            {
                                                continue;
                                            }
                                            article.toUserId = str;
                                            AlipayMobilePublicMessageCustomSendResponse alipayMobilePublicMessageCustomSendResponse = AliOHHelper.CustomSend(article);
                                            if (alipayMobilePublicMessageCustomSendResponse == null || !alipayMobilePublicMessageCustomSendResponse.IsError)
                                            {
                                                flag = true;
                                                WeiXinHelper.UpdateAddSendCount(this.sendID, 1, -1);
                                            }
                                            else
                                            {
                                                AliOHHelper.log(alipayMobilePublicMessageCustomSendResponse.Body);
                                            }
                                            Thread.Sleep(10);
                                        }
                                        if (!flag)
                                        {
                                            WeiXinHelper.UpdateAddSendCount(this.sendID, 0, 2);
                                        }
                                        else
                                        {
                                            WeiXinHelper.UpdateAddSendCount(this.sendID, 0, 1);
                                        }
                                        Thread.Sleep(10);
                                    }
                                    catch (Exception exception)
                                    {
                                        AliOHHelper.log(exception.Message.ToString());
                                    }
                                })).Start();
                                str3 = "{\"type\":\"1\",\"tips\":\"信息正在后台推送中,请稍后刷新群发列表查看结果\"}";
                            }
                        }
                        else
                        {
                            AlipayMobilePublicMessageTotalSendResponse alipayMobilePublicMessageTotalSendResponse = AliOHHelper.TotalSend(article);
                            if (alipayMobilePublicMessageTotalSendResponse.IsError || !(alipayMobilePublicMessageTotalSendResponse.Code == "200"))
                            {
                                str3 = string.Concat("{\"type\":\"0\",\"tips\":\"", alipayMobilePublicMessageTotalSendResponse.Msg, "\"}");
                                WeiXinHelper.UpdateMsgId(this.sendID, "", 2, 0, 0, alipayMobilePublicMessageTotalSendResponse.Body);
                            }
                            else
                            {
                                str3 = "{\"type\":\"1\",\"tips\":\"服务窗群发成功,请于一天后到服务窗后台查询送达结果!\"}";
                                string str8 = "";
                                if (!string.IsNullOrEmpty(alipayMobilePublicMessageTotalSendResponse.Data) && alipayMobilePublicMessageTotalSendResponse.Data.Length > 50)
                                {
                                    str8 = alipayMobilePublicMessageTotalSendResponse.Data.Substring(0, 49);
                                }
                                int alypayUserNum = WeiXinHelper.getAlypayUserNum();
                                WeiXinHelper.UpdateMsgId(this.sendID, str8, 1, alypayUserNum, alypayUserNum, "");
                            }
                        }
                    }
                    base.Response.Write(str3);
                    base.Response.End();
                    return;
                }
                if (this.sendID > 0)
                {
                    this.hdfSendID.Value = this.sendID.ToString();
                    SendAllInfo sendAllInfo = WeiXinHelper.GetSendAllInfo(this.sendID);
                    if (sendAllInfo == null)
                    {
                        base.Response.Redirect("sendalllist.aspx");
                        base.Response.End();
                    }
                    else
                    {
                        MessageType messageType1 = sendAllInfo.MessageType;
                        this.hdfMessageType.Value = sendAllInfo.MessageType.ToString();
                        int articleID = sendAllInfo.ArticleID;
                        this.hdfArticleID.Value = articleID.ToString();
                        this.txtTitle.Text      = sendAllInfo.Title;
                        switch (messageType1)
                        {
                        case MessageType.Text:
                        {
                            this.fkContent.Text = sendAllInfo.Content;
                            break;
                        }

                        case MessageType.News:
                        {
                            if (articleID > 0)
                            {
                                break;
                            }
                            this.hdfIsOldArticle.Value = "1";
                            NewsReplyInfo reply = ReplyHelper.GetReply(this.sendID) as NewsReplyInfo;
                            if (reply == null || reply.NewsMsg == null || reply.NewsMsg.Count == 0)
                            {
                                break;
                            }
                            string[] title = new string[] { "<div class=\"mate-inner\"><h3 id=\"singelTitle\">", reply.NewsMsg[0].Title, "</h3><span>", null, null, null, null, null, null };
                            title[3]      = reply.LastEditDate.ToString("M月d日");
                            title[4]      = "</span><div class=\"mate-img\"><img id=\"img1\" src=\"";
                            title[5]      = reply.NewsMsg[0].PicUrl;
                            title[6]      = "\" class=\"img-responsive\"></div><div class=\"mate-info\" id=\"Lbmsgdesc\">";
                            title[7]      = reply.NewsMsg[0].Description;
                            title[8]      = "</div><div class=\"red-all clearfix\"><strong class=\"fl\">查看全文</strong><em class=\"fr\">&gt;</em></div></div>";
                            this.htmlInfo = string.Concat(title);
                            break;
                        }

                        case MessageType.List:
                        {
                            if (articleID > 0)
                            {
                                break;
                            }
                            this.hdfIsOldArticle.Value = "1";
                            NewsReplyInfo newsReplyInfo = ReplyHelper.GetReply(this.sendID) as NewsReplyInfo;
                            if (newsReplyInfo == null)
                            {
                                break;
                            }
                            StringBuilder stringBuilder1 = new StringBuilder();
                            if (newsReplyInfo.NewsMsg == null || newsReplyInfo.NewsMsg.Count <= 0)
                            {
                                break;
                            }
                            int num5 = 0;
                            foreach (NewsMsgInfo newsMsg in newsReplyInfo.NewsMsg)
                            {
                                num5++;
                                if (num5 != 1)
                                {
                                    string[] title1 = new string[] { "             <div class=\"mate-inner\">                 <div class=\"child-mate\">                     <div class=\"child-mate-title clearfix\">                         <div class=\"title\">", newsMsg.Title, "</div>                         <div class=\"img\">                             <img src=\"", newsMsg.PicUrl, "\" class=\"img-responsive\">                         </div>                     </div>                 </div>             </div>" };
                                    stringBuilder1.Append(string.Concat(title1));
                                }
                                else
                                {
                                    string[] picUrl = new string[] { "<div class=\"mate-inner top\">                 <div class=\"mate-img\" >                     <img id=\"img1\" src=\"", newsMsg.PicUrl, "\" class=\"img-responsive\">                     <div class=\"title\" id=\"title1\">", newsMsg.Title, "</div>                 </div>             </div>" };
                                    stringBuilder1.Append(string.Concat(picUrl));
                                }
                            }
                            this.htmlInfo = stringBuilder1.ToString();
                            break;
                        }
                        }
                    }
                }
                else if (this.LocalArticleID > 0)
                {
                    ArticleInfo articleInfo2 = ArticleHelper.GetArticleInfo(this.LocalArticleID);
                    if (articleInfo2 != null)
                    {
                        this.hdfArticleID.Value   = this.LocalArticleID.ToString();
                        this.hdfMessageType.Value = articleInfo2.ArticleType.ToString();
                    }
                }
                if (string.IsNullOrEmpty(this.htmlInfo))
                {
                    this.htmlInfo = "<div class=\"exit-shop-info\">内容区</div>";
                }
                this.litInfo.Text = this.htmlInfo;
            }
        }
Exemplo n.º 17
0
        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);
        }
Exemplo n.º 18
0
        protected void Page_Load(object sender, EventArgs e)
        {
            int.TryParse(base.Request.QueryString["id"], out this.MaterialID);
            string text1 = base.Request.QueryString["cmd"];

            this.ReUrl = base.Request.QueryString["reurl"];
            if (string.IsNullOrEmpty(this.ReUrl))
            {
                this.ReUrl = "articles.aspx";
            }
            string str = base.Request.Form["posttype"];

            if (!base.IsPostBack)
            {
                if (str == "addsinglearticle")
                {
                    base.Response.ContentType = "application/json";
                    string str2   = base.Request.Form["linkUrl"];
                    string str3   = base.Request.Form["title"];
                    string str4   = base.Request.Form["img"];
                    string str5   = base.Request.Form["memo"];
                    string str6   = base.Request.Form["content"];
                    string s      = base.Request.Form["linkType"];
                    string str8   = base.Request.Form["IsShare"];
                    int    result = 1;
                    int.TryParse(s, out result);
                    string str9 = "{\"type\":\"0\",\"tips\":\"操作失败!\"}";
                    if (string.IsNullOrEmpty(str3))
                    {
                        str9 = "{\"type\":\"0\",\"tips\":\"请填写标题!\"}";
                        base.Response.Write(str9);
                        base.Response.End();
                    }
                    if (string.IsNullOrEmpty(str4))
                    {
                        str9 = "{\"type\":\"0\",\"tips\":\"请选择封面图片!\"}";
                        base.Response.Write(str9);
                        base.Response.End();
                    }
                    if ((result != 1) && string.IsNullOrEmpty(str2))
                    {
                        str9 = "{\"type\":\"0\",\"tips\":\"请设置链接地址!\"}";
                        base.Response.Write(str9);
                        base.Response.End();
                    }
                    ArticleInfo article = new ArticleInfo
                    {
                        ArticleId = this.MaterialID,
                        Url       = str2,
                        Title     = str3
                    };
                    if (string.IsNullOrEmpty(str8))
                    {
                        article.IsShare = false;
                    }
                    else
                    {
                        article.IsShare = bool.Parse(str8);
                    }
                    article.ImageUrl    = str4;
                    article.Memo        = str5;
                    article.ArticleType = ArticleType.News;
                    article.PubTime     = DateTime.Now;
                    article.Content     = str6;
                    article.LinkType    = (LinkType)result;
                    if (article.ArticleId > 0)
                    {
                        if (ArticleHelper.UpdateSingleArticle(article))
                        {
                            str9 = "{\"type\":\"1\",\"id\":\"" + article.ArticleId + "\",\"tips\":\"单图文修改成功!\"}";
                        }
                    }
                    else
                    {
                        int num2 = ArticleHelper.AddSingerArticle(article);
                        if (num2 > 0)
                        {
                            str9 = "{\"type\":\"1\",\"id\":\"" + num2 + "\",\"tips\":\"单图文新增成功!\"}";
                        }
                    }
                    base.Response.Write(str9);
                    base.Response.End();
                }
                else if (this.MaterialID > 0)
                {
                    this.htmlOperName = "编辑";
                    ArticleInfo articleInfo = ArticleHelper.GetArticleInfo(this.MaterialID);
                    if (articleInfo != null)
                    {
                        if (articleInfo.ArticleType == ArticleType.List)
                        {
                            base.Response.Redirect("multiarticlesedit.aspx?id=" + this.MaterialID);
                            base.Response.End();
                        }
                        else
                        {
                            this.htmlArticleTitle = articleInfo.Title;
                            this.htmlImgUrl       = articleInfo.ImageUrl;
                            this.htmlUrl          = articleInfo.Url;
                            this.htmlMemo         = articleInfo.Memo;
                            this.htmlDate         = articleInfo.PubTime.ToString("M月d日");
                            this.fkContent.Text   = articleInfo.Content;
                            this.IsShare.Checked  = articleInfo.IsShare;
                            this.htmlAddJs        = "BindPicData('" + this.htmlImgUrl + "');";
                            this.htmlLinkType     = ((int)articleInfo.LinkType).ToString();
                            if (this.htmlLinkType != "1")
                            {
                                this.htmlAddJs = this.htmlAddJs + "$('#urlData').show();";
                            }
                            this.htmlLinkTypeName = articleInfo.LinkType.ToShowText();
                        }
                    }
                }
            }
        }
Exemplo n.º 19
0
        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 = ReplyHelper.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 = ReplyHelper.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 = ReplyHelper.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());
        }
Exemplo n.º 20
0
        public AbstractResponse GetResponse(Hidistro.Entities.VShop.ReplyInfo reply, string openId)
        {
            if (reply.MessageType == Hidistro.Entities.VShop.MessageType.Text)
            {
                TextReplyInfo info     = reply as TextReplyInfo;
                TextResponse  response = new TextResponse
                {
                    CreateTime = DateTime.Now,
                    Content    = info.Text
                };
                if (reply.Keys == "登录")
                {
                    string str = string.Format("http://{0}/Vshop/Login.aspx?SessionId={1}", HttpContext.Current.Request.Url.Host, openId);
                    response.Content = response.Content.Replace("$login$", string.Format("<a href=\"{0}\">一键登录</a>", str));
                }
                return(response);
            }
            NewsResponse response2 = new NewsResponse
            {
                CreateTime = DateTime.Now,
                Articles   = new List <Article>()
            };

            if (reply.ArticleID > 0)
            {
                ArticleInfo articleInfo = ArticleHelper.GetArticleInfo(reply.ArticleID);
                if (articleInfo.ArticleType == ArticleType.News)
                {
                    Article item = new Article
                    {
                        Description = articleInfo.Memo,
                        PicUrl      = this.FormatImgUrl(articleInfo.ImageUrl),
                        Title       = articleInfo.Title,
                        Url         = string.IsNullOrEmpty(articleInfo.Url) ? string.Format("http://{0}/Vshop/ArticleDetail.aspx?sid={1}", HttpContext.Current.Request.Url.Host, articleInfo.ArticleId) : articleInfo.Url
                    };
                    response2.Articles.Add(item);
                    return(response2);
                }
                if (articleInfo.ArticleType == ArticleType.List)
                {
                    Article article3 = new Article
                    {
                        Description = articleInfo.Memo,
                        PicUrl      = this.FormatImgUrl(articleInfo.ImageUrl),
                        Title       = articleInfo.Title,
                        Url         = string.IsNullOrEmpty(articleInfo.Url) ? string.Format("http://{0}/Vshop/ArticleDetail.aspx?sid={1}", HttpContext.Current.Request.Url.Host, articleInfo.ArticleId) : articleInfo.Url
                    };
                    response2.Articles.Add(article3);
                    foreach (ArticleItemsInfo info3 in articleInfo.ItemsInfo)
                    {
                        article3 = new Article
                        {
                            Description = "",
                            PicUrl      = this.FormatImgUrl(info3.ImageUrl),
                            Title       = info3.Title,
                            Url         = string.IsNullOrEmpty(info3.Url) ? string.Format("http://{0}/Vshop/ArticleDetail.aspx?iid={1}", HttpContext.Current.Request.Url.Host, info3.Id) : info3.Url
                        };
                        response2.Articles.Add(article3);
                    }
                }
                return(response2);
            }
            foreach (NewsMsgInfo info4 in (reply as NewsReplyInfo).NewsMsg)
            {
                Article article6 = new Article
                {
                    Description = info4.Description,
                    PicUrl      = string.Format("http://{0}{1}", HttpContext.Current.Request.Url.Host, info4.PicUrl),
                    Title       = info4.Title,
                    Url         = string.IsNullOrEmpty(info4.Url) ? string.Format("http://{0}/Vshop/ImageTextDetails.aspx?messageId={1}", HttpContext.Current.Request.Url.Host, info4.Id) : info4.Url
                };
                response2.Articles.Add(article6);
            }
            return(response2);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (this.IsPostBack)
            {
                return;
            }
            if (this.type == "getarticleinfo")
            {
                this.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 stringBuilder = new StringBuilder();
                        switch (articleInfo.ArticleType)
                        {
                        case ArticleType.News:
                            s = "{\"type\":\"1\",\"articletype\":" + (object)articleInfo.ArticleType + ",\"title\":\"" + this.String2Json(articleInfo.Title) + "\",\"date\":\"" + this.String2Json(articleInfo.PubTime.ToString("M月d日")) + "\",\"imgurl\":\"" + this.String2Json(articleInfo.ImageUrl) + "\",\"memo\":\"" + this.String2Json(articleInfo.Memo) + "\"}";
                            break;

                        case ArticleType.List:
                            foreach (ArticleItemsInfo articleItemsInfo in (IEnumerable <ArticleItemsInfo>)articleInfo.ItemsInfo)
                            {
                                stringBuilder.Append("{\"title\":\"" + this.String2Json(articleItemsInfo.Title) + "\",\"imgurl\":\"" + this.String2Json(articleItemsInfo.ImageUrl) + "\"},");
                            }
                            s = "{\"type\":\"1\",\"articletype\":" + (object)articleInfo.ArticleType + ",\"title\":\"" + this.String2Json(articleInfo.Title) + "\",\"date\":\"" + this.String2Json(articleInfo.PubTime.ToString("M月d日")) + "\",\"imgurl\":\"" + this.String2Json(articleInfo.ImageUrl) + "\",\"items\":[" + ((object)stringBuilder).ToString().Trim(',') + "]}";
                            break;

                        default:
                            s = "{\"type\":\"1\",\"articletype\":" + (object)articleInfo.ArticleType + ",\"title\":\"" + this.String2Json(articleInfo.Title) + "\",\"date\":\"" + this.String2Json(articleInfo.PubTime.ToString("M月d日")) + "\",\"imgurl\":\"" + this.String2Json(articleInfo.ImageUrl) + "\",\"memo\":\"" + this.String2Json(articleInfo.Content) + "\"}";
                            break;
                        }
                    }
                }
                this.Response.Write(s);
                this.Response.End();
            }
            else if (this.type == "postdata")
            {
                this.Response.ContentType = "application/json";
                this.sendID = Globals.RequestFormNum("sendid");
                int    num          = Globals.RequestFormNum("sendtype");
                int    msgType      = Globals.RequestFormNum("msgtype");
                int    articleid    = Globals.RequestFormNum("articleid");
                string title        = Globals.RequestFormStr("title");
                string content      = Globals.RequestFormStr("content");
                int    isoldarticle = Globals.RequestFormNum("isoldarticle");
                string str1         = this.SavePostData(msgType, articleid, title, content, isoldarticle, this.sendID, true);
                string s;
                if (string.IsNullOrEmpty(str1))
                {
                    MessageType messageType = (MessageType)msgType;
                    string      str2        = string.Empty;
                    Articles    Articles    = new Articles();
                    Articles.msgType = "text";
                    string storeUrl = Globals.HostPath(HttpContext.Current.Request.Url);
                    if (messageType == MessageType.List || messageType == MessageType.News)
                    {
                        this.sendID = Globals.ToNum((object)this.SavePostData(msgType, articleid, title, content, isoldarticle, this.sendID, false));
                        ArticleInfo articleInfo = ArticleHelper.GetArticleInfo(articleid);
                        if (articleInfo == null)
                        {
                            this.Response.Write("{\"type\":\"0\",\"tips\":\"素材不存在了\"}");
                            this.Response.End();
                        }
                        Articles = this.GetAlipayArticlesFromArticleInfo(articleInfo, storeUrl);
                    }
                    else
                    {
                        this.sendID   = Globals.ToNum((object)this.SavePostData(msgType, articleid, title, content, isoldarticle, this.sendID, false));
                        Articles.text = new MessageText()
                        {
                            content = Globals.StripHtmlXmlTags(content)
                        };
                    }
                    SiteSettings masterSettings = SettingsManager.GetMasterSettings(true);
                    if (AlipayFuwuConfig.appId.Length < 15)
                    {
                        AlipayFuwuConfig.CommSetConfig(masterSettings.AlipayAppid, this.Server.MapPath("~/"), "GBK");
                    }
                    if (num == 1)
                    {
                        AlipayMobilePublicMessageTotalSendResponse totalSendResponse = AliOHHelper.TotalSend(Articles);
                        if (!totalSendResponse.IsError && totalSendResponse.Code == "200")
                        {
                            s = "{\"type\":\"1\",\"tips\":\"服务窗群发成功,请于一天后到服务窗后台查询送达结果!\"}";
                            string msgid = "";
                            if (!string.IsNullOrEmpty(totalSendResponse.Data) && totalSendResponse.Data.Length > 50)
                            {
                                msgid = totalSendResponse.Data.Substring(0, 49);
                            }
                            int alypayUserNum = WeiXinHelper.getAlypayUserNum();
                            WeiXinHelper.UpdateMsgId(this.sendID, msgid, 1, alypayUserNum, alypayUserNum, "");
                        }
                        else
                        {
                            s = "{\"type\":\"0\",\"tips\":\"" + totalSendResponse.Msg + "\"}";
                            WeiXinHelper.UpdateMsgId(this.sendID, "", 2, 0, 0, totalSendResponse.Body);
                        }
                    }
                    else
                    {
                        List <string> sendList         = new List <string>();
                        DataTable     rencentAliOpenId = WeiXinHelper.GetRencentAliOpenID();
                        if (rencentAliOpenId != null)
                        {
                            for (int index = 0; index < rencentAliOpenId.Rows.Count; ++index)
                            {
                                sendList.Add(rencentAliOpenId.Rows[index][0].ToString());
                            }
                        }
                        if (sendList.Count > 0)
                        {
                            WeiXinHelper.UpdateMsgId(this.sendID, "", 0, 0, sendList.Count, "");
                            new Thread((ThreadStart)(() =>
                            {
                                try
                                {
                                    bool flag = false;
                                    foreach (string str in sendList)
                                    {
                                        if (str.Length > 16)
                                        {
                                            Articles.toUserId = str;
                                            AlipayMobilePublicMessageCustomSendResponse customSendResponse = AliOHHelper.CustomSend(Articles);
                                            if (customSendResponse != null && customSendResponse.IsError)
                                            {
                                                AliOHHelper.log(customSendResponse.Body);
                                            }
                                            else
                                            {
                                                flag = true;
                                                WeiXinHelper.UpdateAddSendCount(this.sendID, 1, -1);
                                            }
                                            Thread.Sleep(10);
                                        }
                                    }
                                    if (flag)
                                    {
                                        WeiXinHelper.UpdateAddSendCount(this.sendID, 0, 1);
                                    }
                                    else
                                    {
                                        WeiXinHelper.UpdateAddSendCount(this.sendID, 0, 2);
                                    }
                                    Thread.Sleep(10);
                                }
                                catch (Exception ex)
                                {
                                    AliOHHelper.log(((object)ex.Message).ToString());
                                }
                            })).Start();
                            s = "{\"type\":\"1\",\"tips\":\"信息正在后台推送中,请稍后刷新群发列表查看结果\"}";
                        }
                        else
                        {
                            s = "{\"type\":\"0\",\"tips\":\"暂时没有关注的用户可以发送信息\"}";
                        }
                    }
                }
                else
                {
                    s = "{\"type\":\"0\",\"tips\":\"" + str1 + "\"}";
                }
                this.Response.Write(s);
                this.Response.End();
            }
            else
            {
                if (this.sendID > 0)
                {
                    this.hdfSendID.Value = this.sendID.ToString();
                    SendAllInfo sendAllInfo = WeiXinHelper.GetSendAllInfo(this.sendID);
                    if (sendAllInfo != null)
                    {
                        MessageType messageType = sendAllInfo.MessageType;
                        this.hdfMessageType.Value = ((int)sendAllInfo.MessageType).ToString();
                        int articleId = sendAllInfo.ArticleID;
                        this.hdfArticleID.Value = articleId.ToString();
                        this.txtTitle.Text      = sendAllInfo.Title;
                        switch (messageType)
                        {
                        case MessageType.Text:
                            this.fkContent.Text = sendAllInfo.Content;
                            break;

                        case MessageType.News:
                            if (articleId <= 0)
                            {
                                this.hdfIsOldArticle.Value = "1";
                                NewsReplyInfo newsReplyInfo = ReplyHelper.GetReply(this.sendID) as NewsReplyInfo;
                                if (newsReplyInfo != null && newsReplyInfo.NewsMsg != null && newsReplyInfo.NewsMsg.Count != 0)
                                {
                                    this.htmlInfo = "<div class=\"mate-inner\"><h3 id=\"singelTitle\">" + newsReplyInfo.NewsMsg[0].Title + "</h3><span>" + newsReplyInfo.LastEditDate.ToString("M月d日") + "</span><div class=\"mate-img\"><img id=\"img1\" src=\"" + newsReplyInfo.NewsMsg[0].PicUrl + "\" class=\"img-responsive\"></div><div class=\"mate-info\" id=\"Lbmsgdesc\">" + newsReplyInfo.NewsMsg[0].Description + "</div><div class=\"red-all clearfix\"><strong class=\"fl\">查看全文</strong><em class=\"fr\">&gt;</em></div></div>";
                                    break;
                                }
                                else
                                {
                                    break;
                                }
                            }
                            else
                            {
                                break;
                            }

                        case MessageType.List:
                            if (articleId <= 0)
                            {
                                this.hdfIsOldArticle.Value = "1";
                                NewsReplyInfo newsReplyInfo = ReplyHelper.GetReply(this.sendID) as NewsReplyInfo;
                                if (newsReplyInfo != null)
                                {
                                    StringBuilder stringBuilder = new StringBuilder();
                                    if (newsReplyInfo.NewsMsg != null && newsReplyInfo.NewsMsg.Count > 0)
                                    {
                                        int num = 0;
                                        foreach (NewsMsgInfo newsMsgInfo in (IEnumerable <NewsMsgInfo>)newsReplyInfo.NewsMsg)
                                        {
                                            ++num;
                                            if (num == 1)
                                            {
                                                stringBuilder.Append("<div class=\"mate-inner top\">                 <div class=\"mate-img\" >                     <img id=\"img1\" src=\"" + newsMsgInfo.PicUrl + "\" class=\"img-responsive\">                     <div class=\"title\" id=\"title1\">" + newsMsgInfo.Title + "</div>                 </div>             </div>");
                                            }
                                            else
                                            {
                                                stringBuilder.Append("             <div class=\"mate-inner\">                 <div class=\"child-mate\">                     <div class=\"child-mate-title clearfix\">                         <div class=\"title\">" + newsMsgInfo.Title + "</div>                         <div class=\"img\">                             <img src=\"" + newsMsgInfo.PicUrl + "\" class=\"img-responsive\">                         </div>                     </div>                 </div>             </div>");
                                            }
                                        }
                                        this.htmlInfo = ((object)stringBuilder).ToString();
                                        break;
                                    }
                                    else
                                    {
                                        break;
                                    }
                                }
                                else
                                {
                                    break;
                                }
                            }
                            else
                            {
                                break;
                            }
                        }
                    }
                    else
                    {
                        this.Response.Redirect("sendalllist.aspx");
                        this.Response.End();
                    }
                }
                else if (this.LocalArticleID > 0)
                {
                    ArticleInfo articleInfo = ArticleHelper.GetArticleInfo(this.LocalArticleID);
                    if (articleInfo != null)
                    {
                        this.hdfArticleID.Value   = this.LocalArticleID.ToString();
                        this.hdfMessageType.Value = ((int)articleInfo.ArticleType).ToString();
                    }
                }
                if (string.IsNullOrEmpty(this.htmlInfo))
                {
                    this.htmlInfo = "<div class=\"exit-shop-info\">内容区</div>";
                }
                this.litInfo.Text = this.htmlInfo;
            }
        }
Exemplo n.º 22
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            if (!base.IsPostBack)
            {
                if (this.type == "getarticleinfo")
                {
                    base.Response.ContentType = "application/json";
                    string s   = "{\"type\":\"0\",\"tips\":\"操作失败\"}";
                    int    num = Globals.RequestFormNum("articleid");
                    if (num > 0)
                    {
                        ArticleInfo articleInfo = ArticleHelper.GetArticleInfo(num);
                        if (articleInfo != null)
                        {
                            System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder();
                            switch (articleInfo.ArticleType)
                            {
                            case ArticleType.News:
                                s = string.Concat(new object[]
                                {
                                    "{\"type\":\"1\",\"articletype\":",
                                    (int)articleInfo.ArticleType,
                                    ",\"title\":\"",
                                    ReplyEdit.String2Json(articleInfo.Title),
                                    "\",\"date\":\"",
                                    ReplyEdit.String2Json(articleInfo.PubTime.ToString("M月d日")),
                                    "\",\"imgurl\":\"",
                                    ReplyEdit.String2Json(articleInfo.ImageUrl),
                                    "\",\"memo\":\"",
                                    ReplyEdit.String2Json(articleInfo.Memo),
                                    "\"}"
                                });
                                goto IL_301;

                            case ArticleType.List:
                            {
                                System.Collections.Generic.IList <ArticleItemsInfo> itemsInfo = articleInfo.ItemsInfo;
                                foreach (ArticleItemsInfo current in itemsInfo)
                                {
                                    stringBuilder.Append(string.Concat(new string[]
                                        {
                                            "{\"title\":\"",
                                            ReplyEdit.String2Json(current.Title),
                                            "\",\"imgurl\":\"",
                                            ReplyEdit.String2Json(current.ImageUrl),
                                            "\"},"
                                        }));
                                }
                                s = string.Concat(new object[]
                                    {
                                        "{\"type\":\"1\",\"articletype\":",
                                        (int)articleInfo.ArticleType,
                                        ",\"title\":\"",
                                        ReplyEdit.String2Json(articleInfo.Title),
                                        "\",\"date\":\"",
                                        ReplyEdit.String2Json(articleInfo.PubTime.ToString("M月d日")),
                                        "\",\"imgurl\":\"",
                                        ReplyEdit.String2Json(articleInfo.ImageUrl),
                                        "\",\"items\":[",
                                        stringBuilder.ToString().Trim(new char[]
                                        {
                                            ','
                                        }),
                                        "]}"
                                    });
                                goto IL_301;
                            }
                            }
                            s = string.Concat(new object[]
                            {
                                "{\"type\":\"1\",\"articletype\":",
                                (int)articleInfo.ArticleType,
                                ",\"title\":\"",
                                ReplyEdit.String2Json(articleInfo.Title),
                                "\",\"date\":\"",
                                ReplyEdit.String2Json(articleInfo.PubTime.ToString("M月d日")),
                                "\",\"imgurl\":\"",
                                ReplyEdit.String2Json(articleInfo.ImageUrl),
                                "\",\"memo\":\"",
                                ReplyEdit.String2Json(articleInfo.Content),
                                "\"}"
                            });
                        }
                    }
IL_301:
                    base.Response.Write(s);
                    base.Response.End();
                }
                else if (this.type == "subscribe" && this.replyID == 0)
                {
                    this.replyID = ReplyHelper.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;
                }
                else
                {
                    if (this.replyID > 0)
                    {
                        this.htmlTitle = "修改自动回复";
                        Hidistro.Entities.VShop.ReplyInfo reply = ReplyHelper.GetReply(this.replyID);
                        if (reply != null)
                        {
                            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 textReplyInfo = ReplyHelper.GetReply(this.replyID) as TextReplyInfo;
                                if (textReplyInfo != null)
                                {
                                    string text = textReplyInfo.Text;
                                    text = System.Text.RegularExpressions.Regex.Replace(text, "</?([^>^a^p]*)>", "");
                                    text = System.Text.RegularExpressions.Regex.Replace(text, "<img([^>]*)>", "");
                                    text = text.Replace("</p>", "\r\n");
                                    text = text.Replace("<p>", "");
                                    this.fkContent.Text = text;
                                }
                                break;
                            }

                            case MessageType.News:
                                if (articleID <= 0)
                                {
                                    this.hdfIsOldArticle.Value = "1";
                                    NewsReplyInfo newsReplyInfo = ReplyHelper.GetReply(this.replyID) as NewsReplyInfo;
                                    if (newsReplyInfo != null && newsReplyInfo.NewsMsg != null && newsReplyInfo.NewsMsg.Count != 0)
                                    {
                                        this.htmlInfo = string.Concat(new string[]
                                        {
                                            "<div class=\"mate-inner\"><h3 id=\"singelTitle\">",
                                            newsReplyInfo.NewsMsg[0].Title,
                                            "</h3><span>",
                                            newsReplyInfo.LastEditDate.ToString("M月d日"),
                                            "</span><div class=\"mate-img\"><img id=\"img1\" src=\"",
                                            newsReplyInfo.NewsMsg[0].PicUrl,
                                            "\" class=\"img-responsive\"></div><div class=\"mate-info\" id=\"Lbmsgdesc\">",
                                            newsReplyInfo.NewsMsg[0].Description,
                                            "</div><div class=\"red-all clearfix\"><strong class=\"fl\">查看全文</strong><em class=\"fr\">&gt;</em></div></div>"
                                        });
                                    }
                                }
                                break;

                            case MessageType.List:
                                if (articleID <= 0)
                                {
                                    this.hdfIsOldArticle.Value = "1";
                                    NewsReplyInfo newsReplyInfo2 = ReplyHelper.GetReply(this.replyID) as NewsReplyInfo;
                                    if (newsReplyInfo2 != null)
                                    {
                                        System.Text.StringBuilder stringBuilder2 = new System.Text.StringBuilder();
                                        if (newsReplyInfo2.NewsMsg != null && newsReplyInfo2.NewsMsg.Count > 0)
                                        {
                                            int num2 = 0;
                                            foreach (NewsMsgInfo current2 in newsReplyInfo2.NewsMsg)
                                            {
                                                num2++;
                                                if (num2 == 1)
                                                {
                                                    stringBuilder2.Append(string.Concat(new string[]
                                                    {
                                                        "<div class=\"mate-inner top\">                 <div class=\"mate-img\" >                     <img id=\"img1\" src=\"",
                                                        current2.PicUrl,
                                                        "\" class=\"img-responsive\">                     <div class=\"title\" id=\"title1\">",
                                                        current2.Title,
                                                        "</div>                 </div>             </div>"
                                                    }));
                                                }
                                                else
                                                {
                                                    stringBuilder2.Append(string.Concat(new string[]
                                                    {
                                                        "             <div class=\"mate-inner\">                 <div class=\"child-mate\">                     <div class=\"child-mate-title clearfix\">                         <div class=\"title\">",
                                                        current2.Title,
                                                        "</div>                         <div class=\"img\">                             <img src=\"",
                                                        current2.PicUrl,
                                                        "\" class=\"img-responsive\">                         </div>                     </div>                 </div>             </div>"
                                                    }));
                                                }
                                            }
                                            this.htmlInfo = stringBuilder2.ToString();
                                        }
                                    }
                                }
                                break;
                            }
                        }
                        else
                        {
                            base.Response.Redirect("replyonkey.aspx");
                            base.Response.End();
                        }
                    }
                    if (string.IsNullOrEmpty(this.htmlInfo))
                    {
                        this.htmlInfo = "<div class=\"exit-shop-info\">内容区</div>";
                    }
                    this.litInfo.Text = this.htmlInfo;
                }
                if (ReplyHelper.GetNoMatchReplyID(this.replyID) > 0)
                {
                    for (int j = 0; j < this.rbtlMatchType.Items.Count; j++)
                    {
                        if (this.rbtlMatchType.Items[j].Value == "4")
                        {
                            this.rbtlMatchType.Items[j].Enabled = false;
                        }
                    }
                }
            }
        }
Exemplo n.º 23
0
        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 = ReplyHelper.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;
                }
                else
                {
                    if (this.replyID > 0)
                    {
                        this.htmlTitle = "修改自动回复";
                        Hidistro.Entities.VShop.ReplyInfo reply = ReplyHelper.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 = ReplyHelper.GetReply(this.replyID) as TextReplyInfo;
                                if (info7 != null)
                                {
                                    string str2 = Regex.Replace(Regex.Replace(info7.Text, "</?([^>^a^p]*)>", ""), "<img([^>]*)>", "");
                                    this.fkContent.Text = str2;
                                }
                                break;
                            }

                            case MessageType.News:
                                if (articleID <= 0)
                                {
                                    this.hdfIsOldArticle.Value = "1";
                                    NewsReplyInfo info6 = ReplyHelper.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\">&gt;</em></div></div>";
                                    }
                                }
                                break;

                            case MessageType.List:
                                if (articleID <= 0)
                                {
                                    this.hdfIsOldArticle.Value = "1";
                                    NewsReplyInfo info4 = ReplyHelper.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;
                }
                goto Label_0800;
            }
            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();
Label_0800:
            if (ReplyHelper.GetNoMatchReplyID(this.replyID) > 0)
            {
                for (int j = 0; j < this.rbtlMatchType.Items.Count; j++)
                {
                    if (this.rbtlMatchType.Items[j].Value == "4")
                    {
                        this.rbtlMatchType.Items[j].Enabled = false;
                    }
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            string str2;

            if (base.IsPostBack)
            {
                return;
            }
            if (!(this.type == "getarticleinfo"))
            {
                if (!(this.type == "postdata"))
                {
                    if (this.sendID > 0)
                    {
                        this.hdfSendID.Value = this.sendID.ToString();
                        SendAllInfo sendAllInfo = WeiXinHelper.GetSendAllInfo(this.sendID);
                        if (sendAllInfo != null)
                        {
                            MessageType messageType = sendAllInfo.MessageType;
                            this.hdfMessageType.Value = ((int)sendAllInfo.MessageType).ToString();
                            int articleID = sendAllInfo.ArticleID;
                            this.hdfArticleID.Value = articleID.ToString();
                            this.txtTitle.Text      = sendAllInfo.Title;
                            switch (messageType)
                            {
                            case MessageType.Text:
                                this.fkContent.Text = sendAllInfo.Content;
                                break;

                            case MessageType.News:
                                if (articleID <= 0)
                                {
                                    this.hdfIsOldArticle.Value = "1";
                                    NewsReplyInfo reply = ReplyHelper.GetReply(this.sendID) as NewsReplyInfo;
                                    if (((reply != null) && (reply.NewsMsg != null)) && (reply.NewsMsg.Count != 0))
                                    {
                                        this.htmlInfo = "<div class=\"mate-inner\"><h3 id=\"singelTitle\">" + reply.NewsMsg[0].Title + "</h3><span>" + reply.LastEditDate.ToString("M月d日") + "</span><div class=\"mate-img\"><img id=\"img1\" src=\"" + reply.NewsMsg[0].PicUrl + "\" class=\"img-responsive\"></div><div class=\"mate-info\" id=\"Lbmsgdesc\">" + reply.NewsMsg[0].Description + "</div><div class=\"red-all clearfix\"><strong class=\"fl\">查看全文</strong><em class=\"fr\">&gt;</em></div></div>";
                                    }
                                }
                                break;

                            case MessageType.List:
                                if (articleID <= 0)
                                {
                                    this.hdfIsOldArticle.Value = "1";
                                    NewsReplyInfo info6 = ReplyHelper.GetReply(this.sendID) as NewsReplyInfo;
                                    if (info6 != null)
                                    {
                                        StringBuilder builder2 = new StringBuilder();
                                        if ((info6.NewsMsg != null) && (info6.NewsMsg.Count > 0))
                                        {
                                            int num15 = 0;
                                            foreach (NewsMsgInfo info7 in info6.NewsMsg)
                                            {
                                                num15++;
                                                if (num15 == 1)
                                                {
                                                    builder2.Append("<div class=\"mate-inner top\">                 <div class=\"mate-img\" >                     <img id=\"img1\" src=\"" + info7.PicUrl + "\" class=\"img-responsive\">                     <div class=\"title\" id=\"title1\">" + info7.Title + "</div>                 </div>             </div>");
                                                }
                                                else
                                                {
                                                    builder2.Append("             <div class=\"mate-inner\">                 <div class=\"child-mate\">                     <div class=\"child-mate-title clearfix\">                         <div class=\"title\">" + info7.Title + "</div>                         <div class=\"img\">                             <img src=\"" + info7.PicUrl + "\" class=\"img-responsive\">                         </div>                     </div>                 </div>             </div>");
                                                }
                                            }
                                            this.htmlInfo = builder2.ToString();
                                        }
                                    }
                                }
                                break;
                            }
                        }
                        else
                        {
                            base.Response.Redirect("sendalllist.aspx");
                            base.Response.End();
                        }
                    }
                    else if (this.LocalArticleID > 0)
                    {
                        ArticleInfo articleInfo = ArticleHelper.GetArticleInfo(this.LocalArticleID);
                        if (articleInfo != null)
                        {
                            this.hdfArticleID.Value   = this.LocalArticleID.ToString();
                            this.hdfMessageType.Value = ((int)articleInfo.ArticleType).ToString();
                        }
                    }
                    if (string.IsNullOrEmpty(this.htmlInfo))
                    {
                        this.htmlInfo = "<div class=\"exit-shop-info\">内容区</div>";
                    }
                    this.litInfo.Text = this.htmlInfo;
                    return;
                }
                base.Response.ContentType = "application/json";
                str2        = "{\"type\":\"1\",\"tips\":\"操作成功\"}";
                this.sendID = Globals.RequestFormNum("sendid");
                int    num2         = Globals.RequestFormNum("sendtype");
                int    msgType      = Globals.RequestFormNum("msgtype");
                int    num4         = Globals.RequestFormNum("articleid");
                string title        = Globals.RequestFormStr("title");
                string content      = Globals.RequestFormStr("content");
                int    isoldarticle = Globals.RequestFormNum("isoldarticle");
                string str5         = this.SavePostData(msgType, num4, title, content, isoldarticle, this.sendID, true);
                if (!string.IsNullOrEmpty(str5))
                {
                    str2 = "{\"type\":\"0\",\"tips\":\"" + str5 + "\"}";
                }
                else
                {
                    MessageType  type           = (MessageType)msgType;
                    string       str6           = string.Empty;
                    SiteSettings masterSettings = SettingsManager.GetMasterSettings(false);
                    string       str7           = JsonConvert.DeserializeObject <Token>(TokenApi.GetToken(masterSettings.WeixinAppId, masterSettings.WeixinAppSecret)).access_token;
                    switch (type)
                    {
                    case MessageType.News:
                    case MessageType.List:
                    {
                        bool        flag  = true;
                        ArticleInfo info3 = ArticleHelper.GetArticleInfo(num4);
                        if (info3.MediaId.Length < 1)
                        {
                            string jsonValue = NewsApi.GetJsonValue(NewsApi.GetMedia_IDByPath(str7, info3.ImageUrl), "media_id");
                            if (string.IsNullOrEmpty(jsonValue))
                            {
                                flag = false;
                                str2 = "{\"type\":\"2\",\"tips\":\"" + NewsApi.GetErrorCodeMsg(NewsApi.GetJsonValue(jsonValue, "errcode")) + "111111\"}";
                            }
                            else
                            {
                                ArticleHelper.UpdateMedia_Id(0, info3.ArticleId, jsonValue);
                            }
                        }
                        if (type == MessageType.List)
                        {
                            foreach (ArticleItemsInfo info4 in info3.ItemsInfo)
                            {
                                if ((info4.MediaId == null) || (info4.MediaId.Length < 1))
                                {
                                    string msg     = NewsApi.GetMedia_IDByPath(str7, info4.ImageUrl);
                                    string mediaid = NewsApi.GetJsonValue(msg, "media_id");
                                    if (mediaid.Length == 0)
                                    {
                                        this.errcode = NewsApi.GetJsonValue(msg, "errcode");
                                        msg          = "";
                                        flag         = false;
                                        str2         = "{\"type\":\"2\",\"tips\":\"" + NewsApi.GetErrorCodeMsg(this.errcode) + "\"}";
                                        break;
                                    }
                                    ArticleHelper.UpdateMedia_Id(1, info4.Id, mediaid);
                                }
                            }
                        }
                        if (flag)
                        {
                            string articlesJsonStr = this.GetArticlesJsonStr(info3);
                            string str12           = NewsApi.UploadNews(str7, articlesJsonStr);
                            this.sendID = Globals.ToNum(this.SavePostData(msgType, num4, title, content, isoldarticle, this.sendID, false));
                            string str13 = NewsApi.GetJsonValue(str12, "media_id");
                            if (str13.Length > 0)
                            {
                                if (num2 == 1)
                                {
                                    str6 = NewsApi.SendAll(str7, NewsApi.CreateImageNewsJson(str13));
                                    if (!string.IsNullOrWhiteSpace(str6))
                                    {
                                        string str14 = NewsApi.GetJsonValue(str6, "msg_id");
                                        if (!string.IsNullOrEmpty(str14))
                                        {
                                            WeiXinHelper.UpdateMsgId(this.sendID, str14, 0, 0, 0, "");
                                        }
                                        else
                                        {
                                            this.errcode = NewsApi.GetJsonValue(str6, "errcode");
                                            string errorCodeMsg = NewsApi.GetErrorCodeMsg(this.errcode);
                                            WeiXinHelper.UpdateMsgId(this.sendID, str14, 2, 0, 0, errorCodeMsg);
                                            str2 = "{\"type\":\"2\",\"tips\":\"" + errorCodeMsg + "!!\"}";
                                        }
                                    }
                                    else
                                    {
                                        str2 = "{\"type\":\"2\",\"tips\":\"type参数错误\"}";
                                    }
                                }
                                else
                                {
                                    DataTable rencentOpenID  = WeiXinHelper.GetRencentOpenID(100);
                                    int       count          = rencentOpenID.Rows.Count;
                                    int       sendcount      = 0;
                                    string    returnjsondata = string.Empty;
                                    for (int i = 0; i < rencentOpenID.Rows.Count; i++)
                                    {
                                        string str17 = NewsApi.KFSend(str7, this.GetKFSendImageJson(rencentOpenID.Rows[i][0].ToString(), info3));
                                        this.errcode = NewsApi.GetJsonValue(str17, "errcode");
                                        if (this.errcode == "0")
                                        {
                                            sendcount++;
                                        }
                                        else
                                        {
                                            returnjsondata = NewsApi.GetErrorCodeMsg(this.errcode);
                                        }
                                    }
                                    int sendstate = (sendcount > 0) ? 1 : 2;
                                    WeiXinHelper.UpdateMsgId(this.sendID, "", sendstate, sendcount, count, returnjsondata);
                                }
                            }
                            else
                            {
                                this.errcode = NewsApi.GetJsonValue(str12, "errcode");
                                str2         = "{\"type\":\"2\",\"tips\":\"" + NewsApi.GetErrorCodeMsg(this.errcode) + "!\"}";
                            }
                        }
                        goto Label_091D;
                    }
                    }
                    this.sendID = Globals.ToNum(this.SavePostData(msgType, num4, title, content, isoldarticle, this.sendID, false));
                    if (num2 == 1)
                    {
                        str6 = NewsApi.SendAll(str7, this.CreateTxtNewsJson(content));
                        if (!string.IsNullOrWhiteSpace(str6))
                        {
                            string msgid = NewsApi.GetJsonValue(str6, "msg_id");
                            if (msgid.Length == 0)
                            {
                                this.errcode = NewsApi.GetJsonValue(str6, "errcode");
                                string str19 = NewsApi.GetErrorCodeMsg(this.errcode);
                                WeiXinHelper.UpdateMsgId(this.sendID, msgid, 2, 0, 0, str19);
                                str2 = "{\"type\":\"2\",\"tips\":\"" + str19 + "\"}";
                            }
                            else
                            {
                                WeiXinHelper.UpdateMsgId(this.sendID, msgid, 0, 0, 0, "");
                            }
                        }
                        else
                        {
                            str2 = "{\"type\":\"2\",\"tips\":\"type参数错误\"}";
                        }
                    }
                    else
                    {
                        DataTable table2     = WeiXinHelper.GetRencentOpenID(100);
                        int       totalcount = table2.Rows.Count;
                        int       num11      = 0;
                        string    str20      = string.Empty;
                        for (int j = 0; j < table2.Rows.Count; j++)
                        {
                            string str21 = NewsApi.KFSend(str7, NewsApi.CreateKFTxtNewsJson(table2.Rows[j][0].ToString(), this.String2Json(this.FormatSendContent(content))));
                            this.errcode = NewsApi.GetJsonValue(str21, "errcode");
                            if (this.errcode == "0")
                            {
                                num11++;
                            }
                            else
                            {
                                str20 = NewsApi.GetErrorCodeMsg(this.errcode);
                            }
                        }
                        int num13 = (num11 > 0) ? 1 : 2;
                        WeiXinHelper.UpdateMsgId(this.sendID, "", num13, num11, totalcount, str20);
                        if (num11 == 0)
                        {
                            str2 = "{\"type\":\"0\",\"tips\":\"发送失败\"}";
                        }
                    }
                }
                goto Label_091D;
            }
            base.Response.ContentType = "application/json";
            string s         = "{\"type\":\"0\",\"tips\":\"操作失败\"}";
            int    articleid = Globals.RequestFormNum("articleid");

            if (articleid > 0)
            {
                ArticleInfo info = ArticleHelper.GetArticleInfo(articleid);
                if (info != null)
                {
                    StringBuilder builder = new StringBuilder();
                    switch (info.ArticleType)
                    {
                    case ArticleType.News:
                        s = string.Concat(new object[] { "{\"type\":\"1\",\"articletype\":", (int)info.ArticleType, ",\"title\":\"", this.String2Json(info.Title), "\",\"date\":\"", this.String2Json(info.PubTime.ToString("M月d日")), "\",\"imgurl\":\"", this.String2Json(info.ImageUrl), "\",\"memo\":\"", this.String2Json(info.Memo), "\"}" });
                        goto Label_030E;

                    case ArticleType.List:
                        foreach (ArticleItemsInfo info2 in info.ItemsInfo)
                        {
                            builder.Append("{\"title\":\"" + this.String2Json(info2.Title) + "\",\"imgurl\":\"" + this.String2Json(info2.ImageUrl) + "\"},");
                        }
                        s = string.Concat(new object[] { "{\"type\":\"1\",\"articletype\":", (int)info.ArticleType, ",\"title\":\"", this.String2Json(info.Title), "\",\"date\":\"", this.String2Json(info.PubTime.ToString("M月d日")), "\",\"imgurl\":\"", this.String2Json(info.ImageUrl), "\",\"items\":[", builder.ToString().Trim(new char[] { ',' }), "]}" });
                        goto Label_030E;
                    }
                    s = string.Concat(new object[] { "{\"type\":\"1\",\"articletype\":", (int)info.ArticleType, ",\"title\":\"", this.String2Json(info.Title), "\",\"date\":\"", this.String2Json(info.PubTime.ToString("M月d日")), "\",\"imgurl\":\"", this.String2Json(info.ImageUrl), "\",\"memo\":\"", this.String2Json(info.Content), "\"}" });
                }
            }
Label_030E:
            base.Response.Write(s);
            base.Response.End();
            return;

Label_091D:
            base.Response.Write(str2);
            base.Response.End();
        }
Exemplo n.º 25
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            int.TryParse(base.Request.QueryString["id"], out this.MaterialID);
            string arg_36_0 = base.Request.QueryString["cmd"];

            this.ReUrl = base.Request.QueryString["reurl"];
            if (string.IsNullOrEmpty(this.ReUrl))
            {
                this.ReUrl = "articles.aspx";
            }
            string a = base.Request.Form["posttype"];

            if (!base.IsPostBack)
            {
                if (a == "addsinglearticle")
                {
                    base.Response.ContentType = "application/json";
                    string text    = base.Request.Form["linkUrl"];
                    string text2   = base.Request.Form["title"];
                    string text3   = base.Request.Form["img"];
                    string memo    = base.Request.Form["memo"];
                    string content = base.Request.Form["content"];
                    string s       = base.Request.Form["linkType"];
                    string value   = base.Request.Form["IsShare"];
                    int    num     = 1;
                    int.TryParse(s, out num);
                    string s2 = "{\"type\":\"0\",\"tips\":\"操作失败!\"}";
                    if (string.IsNullOrEmpty(text2))
                    {
                        s2 = "{\"type\":\"0\",\"tips\":\"请填写标题!\"}";
                        base.Response.Write(s2);
                        base.Response.End();
                    }
                    if (string.IsNullOrEmpty(text3))
                    {
                        s2 = "{\"type\":\"0\",\"tips\":\"请选择封面图片!\"}";
                        base.Response.Write(s2);
                        base.Response.End();
                    }
                    if (num != 1 && string.IsNullOrEmpty(text))
                    {
                        s2 = "{\"type\":\"0\",\"tips\":\"请设置链接地址!\"}";
                        base.Response.Write(s2);
                        base.Response.End();
                    }
                    ArticleInfo articleInfo = new ArticleInfo();
                    articleInfo.ArticleId = this.MaterialID;
                    articleInfo.Url       = text;
                    articleInfo.Title     = text2;
                    if (string.IsNullOrEmpty(value))
                    {
                        articleInfo.IsShare = false;
                    }
                    else
                    {
                        articleInfo.IsShare = bool.Parse(value);
                    }
                    articleInfo.ImageUrl    = text3;
                    articleInfo.Memo        = memo;
                    articleInfo.ArticleType = ArticleType.News;
                    articleInfo.PubTime     = System.DateTime.Now;
                    articleInfo.Content     = content;
                    articleInfo.LinkType    = (LinkType)num;
                    if (articleInfo.ArticleId > 0)
                    {
                        if (ArticleHelper.UpdateSingleArticle(articleInfo))
                        {
                            s2 = "{\"type\":\"1\",\"id\":\"" + articleInfo.ArticleId + "\",\"tips\":\"单图文修改成功!\"}";
                        }
                    }
                    else
                    {
                        int num2 = ArticleHelper.AddSingerArticle(articleInfo);
                        if (num2 > 0)
                        {
                            s2 = "{\"type\":\"1\",\"id\":\"" + num2 + "\",\"tips\":\"单图文新增成功!\"}";
                        }
                    }
                    base.Response.Write(s2);
                    base.Response.End();
                    return;
                }
                if (this.MaterialID > 0)
                {
                    this.htmlOperName = "编辑";
                    ArticleInfo articleInfo2 = ArticleHelper.GetArticleInfo(this.MaterialID);
                    if (articleInfo2 != null)
                    {
                        if (articleInfo2.ArticleType == ArticleType.List)
                        {
                            base.Response.Redirect("multiarticlesedit.aspx?id=" + this.MaterialID);
                            base.Response.End();
                            return;
                        }
                        this.htmlArticleTitle = articleInfo2.Title;
                        this.htmlImgUrl       = articleInfo2.ImageUrl;
                        this.htmlUrl          = articleInfo2.Url;
                        this.htmlMemo         = articleInfo2.Memo;
                        this.htmlDate         = articleInfo2.PubTime.ToString("M月d日");
                        this.fkContent.Text   = articleInfo2.Content;
                        this.IsShare.Checked  = articleInfo2.IsShare;
                        this.htmlAddJs        = "BindPicData('" + this.htmlImgUrl + "');";
                        this.htmlLinkType     = ((int)articleInfo2.LinkType).ToString();
                        if (this.htmlLinkType != "1")
                        {
                            this.htmlAddJs += "$('#urlData').show();";
                        }
                        this.htmlLinkTypeName = articleInfo2.LinkType.ToShowText();
                    }
                }
            }
        }