コード例 #1
0
ファイル: FriController.cs プロジェクト: MeiCheng5230/fromALi
        public Respbase <FriMessageCollection> GetMsgHome(ReqGetMsgHome req)
        {
            FriFacade facade = new FriFacade();
            var       result = facade.GetMsgHome(req);

            return(new Respbase <FriMessageCollection> {
                Data = result
            });
        }
コード例 #2
0
ファイル: FriFacade.cs プロジェクト: MeiCheng5230/fromALi
        /// <summary>
        /// 获取信友圈消息[首页]
        /// </summary>
        /// <param name="req"></param>
        /// <returns></returns>
        public FriMessageCollection GetMsgHome(ReqGetMsgHome req)
        {
            TnetReginfo          reginfo = HttpContext.Current.GetRegInfo();
            FriMessageCollection result  = new FriMessageCollection();
            var queryMsg = from msg in db.VpxinMessageSet
                           where msg.Localnodeid == req.Nodeid && msg.Createtime > req.StartTime
                           select new MessageDto
            {
                Commentnum  = msg.Commentnum,
                Nodeid      = msg.Msgnodeid,
                Localnodeid = msg.Localnodeid,
                Content     = msg.Content,
                Createtime  = msg.Createtime,
                Down        = msg.Down,
                Infoid      = msg.Infoid,
                Ispay       = msg.Ispay,
                Picurl      = msg.Picurl,
                Price       = msg.Price,
                Reward      = msg.Reward,
                Sound       = msg.Sound,
                Up          = msg.Up,
                Video       = msg.Video,
                IsDown      = msg.IsDown,
                IsUp        = msg.IsUp,
                Hisid       = msg.Hisid
            };

            result.Messages = queryMsg.OrderByDescending(a => a.Createtime).Skip(req.PageSize * (req.PageIndex - 1)).Take(req.PageSize).ToList();
            bool isResult = IsMessage(result.Messages);

            int[] infos        = result.Messages.Select(a => a.Infoid).ToArray();
            var   queryComment = from mu in db.TpxinMessageUesrSet
                                 join comment in db.TpxinCommentHisSet on new { mu.Typeid, mu.Infoid } equals new { Typeid = 1, Infoid = comment.Hisid }
            join msg in db.TpxinMessageSet on comment.Infoid equals msg.Infoid
            where mu.Nodeid == reginfo.Nodeid && msg.Createtime > req.StartTime && infos.Contains(msg.Infoid)
            orderby comment.Createtime ascending
            select new CommentDto
            {
                Content    = comment.Content,
                Createtime = comment.Createtime,
                Hisid      = comment.Hisid,
                Infoid     = comment.Infoid,
                Nodeid     = comment.Nodeid,
                Phisid     = comment.Phisid,
                Pnodeid    = comment.Pnodeid
            };

            result.Comments = queryComment.ToList();
            return(result);
        }