/// <summary> /// 获取领取红包页面信息 /// </summary> /// <param name="req"></param> /// <returns></returns> public async Task <RedPacketInfoDto> GetRedPacketInfo(RedPacketInfoReq req) { var resultDto = new RedPacketInfoDto(); var dt = DateTime.Now; ////当月开始时间 00:00:00 //var preMonthStart = DateTime.Now.AddDays(1 - DateTime.Now.Day).Date; ////当月结束时间 23:59:59 //var preMonthEnd = DateTime.Now.AddDays(1 - DateTime.Now.Day).Date.AddMonths(1).AddSeconds(-1); //var counter = await db.TblcCentcardHisSet.CountAsync(his => his.Nodeid == req.Nodeid && his.Createtime >= preMonthStart && his.Createtime <= preMonthEnd && (his.Typeid == 0 || his.Typeid == 1)); //resultDto.IsCompleteTask = counter > 0;//本月完成购买充值卡任务 resultDto.IsCompleteTask = PXinContext.IsFinishTask(db, req.Nodeid, 1); resultDto.IsCompleteTask1 = PXinContext.IsFinishTask(db, req.Nodeid, 0); var open = await db.TnetOpenInfoSet.FirstOrDefaultAsync(w => dt >= w.Fromtime && dt <= w.Endtime && w.Typeid == 20001 && w.Nodeid == req.Nodeid); resultDto.IsOpen = open == null ? 0 : 1; var user = db.TnetReginfoSet.Where(c => c.Nodeid == req.Nodeid).FirstOrDefault(); //PxinCache.GetRegInfo(req.Nodeid);// HttpContext.Current.GetRegInfo(); resultDto.Name = user?.Nodename; resultDto.NodeCode = user?.Nodecode; var redPacket = await db.TbtcYdTransferHisSet.FirstOrDefaultAsync(h => h.NodeId == req.Nodeid && h.BeginTime <= dt && h.EndTime > dt); resultDto.Status = redPacket == null ? 2 : redPacket.Status;//红包状态 resultDto.InfoId = redPacket == null ? 0 : redPacket.HisId; var pxinUser = await db.TpxinUserinfoSet.FirstOrDefaultAsync(u => u.Nodeid == req.Nodeid); resultDto.ADain = pxinUser == null ? 0 : pxinUser.Apoint;//当前用户通过竞拍所得A点 //log.Info($"GetRedPacketInfo:nodeid={req.Nodeid}&counter={counter}&isopen={resultDto.IsOpen}&Status={resultDto.Status}&ADain={resultDto.ADain}"); //resultDto.Status = (resultDto.ADain > 0 && resultDto.IsCompleteTask) ? resultDto.Status : 2; resultDto.Status = resultDto.ADain > 0 ? resultDto.Status : 2; if (redPacket == null) { resultDto.SV = 0; resultDto.SVC = 0; resultDto.DOS = 0; } else { var redPackets = await(from t in db.TbtcYdTransferHisSet.Where(h => h.NodeId == req.Nodeid) join e in db.TbtcYdTransferHisExt2Set on t.HisId equals e.Hisid into temp_transfer from transferHis in temp_transfer.DefaultIfEmpty() where t.Status == 1 select new { TypeId = transferHis == null ? default : transferHis.Typeid, Amount = transferHis == null ? default : transferHis.Amount, ReceStatus = t.Status, SettStatus = transferHis == null ? default : transferHis.Status, }).ToListAsync();
public async Task <Respbase <RedPacketInfoDto> > GetRedPacketInfo(RedPacketInfoReq req) { var result = await _redpacketFacade.GetRedPacketInfo(req); if (result == null) { return(new Respbase <RedPacketInfoDto>() { Data = null, Message = _redpacketFacade.PromptInfo.Message, Result = _redpacketFacade.PromptInfo.Result }); } return(new Respbase <RedPacketInfoDto>() { Data = result }); }