Beispiel #1
0
        /// <summary>
        /// 积分点击
        /// </summary>
        public ResultJson ClickScore(ClickScoreRequest request)
        {
            ResultJson result = new ResultJson();
            var        Ids    = request.ScoreIds.Split(',').GroupBy(p => p).Select(p => p.Key).ToList();

            lock (obj)
            {
                if (CacheForModelScore.Instance.UpdateScoreByIds(request.UserId, request.ScoreIds))
                {
                    var scoreList = CacheForModelScore.Instance.ScoreList(request.UserId);
                    var a         = scoreList.Where(p => Ids.Contains(p.ScoreId.ToString())).ToList();
                    var Score_Add = scoreList.Where(p => Ids.Contains(p.ScoreId.ToString())).ToList().Sum(p => p.ScoreNum);
                    var UserInfo  = CacheForModelUser.Instance.GetUserInfo(request.UserId);
                    UserInfo.UserScore = UserInfo.UserScore == null ? Score_Add : Score_Add + UserInfo.UserScore;
                    if (CustomerOper.Instance.Update(UserInfo))
                    {
                        result.HttpCode = 200;
                        result.Message  = "用户积分增加";
                    }
                    else
                    {
                        result.HttpCode = 300;
                        result.Message  = Enum_Message.DataNotSuccessMessage.Enum_GetString();
                    }
                }
                else
                {
                    result.HttpCode = 300;
                    result.Message  = Enum_Message.DataNotSuccessMessage.Enum_GetString();
                }
            }
            return(result);
        }
 public ResultJson ClickScore(ClickScoreRequest request)
 {
     return(ScoreBiz.Instance.ClickScore(request));
 }