public void AddUserRecommend(UserRecommendInputDto input) { int id = this._userRecommendReposity.AddRecommend(input.MapTo <Entitys.UserRecommend>()); if (id >= 1) { Entitys.PointsLog pointLog = new Entitys.PointsLog(); pointLog.FK_ID = id.ToString(); pointLog.UserId = input.RecommenderId; pointLog.SourceType = 1; pointLog.Score = input.Score; this._pointsLogRepository.InvitAddPoints(pointLog); Entitys.UserDynamicInfo dyInfo = new Entitys.UserDynamicInfo(); dyInfo.TotalScore = input.Score; dyInfo.UserId = input.RecommenderId; this._userDynamicInfoRepository.UpdatePointsScore(dyInfo); } }
/// <summary> /// 订阅(关注)事件 /// </summary> /// <returns></returns> public override IResponseMessageBase OnEvent_SubscribeRequest(RequestMessageEvent_Subscribe requestMessage) { //requestMessage. string eventKey = requestMessage.EventKey; if (!string.IsNullOrEmpty(eventKey)) { string[] userInfo = eventKey.Split(SplitChar, StringSplitOptions.None); UserRecommendInputDto input = new UserRecommendInputDto(); input.Recommended = requestMessage.FromUserName; input.Recommender = userInfo[1]; input.Score = Common.CommonConst.InvitScore; input.RecommenderId = int.Parse(userInfo[0]); this.AppService.AddUserRecommend(input); } var responseMessage = ResponseMessageBase.CreateFromRequestMessage <ResponseMessageText>(requestMessage); responseMessage.Content = "欢迎订阅"; return(responseMessage); }