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