Merge branch 'feat/1.0.7/short-id' into test

This commit is contained in:
aichy126 2023-03-16 10:40:52 +08:00
commit 88d79ec42a
5 changed files with 20 additions and 4 deletions

View File

@ -6227,6 +6227,10 @@ const docTemplate = `{
"description": "created time",
"type": "integer"
},
"description": {
"description": "description",
"type": "string"
},
"display_name": {
"description": "display_name",
"type": "string"

View File

@ -6215,6 +6215,10 @@
"description": "created time",
"type": "integer"
},
"description": {
"description": "description",
"type": "string"
},
"display_name": {
"description": "display_name",
"type": "string"

View File

@ -637,6 +637,9 @@ definitions:
created_at:
description: created time
type: integer
description:
description: description
type: string
display_name:
description: display_name
type: string

View File

@ -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]

View File

@ -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
}