コード例 #1
0
        public ActionResult LeaveMsgPlusOne(int id, string falg)
        {
            var msg = LeaveMsgBll.LoadEntities(m => m.Id == id).FirstOrDefault();

            if (msg != null)
            {
                if (falg == "tip")
                {
                    msg.Tip = msg.Tip == null?1:msg.Tip + 1;
                }
                if (falg == "stamp")
                {
                    msg.Stamp = msg.Stamp == null?1:msg.Stamp + 1;
                }
                if (LeaveMsgBll.Update(msg))
                {
                    return(Content("ok"));
                }
                else
                {
                    return(Content("no"));
                }
            }
            else
            {
                return(Content("noExist"));
            }
        }
コード例 #2
0
        public ActionResult Welcome()
        {
            ViewBag.todayAllLeaveMsg = LeaveMsgBll.LoadEntities(m => true).Where(m => DbFunctions.DiffDays(m.InTime, DateTime.Now) == 0).Count();
            ViewBag.todayAllOrder    = OrderBll.LoadEntities(r => true).Where(r => DbFunctions.DiffDays(r.InTime, DateTime.Now) == 0).Count();
            ViewBag.todayYj          = FeedbackBll.LoadEntities(f => true).Where(f => DbFunctions.DiffDays(f.InTime, DateTime.Now) == 0).Count();

            ViewBag.total  = HttpContext.Application["total"];
            ViewBag.onLine = HttpContext.Application["onLine"];

            return(View());
        }
コード例 #3
0
        /// <summary>
        /// 新闻评论的数据加载
        /// </summary>
        /// <returns></returns>
        public ActionResult LoadNewsLeaveMsg()
        {
            int newsId    = int.Parse(Request["newsId"]);
            int pageIndex = int.Parse(Request["pageIndex"] ?? "1");
            int pageSize  = int.Parse(Request["pageSize"] ?? "20");
            int total     = 0;
            var msg       = LeaveMsgBll.LoadEntities(m => true);
            var news      = NewsBll.LoadEntities(n => n.Id > 0).Select(n => new { n.Id });
            var user      = PersonalUserBll.LoadEntities(u => u.Id > 0).Select(u => new { u.UName, u.Id, u.Head });
            //-------------请求发布的评论----------------------------------
            var data = from m in msg
                       join u in user on m.PersonalUserId equals u.Id into um
                       from umi in um.DefaultIfEmpty()
                       join n in news on m.NewsId equals n.Id
                       where m.NewsId == newsId
                       where m.ReplyId == null || m.ReplyId == 0
                       select new Publish()
            {
                Id          = m.Id,
                Msg         = m.Msg,
                City        = m.City,
                UserName    = umi != null ? umi.UName : "" + m.Id + "" + "爽赞网友",         //用户名
                UserNameImg = umi.Head != null ? ("/Content/Img/" + umi.Head) : null,    //用户头像
                InTime      = m.InTime,
                Tip         = m.Tip == null ? 0 : m.Tip,
                Stamp       = m.Stamp == null ? 0 : m.Stamp,
            };
            var alldata = data.AsNoTracking().OrderByDescending(d => d.InTime).Skip(pageSize * (pageIndex - 1)).Take(pageSize).ToList();

            total = data.Count();
            List <Publish> list = WebHelper.ToListTimeSpan(alldata);
            //-------------------------- //回复的数据---------------------------------------------
            string pubStrNav = LaomaPager.ShowPageNavigate(pageSize, pageIndex, total);

            //回复的数据
            var replyData = LeaveMsgBll.GetNewsLeaveMsgData(newsId).Select(n => new Reply
            {
                SelfId       = n.SelfId,
                ReplyId      = n.ReplyId,
                ReplyContent = n.ReplyContent,
                ReplyCity    = n.ReplyCity,
                ReplyName    = n.ReplyName,
                ReplyUserImg = n.ReplyUserImg,  //用户头像
                ReplyInTime  = n.ReplyInTime,
                ReplyTip     = n.ReplyTip,
                ReplyStamp   = n.ReplyStamp,
            }).ToList();
            List <Reply> replyList = WebHelper.ToReplyStrTimeSpan(replyData);
            var          result    = new { Data = list, replyData = replyList, PubStrNav = pubStrNav, Total = total };

            return(Json(result, JsonRequestBehavior.AllowGet));
        }
コード例 #4
0
        public ActionResult AddNewsReplyMsg()
        {
            string ip     = Request["ip"];
            string msg    = Request["msg"];
            string guid   = Request["userId"];
            var    user   = Common.CacheHelper.Get(guid) as PersonalUser;
            int    userId = 0;

            if (user != null)
            {
                userId = user.Id;
            }
            if (ForbiddenListBll.CheckBannd(msg))
            {
                return(Content("banned,提示:您所输入的信息包含禁用词!"));
            }
            if (BlackListIPBll.CheckBlackListIp(ip))
            {
                return(Content("ipNo,提示:您所在地IP已被受限!暂不能发表评论!如需操作,联系爽赞网管理人员"));
            }
            else
            {
                LeaveMsg levaemsg = new LeaveMsg()
                {
                    PersonalUserId = userId,
                    IP             = ip,
                    City           = Request["city"],
                    Msg            = msg,
                    MsgNum         = null,
                    InTime         = DateTime.Now,
                    ReplyId        = int.Parse(Request["replyId"]),  //变化点
                    UserRaidersId  = int.Parse(Request["raidersId"]) //变化点
                };
                if (LeaveMsgBll.Add(levaemsg) != null)
                {
                    return(Content("ok,恭喜:评论提交成功"));
                }
                else
                {
                    return(Content("no,提示:评论提交失败!"));
                }
            }
        }