public ResultBase GetLotteryInfo([FromBody] GetLotteryInfoReq req) { if (string.IsNullOrEmpty(req.Uid)) { return(new ResultBase { IsSuccess = false, Code = CodeConstant.ClientError_NotFound_Para, }); } ActivityInfoService activityInfoService = new ActivityInfoService(); GetLotteryInfoResq resq = new GetLotteryInfoResq(); try { resq = activityInfoService.GetLotteryInfo(req); } catch (Exception ex) { return(new ResultBase { IsSuccess = false, Code = CodeConstant.ServerError, Message = ex.Message + ex.StackTrace }); } if (resq != null) { return(new ResultBase { IsSuccess = true, Code = CodeConstant.Success, Data = resq }); } else { return(new ResultBase { IsSuccess = false, Code = CodeConstant.DataNull }); } }
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); }