/// <summary> /// 获取 /// </summary> /// <param name="context"></param> /// <returns></returns> private string GetWxShowInfo(HttpContext context) { string autoId = context.Request["Autoid"]; BLLJIMP.Model.WXShowInfo wxShowInfo = bllJuactivity.Get <BLLJIMP.Model.WXShowInfo>(string.Format(" AutoId={0}", autoId)); if (wxShowInfo != null) { wxShowInfo.WXShowImgInfos = bllJuactivity.GetList <BLLJIMP.Model.WXShowImgInfo>(string.Format(" ShowId={0}", wxShowInfo.AutoId)); resp.Status = 0; resp.ExObj = wxShowInfo; } else { resp.Status = 0; resp.ExObj = "系统出错,请联系管理员!!!"; } return(Common.JSONHelper.ObjectToJson(resp)); }
protected void Page_Load(object sender, EventArgs e) { Id = Convert.ToInt32(Request["AutoId"]); shareLink = string.Format("http://{0}{1}?AutoId={2}", Request.Url.Host, Request.FilePath, Id); wxsInfo = bll.Get <BLLJIMP.Model.WXShowInfo>(" AutoId=" + Id); if (wxsInfo != null) { string sourceimg = wxsInfo.ShowImg; wxsInfo.ShowImg = "http://" + Request.Url.Host + wxsInfo.ShowImg; List <BLLJIMP.Model.WXShowImgInfo> wxsInfos = bll.GetList <BLLJIMP.Model.WXShowImgInfo>(" ShowId=" + wxsInfo.AutoId); if (wxsInfos != null) { for (int i = 0; i < wxsInfos.Count; i++) { strInit.AppendFormat("<div class=\"listli\"><img src=\"{0}\" class=\"img\" data-original=\"background-image:url({0}); \"></span>", wxsInfos[i].ImgStr); strInit.AppendFormat("<span class=\"text\" style=\"color:{3};\"><h2 style=\"color:{2};\">{0}</h2>{1}</span>", wxsInfos[i].ShowTitle, wxsInfos[i].ShowContext, wxsInfos[i].ShowTitleColor, wxsInfos[i].ShowContextColor); strInit.AppendFormat("<span class=\"nextbtn\"><span class=\"smallicon\"></span></span></div>"); if (string.IsNullOrEmpty(wxsInfos[i].ShowTitle) && string.IsNullOrEmpty(wxsInfos[i].ShowContext)) { stranimation.Append("case " + i + ":_this.animation(current.find(\".img\"), " + wxsInfos[i].ShowAnimation.ToString() + ", function () {"); stranimation.Append(" _this.animation(current.find(\".nextbtn\"), 99);"); stranimation.Append("});break;"); stranimation.Append("\n"); } else { //stranimation.AppendFormat("case " + i + ":_this.animation(current.find(\".img\"), " + wxsInfos[i].ShowAnimation + ", function () {"); string str = "case " + i + ":"; stranimation.Append(str + "_this.animation(current.find(\".img\")," + wxsInfos[i].ShowAnimation + ", function () {"); stranimation.Append("_this.animation(current.find(\".text\"), 2,"); string s = "function () { "; stranimation.Append(s + "_this.animation(current.find(\".nextbtn\"), 99)});"); stranimation.Append("})"); stranimation.Append(";break;"); stranimation.Append("\n"); } } } if (!string.IsNullOrEmpty(wxsInfo.ShowUrl)) { stranimation.Append("case " + wxsInfos.Count + ":_this.animation(current.find(\".blackpage\"), 15, function (){ "); stranimation.Append("_this.maininitstate++;if(_this.maininitstate"); stranimation.Append(" == 2) { _this.container.css({ \"-webkit-transition\""); stranimation.Append(": \"opacity 1s ease-out\", \"opacity\": \"0\" });"); stranimation.AppendFormat("window.location.href = '{0}';", wxsInfo.ShowUrl); stranimation.Append(" var picanimate1end = function () { _this.container[0].removeEventListener(\"webkitTransitionEnd\", picanimate1end, false);"); stranimation.Append("_this.container.remove();}; _this.container[0].addEventListener(\"webkitTransitionEnd\", picanimate1end, false);"); stranimation.Append(" }}); break;"); stranimation.Append("\n"); } stranimation.Append("default "); stranimation.Append(": _this.animation(current.find(\".img\")"); stranimation.Append(", 1, function () {"); stranimation.Append("_this.animation(current.find(\".text\"), 2,"); stranimation.Append("function () { _this.animation(current.find(\".nextbtn\"), 99)});"); stranimation.Append("});"); MonitorEventDetailsInfo detailInfo = new MonitorEventDetailsInfo(); detailInfo.MonitorPlanID = Id; detailInfo.EventType = 0; detailInfo.EventBrowser = HttpContext.Current.Request.Browser == null ? "" : HttpContext.Current.Request.Browser.ToString(); detailInfo.EventBrowserID = HttpContext.Current.Request.Browser.Id;; if (HttpContext.Current.Request.Browser.Beta) { detailInfo.EventBrowserIsBata = "测试版"; } else { detailInfo.EventBrowserIsBata = "正式版"; } detailInfo.EventBrowserVersion = HttpContext.Current.Request.Browser.Version; detailInfo.EventDate = DateTime.Now; if (HttpContext.Current.Request.Browser.Win16) { detailInfo.EventSysByte = "16位系统"; } else if (HttpContext.Current.Request.Browser.Win32) { detailInfo.EventSysByte = "32位系统"; } else { detailInfo.EventSysByte = "64位系统"; } detailInfo.EventSysPlatform = HttpContext.Current.Request.Browser.Platform; detailInfo.SourceIP = Common.MySpider.GetClientIP(); detailInfo.IPLocation = Common.MySpider.GetIPLocation(detailInfo.SourceIP); detailInfo.SourceUrl = HttpContext.Current.Request.Url.ToString(); detailInfo.RequesSourcetUrl = HttpContext.Current.Request.UrlReferrer != null?HttpContext.Current.Request.UrlReferrer.ToString() : ""; detailInfo.WebsiteOwner = bll.WebsiteOwner; detailInfo.ModuleType = "wshow"; if (bll.IsLogin) { detailInfo.EventUserID = bll.GetCurrUserID(); } bll.Add(detailInfo); int ipCount = bll.GetCount <MonitorEventDetailsInfo>(" SourceIP ", string.Format(" WebsiteOwner='{0}' AND MonitorPlanID={1} ", bll.WebsiteOwner, Id)); int uvCount = bll.GetCount <MonitorEventDetailsInfo>(" EventUserID ", string.Format(" EventUserID is not null AND WebsiteOwner='{0}' AND MonitorPlanID={1} ", bll.WebsiteOwner, Id)); int pvCount = bll.GetCount <MonitorEventDetailsInfo>(string.Format(" WebsiteOwner='{0}' AND MonitorPlanID={1} ", bll.WebsiteOwner, Id)); wxsInfo.PV = pvCount; wxsInfo.IP = ipCount; wxsInfo.UV = uvCount; wxsInfo.ShowImg = sourceimg; bll.Update(wxsInfo); if (!string.IsNullOrEmpty(Request["sid"])) //有推广人 { if (!string.IsNullOrEmpty(wxsInfo.ShowUrl)) { if (wxsInfo.ShowUrl.EndsWith(".chtml")) { //替换链接 var par = wxsInfo.ShowUrl.Split('/'); wxsInfo.ShowUrl = wxsInfo.ShowUrl.Replace(par[3], string.Format("{0}/{1}", par[3], Request["sid"])); shareLink = string.Format("{0}&sid={1}", shareLink, Request["sid"]); } } } else { if (bll.IsLogin) { if (!string.IsNullOrEmpty(wxsInfo.ShowUrl)) { if (wxsInfo.ShowUrl.EndsWith(".chtml")) { UserInfo CurrentUserInfo = bll.GetCurrentUserInfo(); string CurrentUserIDHex = Convert.ToString(CurrentUserInfo.AutoID, 16); //替换链接 var par = wxsInfo.ShowUrl.Split('/'); wxsInfo.ShowUrl = wxsInfo.ShowUrl.Replace(par[3], string.Format("{0}/{1}", par[3], CurrentUserIDHex)); shareLink = string.Format("{0}&sid={1}", shareLink, CurrentUserIDHex); } } } } } }
/// <summary> /// 插入数据 /// </summary> /// <param name="context"></param> /// <returns></returns> private string InsertUpdateWXShowInfo(HttpContext context) { string autoId = context.Request["Autoid"]; string showName = context.Request["ShowName"]; string showDescription = context.Request["ShowDescription"]; string showImg = context.Request["ShowImg"]; string showUrl = context.Request["ShowUrl"]; string imgStr = context.Request["ImgStr"]; string showTitle = context.Request["ShowTitle"]; string animation = context.Request["Animation"]; string showContext = context.Request["ShowContext"]; string showMusic = context.Request["ShowMusic"]; string autoPlayTimeSpan = context.Request["AutoPlayTimeSpan"]; string showTitleColor = context.Request["ShowTitleColor"]; string showContextColor = context.Request["ShowContextColor"]; if (string.IsNullOrEmpty(showName)) { resp.Msg = "请填写微秀名称"; goto outoff; } if (!string.IsNullOrEmpty(showUrl)) { string match = @"http(s)?://([\w-]+\.)+[\w-]+(/[\w- ./?%&=]*)?"; Regex reg = new Regex(match); if (!reg.IsMatch(showUrl)) { resp.Msg = "请输入正确的网址,格式如 http://www.baidu.com"; // goto outoff; } } if (string.IsNullOrEmpty(autoId)) { autoId = "0"; } BLLJIMP.Model.WXShowInfo wxShowInfo = bllJuactivity.Get <BLLJIMP.Model.WXShowInfo>(string.Format(" Autoid={0}", autoId)); #region 修改 if (wxShowInfo != null) { //更新微秀信息 wxShowInfo.ShowName = showName; wxShowInfo.ShowDescription = showDescription; wxShowInfo.ShowImg = showImg; wxShowInfo.ShowUrl = showUrl; wxShowInfo.ShowMusic = showMusic; wxShowInfo.AutoPlayTimeSpan = Convert.ToInt32(autoPlayTimeSpan); if (!bllJuactivity.Update(wxShowInfo)) { resp.Msg = "更新失败"; goto outoff; } //删除旧的微信展示页 var resultCount = bllJuactivity.Delete(new WXShowImgInfo(), string.Format(" ShowId={0}", wxShowInfo.AutoId)); //添加新展示页 List <BLLJIMP.Model.WXShowImgInfo> wxsImgInfos = new List <BLLJIMP.Model.WXShowImgInfo>(); string[] imgStrs = imgStr.Split(','); string[] showTitles = showTitle.Split(','); string[] animations = animation.Split(','); string[] showContexts = showContext.Split(','); string[] showTitleColors = showTitleColor.Split(','); string[] showContextColors = showContextColor.Split(','); for (int i = 0; i < imgStrs.Length; i++) { if (string.IsNullOrEmpty(imgStrs[i]) && string.IsNullOrEmpty(showTitles[i]) && string.IsNullOrEmpty(animations[i]) && string.IsNullOrEmpty(showContexts[i ])) { break; } else { wxsImgInfos.Add(new BLLJIMP.Model.WXShowImgInfo() { ShowId = wxShowInfo.AutoId, ImgStr = imgStrs[i], ShowTitle = showTitles[i], ShowAnimation = Convert.ToInt32(animations[i]), ShowContext = showContexts[i], ShowTitleColor = showTitleColors[i], ShowContextColor = showContextColors[i] }); } } if (bllJuactivity.AddList <BLLJIMP.Model.WXShowImgInfo>(wxsImgInfos)) { resp.Status = 1; resp.Msg = "修改成功"; goto outoff; } else { resp.Msg = "插入新展示页失败"; goto outoff; }; } #endregion #region 添加 else { BLLJIMP.Model.WXShowInfo wxsInfo = new BLLJIMP.Model.WXShowInfo() { ShowName = showName, ShowDescription = showDescription, ShowImg = showImg, ShowUrl = showUrl, InsertDate = DateTime.Now, websiteOwner = bll.WebsiteOwner, UserId = currentUserInfo.UserID, ShowMusic = showMusic, AutoPlayTimeSpan = Convert.ToInt32(autoPlayTimeSpan) }; if (bllJuactivity.Add(wxsInfo)) { BLLJIMP.Model.WXShowInfo wxsi = bllJuactivity.Get <BLLJIMP.Model.WXShowInfo>(string.Format(" ShowName='{0}' AND websiteOwner='{1}' AND UserId='{2}'", showName, bll.WebsiteOwner, currentUserInfo.UserID)); List <BLLJIMP.Model.WXShowImgInfo> wxsiInfos = new List <BLLJIMP.Model.WXShowImgInfo>(); if (wxsi != null) { string[] imgStrs = imgStr.Split(','); string[] showTitles = showTitle.Split(','); string[] animations = animation.Split(','); string[] showContexts = showContext.Split(','); string[] showTitleColors = showTitleColor.Split(','); string[] showContextColors = showContextColor.Split(','); for (int i = 0; i < imgStrs.Length; i++) { if (string.IsNullOrEmpty(imgStrs[i]) && string.IsNullOrEmpty(showTitles[i]) && string.IsNullOrEmpty(animations[i]) && string.IsNullOrEmpty(showContexts[i ])) { break; } else { wxsiInfos.Add(new BLLJIMP.Model.WXShowImgInfo() { ShowId = wxsi.AutoId, ImgStr = imgStrs[i], ShowTitle = showTitles[i], ShowAnimation = Convert.ToInt32(animations[i]), ShowContext = showContexts[i], ShowTitleColor = showTitleColors[i], ShowContextColor = showContextColors[i] }); } } } if (bllJuactivity.AddList <BLLJIMP.Model.WXShowImgInfo>(wxsiInfos)) { resp.Status = 1; resp.Msg = "添加成功"; } else { resp.Msg = "添加失败"; } } else { resp.Msg = "添加失败"; } } #endregion outoff: return(Common.JSONHelper.ObjectToJson(resp)); }