mirror of https://gitee.com/answerdev/answer.git
Merge branch 'feat/1.0.7/short-id' into test
This commit is contained in:
commit
76605ebccd
16
docs/docs.go
16
docs/docs.go
|
@ -5835,6 +5835,10 @@ const docTemplate = `{
|
||||||
"title": {
|
"title": {
|
||||||
"description": "title",
|
"description": "title",
|
||||||
"type": "string"
|
"type": "string"
|
||||||
|
},
|
||||||
|
"url_title": {
|
||||||
|
"description": "url title",
|
||||||
|
"type": "string"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -6082,6 +6086,10 @@ const docTemplate = `{
|
||||||
"title": {
|
"title": {
|
||||||
"description": "title",
|
"description": "title",
|
||||||
"type": "string"
|
"type": "string"
|
||||||
|
},
|
||||||
|
"url_title": {
|
||||||
|
"description": "url title",
|
||||||
|
"type": "string"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -6661,6 +6669,10 @@ const docTemplate = `{
|
||||||
"description": "title",
|
"description": "title",
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
|
"url_title": {
|
||||||
|
"description": "url title",
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
"vote_type": {
|
"vote_type": {
|
||||||
"description": "vote type",
|
"description": "vote type",
|
||||||
"type": "string"
|
"type": "string"
|
||||||
|
@ -7324,7 +7336,7 @@ const docTemplate = `{
|
||||||
"properties": {
|
"properties": {
|
||||||
"permalink": {
|
"permalink": {
|
||||||
"type": "integer",
|
"type": "integer",
|
||||||
"maximum": 3,
|
"maximum": 4,
|
||||||
"minimum": 0
|
"minimum": 0
|
||||||
},
|
},
|
||||||
"robots": {
|
"robots": {
|
||||||
|
@ -7341,7 +7353,7 @@ const docTemplate = `{
|
||||||
"properties": {
|
"properties": {
|
||||||
"permalink": {
|
"permalink": {
|
||||||
"type": "integer",
|
"type": "integer",
|
||||||
"maximum": 3,
|
"maximum": 4,
|
||||||
"minimum": 0
|
"minimum": 0
|
||||||
},
|
},
|
||||||
"robots": {
|
"robots": {
|
||||||
|
|
|
@ -5823,6 +5823,10 @@
|
||||||
"title": {
|
"title": {
|
||||||
"description": "title",
|
"description": "title",
|
||||||
"type": "string"
|
"type": "string"
|
||||||
|
},
|
||||||
|
"url_title": {
|
||||||
|
"description": "url title",
|
||||||
|
"type": "string"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -6070,6 +6074,10 @@
|
||||||
"title": {
|
"title": {
|
||||||
"description": "title",
|
"description": "title",
|
||||||
"type": "string"
|
"type": "string"
|
||||||
|
},
|
||||||
|
"url_title": {
|
||||||
|
"description": "url title",
|
||||||
|
"type": "string"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -6649,6 +6657,10 @@
|
||||||
"description": "title",
|
"description": "title",
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
|
"url_title": {
|
||||||
|
"description": "url title",
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
"vote_type": {
|
"vote_type": {
|
||||||
"description": "vote type",
|
"description": "vote type",
|
||||||
"type": "string"
|
"type": "string"
|
||||||
|
@ -7312,7 +7324,7 @@
|
||||||
"properties": {
|
"properties": {
|
||||||
"permalink": {
|
"permalink": {
|
||||||
"type": "integer",
|
"type": "integer",
|
||||||
"maximum": 3,
|
"maximum": 4,
|
||||||
"minimum": 0
|
"minimum": 0
|
||||||
},
|
},
|
||||||
"robots": {
|
"robots": {
|
||||||
|
@ -7329,7 +7341,7 @@
|
||||||
"properties": {
|
"properties": {
|
||||||
"permalink": {
|
"permalink": {
|
||||||
"type": "integer",
|
"type": "integer",
|
||||||
"maximum": 3,
|
"maximum": 4,
|
||||||
"minimum": 0
|
"minimum": 0
|
||||||
},
|
},
|
||||||
"robots": {
|
"robots": {
|
||||||
|
|
|
@ -356,6 +356,9 @@ definitions:
|
||||||
title:
|
title:
|
||||||
description: title
|
description: title
|
||||||
type: string
|
type: string
|
||||||
|
url_title:
|
||||||
|
description: url title
|
||||||
|
type: string
|
||||||
type: object
|
type: object
|
||||||
schema.GetCommentResp:
|
schema.GetCommentResp:
|
||||||
properties:
|
properties:
|
||||||
|
@ -538,6 +541,9 @@ definitions:
|
||||||
title:
|
title:
|
||||||
description: title
|
description: title
|
||||||
type: string
|
type: string
|
||||||
|
url_title:
|
||||||
|
description: url title
|
||||||
|
type: string
|
||||||
type: object
|
type: object
|
||||||
schema.GetReportTypeResp:
|
schema.GetReportTypeResp:
|
||||||
properties:
|
properties:
|
||||||
|
@ -956,6 +962,9 @@ definitions:
|
||||||
title:
|
title:
|
||||||
description: title
|
description: title
|
||||||
type: string
|
type: string
|
||||||
|
url_title:
|
||||||
|
description: url title
|
||||||
|
type: string
|
||||||
vote_type:
|
vote_type:
|
||||||
description: vote type
|
description: vote type
|
||||||
type: string
|
type: string
|
||||||
|
@ -1412,7 +1421,7 @@ definitions:
|
||||||
schema.SiteSeoReq:
|
schema.SiteSeoReq:
|
||||||
properties:
|
properties:
|
||||||
permalink:
|
permalink:
|
||||||
maximum: 3
|
maximum: 4
|
||||||
minimum: 0
|
minimum: 0
|
||||||
type: integer
|
type: integer
|
||||||
robots:
|
robots:
|
||||||
|
@ -1424,7 +1433,7 @@ definitions:
|
||||||
schema.SiteSeoResp:
|
schema.SiteSeoResp:
|
||||||
properties:
|
properties:
|
||||||
permalink:
|
permalink:
|
||||||
maximum: 3
|
maximum: 4
|
||||||
minimum: 0
|
minimum: 0
|
||||||
type: integer
|
type: integer
|
||||||
robots:
|
robots:
|
||||||
|
|
|
@ -198,6 +198,8 @@ type GetCommentPersonalWithPageResp struct {
|
||||||
ObjectType string `json:"object_type" enums:"question,answer,tag,comment"`
|
ObjectType string `json:"object_type" enums:"question,answer,tag,comment"`
|
||||||
// title
|
// title
|
||||||
Title string `json:"title"`
|
Title string `json:"title"`
|
||||||
|
// url title
|
||||||
|
UrlTitle string `json:"url_title"`
|
||||||
// content
|
// content
|
||||||
Content string `json:"content"`
|
Content string `json:"content"`
|
||||||
}
|
}
|
||||||
|
|
|
@ -215,14 +215,16 @@ type UserAnswerInfo struct {
|
||||||
CreateTime int `json:"create_time"`
|
CreateTime int `json:"create_time"`
|
||||||
UpdateTime int `json:"update_time"`
|
UpdateTime int `json:"update_time"`
|
||||||
QuestionInfo struct {
|
QuestionInfo struct {
|
||||||
Title string `json:"title"`
|
Title string `json:"title"`
|
||||||
Tags []interface{} `json:"tags"`
|
UrlTitle string `json:"url_title"`
|
||||||
|
Tags []interface{} `json:"tags"`
|
||||||
} `json:"question_info"`
|
} `json:"question_info"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type UserQuestionInfo struct {
|
type UserQuestionInfo struct {
|
||||||
ID string `json:"question_id"`
|
ID string `json:"question_id"`
|
||||||
Title string `json:"title"`
|
Title string `json:"title"`
|
||||||
|
UrlTitle string `json:"url_title"`
|
||||||
VoteCount int `json:"vote_count"`
|
VoteCount int `json:"vote_count"`
|
||||||
Tags []interface{} `json:"tags"`
|
Tags []interface{} `json:"tags"`
|
||||||
ViewCount int `json:"view_count"`
|
ViewCount int `json:"view_count"`
|
||||||
|
|
|
@ -26,6 +26,8 @@ type GetRankPersonalWithPageResp struct {
|
||||||
ObjectType string `json:"object_type" enums:"question,answer,tag,comment"`
|
ObjectType string `json:"object_type" enums:"question,answer,tag,comment"`
|
||||||
// title
|
// title
|
||||||
Title string `json:"title"`
|
Title string `json:"title"`
|
||||||
|
// url title
|
||||||
|
UrlTitle string `json:"url_title"`
|
||||||
// content
|
// content
|
||||||
Content string `json:"content"`
|
Content string `json:"content"`
|
||||||
// reputation
|
// reputation
|
||||||
|
|
|
@ -28,7 +28,7 @@ type SiteGeneralReq struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
type SiteSeoReq struct {
|
type SiteSeoReq struct {
|
||||||
PermaLink int `validate:"required,lte=3,gte=0" form:"permalink" json:"permalink"`
|
PermaLink int `validate:"required,lte=4,gte=0" form:"permalink" json:"permalink"`
|
||||||
Robots string `validate:"required" form:"robots" json:"robots"`
|
Robots string `validate:"required" form:"robots" json:"robots"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -60,6 +60,8 @@ type GetVoteWithPageResp struct {
|
||||||
ObjectType string `json:"object_type" enums:"question,answer,tag,comment"`
|
ObjectType string `json:"object_type" enums:"question,answer,tag,comment"`
|
||||||
// title
|
// title
|
||||||
Title string `json:"title"`
|
Title string `json:"title"`
|
||||||
|
// url title
|
||||||
|
UrlTitle string `json:"url_title"`
|
||||||
// content
|
// content
|
||||||
Content string `json:"content"`
|
Content string `json:"content"`
|
||||||
// vote type
|
// vote type
|
||||||
|
|
|
@ -18,7 +18,9 @@ import (
|
||||||
"github.com/answerdev/answer/internal/service/permission"
|
"github.com/answerdev/answer/internal/service/permission"
|
||||||
usercommon "github.com/answerdev/answer/internal/service/user_common"
|
usercommon "github.com/answerdev/answer/internal/service/user_common"
|
||||||
"github.com/answerdev/answer/pkg/encryption"
|
"github.com/answerdev/answer/pkg/encryption"
|
||||||
|
"github.com/answerdev/answer/pkg/htmltext"
|
||||||
"github.com/answerdev/answer/pkg/uid"
|
"github.com/answerdev/answer/pkg/uid"
|
||||||
|
"github.com/davecgh/go-spew/spew"
|
||||||
"github.com/jinzhu/copier"
|
"github.com/jinzhu/copier"
|
||||||
"github.com/segmentfault/pacman/errors"
|
"github.com/segmentfault/pacman/errors"
|
||||||
"github.com/segmentfault/pacman/log"
|
"github.com/segmentfault/pacman/log"
|
||||||
|
@ -446,8 +448,10 @@ func (cs *CommentService) GetCommentPersonalWithPage(ctx context.Context, req *s
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error(err)
|
log.Error(err)
|
||||||
} else {
|
} else {
|
||||||
|
spew.Dump("==", objInfo)
|
||||||
commentResp.ObjectType = objInfo.ObjectType
|
commentResp.ObjectType = objInfo.ObjectType
|
||||||
commentResp.Title = objInfo.Title
|
commentResp.Title = objInfo.Title
|
||||||
|
commentResp.UrlTitle = htmltext.UrlTitle(objInfo.Title)
|
||||||
commentResp.QuestionID = objInfo.QuestionID
|
commentResp.QuestionID = objInfo.QuestionID
|
||||||
commentResp.AnswerID = objInfo.AnswerID
|
commentResp.AnswerID = objInfo.AnswerID
|
||||||
}
|
}
|
||||||
|
|
|
@ -770,13 +770,13 @@ func (qs *QuestionService) SearchUserCollectionList(ctx context.Context, page, p
|
||||||
return list, count, err
|
return list, count, err
|
||||||
}
|
}
|
||||||
for _, id := range questionIDs {
|
for _, id := range questionIDs {
|
||||||
_, ok := questionMaps[id]
|
_, ok := questionMaps[uid.EnShortID(id)]
|
||||||
if ok {
|
if ok {
|
||||||
questionMaps[id].LastAnsweredUserInfo = nil
|
questionMaps[uid.EnShortID(id)].LastAnsweredUserInfo = nil
|
||||||
questionMaps[id].UpdateUserInfo = nil
|
questionMaps[uid.EnShortID(id)].UpdateUserInfo = nil
|
||||||
questionMaps[id].Content = ""
|
questionMaps[uid.EnShortID(id)].Content = ""
|
||||||
questionMaps[id].HTML = ""
|
questionMaps[uid.EnShortID(id)].HTML = ""
|
||||||
list = append(list, questionMaps[id])
|
list = append(list, questionMaps[uid.EnShortID(id)])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -834,6 +834,7 @@ func (qs *QuestionService) SearchUserTopList(ctx context.Context, userName strin
|
||||||
for _, item := range questionlist {
|
for _, item := range questionlist {
|
||||||
info := &schema.UserQuestionInfo{}
|
info := &schema.UserQuestionInfo{}
|
||||||
_ = copier.Copy(info, item)
|
_ = copier.Copy(info, item)
|
||||||
|
info.UrlTitle = htmltext.UrlTitle(info.Title)
|
||||||
userQuestionlist = append(userQuestionlist, info)
|
userQuestionlist = append(userQuestionlist, info)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -842,6 +843,7 @@ func (qs *QuestionService) SearchUserTopList(ctx context.Context, userName strin
|
||||||
_ = copier.Copy(info, item)
|
_ = copier.Copy(info, item)
|
||||||
info.AnswerID = item.ID
|
info.AnswerID = item.ID
|
||||||
info.QuestionID = item.QuestionID
|
info.QuestionID = item.QuestionID
|
||||||
|
info.QuestionInfo.UrlTitle = htmltext.UrlTitle(info.QuestionInfo.Title)
|
||||||
userAnswerlist = append(userAnswerlist, info)
|
userAnswerlist = append(userAnswerlist, info)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,7 @@ import (
|
||||||
"github.com/answerdev/answer/internal/service/permission"
|
"github.com/answerdev/answer/internal/service/permission"
|
||||||
"github.com/answerdev/answer/internal/service/role"
|
"github.com/answerdev/answer/internal/service/role"
|
||||||
usercommon "github.com/answerdev/answer/internal/service/user_common"
|
usercommon "github.com/answerdev/answer/internal/service/user_common"
|
||||||
|
"github.com/answerdev/answer/pkg/htmltext"
|
||||||
"github.com/segmentfault/pacman/errors"
|
"github.com/segmentfault/pacman/errors"
|
||||||
"github.com/segmentfault/pacman/log"
|
"github.com/segmentfault/pacman/log"
|
||||||
"xorm.io/xorm"
|
"xorm.io/xorm"
|
||||||
|
@ -260,6 +261,7 @@ func (rs *RankService) GetRankPersonalWithPage(ctx context.Context, req *schema.
|
||||||
commentResp.RankType = activity_type.Format(userRankInfo.ActivityType)
|
commentResp.RankType = activity_type.Format(userRankInfo.ActivityType)
|
||||||
commentResp.ObjectType = objInfo.ObjectType
|
commentResp.ObjectType = objInfo.ObjectType
|
||||||
commentResp.Title = objInfo.Title
|
commentResp.Title = objInfo.Title
|
||||||
|
commentResp.UrlTitle = htmltext.UrlTitle(objInfo.Title)
|
||||||
commentResp.Content = objInfo.Content
|
commentResp.Content = objInfo.Content
|
||||||
commentResp.QuestionID = objInfo.QuestionID
|
commentResp.QuestionID = objInfo.QuestionID
|
||||||
commentResp.AnswerID = objInfo.AnswerID
|
commentResp.AnswerID = objInfo.AnswerID
|
||||||
|
|
|
@ -9,6 +9,7 @@ import (
|
||||||
"github.com/answerdev/answer/internal/service/comment_common"
|
"github.com/answerdev/answer/internal/service/comment_common"
|
||||||
"github.com/answerdev/answer/internal/service/config"
|
"github.com/answerdev/answer/internal/service/config"
|
||||||
"github.com/answerdev/answer/internal/service/object_info"
|
"github.com/answerdev/answer/internal/service/object_info"
|
||||||
|
"github.com/answerdev/answer/pkg/htmltext"
|
||||||
"github.com/answerdev/answer/pkg/obj"
|
"github.com/answerdev/answer/pkg/obj"
|
||||||
"github.com/segmentfault/pacman/log"
|
"github.com/segmentfault/pacman/log"
|
||||||
|
|
||||||
|
@ -190,6 +191,7 @@ func (vs *VoteService) ListUserVotes(ctx context.Context, req schema.GetVoteWith
|
||||||
AnswerID: objInfo.AnswerID,
|
AnswerID: objInfo.AnswerID,
|
||||||
ObjectType: objInfo.ObjectType,
|
ObjectType: objInfo.ObjectType,
|
||||||
Title: objInfo.Title,
|
Title: objInfo.Title,
|
||||||
|
UrlTitle: htmltext.UrlTitle(objInfo.Title),
|
||||||
Content: objInfo.Content,
|
Content: objInfo.Content,
|
||||||
VoteType: activity_type.Format(voteInfo.ActivityType),
|
VoteType: activity_type.Format(voteInfo.ActivityType),
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue