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();
        }
Example #2
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;
            }
        }