mirror of https://gitee.com/answerdev/answer.git
update question action time
This commit is contained in:
parent
b11dbae971
commit
8b07d5c47d
|
@ -107,6 +107,14 @@ func (qr *questionRepo) UpdateQuestionStatus(ctx context.Context, question *enti
|
||||||
return nil
|
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) {
|
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)
|
_, err = qr.data.DB.Where("id =?", question.ID).Cols("accepted_answer_id").Update(question)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -34,6 +34,7 @@ type QuestionRepo interface {
|
||||||
GetQuestionPage(ctx context.Context, page, pageSize int, userID, tagID, orderCond string) (
|
GetQuestionPage(ctx context.Context, page, pageSize int, userID, tagID, orderCond string) (
|
||||||
questionList []*entity.Question, total int64, err error)
|
questionList []*entity.Question, total int64, err error)
|
||||||
UpdateQuestionStatus(ctx context.Context, question *entity.Question) (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)
|
SearchByTitleLike(ctx context.Context, title string) (questionList []*entity.Question, err error)
|
||||||
UpdatePvCount(ctx context.Context, questionID string) (err error)
|
UpdatePvCount(ctx context.Context, questionID string) (err error)
|
||||||
UpdateAnswerCount(ctx context.Context, questionID string, num int) (err error)
|
UpdateAnswerCount(ctx context.Context, questionID string, num int) (err error)
|
||||||
|
|
|
@ -354,7 +354,7 @@ func (qs *QuestionService) RemoveQuestion(ctx context.Context, req *schema.Remov
|
||||||
}
|
}
|
||||||
|
|
||||||
questionInfo.Status = entity.QuestionStatusDeleted
|
questionInfo.Status = entity.QuestionStatusDeleted
|
||||||
err = qs.questionRepo.UpdateQuestionStatus(ctx, questionInfo)
|
err = qs.questionRepo.UpdateQuestionStatusWithOutUpdateTime(ctx, questionInfo)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue