Exemplo n.º 1
0
        public ApiResult <PagedListP <AchievementModel> > GetMyBet(int lType, string PlayName, int pageIndex = 1, int pageSize = 20)
        {
            PersonalService service = new PersonalService();
            PagedListP <AchievementModel> resDto = service.GetMyBet(lType, PlayName, pageIndex, pageSize, this.UserInfo.UserId);

            return(new ApiResult <PagedListP <AchievementModel> >()
            {
                Data = resDto
            });
        }
Exemplo n.º 2
0
        public ApiResult <PagedListP <ComeOutRecordModel> > GetMyCommissionList(int Type, int pageIndex = 1, int pageSize = 20)
        {
            PersonalService service = new PersonalService();
            PagedListP <ComeOutRecordModel> resDto = service.GetMyCommissionList(Type, pageIndex, pageSize, this.UserInfo.UserId);

            return(new ApiResult <PagedListP <ComeOutRecordModel> >()
            {
                Data = resDto
            });
        }
Exemplo n.º 3
0
        public ApiResult <PagedListP <SystemMessage> > GetSysMessage(long uid = 0, int pageIndex = 1, int pageSize = 20)
        {
            PersonalService            service = new PersonalService();
            PagedListP <SystemMessage> resDto  = service.GetSysMessage(uid, pageIndex, pageSize, this.UserInfo.UserId);

            return(new ApiResult <PagedListP <SystemMessage> >()
            {
                Data = resDto
            });
        }
Exemplo n.º 4
0
        public ApiResult <PagedListP <BetModel> > GetBet(int pid = 0, int pageIndex = 1, int pageSize = 20)
        {
            PersonalService       service = new PersonalService();
            PagedListP <BetModel> resDto  = service.GetBet(pid, pageIndex, pageSize, this.UserInfo.UserId);

            return(new ApiResult <PagedListP <BetModel> >()
            {
                Data = resDto
            });
        }
Exemplo n.º 5
0
        public ApiResult <PagedListP <Plan> > GetPlanData(int lType, int pageIndex = 1, int pageSize = 10)
        {
            PlanService       service = new PlanService();
            PagedListP <Plan> list    = service.GetPlanData(lType, pageIndex, pageSize);

            return(new ApiResult <PagedListP <Plan> >()
            {
                Data = list
            });
        }
Exemplo n.º 6
0
        public ApiResult <PagedListP <AccessRecord> > GetVisitRecord(long uid = 0, int pageIndex = 1, int pageSize = 20)
        {
            PersonalService           service = new PersonalService();
            PagedListP <AccessRecord> resDto  = service.GetVisitRecord(uid, pageIndex, pageSize, this.UserInfo.UserId);

            return(new ApiResult <PagedListP <AccessRecord> >()
            {
                Data = resDto
            });
        }
Exemplo n.º 7
0
        public ApiResult <PagedListP <BettingRecord> > GetPlan(long uid = 0, int ltype = 0, int winState = 0, int pageIndex = 1, int pageSize = 20)
        {
            PersonalService            service = new PersonalService();
            PagedListP <BettingRecord> resDto  = service.GetPlan(uid, ltype, winState, pageIndex, pageSize, this.UserInfo.UserId);

            return(new ApiResult <PagedListP <BettingRecord> >()
            {
                Data = resDto
            });
        }
Exemplo n.º 8
0
        public ApiResult <PagedListP <AchievementModel> > GetUserLastPlay(LastPlayReqDto model)
        {
            PlanService service = new PlanService();
            PagedListP <AchievementModel> list = service.GetUserLastPlay(model.uid, model.lType, model.playName, this.UserInfo.UserId);

            return(new ApiResult <PagedListP <AchievementModel> >()
            {
                Data = list
            });
        }
Exemplo n.º 9
0
        public ApiResult <PagedListP <Expert> > GetExpertList(ExpertListReqDto model)
        {
            PlanService         service = new PlanService();
            PagedListP <Expert> list    = service.GetExpertList(model.lType, model.playName, model.type, model.pageIndex, model.pageSize);

            return(new ApiResult <PagedListP <Expert> >()
            {
                Data = list
            });
        }
Exemplo n.º 10
0
        public ApiResult <PagedListP <Comment> > GetDenamic(long uid = 0, int pageIndex = 1, int pageSize = 20)
        {
            PersonalService      service = new PersonalService();
            PagedListP <Comment> resDto  = service.GetDenamic(uid, pageIndex, pageSize, this.UserInfo.UserId);


            return(new ApiResult <PagedListP <Comment> >()
            {
                Data = resDto
            });
        }
Exemplo n.º 11
0
        public ApiResult <PagedListP <UserCoupon> > UserCouponList(int type, int pageIndex = 1, int pageSize = 20)
        {
            long userId = this.UserInfo.UserId;

            PersonalService         service = new PersonalService();
            PagedListP <UserCoupon> resDto  = service.GetMyUserCouponList(type, pageIndex, pageSize, userId);

            return(new ApiResult <PagedListP <UserCoupon> >()
            {
                Data = resDto
            });
        }
Exemplo n.º 12
0
        /// <summary>
        /// 获取官方计划推荐数据(分页)
        /// </summary>
        public PagedListP <Plan> GetPlanData(int lType, int pageIndex, int pageSize)
        {
            string memcacheKey = string.Format(RedisKeyConst.Plan_RecommendListApi, lType, pageIndex);

            var pager = CacheHelper.GetCache <PagedListP <Plan> >(memcacheKey);

            if (pager == null)
            {
                int count     = Util.GetGFTJCount(lType);
                int totalSize = (pageSize + 1) * count;

                pager           = new PagedListP <Plan>();
                pager.PageSize  = totalSize;
                pager.PageIndex = pageIndex;
                string totalsql =
                    "select COUNT(1) from ( select row_number() over(order by Id desc) as rownumber,* from [Plan] where lType = " +
                    lType + ") as temp";
                string sql = string.Format(@"select top {0} temp.* from ( 
       select row_number() over(order by a.Id desc,a.Sort) as rownumber,a.*,b.Num as OpenNum,b.SubTime as OpenTime 
	    from [Plan] a 
	    left join LotteryRecord b on b.Issue=a.Issue and b.lType=a.lType
        where a.lType = {1}
    )as temp where rownumber>{2} 
	order by temp.Issue desc,temp.Sort"    , totalSize, lType, (pageIndex - 1) * totalSize);
                pager.PageData   = Util.ReaderToList <Plan>(sql); //计划列表
                pager.TotalCount = ToolsHelper.ObjectToInt(SqlHelper.ExecuteScalar(totalsql));

                int memcacheTimeout = 4;
                if (lType < 9)
                {
                    memcacheTimeout = 1440; //24小时
                }
                CacheHelper.AddCache(memcacheKey, pager, memcacheTimeout);
            }

            return(pager);
        }
Exemplo n.º 13
0
        /// <summary>
        /// 获取专家列表
        /// </summary>
        public PagedListP <Expert> GetExpertList(int lType, string playName, int type, int pageIndex, int pageSize)
        {
            var pager = new PagedListP <Expert>();

            pager.PageIndex = pageIndex;
            pager.PageSize  = pageSize;

            var playList = lotteryService.GetPlayList(lType).Data;

            int?playNameId = playList.FirstOrDefault(x => x.PlayName == playName)?.Id;

            if (!playNameId.HasValue)
            {
                return(pager);
            }

            string memcacheKey = string.Format(RedisKeyConst.Plan_ExpertList, type, lType, playNameId); //string.Format("expertList_{0}_{1}_{2}", lType, playNameId, type);
            var    list        = CacheHelper.GetCache <List <Expert> >(memcacheKey);

            if (list == null)
            {
                string sqlWhere = type == 1 ? ">=" : "<";
                string sql      = string.Format(@"
 select top 100 row_number() over(order by a.playTotalScore DESC ) as rowNumber,
    a.*,b.ltypeTotalScore,c.MinIntegral,isnull(d.Name,'') as Name,isnull(e.RPath,'') as avater 
from (
  select UserId,lType,PlayName, isnull( sum(score),0) AS playTotalScore from [C8].[dbo].[BettingRecord]
  where WinState>1 and lType=@lType and PlayName=@PlayName
  group by UserId, lType, PlayName
 ) a
  left join (
   select UserId,lType, isnull( sum(score),0) AS ltypeTotalScore from [C8].[dbo].[BettingRecord]
   where WinState>1 and lType=@lType
   group by UserId, lType
  ) b on b.lType=a.lType and b.UserId=a.UserId
  left join ( 
	select lType, isnull( min(MinIntegral),0) as MinIntegral 
	from [dbo].[LotteryCharge] 
    where lType=@lType
    group by lType
  ) c on c.lType=a.lType
  left join UserInfo d on d.Id=a.UserId
  left join ResourceMapping e on e.FkId =a.UserId and e.[Type]=@ResourceType

  where b.ltypeTotalScore {0} c.MinIntegral and a.PlayName=@PlayName and a.lType=@lType 
  ", sqlWhere);

                var sqlParameter = new[]
                {
                    new SqlParameter("@ResourceType", (int)ResourceTypeEnum.用户头像),
                    new SqlParameter("@PlayName", playName),
                    new SqlParameter("@lType", lType),
                };
                list = Util.ReaderToList <Expert>(sql, sqlParameter);

                if (list == null)
                {
                    return(pager);
                }

                list.ForEach(x =>
                {
                    GetLastBettingRecord(x, 10);
                });

                CacheHelper.AddCache(memcacheKey, list, 240);
            }


            #region 分页查询专家排行数据行

            pager.PageData = list.Skip(pager.StartIndex - 1).Take(pageSize).ToList();


            pager.TotalCount = list.Count;
            #endregion

            return(pager);
        }
Exemplo n.º 14
0
        /// <summary>
        /// 获取用户近期竞猜记录【已开奖】(ExtraData 返回当前用户是否点阅过最新一期未开奖的记录)
        /// </summary>
        public PagedListP <AchievementModel> GetUserLastPlay(long uid, int lType, string playName, long userId)
        {
            string strsql  = string.Empty;
            string numsql  = string.Empty;
            string playSql = string.Empty;

            var pager = new PagedListP <AchievementModel>();

            pager.PageIndex = 1;
            pager.PageSize  = 10;
            SqlParameter[] sp = new SqlParameter[] { };
            if (playName == "全部")//全部
            {
                strsql  = string.Format(@"select * from BettingRecord   where UserId ={0} and lType = {1}", uid, lType);
                numsql  = string.Format(@"SELECT * FROM (  select row_number() over(order by l.SubTime desc  ) as rowNumber, Num,l.SubTime,l.Issue,b.lType from LotteryRecord l
	                                      ,BettingRecord b
	                                      where b.Issue=l.Issue and b.lType=l.lType
	                                      and b.UserId={0} and b.lType={1}  and b.WinState in(3,4)
	                                      group by l.Issue,Num,l.SubTime,b.lType
	                                      )t
	                                      where   rowNumber BETWEEN {2} AND {3}  "    , uid, lType, pager.StartIndex, pager.EndIndex);
                playSql = string.Format(@" select top 1 * from BettingRecord where UserId={0} 
                                                     and lType={1} and WinState=1 order by SubTime desc", uid, lType);
            }
            else
            {
                strsql  = string.Format(@"
                select * from BettingRecord   where UserId ={0} and lType = {1}  and PlayName = @PlayName", uid, lType);
                numsql  = string.Format(@"SELECT * FROM (  select row_number() over(order by l.SubTime desc  ) as rowNumber,  Num,l.SubTime,l.Issue,b.lType from LotteryRecord l
	                                      ,BettingRecord b
	                                      where b.Issue=l.Issue and b.lType=l.lType
	                                      and b.UserId={0} and b.lType={1} and b.PlayName=@PlayName  and b.WinState in(3,4)
	                                      group by l.Issue,Num,l.SubTime,b.lType
	                                      )t
	                                      where   rowNumber BETWEEN {2} AND {3} "    , uid, lType, pager.StartIndex, pager.EndIndex);
                playSql = string.Format(@" select top 1 * from BettingRecord where UserId={0} 
                                                     and lType={1} and WinState=1 and PlayName=@PlayName order by SubTime desc", uid, lType);

                sp = new SqlParameter[] { new SqlParameter("@PlayName", playName) };
            }

            List <LotteryNum>       listnum = Util.ReaderToList <LotteryNum>(numsql, sp);//我对应的开奖数据
            List <BettingRecord>    listbet = Util.ReaderToList <BettingRecord>(strsql, sp);
            List <AchievementModel> list    = new List <AchievementModel>();

            if (listnum.Count > 0)
            {
                foreach (var item in listnum)
                {
                    AchievementModel model = new AchievementModel();
                    LotteryNum       l     = new LotteryNum();
                    l.Issue   = item.Issue;
                    l.Num     = item.Num;
                    l.SubTime = Convert.ToDateTime(item.SubTime).ToString("yyyy-MM-dd");
                    l.lType   = item.lType;

                    model.LotteryNum = l;
                    if (listbet.Count() > 0)
                    {
                        model.BettingRecord = listbet.Where(x => x.Issue == item.Issue).ToList();
                    }
                    list.Add(model);
                }
            }
            pager.PageData = list;

            //查询最新一期玩法
            var lastPlay  = Util.ReaderToList <BettingRecordViewModel>(playSql, sp);
            var extraData = lastPlay.FirstOrDefault();

            if (extraData != null)
            {
                //查询当前用户是否点阅过该记录
                string isSubSql = "select count(1) from dbo.ComeOutRecord where Type="
                                  + (int)TransactionTypeEnum.点阅 + " and UserId=" + userId + " and OrderId=" + extraData.Id;
                object objIsSub = SqlHelper.ExecuteScalar(isSubSql);
                extraData.IsRead = objIsSub != null && Convert.ToInt32(objIsSub) > 0;
            }

            pager.ExtraData = extraData;
            return(pager);
        }