/// <summary> /// 签到 /// </summary> private string Sign() { int state = 1; if (!Utils.HasAvtivityDateTimes()) { state = 5; return(state.ToString()); } //验证当前用户当天投注是否达到条件 DateTime startTime = Utils.GetNowBeginDate(); DateTime endTime = Utils.GetNowEndDate(); IBetDetailService betDetailServices = IoC.Resolve <IBetDetailService>(); var totalAmt = 0m; int[] whereStates = new int[] { 1, 2 }; var sumResult = betDetailServices.Where(c => c.UserId == this.CookUserInfo.Id && c.OccDate >= startTime && c.OccDate <= endTime && whereStates.Contains((int)c.Stauts)); if (sumResult.Any()) { totalAmt = sumResult.Sum(c => c.TotalAmt); } if (totalAmt > Convert.ToDecimal(System.Configuration.ConfigurationManager.AppSettings["sign"])) { ISignService signServices = IoC.Resolve <ISignService>(); //查询今天是否已经签到过 int occday = Utils.GetActivityOccDay(); if (signServices.Where(c => c.Uid == CookUserInfo.Id && c.OccDay == occday).Count() < 1) { signServices.Create(new BasicModel.Act.Sign() { OccDay = occday, Uid = CookUserInfo.Id }); signServices.Save(); state = 0; } else { state = 3; } } else { state = 2; } return(state.ToString()); }