Esempio n. 1
0
        public Tuple <bool, int[], GetLotteryInfoResq> HelpGetLottery(GetLotteryInfoReq req)
        {
            ActivityInfoProcessing activityInfoProcessing = new ActivityInfoProcessing();

            if (activityInfoProcessing.GetHelperCount(req) >= 1)
            {
                return(new Tuple <bool, int[], GetLotteryInfoResq>(false, new int[] { -1 }, null));
            }

            if (!activityInfoProcessing.ExistUId(req.HelperUid))
            {
                activityInfoProcessing.InsertUserInfo(req.HelperUid, req.HelperHeadUrl, req.HelperNickName);
            }

            int rondom = GetRondomLottery();

            activityInfoProcessing.InserLotteryInfo(req, rondom);
            return(new Tuple <bool, int[], GetLotteryInfoResq>(true, new int[] { rondom }, GetLotteryInfo(req)));
        }
Esempio n. 2
0
        public GetLotteryInfoResq GetLotteryInfo(GetLotteryInfoReq para)
        {
            ActivityInfoProcessing activityInfoProcessing = new ActivityInfoProcessing();

            if (!activityInfoProcessing.ExistUId(para.Uid))
            {
                activityInfoProcessing.InsertUserInfo(para.Uid, para.HeadUrl, para.NickName);
            }

            GetLotteryInfoResq getLotteryInfoResq = new GetLotteryInfoResq();

            getLotteryInfoResq.AvailableCount = 2 - activityInfoProcessing.GetTodayLotteryCount(para);
            getLotteryInfoResq.userInfo       = activityInfoProcessing.GetUserInfoModel(para);
            getLotteryInfoResq.userBoxIndex   = activityInfoProcessing.GetUserBoxInfos(para).Select(m => m.F_BoxIndex).ToArray();

            List <UserLotteryCount> userLotteryDetails = activityInfoProcessing.GetUserLotteryCount(para);
            List <UserLotteryHelp>  userLotteryHelps   = activityInfoProcessing.GetUserLotteryHelp(para);

            List <UserLotteryDetail> details = new List <UserLotteryDetail>();

            foreach (UserLotteryCount item in userLotteryDetails)
            {
                var userHelp = userLotteryHelps.Where(m => m.F_LotteryIndex == item.F_LotteryIndex).OrderByDescending(m => m.F_CreateTime).FirstOrDefault();
                if (userHelp != null)
                {
                    UserLotteryDetail detail = new UserLotteryDetail();
                    detail.F_LotteryCount   = item.F_IndexCount;
                    detail.F_LotteryIndex   = item.F_LotteryIndex;
                    detail.F_UId            = item.F_UId;
                    detail.F_CreateUId      = userHelp.F_CreateUId;
                    detail.F_CreateNickName = userHelp.F_CreateNickName;
                    detail.F_CreateHeadUrl  = userHelp.F_CreateHeadUrl;
                    details.Add(detail);
                }
            }
            getLotteryInfoResq.userLottery = details;
            return(getLotteryInfoResq);
        }