update question action time

This commit is contained in:
aichy126 2023-02-20 15:14:39 +08:00
parent b11dbae971
commit 8b07d5c47d
3 changed files with 10 additions and 1 deletions

View File

@ -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 {

View File

@ -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)

View File

@ -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
}