Example #1
0
        public CommentInfoResponse CommentInfoResponseMapping(CommentEntity source, float currentVer)
        {
            if (source == null)
            {
                return null;
            }

            //找两个用户,当前发评论的用户,被回复的用户
            var uids = new List<int>(2) { source.User_Id, source.ReplyUser };

            var users = _customerRepository.GetListByIds(uids.Where(v => v != 0).Distinct().ToList());
            var resourec = ResourceInfoResponsesMapping(GetListResourceEntities(SourceType.CommentAudio, source.Id));

            return CommentInfoResponseMapping(source, users, resourec.ToList(), currentVer);
        }
Example #2
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="source"></param>
        /// <param name="userEntities"></param>
        /// <returns></returns>
        public CommentInfoResponse CommentInfoResponseMapping(CommentEntity source, List<UserEntity> userEntities, List<ResourceInfoResponse> resource, float currentVer)
        {
            var target = Mapper.Map<CommentEntity, CommentInfoResponse>(source);
            //找两个用户,当前发评论的用户,被回复的用户
            var userResponses = ShowCustomerInfoResponseMapping(userEntities).ToList();

            target.ResourceInfoResponses = resource;

            if (currentVer < 2.1)
            {
                //
                if (target.ResourceInfoResponses != null && target.ResourceInfoResponses.Count > 0)
                {
                    target.Content = "系统提示:“下载最新版本,参与语音互动!”";
                }
            }

            var user = userResponses.FirstOrDefault(v => v.Id == target.User_Id);
            var replyUser = userResponses.FirstOrDefault(v => v.Id == target.ReplyUser);

            target.Customer = user;
            target.ReplyUserNickname = (replyUser == null) ? String.Empty : (String.IsNullOrEmpty(replyUser.Nickname) ? replyUser.Name : replyUser.Nickname);

            return target;
        }