mirror of https://gitee.com/answerdev/answer.git
fix question userid
This commit is contained in:
parent
ecf3f023eb
commit
de5b2966bf
|
@ -224,6 +224,7 @@ func (as *AnswerService) Update(ctx context.Context, req *schema.AnswerUpdateReq
|
||||||
now := time.Now()
|
now := time.Now()
|
||||||
insertData := new(entity.Answer)
|
insertData := new(entity.Answer)
|
||||||
insertData.ID = req.ID
|
insertData.ID = req.ID
|
||||||
|
insertData.UserID = answerInfo.UserID
|
||||||
insertData.QuestionID = req.QuestionID
|
insertData.QuestionID = req.QuestionID
|
||||||
insertData.OriginalText = req.Content
|
insertData.OriginalText = req.Content
|
||||||
insertData.ParsedText = req.HTML
|
insertData.ParsedText = req.HTML
|
||||||
|
|
|
@ -282,6 +282,14 @@ func (qs *QuestionService) UpdateQuestion(ctx context.Context, req *schema.Quest
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dbinfo, has, err := qs.questionRepo.GetQuestion(ctx, req.ID)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if !has {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
now := time.Now()
|
now := time.Now()
|
||||||
question := &entity.Question{}
|
question := &entity.Question{}
|
||||||
question.Title = req.Title
|
question.Title = req.Title
|
||||||
|
@ -290,13 +298,8 @@ func (qs *QuestionService) UpdateQuestion(ctx context.Context, req *schema.Quest
|
||||||
question.ID = req.ID
|
question.ID = req.ID
|
||||||
question.UpdatedAt = now
|
question.UpdatedAt = now
|
||||||
question.PostUpdateTime = now
|
question.PostUpdateTime = now
|
||||||
dbinfo, has, err := qs.questionRepo.GetQuestion(ctx, question.ID)
|
question.UserID = dbinfo.UserID
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if !has {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
question.LastEditUserID = "0"
|
question.LastEditUserID = "0"
|
||||||
if dbinfo.UserID != req.UserID {
|
if dbinfo.UserID != req.UserID {
|
||||||
question.LastEditUserID = req.UserID
|
question.LastEditUserID = req.UserID
|
||||||
|
|
Loading…
Reference in New Issue