public JsonResult <object> AddComment(AddCommentRequest request) { if (request == null) { return(JsonError("请求参数不能为空")); } if (string.IsNullOrEmpty(request.CommentContent)) { throw new Exception("评论内容不能为空"); } if (!_articleService.ExistData(request.ArticleID)) { throw new Exception("文章不存在"); } var baseInfo = GetBaseInfo(); if (!_weCharUserInfoService.Exist(baseInfo.UnionID)) { throw new Exception("微信账号不存在"); } var msgObj = WXHelper.MsgCheck(request.CommentContent); if (msgObj.errcode == Senparc.Weixin.ReturnCode.请求成功) { CommentDomain domain = request.ToDomainModel(); domain.UnionID = baseInfo.UnionID; domain.ID = Guid.NewGuid(); domain.CreateTime = DateTime.Now; _commentService.NewCreate(domain); return(JsonNet("发表成功")); } if (msgObj.errcode == (Senparc.Weixin.ReturnCode) 40001) { WXHelper.RemoveAccessToken(); //access_token失效 请重新获取 return(JsonNet("发表错误,请重新发送")); } return(JsonError(msgObj.errcode.ToString())); }