Skip to content

A Q&A platform software for teams at any scales. Whether it's a community forum, help center, or knowledge management platform, you can always count on Apache Answer.

update tag show

aichy126436829c2d1d1
diff --git a/internal/repo/tag_common/tag_common_repo.go b/internal/repo/tag_common/tag_common_repo.go
index 50f8517f..3d372618 100644
--- a/internal/repo/tag_common/tag_common_repo.go
+++ b/internal/repo/tag_common/tag_common_repo.go
@@ -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()
diff --git a/internal/service/tag_common/tag_common.go b/internal/service/tag_common/tag_common.go
index 42a156a7..35721c1a 100644
--- a/internal/service/tag_common/tag_common.go
+++ b/internal/service/tag_common/tag_common.go
@@ -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
}