/// <summary> /// 获取特定app在电商中的当前生效的积分扩展信息。 /// </summary> /// <param name="paramDto">查询参数</param> /// <returns></returns> public ResultDTO <UserScoreDTO> GetUserScoreInAppExt(Param2DTO paramDto) { Jinher.AMP.BTP.Deploy.CustomDTO.ResultDTO <Jinher.AMP.BTP.Deploy.CustomDTO.UserScoreDTO> result = new ResultDTO <Jinher.AMP.BTP.Deploy.CustomDTO.UserScoreDTO>(); UserScoreDTO usDto = new UserScoreDTO(); result.Data = usDto; try { if (paramDto == null) { result.Message = "参数错误,参数不能为空!"; result.ResultCode = 1; return(result); } if (paramDto.UserId == Guid.Empty) { result.Message = "参数错误,appId不能为空!"; result.ResultCode = 1; return(result); } if (paramDto.AppId == Guid.Empty) { result.Message = "参数错误,appId不能为空!"; result.ResultCode = 1; return(result); } var appIsCashForScore = (from ae in AppExtension.ObjectSet() where ae.Id == paramDto.AppId select ae.IsCashForScore).FirstOrDefault(); if (appIsCashForScore == null || appIsCashForScore == false) { usDto.IsCashForScore = false; return(result); } usDto.IsCashForScore = appIsCashForScore; var ssFirst = (from ss in ScoreSetting.ObjectSet() where ss.AppId == paramDto.AppId orderby ss.SubTime descending select ss.ScoreCost).FirstOrDefault(); if (!ssFirst.HasValue) { return(result); } usDto.ScoreCost = ssFirst.Value; int score = Jinher.AMP.BTP.TPS.SignSV.Instance.GiveUserScore(paramDto.UserId, paramDto.AppId); usDto.Score = score; usDto.Money = DecimalExt.ToMoney((decimal)score / usDto.ScoreCost); } catch (Exception ex) { string str = string.Format("ScoreSettingSV.GetUserScoreInAppExt中发生异常,参数AppId:{0},异常信息:{1}", paramDto.AppId, ex); LogHelper.Error(str); result.Message = "服务异常!"; result.ResultCode = 2; } return(result); }
/// <summary> /// 获取用户在当前应用中的积分。 /// </summary> public void initUserScore() { Param2DTO pdto = new Param2DTO(); pdto.UserId = _condition.userId; pdto.AppId = _condition.esAppId; ScoreSettingSV sv = new ScoreSettingSV(); ResultDTO <UserScoreDTO> usResult = sv.GetUserScoreInAppExt(pdto); if (usResult.ResultCode != 0) { return; } dto.UserScore = usResult.Data; }