Exemplo n.º 1
0
        public string GetLiuYanReplyInfo(dynamic requestData)
        {
            LogHelper.WriteMsgByDay("WeiXinController-GetLiuYanReplyInfo-log:" + requestData.ToString());
            int    page     = requestData.page;
            int    pagesize = requestData.pagesize;
            string keyType  = requestData.KeyType;
            string keyId    = requestData.KeyId;
            string parentId = requestData.ParentId;

            if (string.IsNullOrEmpty(keyType) || string.IsNullOrEmpty(keyId) || string.IsNullOrEmpty(parentId))
            {
                return("参数不能为空");
            }
            else
            {
                string sql        = string.Format(@"SELECT row_number() over(order BY CreateDate) RowId,t.* 
                                             FROM ( SELECT  a.Id,a.KeyId,a.OpenId,a.LiuYan, c.Nickname,c.HeadImgUrl,r.HotelName, a.CreateDate,COUNT(b.Id) ReplyCount 
                                                    FROM CpkLiuYan a
                                                    LEFT JOIN CpkLiuYan b ON a.Id=b.ParentId
		                                            JOIN dbo.OpenIdAssociated c ON c.OpenId = a.OpenId
		                                            JOIN dbo.RegistMember r ON r.MemberId = c.UserId AND c.UserType =2
                                                    WHERE a.ParentId={0} AND a.KeyId= {1} AND a.KeyType = '{2}' 
                                                    GROUP BY a.Id,a.KeyId,a.OpenId,a.LiuYan ,a.CreateDate,c.Nickname,c.HeadImgUrl,r.HotelName
                                                   ) t", parentId, keyId, keyType);
                String sqlpage    = PageHelper.GetPagerSql(page, pagesize, sql); //分页sql
                var    data       = SqlHelper2.ExecuteDataTable(sqlpage);        //分页的数据
                var    totalcount = SqlHelper2.GetCountByNormalSql(sql);         //总条数
                var    toatlpage  = PageHelper.GetTotalPage(totalcount, pagesize);
                return(JsonConvert.SerializeObject(data));
            }
        }