public IActionResult CheckSignIn(UserType userType = UserType.Consumer) { var scoreBiz = new ScoreExBiz(); var result = scoreBiz.CheckInSendIntergral(UserID, userType.ToString()); return(Success(result)); }
[HttpGet, Produces(typeof(ResponseDto))]//, AllowAnonymous public async Task <IActionResult> CheckInSendIntergral(string userID, UserType userType = UserType.Consumer) { if (string.IsNullOrWhiteSpace(userID)) { userID = UserID; } var scoreBiz = new ScoreExBiz(); if (scoreBiz.CheckInSendIntergral(UserID, userType.ToString())) { return(Failed(ErrorCode.SystemException, "今日已签到")); } var theRightIntergral = 0; //连续签到 判断 一个月为期,首日签到1积分,连续签到递增1积分, //连续签到上限为7积分,连续签到8,9,10天均为7个积分,若中断则重新计算,一个月最多得189分 var recordModel = await scoreBiz.GetCheckInSendIntergralRecord(UserID, SendIntergralEnum.连续签到送积分.ToString(), userType); if (recordModel != null && (DateTime.Now.Date - recordModel.CreationDate.Date).Days.Equals(1)) { //满勤的情况 var modelList = await scoreBiz.GetModelListByCondition(UserID, userType.ToString(), 30); theRightIntergral = recordModel.Variation < 7 ? recordModel.Variation + 1 : modelList.Where(a => a.Variation.Equals(7)).ToList().Count > 23 && modelList.Where(a => a.Variation.Equals(1)).ToList().Count == 1 && modelList[modelList.Count - 1].Variation == 1 ? 1 : 7; } else { theRightIntergral = 1; } var isSucc = InsertIntergral(theRightIntergral, SendIntergralEnum.连续签到送积分, userType); return(isSucc ? Success() : Failed(ErrorCode.DataBaseError, "签到积分插入错误")); }