Ejemplo n.º 1
0
        //内容详细页:内容ID
        public ActionResult ContentDetail(string id)
        {
            //获取并设置项目版本号
            SetMetasVersion();
            //获取当前登录的用户编号
            String userID = User.Identity.Name;
            userID = userID == "" ? null : userID;

            //获取内容
            BiZ.Content.PublicContent content = new BiZ.Content.PublicContent().getPublicContent(id);
            string memberID = "";
            if (content != null)
                memberID = content.Creater.MemberID;

            if (content == null) RedirectToAction("Err", "Err", new { errorno = "404" });

            if (content.DeleteFlag == BiZ.Comm.DeletedFlag.Yes)
                return RedirectToAction("TaContent/" + memberID + "/all/1", "Content");

            if (userID != null && userID != "" && memberID != null && memberID != "")
            {
                #region 是否浏览自己的主页
                bool isme = memberID == userID;
                if (!isme)
                {
                    //增加来访
                    BiZ.Member.Activity.ActivityController.VisitMember(userID, memberID);
                }
                #endregion
            }

            //获取当前登录的用户对象
            Models.MemberFullDisplayObj memberDisplayObj = Models.DisplayObjProvider.getMemberFullDisplayObj(content.Creater.MemberID);

            Models.PageModels.Content.ContentModel model = new Models.PageModels.Content.ContentModel();
            model.UserID = userID;
            model.MemberID = content.Creater.MemberID;
            model.AlreadyLogon = userID != null && userID != "" ? true : false;
            model.Member = memberDisplayObj;
            model.contenttype = content.ContentType.ToString();
            model.contentobj = content;

            return View(model);
        }
Ejemplo n.º 2
0
        //删除内容(更改内容删除状态):contentid-内容编号
        public ActionResult DeleteContent(string contentid)
        {
            BiZ.Content.PublicContent contentobj = new BiZ.Content.PublicContent().getPublicContent(contentid);
            contentobj.DeleteFlag = BiZ.Comm.DeletedFlag.Yes;
            contentobj.UpdateTime = DateTime.Now;
            contentobj.savePublicContent(contentobj);
            if (contentobj != null)
            {
                string memberId = HttpContext.User.Identity.Name;
                //增加用户动态到后台
                BiZ.Sys.MemberActivity.MemberActivityProvider.CreateMemberActivity(
                    memberId,
                    "",
                    BiZ.Sys.MemberActivity.MemberActivityType.RemoveContent,
                    "/Content/ContentDetail/" + contentobj.ID);

                return Json(new JavaScriptSerializer().Serialize(true));
            }
            return Json(new JavaScriptSerializer().Serialize(false));
        }
Ejemplo n.º 3
0
        public ActionResult AddContentLike(String contentID, String likeContentType)
        {
            String userID = User.Identity.Name;
            userID = userID == "" ? null : userID;
            Boolean ifLiked = BiZ.Like.LikeDataFactory.IfLiked<BiZ.Like.LikeData>(userID, contentID, BiZ.Like.LikeType.Content, BiZ.Like.LikeData.GetCollectionName());
            if (!ifLiked)
            {
                BiZ.Member.Member mym = BiZ.MemberManager.MemberManager.GetMember(userID);
                BiZ.Like.LikeDataFactory.AddLikeData(userID, contentID, BiZ.Like.LikeType.Content);
                BiZ.Content.PublicContent.UpdateLikeCount(contentID);
                //追加喜欢的集合
                BiZ.Content.PublicContent obj = new BiZ.Content.PublicContent().getPublicContent(contentID);
                obj.LikeList.Add(
                    new BiZ.Like.LikeMember(userID, mym.MemberInfomation.NickName, mym.MemberInfomation.IconPath)
                    );
                //保存更改
                obj.savePublicContent(obj);
                //增加魅力值
                BiZ.Member.Activity.ActivityController.AddGlamourValue(
                    userID,
                    obj.MemberID,
                    BiZ.Member.GlamourCounts.GlamourCountOperate.GlamourCountType.ContentLike,
                    BiZ.Member.GlamourCounts.GlamourCountOperate.ModifyGlamourValue.One,
                    likeContentType
                    );
                //增加积分增长的进度值
                BiZ.Member.Member memberobj = BiZ.MemberManager.MemberManager.GetMember(obj.MemberID);
                int MaxPointsSchedule = Common.Comm.getMaxPointsSchedule();
                if (memberobj.Status.PointsSchedule < MaxPointsSchedule)
                {
                    //增加一点进度值
                    BiZ.MemberManager.MemberManager.ModifyPointsSchedule(obj.MemberID, BiZ.MemberManager.StatusModifyType.Add);
                }
                //增加用户关联动态
                ActivityController.addActivityToContent(obj, null, userID, "addLike");

                //增加用户动态到后台
                BiZ.Sys.MemberActivity.MemberActivityProvider.CreateMemberActivity(
                    userID,
                    obj.MemberID,
                    BiZ.Sys.MemberActivity.MemberActivityType.LikeOther,
                    "/Content/ContentDetail/" + obj.ID);

                Models.PageModels.Content.ContentModel model = new Models.PageModels.Content.ContentModel();
                model.contentobj = obj;
                return Json(new JavaScriptSerializer().Serialize(model));
            }
            return Json(new JavaScriptSerializer().Serialize(false));
        }