From 8f53748ccf09b0e00aee57e4239a0003abe3c8c3 Mon Sep 17 00:00:00 2001 From: aichy126 <16996097+aichy126@users.noreply.github.com> Date: Mon, 5 Dec 2022 13:18:34 +0800 Subject: [PATCH] fix answer update time --- internal/service/question_common/question.go | 6 ++++++ internal/service/revision_service.go | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/internal/service/question_common/question.go b/internal/service/question_common/question.go index 045b979d..3be2c3f9 100644 --- a/internal/service/question_common/question.go +++ b/internal/service/question_common/question.go @@ -115,6 +115,12 @@ func (qs *QuestionCommon) UpdataPostTime(ctx context.Context, questionID string) questioninfo.PostUpdateTime = now return qs.questionRepo.UpdateQuestion(ctx, questioninfo, []string{"post_update_time"}) } +func (qs *QuestionCommon) UpdataPostSetTime(ctx context.Context, questionID string, setTime time.Time) error { + questioninfo := &entity.Question{} + questioninfo.ID = questionID + questioninfo.PostUpdateTime = setTime + return qs.questionRepo.UpdateQuestion(ctx, questioninfo, []string{"post_update_time"}) +} func (qs *QuestionCommon) FindInfoByID(ctx context.Context, questionIDs []string, loginUserID string) (map[string]*schema.QuestionInfo, error) { list := make(map[string]*schema.QuestionInfo) diff --git a/internal/service/revision_service.go b/internal/service/revision_service.go index fe0e9eb6..e53301b2 100644 --- a/internal/service/revision_service.go +++ b/internal/service/revision_service.go @@ -179,7 +179,7 @@ func (rs *RevisionService) revisionAuditAnswer(ctx context.Context, revisionitem if saveerr != nil { return saveerr } - saveerr = rs.questionCommon.UpdataPostTime(ctx, answerinfo.QuestionID) + saveerr = rs.questionCommon.UpdataPostSetTime(ctx, answerinfo.QuestionID, time.Unix(answerinfo.UpdateTime, 0)) if saveerr != nil { return saveerr }