public ResultNormal submitReply(SubmitReply submitReply) { ResultNormal result = new ResultNormal(); try { if (string.IsNullOrEmpty(submitReply.userId)) { submitReply.userId = this.getUserId(); } else { if (submitReply.userId != this.getUserId()) { throw new CCException("身份不明确,请登录后再尝试"); } } submitReply.userId = this.getUserId(); result.ResultId = _commentServices.submitCommentReply(submitReply); //创建通知消息 this.async_CreateReplyMessage(submitReply, result.ResultId); } catch (Exception ex) { result.ErrorMsg = ex.Message; } return(result); }
private void async_CreateReplyMessage(SubmitReply submitReply, long replyId) { Task.Run(() => { try { _messageServices.CreateNotification_Reply(new MsgSubmitReply { SubmitReply = submitReply, ReplyId = replyId, }); } catch (Exception msgEx) { NLogUtil.cc_ErrorTxt("【回复通知】错误:" + msgEx.Message); } }); }
public long submitCommentReply(SubmitReply submitReply) { if (string.IsNullOrEmpty(submitReply.userId)) { throw new Exception("非法操作!"); } if (string.IsNullOrEmpty(submitReply.bookCode)) { throw new Exception("书Code没有,无法操作!"); } long result = -1; ECommentReply_Res reply = new ECommentReply_Res { authorId = submitReply.userId, content = submitReply.content, commentId = submitReply.commentId, bookCode = submitReply.bookCode, replyType = ReplyType.Normal, }; if (submitReply.replyId > 0) { reply.replyId = submitReply.replyId; reply.replyAuthorId = submitReply.replyAuthorId; reply.replyName = submitReply.replyAuthorName; } var transResult = _commentResRepository.Db.Ado.UseTran(() => { _commentResRepository.UpdateComment_ReplyNum(submitReply.commentId, OperationDirection.plus); result = _commentReplyResRepository.Add_Sync(reply); }); if (!transResult.IsSuccess) { throw new Exception(transResult.ErrorMessage); } return(result); }