Exemplo n.º 1
0
        public async Task <RpsData <IEnumerable <RpsPoster> > > GetUserPoster(ParamUserBase param)
        {
            var parameters = new List <object>();

            parameters.Add(new SqlParameter("@UserId", param.Id));
            var result = await _context.SqlQueryAsync <RpsPoster>(@"SELECT  g.[Icon] ,p.[Gate], Count(p.[Gate]) as Count,
	                                                  (select count(Id) from [dbo].[Game_Posters] gp where gp.GateId=p.Gate and gp.UserId=@UserId) as GetCount
                                                  FROM [Game2048].[dbo].[Game_PosterGallery]  p
                                                  inner join [dbo].[Game_Gate] g on g.Gate=p.[Gate] group by g.[Icon],p.[Gate]", parameters);

            return(RpsData <IEnumerable <RpsPoster> > .Ok(result));
        }
Exemplo n.º 2
0
        public async Task <RpsData <RpsRankingList> > GetRankingList(ParamRankingList param)
        {
            var parameters = new List <object>();

            parameters.Add(new SqlParameter("@UserId", param.Id));
            parameters.Add(new SqlParameter("@Gate", param.Gate));
            parameters.Add(new SqlParameter("@GameType", param.GameType));
            parameters.Add(new SqlParameter("@Take", param.Num));
            var rankinglist = await _context.SqlQueryAsync <BaseRanking>(@"select *from 
                                            (
                                            select u.Icon, u.NickName as Name,s.Score,
                                            ROW_NUMBER() OVER(order by s.Score desc) as Number 
                                            from  [dbo].[Game_UserTB] u
                                            inner join [dbo].[Game_UserScore] s on u.Id=s.UserId
                                            where u.GameType=@GameType and u.Status=0 and s.Gate=@Gate
                                             )
                                            temp where temp.Number<=@Take", parameters);

            var myrankinglist = await _context.SqlQueryAsync <BaseRanking>(@"select *from 
                                            (
                                            select u.Icon, u.NickName as Name,s.Score,u.Id,
                                            ROW_NUMBER() OVER(order by s.Score desc) as Number 
                                            from  [dbo].[Game_UserTB] u
                                            inner join [dbo].[Game_UserScore] s on u.Id=s.UserId
                                            where u.GameType=@GameType and u.Status=0 and s.Gate=@Gate
                                             )
                                            temp where temp.Id<=@UserId", parameters);


            var result = new RpsRankingList()
            {
                MyRanking = myrankinglist.FirstOrDefault(),
                OtherList = rankinglist
            };

            return(RpsData <RpsRankingList> .Ok(result));
        }
Exemplo n.º 3
0
        public async Task <RpsData <IEnumerable <RpsSignList> > > GetSignList(ParamUserBase param)
        {
            var parampters = new List <object>();

            parampters.Add(new SqlParameter("@UserId", param.Id));
            IEnumerable <RpsSignList> result = await _context.SqlQueryAsync <RpsSignList>(@"
                 select b.Id SignHisId,b.IsGet IsGet,b.CreateDate as CreateDate,ROW_NUMBER() over(order by b.CreateDate) as Day  from [dbo].[Game_UserLoginInfo] a  
                               inner join 
                               [dbo].[Game_SignInHistory] b 
                               on a.UserId=b.UserId
                         where a.UserId=@UserId 
                        and a.SignInContinuousDays!=0 
                        and DATEDIFF(day,a.LatetestSignInDate,GETDATE())<=1
                        and b.CreateDate>DATEADD(day,-a.SignInContinuousDays,a.LatetestSignInDate)", parampters);

            return(RpsData <IEnumerable <RpsSignList> > .Ok(result));
        }