/// <summary> /// [内容] -- 点赞 /// </summary> private EMsgContent_Praize praizeToContent(MsgSubmitPraize msgSubmitPraize) { var submitPraize = msgSubmitPraize.SubmitPraize; var bi = _bookRepository.getBookSimple_ByCode(submitPraize.bookCode); if (bi == null) { throw new Exception("消息服务[praizeToContent]:没有找到书本Code"); } EMsgContent_Praize msgContent = new EMsgContent_Praize { BookCode = bi.Code, BookName = bi.Title, BookUrl = bi.CoverUrl, PraizeTarget = submitPraize.praizeTarget, }; string content = ""; ResSimple res = null; switch (msgContent.PraizeTarget) { case PraizeTarget.Resource: res = _resourceReponsitory.getSimpleByCode(submitPraize.refCode); // content = res.ResType == ResType.BookOss ?$"[文件]-{res.OrigFileName}" :$"[URL]-{res.Url}"; msgContent.RefId = res.Code; break; case PraizeTarget.Comment: EComment_Res comment = _commentRepository.GetByKey(Convert.ToInt64(submitPraize.refCode)).Result; content = comment.content; msgContent.RefId = comment.Id.ToString(); msgContent.CommentId = comment.Id; msgContent.OrigContent = content; res = _resourceReponsitory.getSimpleByCode(submitPraize.parentRefCode); break; case PraizeTarget.CommentReply: ECommentReply_Res reply = _commentReplyRepository.GetByKey(Convert.ToInt64(submitPraize.refCode)).Result; content = reply.content; msgContent.CommentId = reply.commentId; msgContent.ReplyId = reply.Id; msgContent.RefId = reply.Id.ToString(); msgContent.OrigContent = content; res = _resourceReponsitory.getSimpleByCommentId(Convert.ToInt64(submitPraize.parentRefCode)); break; } if (res == null) { throw new Exception("消息服务[praizeToContent]:没有找到资源信息"); } msgContent.ResCode = res.Code; msgContent.ResName = res.ShowName; return(msgContent); }
private EMsgInfo_ReplyRes replyToMsg(MsgSubmitReply msgSubmitReply, ResSimple resSimple) { var submit = msgSubmitReply.SubmitReply; EUserInfo ownerInfo = null; if (submit.replyId < 0) //接受者--回复评论的人 { ownerInfo = _commentRepository.getCommentAutherId(submit.commentId); } else //接受者--回复回复的人 { ownerInfo = _commentReplyRepository.getReplyAutherId(submit.replyId); } if (ownerInfo == null) { throw new Exception("[MessageServices]replyToMsg:没有找到通知者用户Id"); } EMsgInfo_ReplyRes msg = new EMsgInfo_ReplyRes { CreatedDateTime = DateTime.Now, // CommentId = msgSubmitComment.CommentId, // NotificationStatus = NotificationStatus.created, CommentId = submit.commentId, ReplyId = msgSubmitReply.ReplyId, ReplyReplyId = submit.replyId, resCode = resSimple.Code, SendUserId = submit.userId, SendName = submit.userName, SendHeaderUrl = submit.userHeaderUrl, ReceiveUserId = ownerInfo.Id, ReceiveContent = submit.content, }; return(msg); }
/// <summary> /// [内容] -- 回复信息 /// </summary> private EMsgContent_ReplyRes replyToContent(MsgSubmitReply msgSubmitReply, ResSimple resSimple) { var submit = msgSubmitReply.SubmitReply; var bi = _bookRepository.getBookSimple_ByCode(submit.bookCode); if (bi == null) { throw new Exception("消息服务[replyToContent]:没有找到书本Code"); } //评论原始内容 // EComment_Res comment = _commentRepository.GetByKey(submit.commentId).Result; EMsgContent_ReplyRes msgContent = new EMsgContent_ReplyRes { BookCode = bi.Code, BookName = bi.Title, BookUrl = bi.CoverUrl, ResCode = resSimple.Code, ResName = resSimple.ShowName }; //资源信息 //var res = _resourceReponsitory.getSimpleByCommentId(submit.commentId); //msgContent.ResCode = res.Code; //msgContent.ResName = res.ShowName; //if (submit.replyId > 0) //{ // //回复信息 // ECommentReply_Res reply = _commentReplyRepository.GetByKey(submit.replyId).Result; // msgContent.OrigReplyContent = reply.content //} return(msgContent); }