Skip to content

A Q&A platform software for teams at any scales. Whether it's a community forum, help center, or knowledge management platform, you can always count on Apache Answer.

update question action time

aichy1268b07d5c47d98
diff --git a/internal/repo/question/question_repo.go b/internal/repo/question/question_repo.go
index 963cf667..2756ea52 100644
--- a/internal/repo/question/question_repo.go
+++ b/internal/repo/question/question_repo.go
@@ -107,6 +107,14 @@ func (qr *questionRepo) UpdateQuestionStatus(ctx context.Context, question *enti
return nil
}
+func (qr *questionRepo) UpdateQuestionStatusWithOutUpdateTime(ctx context.Context, question *entity.Question) (err error) {
+ _, err = qr.data.DB.Where("id =?", question.ID).Cols("status").Update(question)
+ if err != nil {
+ return errors.InternalServer(reason.DatabaseError).WithError(err).WithStack()
+ }
+ return nil
+}
+
func (qr *questionRepo) UpdateAccepted(ctx context.Context, question *entity.Question) (err error) {
_, err = qr.data.DB.Where("id =?", question.ID).Cols("accepted_answer_id").Update(question)
if err != nil {
diff --git a/internal/service/question_common/question.go b/internal/service/question_common/question.go
index 43be1b78..23424d2c 100644
--- a/internal/service/question_common/question.go
+++ b/internal/service/question_common/question.go
@@ -34,6 +34,7 @@ type QuestionRepo interface {
GetQuestionPage(ctx context.Context, page, pageSize int, userID, tagID, orderCond string) (
questionList []*entity.Question, total int64, err error)
UpdateQuestionStatus(ctx context.Context, question *entity.Question) (err error)
+ UpdateQuestionStatusWithOutUpdateTime(ctx context.Context, question *entity.Question) (err error)
SearchByTitleLike(ctx context.Context, title string) (questionList []*entity.Question, err error)
UpdatePvCount(ctx context.Context, questionID string) (err error)
UpdateAnswerCount(ctx context.Context, questionID string, num int) (err error)
diff --git a/internal/service/question_service.go b/internal/service/question_service.go
index 63a11596..254fccd9 100644
--- a/internal/service/question_service.go
+++ b/internal/service/question_service.go
@@ -354,7 +354,7 @@ func (qs *QuestionService) RemoveQuestion(ctx context.Context, req *schema.Remov
}
questionInfo.Status = entity.QuestionStatusDeleted
- err = qs.questionRepo.UpdateQuestionStatus(ctx, questionInfo)
+ err = qs.questionRepo.UpdateQuestionStatusWithOutUpdateTime(ctx, questionInfo)
if err != nil {
return err
}