update question

This commit is contained in:
aichy126 2023-03-13 11:12:31 +08:00
parent ca6d8fb5a8
commit 1a814da53b
2 changed files with 6 additions and 2 deletions

View File

@ -215,14 +215,16 @@ type UserAnswerInfo struct {
CreateTime int `json:"create_time"`
UpdateTime int `json:"update_time"`
QuestionInfo struct {
Title string `json:"title"`
Tags []interface{} `json:"tags"`
Title string `json:"title"`
UrlTitle string `json:"url_title"`
Tags []interface{} `json:"tags"`
} `json:"question_info"`
}
type UserQuestionInfo struct {
ID string `json:"question_id"`
Title string `json:"title"`
UrlTitle string `json:"url_title"`
VoteCount int `json:"vote_count"`
Tags []interface{} `json:"tags"`
ViewCount int `json:"view_count"`

View File

@ -834,6 +834,7 @@ func (qs *QuestionService) SearchUserTopList(ctx context.Context, userName strin
for _, item := range questionlist {
info := &schema.UserQuestionInfo{}
_ = copier.Copy(info, item)
info.UrlTitle = htmltext.UrlTitle(info.Title)
userQuestionlist = append(userQuestionlist, info)
}
@ -842,6 +843,7 @@ func (qs *QuestionService) SearchUserTopList(ctx context.Context, userName strin
_ = copier.Copy(info, item)
info.AnswerID = item.ID
info.QuestionID = item.QuestionID
info.QuestionInfo.UrlTitle = htmltext.UrlTitle(info.QuestionInfo.Title)
userAnswerlist = append(userAnswerlist, info)
}