private void ShowInfo() { Maticsoft.Model.SNS.Posts model = new Maticsoft.BLL.SNS.Posts().GetModel(this.PostID); if (model != null) { this.localVideoUrl = model.VideoUrl; } }
public ActionResult Detail(int id) { Maticsoft.Model.SNS.Posts model = new Maticsoft.BLL.SNS.Posts().GetModel(id); if (model == null) { return base.RedirectToAction("Index", "Home"); } ((dynamic) base.ViewBag).CommentPageSize = this.commentPagesize; ((dynamic) base.ViewBag).Commentcount = new Maticsoft.BLL.SNS.Comments().GetCommentCount(0, id); IPageSetting pageSetting = PageSetting.GetPageSetting("VideoDetail", ApplicationKeyType.SNS); string[][] values = new string[1][]; values[0] = new string[] { "{cname}", model.Description ?? (model.CreatedNickName + "分享的视频") }; pageSetting.Replace(values); ((dynamic) base.ViewBag).Title = pageSetting.Title; ((dynamic) base.ViewBag).Keywords = pageSetting.Keywords; ((dynamic) base.ViewBag).Description = pageSetting.Description; return base.View(model); }
public PartialViewResult TopVideo(int id, int top = 5) { List<Maticsoft.Model.SNS.Posts> videoList = new Maticsoft.BLL.SNS.Posts().GetVideoList(id, top); return this.PartialView("_TopVideo", videoList); }
public void AjaxPostWeibo(FormCollection Fm) { UserBind bind = new UserBind(); Maticsoft.BLL.SNS.Posts posts = new Maticsoft.BLL.SNS.Posts(); Maticsoft.BLL.SNS.GroupTopics topics = new Maticsoft.BLL.SNS.GroupTopics(); Maticsoft.BLL.SNS.GroupTopicReply reply = new Maticsoft.BLL.SNS.GroupTopicReply(); if ((base.currentUser.UserType != "AA") && !string.IsNullOrWhiteSpace(Fm["MediaIds"])) { string mediaIDs = Fm["MediaIds"]; string productName = Fm["ShareDes"]; string str3 = Fm["ImageUrl"]; string text1 = Fm["VideoRawUrl"]; string url = Fm["Url"]; string str5 = Fm["Type"]; int targetId = Globals.SafeInt(Fm["TargetID"], 0); int postID = Globals.SafeInt(Fm["PostID"], 0); int topicID = Globals.SafeInt(Fm["TopicID"], 0); int num4 = Globals.SafeInt(Fm["AlumbID"], 0); int replyID = Globals.SafeInt(Fm["ReplyId"], 0); if (num4 > 0) { url = string.Concat(new object[] { "http://", Globals.DomainFullName, "/Album/Details?AlbumID=", num4 }); } if (postID > 0) { Maticsoft.Model.SNS.Posts model = posts.GetModel(postID); if (model != null) { if (model.Type == 1) { str5 = "Photo"; targetId = model.TargetId; if (string.IsNullOrEmpty(productName)) { productName = "分享图片"; } } else if (model.Type == 2) { str5 = "Product"; targetId = model.TargetId; if (string.IsNullOrEmpty(productName)) { productName = model.ProductName; } } else if (model.Type == 0) { str5 = "Weibo"; productName = string.IsNullOrEmpty(model.Description) ? "分享图片" : model.Description; } str3 = model.ImageUrl.Replace("{0}", "T116x170_"); } } if (topicID > 0) { url = string.Concat(new object[] { "http://", Globals.DomainFullName, "/Group/TopicReply?id=", topicID }); Maticsoft.Model.SNS.GroupTopics topics2 = topics.GetModel(topicID); str3 = (topics2 != null) ? topics2.ImageUrl : ""; } if (replyID > 0) { url = string.Concat(new object[] { "http://", Globals.DomainFullName, "/Group/TopicReply?id=", topicID }); Maticsoft.Model.SNS.GroupTopicReply reply2 = reply.GetModel(replyID); str3 = (reply2 != null) ? reply2.PhotoUrl : ""; } if ((!string.IsNullOrEmpty(str3) && (str3.Split(new char[] { '|' }).Length > 2)) && (str5 != "Product")) { str3 = "http://" + Globals.DomainFullName + str3.Split(new char[] { '|' })[0]; } if (str5 == "Weibo") { url = string.Concat(new object[] { "http://", Globals.DomainFullName, "/User/Posts/", base.currentUser.UserID }); } else if ((str5 == "Photo") || (str5 == "Product")) { url = string.Concat(new object[] { "http://", Globals.DomainFullName, "/Detail/", str5, "/", targetId }); } try { bind.SendWeiBo(base.currentUser.UserID, mediaIDs, productName, url, str3); } catch (Exception exception) { base.Response.Write(exception); } } }
public ActionResult AjaxAddFavourite(FormCollection Fm) { int postId = Globals.SafeInt(Fm["TargetId"], 0); if (Fm["Type"] == "Video") { Maticsoft.BLL.SNS.Posts posts = new Maticsoft.BLL.SNS.Posts(); if (posts.UpdateFavCount(postId)) { return base.Content("Ok"); } return base.Content("No"); } Maticsoft.Model.SNS.UserFavourite favModel = new Maticsoft.Model.SNS.UserFavourite(); Maticsoft.BLL.SNS.UserFavourite favourite2 = new Maticsoft.BLL.SNS.UserFavourite(); int topicId = Globals.SafeInt(Fm["TopicId"], 0); int replyId = Globals.SafeInt(Fm["ReplyId"], 0); favModel.Type = (Fm["Type"] == "Product") ? 1 : 0; favModel.TargetID = Globals.SafeInt(Fm["TargetId"], 0); favModel.CreatedDate = DateTime.Now; favModel.CreatedUserID = base.currentUser.UserID; favModel.CreatedNickName = base.currentUser.NickName; if (favourite2.Exists(base.currentUser.UserID, favModel.Type, favModel.TargetID)) { return base.Content("Repeat"); } if (favourite2.AddEx(favModel, topicId, replyId)) { return base.Content("Ok"); } return base.Content("No"); }
public ActionResult AjaxAddImage(FormCollection Fm) { bool flag = true; Maticsoft.BLL.SNS.Posts posts = new Maticsoft.BLL.SNS.Posts(); Maticsoft.Model.SNS.Posts post = new Maticsoft.Model.SNS.Posts(); string str = Fm["List"]; if (!string.IsNullOrWhiteSpace(str)) { foreach (JsonObject obj2 in JsonConvert.Import<JsonArray>(str)) { string address = obj2["ImageUrl"].ToString(); string str3 = InjectionFilter.Filter(obj2["ShareDec"].ToString()); int ablumId = Globals.SafeInt(obj2["AlbumId"].ToString(), 0); post.Description = str3; post.CreatedDate = DateTime.Now; post.CreatedNickName = base.currentUser.NickName; post.CreatedUserID = base.currentUser.UserID; post.Type = 1; post.UserIP = base.Request.UserHostAddress; string valueByCache = Maticsoft.BLL.SysManage.ConfigSystem.GetValueByCache("SNS_ImageStoreWay"); string path = ""; string imgname = this.CreateIDCode() + ".jpg"; using (System.Net.WebClient client = new System.Net.WebClient()) { if (valueByCache != "1") { string str7 = "/Upload/SNS/Images/Photos/" + DateTime.Now.ToString("yyyyMMdd") + "/"; string str8 = "/Upload/SNS/Images/PhotosThumbs/" + DateTime.Now.ToString("yyyyMMdd") + "/"; if (!Directory.Exists(base.Server.MapPath(str7))) { Directory.CreateDirectory(base.Server.MapPath(str7)); } if (!Directory.Exists(base.Server.MapPath(str8))) { Directory.CreateDirectory(base.Server.MapPath(str8)); } path = str7 + imgname; client.DownloadFile(address, base.Server.MapPath(path)); } else { byte[] buffer = client.DownloadData(address); if ((buffer == null) || (buffer.Length == 0)) { flag = false; } string fileName = this.CreateIDCode() + ".jpg"; if (UpYunManager.UploadExecute(buffer, fileName, ApplicationKeyType.SNS, out path)) { post.ImageUrl = path + "|" + path; post = posts.AddPost(post, ablumId, -1L, 0, "", "", "", true); } } } if (valueByCache != "1") { string thumbImagePath = ""; this.MakeThumbnail(imgname, out thumbImagePath); post.ImageUrl = path + "|" + thumbImagePath; post = posts.AddPost(post, ablumId, -1L, 0, "", "", "", true); } } if (flag) { return base.Json(new { Data = true }); } } return base.Json(new { Data = false }); }
public ActionResult ScrollPost(string ViewName = "ScrollPost", int top = 10, Maticsoft.Model.SNS.EnumHelper.PostContentType PostType = 2) { List<Maticsoft.Model.SNS.Posts> scrollPost = new Maticsoft.BLL.SNS.Posts().GetScrollPost(top, PostType); return base.View(ViewName, scrollPost); }