public Tuple <int[], GetLotteryInfoResq> GetLottery(GetLotteryInfoReq para) { ActivityInfoProcessing activityInfoProcessing = new ActivityInfoProcessing(); int todayCount = activityInfoProcessing.GetTodayLotteryCount(para); if (todayCount == 0) { int rondom = LotteryProbability.GetRondom(); activityInfoProcessing.InserLotteryInfo(para, rondom); return(new Tuple <int[], GetLotteryInfoResq>(new int[] { rondom, rondom, rondom }, GetLotteryInfo(para))); } else if (todayCount == 1) { int index0 = LotteryProbability.GetRondom(); int index1 = LotteryProbability.GetRondom(); int index2 = LotteryProbability.GetRondom(); if (index0 == index1 && index1 == index2) { activityInfoProcessing.InserLotteryInfo(para, index0); } else { activityInfoProcessing.InserLotteryInfo(para, -1); } return(new Tuple <int[], GetLotteryInfoResq>(new int[] { index0, index1, index2 }, GetLotteryInfo(para))); } else //两次机会都用完了 { return(new Tuple <int[], GetLotteryInfoResq>(new int[] { }, null)); } }
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); }
public int GetTodayCount(GetLotteryInfoReq req) { ActivityInfoProcessing activityInfoProcessing = new ActivityInfoProcessing(); return(activityInfoProcessing.GetTodayLotteryCount(req)); }