mirror of https://gitee.com/answerdev/answer.git
update tags
This commit is contained in:
parent
cf2fc12e38
commit
5d6bd5976c
|
@ -6178,6 +6178,10 @@ const docTemplate = `{
|
|||
"description": "created time",
|
||||
"type": "integer"
|
||||
},
|
||||
"description": {
|
||||
"description": "description",
|
||||
"type": "string"
|
||||
},
|
||||
"display_name": {
|
||||
"description": "display_name",
|
||||
"type": "string"
|
||||
|
|
|
@ -6166,6 +6166,10 @@
|
|||
"description": "created time",
|
||||
"type": "integer"
|
||||
},
|
||||
"description": {
|
||||
"description": "description",
|
||||
"type": "string"
|
||||
},
|
||||
"display_name": {
|
||||
"description": "display_name",
|
||||
"type": "string"
|
||||
|
|
|
@ -624,6 +624,9 @@ definitions:
|
|||
created_at:
|
||||
description: created time
|
||||
type: integer
|
||||
description:
|
||||
description: description
|
||||
type: string
|
||||
display_name:
|
||||
description: display_name
|
||||
type: string
|
||||
|
|
|
@ -108,6 +108,8 @@ type GetTagPageResp struct {
|
|||
DisplayName string `json:"display_name"`
|
||||
// excerpt
|
||||
Excerpt string `json:"excerpt"`
|
||||
//description
|
||||
Description string `json:"description"`
|
||||
// original text
|
||||
OriginalText string `json:"original_text"`
|
||||
// parsed_text
|
||||
|
@ -127,7 +129,7 @@ type GetTagPageResp struct {
|
|||
}
|
||||
|
||||
func (tr *GetTagPageResp) GetExcerpt() {
|
||||
excerpt := strings.TrimSpace(tr.OriginalText)
|
||||
excerpt := strings.TrimSpace(tr.ParsedText)
|
||||
idx := strings.Index(excerpt, "\n")
|
||||
if idx >= 0 {
|
||||
excerpt = excerpt[0:idx]
|
||||
|
|
|
@ -353,10 +353,10 @@ func (ts *TagService) GetTagWithPage(ctx context.Context, req *schema.GetTagWith
|
|||
|
||||
resp := make([]*schema.GetTagPageResp, 0)
|
||||
for _, tag := range tags {
|
||||
//excerpt := htmltext.FetchExcerpt(tag.ParsedText, "...", 240)
|
||||
resp = append(resp, &schema.GetTagPageResp{
|
||||
item := &schema.GetTagPageResp{
|
||||
TagID: tag.ID,
|
||||
SlugName: tag.SlugName,
|
||||
Description: htmltext.FetchExcerpt(tag.ParsedText, "...", 240),
|
||||
DisplayName: tag.DisplayName,
|
||||
OriginalText: tag.OriginalText,
|
||||
ParsedText: tag.ParsedText,
|
||||
|
@ -367,7 +367,10 @@ func (ts *TagService) GetTagWithPage(ctx context.Context, req *schema.GetTagWith
|
|||
UpdatedAt: tag.UpdatedAt.Unix(),
|
||||
Recommend: tag.Recommend,
|
||||
Reserved: tag.Reserved,
|
||||
})
|
||||
}
|
||||
item.GetExcerpt()
|
||||
resp = append(resp, item)
|
||||
|
||||
}
|
||||
return pager.NewPageModel(total, resp), nil
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue