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

aichy1261a814da53b94
diff --git a/internal/schema/question_schema.go b/internal/schema/question_schema.go
index b0101141..c743577b 100644
--- a/internal/schema/question_schema.go
+++ b/internal/schema/question_schema.go
@@ -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"`
diff --git a/internal/service/question_service.go b/internal/service/question_service.go
index 532c441e..3f293e39 100644
--- a/internal/service/question_service.go
+++ b/internal/service/question_service.go
@@ -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)
}