示例#1
0
        public void addreply(System.Web.HttpContext context)
        {
            ReplyInfo replyInfo = new ReplyInfo();
            string    s         = "{\"status\":\"0\"}";

            replyInfo.EditDate     = System.DateTime.Now;
            replyInfo.IsDisable    = true;
            replyInfo.Type         = int.Parse(context.Request["Type"]);
            replyInfo.ReplyKeyId   = int.Parse(context.Request["ReplyKeyId"]);
            replyInfo.ReceiverType = context.Request["ReceiverType"];
            if (replyInfo.ReceiverType == "text")
            {
                replyInfo.Content = context.Request["Content"];
            }
            else
            {
                replyInfo.Url = context.Request["Url"];
                SiteSettings masterSettings = SettingsManager.GetMasterSettings(false);
                string       text;
                if (!string.IsNullOrEmpty(masterSettings.ShopHomePic))
                {
                    text = Globals.HostPath(System.Web.HttpContext.Current.Request.Url) + masterSettings.ShopHomePic;
                }
                else
                {
                    text = Globals.HostPath(System.Web.HttpContext.Current.Request.Url) + masterSettings.DistributorBackgroundPic.Split(new char[]
                    {
                        '|'
                    })[0];
                }
                replyInfo.Image = text;
                if (string.IsNullOrEmpty(context.Request["Image"]) && string.IsNullOrEmpty(context.Request["Display_name"]) && string.IsNullOrEmpty(context.Request["Summary"]))
                {
                    replyInfo.Displayname = masterSettings.SiteName;
                    replyInfo.Summary     = (string.IsNullOrEmpty(masterSettings.ShopIntroduction) ? masterSettings.SiteName : masterSettings.ShopIntroduction);
                }
                else
                {
                    replyInfo.Image       = (string.IsNullOrEmpty(context.Request["Image"]) ? text : context.Request["Image"]);
                    replyInfo.Displayname = context.Request["Display_name"];
                    replyInfo.Summary     = context.Request["Summary"];
                    replyInfo.ArticleId   = int.Parse(context.Request["ArticleId"]);
                }
            }
            if (WeiboHelper.SaveReplyInfo(replyInfo))
            {
                s = "{\"status\":\"1\"}";
            }
            context.Response.Write(s);
        }