田爽 il y a 1 an
Parent
commit
8ecf2a281b
1 fichiers modifiés avec 10 ajouts et 10 suppressions
  1. 10 10
      src/Hotline.Api/Controllers/KnowledgeController.cs

+ 10 - 10
src/Hotline.Api/Controllers/KnowledgeController.cs

@@ -814,9 +814,9 @@ namespace Hotline.Api.Controllers
 			if (correction is null)
 				throw UserFriendlyException.SameMessage("无效知识纠错");
 			_mapper.Map(dto, correction);
-			dto.ReplyTime = DateTime.Now;
-			dto.ReplyUserName = _sessionContext.UserName;
-			dto.State = ECorrectionState.AlreadyAnswered;
+			correction.ReplyTime = DateTime.Now;
+			correction.ReplyUserName = _sessionContext.UserName;
+			correction.State = ECorrectionState.AlreadyAnswered;
 			await _knowledgeCorrectionRepository.UpdateAsync(correction, HttpContext.RequestAborted);
 		}
 
@@ -905,14 +905,14 @@ namespace Hotline.Api.Controllers
 		[HttpPut("knowledge_questions/Reply")]
 		public async Task Reply([FromBody] KnowledgeQuestionsUpdateDto dto)
 		{
-			var correction = await _knowledgeQuestionsRepository.GetAsync(dto.Id, HttpContext.RequestAborted);
-			if (correction is null)
+			var questions = await _knowledgeQuestionsRepository.GetAsync(dto.Id, HttpContext.RequestAborted);
+			if (questions is null)
 				throw UserFriendlyException.SameMessage("无效知识提问");
-			_mapper.Map(dto, correction);
-			dto.ReplyTime = DateTime.Now;
-			dto.ReplyUserName = _sessionContext.UserName;
-			dto.State = ECorrectionState.AlreadyAnswered;
-			await _knowledgeQuestionsRepository.UpdateAsync(correction, HttpContext.RequestAborted);
+			_mapper.Map(dto, questions);
+			questions.ReplyTime = DateTime.Now;
+			questions.ReplyUserName = _sessionContext.UserName;
+			questions.State = ECorrectionState.AlreadyAnswered;
+			await _knowledgeQuestionsRepository.UpdateAsync(questions, HttpContext.RequestAborted);
 		}
 
 		/// <summary>