You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@answer.apache.org by li...@apache.org on 2023/11/29 08:21:14 UTC
(incubator-answer) 05/17: fix #618
This is an automated email from the ASF dual-hosted git repository.
linkinstar pushed a commit to branch feat/1.2.1/dashboard
in repository https://gitbox.apache.org/repos/asf/incubator-answer.git
commit 5c896b0d5c41ba532587af68fc231896ca8442e5
Author: Charles Shu <sh...@vip.qq.com>
AuthorDate: Tue Nov 14 16:56:27 2023 +0800
fix #618
Query for the main tag ID, make up for error handling.
---
internal/repo/tag_common/tag_common_repo.go | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/internal/repo/tag_common/tag_common_repo.go b/internal/repo/tag_common/tag_common_repo.go
index 67cebc8e..090e3393 100644
--- a/internal/repo/tag_common/tag_common_repo.go
+++ b/internal/repo/tag_common/tag_common_repo.go
@@ -22,6 +22,7 @@ package tag_common
import (
"context"
"fmt"
+ "github.com/segmentfault/pacman/log"
"strings"
"github.com/apache/incubator-answer/internal/base/data"
@@ -169,7 +170,10 @@ func (tr *tagCommonRepo) GetTagPage(ctx context.Context, page, pageSize int, tag
tagList = make([]*entity.Tag, 0)
var mainTagIds []string
- tr.data.DB.Context(ctx).Table(tag).Select("main_tag_id").Where("main_tag_id>0").Where(builder.Or(builder.Like{"slug_name", fmt.Sprintf("LOWER(%s)", tag.SlugName)}, builder.Like{"display_name", tag.SlugName})).Get(&mainTagIds)
+ _, err = tr.data.DB.Context(ctx).Table(tag).Select("main_tag_id").Where("main_tag_id>0").Where(builder.Or(builder.Like{"slug_name", fmt.Sprintf("LOWER(%s)", tag.SlugName)}, builder.Like{"display_name", tag.SlugName})).Get(&mainTagIds)
+ if err != nil {
+ log.Error(err)
+ }
session := tr.data.DB.Context(ctx)
if len(tag.SlugName) > 0 {