public async Task <IActionResult> CollectArticleOrQuestionSendIntergral(CollectArticleOrQuestionSendIntergralRequest request) { if (string.IsNullOrWhiteSpace(request.UserID)) { request.UserID = UserID; } var isExist = new CollectionBiz().IsCollectTheTarget(request.UserID, request.TargetGuid); if (!isExist) { return(Failed(ErrorCode.DataBaseError, "该文章或问题还未收藏!")); } var scoreBiz = new ScoreExBiz(); // 收藏1个问题可得3积分,每天9积分为上限 var recordModelList = await scoreBiz.GetToDaysIntergralRecordByCondition(request.UserID, SendIntergralEnum.收藏文章或问题送积分.ToString()); if (recordModelList == null || recordModelList.Count < 3) { if (!InsertIntergral(3, SendIntergralEnum.收藏文章或问题送积分, request.UserType)) { Logger.Error($"收藏文章或问题送积分失败!{JsonConvert.SerializeObject(request)}"); } } //else //{ // //var totalIntergral = recordModelList.Select(a => a.Variation).Sum()>9; // return Failed(ErrorCode.DataBaseError, "今日收藏文章或问题送积分次数已满!"); //} return(Success()); }
public async Task <IActionResult> ShareToSendIntergral(UserType userType = UserType.Consumer) { var scoreBiz = new ScoreExBiz(); //每天分享内容1次即可获5积分,每天30分为上限 var recordModelList = await scoreBiz.GetToDaysIntergralRecordByCondition(UserID, SendIntergralEnum.分享送积分.ToString()); if (recordModelList == null || recordModelList.Count < 6) { if (!InsertIntergral(5, SendIntergralEnum.分享送积分, userType)) { Logger.Error($"分享送积分失败-{JsonConvert.SerializeObject(new { UserId = UserID })}"); } } //else //{ // //var totalIntergral = recordModelList.Select(a => a.Variation).Sum()>30; // return Failed(ErrorCode.DataBaseError, "今日分享送积分次数已满!"); //} return(Success()); }