mirror of https://gitee.com/answerdev/answer.git
feat: cut off answer html description
This commit is contained in:
parent
865bf95b37
commit
5bce99208c
|
@ -5,6 +5,7 @@ import (
|
|||
|
||||
"github.com/answerdev/answer/internal/entity"
|
||||
"github.com/answerdev/answer/internal/schema"
|
||||
"github.com/answerdev/answer/pkg/htmltext"
|
||||
)
|
||||
|
||||
type AnswerRepo interface {
|
||||
|
@ -75,11 +76,11 @@ func (as *AnswerCommon) AdminShowFormat(ctx context.Context, data *entity.Answer
|
|||
info := schema.AdminAnswerInfo{}
|
||||
info.ID = data.ID
|
||||
info.QuestionID = data.QuestionID
|
||||
info.Description = data.ParsedText
|
||||
info.Adopted = data.Adopted
|
||||
info.VoteCount = data.VoteCount
|
||||
info.CreateTime = data.CreatedAt.Unix()
|
||||
info.UpdateTime = data.UpdatedAt.Unix()
|
||||
info.UserID = data.UserID
|
||||
info.Description = htmltext.FetchExcerpt(data.ParsedText, "...", 240)
|
||||
return &info
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue