mirror of https://gitee.com/answerdev/answer.git
update tag show
This commit is contained in:
parent
8c1c1a664c
commit
436829c2d1
|
@ -65,13 +65,16 @@ func (tr *tagCommonRepo) GetTagListByName(ctx context.Context, name string, limi
|
|||
cond.Recommend = true
|
||||
}
|
||||
session.Where(builder.Eq{"status": entity.TagStatusAvailable})
|
||||
// if limit == 0 {
|
||||
// session.Asc("slug_name")
|
||||
// }
|
||||
session.Limit(limit).Asc("slug_name")
|
||||
if !hasReserved {
|
||||
cond.Reserved = false
|
||||
session.UseBool("recommend", "reserved")
|
||||
} else {
|
||||
session.UseBool("recommend")
|
||||
}
|
||||
// if !hasReserved {
|
||||
// cond.Reserved = false
|
||||
// session.UseBool("recommend", "reserved")
|
||||
// } else {
|
||||
session.UseBool("recommend")
|
||||
// }
|
||||
err = session.OrderBy("recommend desc,reserved desc,id desc").Find(&tagList, cond)
|
||||
if err != nil {
|
||||
err = errors.InternalServer(reason.DatabaseError).WithError(err).WithStack()
|
||||
|
|
|
@ -64,7 +64,7 @@ func NewTagCommonService(tagCommonRepo TagCommonRepo, tagRelRepo TagRelRepo,
|
|||
|
||||
// SearchTagLike get tag list all
|
||||
func (ts *TagCommonService) SearchTagLike(ctx context.Context, req *schema.SearchTagLikeReq) (resp []schema.SearchTagLikeResp, err error) {
|
||||
tags, err := ts.tagCommonRepo.GetTagListByName(ctx, req.Tag, 5, req.IsAdmin)
|
||||
tags, err := ts.tagCommonRepo.GetTagListByName(ctx, req.Tag, 0, req.IsAdmin)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue