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 2024/03/11 07:09:15 UTC

(incubator-answer) branch feat/1.3.0/review updated: feat(question): query revision tags for deleted question

This is an automated email from the ASF dual-hosted git repository.

linkinstar pushed a commit to branch feat/1.3.0/review
in repository https://gitbox.apache.org/repos/asf/incubator-answer.git


The following commit(s) were added to refs/heads/feat/1.3.0/review by this push:
     new ea22497d feat(question): query revision tags for deleted question
ea22497d is described below

commit ea22497d9d96419fa42cddea1df5eaa7396c117e
Author: LinkinStars <li...@foxmail.com>
AuthorDate: Mon Mar 11 15:09:05 2024 +0800

    feat(question): query revision tags for deleted question
---
 cmd/wire_gen.go                                 |   2 +-
 internal/controller/question_controller.go      |   4 +-
 internal/controller/template_render/question.go |   2 +-
 internal/schema/answer_schema.go                |  32 ++---
 internal/schema/question_schema.go              |   2 +-
 internal/service/content/answer_service.go      |   2 +-
 internal/service/content/question_service.go    |   8 +-
 internal/service/content/revision_service.go    |   4 +-
 internal/service/question_common/question.go    | 149 +++++++++++++-----------
 internal/service/tag_common/tag_common.go       |   2 +-
 10 files changed, 108 insertions(+), 99 deletions(-)

diff --git a/cmd/wire_gen.go b/cmd/wire_gen.go
index 47123b97..7cab7d18 100644
--- a/cmd/wire_gen.go
+++ b/cmd/wire_gen.go
@@ -167,7 +167,7 @@ func initApplication(debug bool, serverConf *conf.Server, dbConf *data.Database,
 	answerCommon := answercommon.NewAnswerCommon(answerRepo)
 	metaRepo := meta.NewMetaRepo(dataData)
 	metaService := meta2.NewMetaService(metaRepo)
-	questionCommon := questioncommon.NewQuestionCommon(questionRepo, answerRepo, voteRepo, followRepo, tagCommonService, userCommon, collectionCommon, answerCommon, metaService, configService, activityQueueService, dataData)
+	questionCommon := questioncommon.NewQuestionCommon(questionRepo, answerRepo, voteRepo, followRepo, tagCommonService, userCommon, collectionCommon, answerCommon, metaService, configService, activityQueueService, revisionRepo, dataData)
 	answerActivityRepo := activity.NewAnswerActivityRepo(dataData, activityRepo, userRankRepo, notificationQueueService)
 	answerActivityService := activity2.NewAnswerActivityService(answerActivityRepo, configService)
 	externalNotificationService := notification.NewExternalNotificationService(dataData, userNotificationConfigRepo, followRepo, emailService, userRepo, externalNotificationQueueService, userExternalLoginRepo, siteInfoCommonService)
diff --git a/internal/controller/question_controller.go b/internal/controller/question_controller.go
index 3f5f936c..db35c83f 100644
--- a/internal/controller/question_controller.go
+++ b/internal/controller/question_controller.go
@@ -543,7 +543,7 @@ func (qc *QuestionController) AddQuestionByAnswer(ctx *gin.Context) {
 		return
 	}
 	//add the question id to the answer
-	questionInfo, ok := resp.(*schema.QuestionInfo)
+	questionInfo, ok := resp.(*schema.QuestionInfoResp)
 	if ok {
 		answerReq := &schema.AnswerAddReq{}
 		answerReq.QuestionID = uid.DeShortID(questionInfo.ID)
@@ -657,7 +657,7 @@ func (qc *QuestionController) UpdateQuestion(ctx *gin.Context) {
 		handler.HandleResponse(ctx, err, resp)
 		return
 	}
-	respInfo, ok := resp.(*schema.QuestionInfo)
+	respInfo, ok := resp.(*schema.QuestionInfoResp)
 	if !ok {
 		handler.HandleResponse(ctx, err, resp)
 		return
diff --git a/internal/controller/template_render/question.go b/internal/controller/template_render/question.go
index a2779e23..a65c3083 100644
--- a/internal/controller/template_render/question.go
+++ b/internal/controller/template_render/question.go
@@ -34,7 +34,7 @@ func (t *TemplateRenderController) Index(ctx *gin.Context, req *schema.QuestionP
 	return t.questionService.GetQuestionPage(ctx, req)
 }
 
-func (t *TemplateRenderController) QuestionDetail(ctx *gin.Context, id string) (resp *schema.QuestionInfo, err error) {
+func (t *TemplateRenderController) QuestionDetail(ctx *gin.Context, id string) (resp *schema.QuestionInfoResp, err error) {
 	return t.questionService.GetQuestion(ctx, id, "", schema.QuestionPermission{})
 }
 
diff --git a/internal/schema/answer_schema.go b/internal/schema/answer_schema.go
index 2cd45947..d0c208e6 100644
--- a/internal/schema/answer_schema.go
+++ b/internal/schema/answer_schema.go
@@ -98,22 +98,22 @@ type AnswerListReq struct {
 }
 
 type AnswerInfo struct {
-	ID             string         `json:"id"`
-	QuestionID     string         `json:"question_id"`
-	Content        string         `json:"content"`
-	HTML           string         `json:"html"`
-	CreateTime     int64          `json:"create_time"`
-	UpdateTime     int64          `json:"update_time"`
-	Accepted       int            `json:"accepted"`
-	UserID         string         `json:"-"`
-	UpdateUserID   string         `json:"-"`
-	UserInfo       *UserBasicInfo `json:"user_info,omitempty"`
-	UpdateUserInfo *UserBasicInfo `json:"update_user_info,omitempty"`
-	Collected      bool           `json:"collected"`
-	VoteStatus     string         `json:"vote_status"`
-	VoteCount      int            `json:"vote_count"`
-	QuestionInfo   *QuestionInfo  `json:"question_info,omitempty"`
-	Status         int            `json:"status"`
+	ID             string            `json:"id"`
+	QuestionID     string            `json:"question_id"`
+	Content        string            `json:"content"`
+	HTML           string            `json:"html"`
+	CreateTime     int64             `json:"create_time"`
+	UpdateTime     int64             `json:"update_time"`
+	Accepted       int               `json:"accepted"`
+	UserID         string            `json:"-"`
+	UpdateUserID   string            `json:"-"`
+	UserInfo       *UserBasicInfo    `json:"user_info,omitempty"`
+	UpdateUserInfo *UserBasicInfo    `json:"update_user_info,omitempty"`
+	Collected      bool              `json:"collected"`
+	VoteStatus     string            `json:"vote_status"`
+	VoteCount      int               `json:"vote_count"`
+	QuestionInfo   *QuestionInfoResp `json:"question_info,omitempty"`
+	Status         int               `json:"status"`
 
 	// MemberActions
 	MemberActions []*PermissionMemberAction `json:"member_actions"`
diff --git a/internal/schema/question_schema.go b/internal/schema/question_schema.go
index 5944203b..44ff1303 100644
--- a/internal/schema/question_schema.go
+++ b/internal/schema/question_schema.go
@@ -214,7 +214,7 @@ type QuestionBaseInfo struct {
 	AcceptedAnswer  bool   `json:"accepted_answer"`
 }
 
-type QuestionInfo struct {
+type QuestionInfoResp struct {
 	ID                   string         `json:"id" `
 	Title                string         `json:"title"`
 	UrlTitle             string         `json:"url_title"`
diff --git a/internal/service/content/answer_service.go b/internal/service/content/answer_service.go
index e832c31c..88fa5e3a 100644
--- a/internal/service/content/answer_service.go
+++ b/internal/service/content/answer_service.go
@@ -458,7 +458,7 @@ func (as *AnswerService) updateAnswerRank(ctx context.Context, userID string,
 	}
 }
 
-func (as *AnswerService) Get(ctx context.Context, answerID, loginUserID string) (*schema.AnswerInfo, *schema.QuestionInfo, bool, error) {
+func (as *AnswerService) Get(ctx context.Context, answerID, loginUserID string) (*schema.AnswerInfo, *schema.QuestionInfoResp, bool, error) {
 	answerInfo, has, err := as.answerRepo.GetByID(ctx, answerID)
 	if err != nil {
 		return nil, nil, has, err
diff --git a/internal/service/content/question_service.go b/internal/service/content/question_service.go
index 1d0851b9..9a068640 100644
--- a/internal/service/content/question_service.go
+++ b/internal/service/content/question_service.go
@@ -764,7 +764,7 @@ func (qs *QuestionService) notificationInviteUser(
 // UpdateQuestion update question
 func (qs *QuestionService) UpdateQuestion(ctx context.Context, req *schema.QuestionUpdate) (questionInfo any, err error) {
 	var canUpdate bool
-	questionInfo = &schema.QuestionInfo{}
+	questionInfo = &schema.QuestionInfoResp{}
 
 	_, existUnreviewed, err := qs.revisionService.ExistUnreviewedByObjectID(ctx, req.ID)
 	if err != nil {
@@ -927,7 +927,7 @@ func (qs *QuestionService) UpdateQuestion(ctx context.Context, req *schema.Quest
 
 // GetQuestion get question one
 func (qs *QuestionService) GetQuestion(ctx context.Context, questionID, userID string,
-	per schema.QuestionPermission) (resp *schema.QuestionInfo, err error) {
+	per schema.QuestionPermission) (resp *schema.QuestionInfoResp, err error) {
 	question, err := qs.questioncommon.Info(ctx, questionID, userID)
 	if err != nil {
 		return
@@ -976,7 +976,7 @@ func (qs *QuestionService) GetQuestion(ctx context.Context, questionID, userID s
 // GetQuestionAndAddPV get question one
 func (qs *QuestionService) GetQuestionAndAddPV(ctx context.Context, questionID, loginUserID string,
 	per schema.QuestionPermission) (
-	resp *schema.QuestionInfo, err error) {
+	resp *schema.QuestionInfoResp, err error) {
 	err = qs.questioncommon.UpdatePv(ctx, questionID)
 	if err != nil {
 		log.Error(err)
@@ -1090,7 +1090,7 @@ func (qs *QuestionService) PersonalAnswerPage(ctx context.Context, req *schema.P
 // PersonalCollectionPage get collection list by user
 func (qs *QuestionService) PersonalCollectionPage(ctx context.Context, req *schema.PersonalCollectionPageReq) (
 	pageModel *pager.PageModel, err error) {
-	list := make([]*schema.QuestionInfo, 0)
+	list := make([]*schema.QuestionInfoResp, 0)
 	collectionSearch := &entity.CollectionSearch{}
 	collectionSearch.UserID = req.UserID
 	collectionSearch.Page = req.Page
diff --git a/internal/service/content/revision_service.go b/internal/service/content/revision_service.go
index 6b708833..e004ad07 100644
--- a/internal/service/content/revision_service.go
+++ b/internal/service/content/revision_service.go
@@ -151,7 +151,7 @@ func (rs *RevisionService) RevisionAudit(ctx context.Context, req *schema.Revisi
 }
 
 func (rs *RevisionService) revisionAuditQuestion(ctx context.Context, revisionitem *schema.GetRevisionResp) (err error) {
-	questioninfo, ok := revisionitem.ContentParsed.(*schema.QuestionInfo)
+	questioninfo, ok := revisionitem.ContentParsed.(*schema.QuestionInfoResp)
 	if ok {
 		var PostUpdateTime time.Time
 		dbquestion, exist, dberr := rs.questionRepo.GetQuestion(ctx, questioninfo.ID)
@@ -388,7 +388,7 @@ func (rs *RevisionService) parseItem(ctx context.Context, item *schema.GetRevisi
 	var (
 		err          error
 		question     entity.QuestionWithTagsRevision
-		questionInfo *schema.QuestionInfo
+		questionInfo *schema.QuestionInfoResp
 		answer       entity.Answer
 		answerInfo   *schema.AnswerInfo
 		tag          entity.Tag
diff --git a/internal/service/question_common/question.go b/internal/service/question_common/question.go
index 9fbda693..29b2a0c6 100644
--- a/internal/service/question_common/question.go
+++ b/internal/service/question_common/question.go
@@ -33,6 +33,7 @@ import (
 	"github.com/apache/incubator-answer/internal/service/activity_queue"
 	"github.com/apache/incubator-answer/internal/service/config"
 	"github.com/apache/incubator-answer/internal/service/meta"
+	"github.com/apache/incubator-answer/internal/service/revision"
 	"github.com/apache/incubator-answer/pkg/checker"
 	"github.com/apache/incubator-answer/pkg/htmltext"
 	"github.com/apache/incubator-answer/pkg/uid"
@@ -88,6 +89,7 @@ type QuestionCommon struct {
 	metaService          *meta.MetaService
 	configService        *config.ConfigService
 	activityQueueService activity_queue.ActivityQueueService
+	revisionRepo         revision.RevisionRepo
 	data                 *data.Data
 }
 
@@ -102,6 +104,7 @@ func NewQuestionCommon(questionRepo QuestionRepo,
 	metaService *meta.MetaService,
 	configService *config.ConfigService,
 	activityQueueService activity_queue.ActivityQueueService,
+	revisionRepo revision.RevisionRepo,
 	data *data.Data,
 ) *QuestionCommon {
 	return &QuestionCommon{
@@ -116,6 +119,7 @@ func NewQuestionCommon(questionRepo QuestionRepo,
 		metaService:          metaService,
 		configService:        configService,
 		activityQueueService: activityQueueService,
+		revisionRepo:         revisionRepo,
 		data:                 data,
 	}
 }
@@ -168,8 +172,8 @@ func (qs *QuestionCommon) UpdatePostSetTime(ctx context.Context, questionID stri
 	return qs.questionRepo.UpdateQuestion(ctx, questioninfo, []string{"post_update_time"})
 }
 
-func (qs *QuestionCommon) FindInfoByID(ctx context.Context, questionIDs []string, loginUserID string) (map[string]*schema.QuestionInfo, error) {
-	list := make(map[string]*schema.QuestionInfo)
+func (qs *QuestionCommon) FindInfoByID(ctx context.Context, questionIDs []string, loginUserID string) (map[string]*schema.QuestionInfoResp, error) {
+	list := make(map[string]*schema.QuestionInfoResp)
 	questionList, err := qs.questionRepo.FindByID(ctx, questionIDs)
 	if err != nil {
 		return list, err
@@ -212,30 +216,27 @@ func (qs *QuestionCommon) InviteUserInfo(ctx context.Context, questionID string)
 	return InviteUserInfo, nil
 }
 
-func (qs *QuestionCommon) Info(ctx context.Context, questionID string, loginUserID string) (showinfo *schema.QuestionInfo, err error) {
-	dbinfo, has, err := qs.questionRepo.GetQuestion(ctx, questionID)
+func (qs *QuestionCommon) Info(ctx context.Context, questionID string, loginUserID string) (resp *schema.QuestionInfoResp, err error) {
+	questionInfo, has, err := qs.questionRepo.GetQuestion(ctx, questionID)
 	if err != nil {
-		return showinfo, err
+		return resp, err
 	}
-	dbinfo.ID = uid.DeShortID(dbinfo.ID)
+	questionInfo.ID = uid.DeShortID(questionInfo.ID)
 	if !has {
-		return showinfo, errors.NotFound(reason.QuestionNotFound)
+		return resp, errors.NotFound(reason.QuestionNotFound)
 	}
-	showinfo = qs.ShowFormat(ctx, dbinfo)
-
-	if showinfo.Status == 2 {
-		var metainfo *entity.Meta
-		metainfo, err = qs.metaService.GetMetaByObjectIdAndKey(ctx, dbinfo.ID, entity.QuestionCloseReasonKey)
+	resp = qs.ShowFormat(ctx, questionInfo)
+	if resp.Status == entity.QuestionStatusClosed {
+		metaInfo, err := qs.metaService.GetMetaByObjectIdAndKey(ctx, questionInfo.ID, entity.QuestionCloseReasonKey)
 		if err != nil {
 			log.Error(err)
 		} else {
-			// metainfo.Value
-			closemsg := &schema.CloseQuestionMeta{}
-			err = json.Unmarshal([]byte(metainfo.Value), closemsg)
+			closeMsg := &schema.CloseQuestionMeta{}
+			err = json.Unmarshal([]byte(metaInfo.Value), closeMsg)
 			if err != nil {
 				log.Error("json.Unmarshal CloseQuestionMeta error", err.Error())
 			} else {
-				cfg, err := qs.configService.GetConfigByID(ctx, closemsg.CloseType)
+				cfg, err := qs.configService.GetConfigByID(ctx, closeMsg.CloseType)
 				if err != nil {
 					log.Error("json.Unmarshal QuestionCloseJson error", err.Error())
 				} else {
@@ -245,76 +246,84 @@ func (qs *QuestionCommon) Info(ctx context.Context, questionID string, loginUser
 					operation := &schema.Operation{}
 					operation.Type = reasonItem.Name
 					operation.Description = reasonItem.Description
-					operation.Msg = closemsg.CloseMsg
-					operation.Time = metainfo.CreatedAt.Unix()
+					operation.Msg = closeMsg.CloseMsg
+					operation.Time = metaInfo.CreatedAt.Unix()
 					operation.Level = schema.OperationLevelInfo
-					showinfo.Operation = operation
+					resp.Operation = operation
 				}
 			}
 		}
 	}
 
-	tagmap, err := qs.tagCommon.GetObjectTag(ctx, questionID)
-	if err != nil {
-		return showinfo, err
+	if resp.Status != entity.QuestionStatusDeleted {
+		if resp.Tags, err = qs.tagCommon.GetObjectTag(ctx, questionID); err != nil {
+			return resp, err
+		}
+	} else {
+		revisionInfo, exist, err := qs.revisionRepo.GetLastRevisionByObjectID(ctx, questionID)
+		if err != nil {
+			log.Errorf("get revision error %s", err)
+		}
+		if exist {
+			questionWithTagsRevision := &entity.QuestionWithTagsRevision{}
+			if err = json.Unmarshal([]byte(revisionInfo.Content), questionWithTagsRevision); err != nil {
+				log.Errorf("revision parsing error %s", err)
+				return resp, nil
+			}
+			for _, tag := range questionWithTagsRevision.Tags {
+				resp.Tags = append(resp.Tags, &schema.TagResp{
+					ID:              tag.ID,
+					SlugName:        tag.SlugName,
+					DisplayName:     tag.DisplayName,
+					MainTagSlugName: tag.MainTagSlugName,
+					Recommend:       tag.Recommend,
+					Reserved:        tag.Reserved,
+				})
+			}
+		}
 	}
-	showinfo.Tags = tagmap
 
 	userIds := make([]string, 0)
-	if checker.IsNotZeroString(dbinfo.UserID) {
-		userIds = append(userIds, dbinfo.UserID)
+	if checker.IsNotZeroString(questionInfo.UserID) {
+		userIds = append(userIds, questionInfo.UserID)
 	}
-	if checker.IsNotZeroString(dbinfo.LastEditUserID) {
-		userIds = append(userIds, dbinfo.LastEditUserID)
+	if checker.IsNotZeroString(questionInfo.LastEditUserID) {
+		userIds = append(userIds, questionInfo.LastEditUserID)
 	}
-	if checker.IsNotZeroString(showinfo.LastAnsweredUserID) {
-		userIds = append(userIds, showinfo.LastAnsweredUserID)
+	if checker.IsNotZeroString(resp.LastAnsweredUserID) {
+		userIds = append(userIds, resp.LastAnsweredUserID)
 	}
 	userInfoMap, err := qs.userCommon.BatchUserBasicInfoByID(ctx, userIds)
 	if err != nil {
-		return showinfo, err
-	}
-
-	_, ok := userInfoMap[dbinfo.UserID]
-	if ok {
-		showinfo.UserInfo = userInfoMap[dbinfo.UserID]
-	}
-	_, ok = userInfoMap[dbinfo.LastEditUserID]
-	if ok {
-		showinfo.UpdateUserInfo = userInfoMap[dbinfo.LastEditUserID]
+		return resp, err
 	}
-	_, ok = userInfoMap[showinfo.LastAnsweredUserID]
-	if ok {
-		showinfo.LastAnsweredUserInfo = userInfoMap[showinfo.LastAnsweredUserID]
+	resp.UserInfo = userInfoMap[questionInfo.UserID]
+	resp.UpdateUserInfo = userInfoMap[questionInfo.LastEditUserID]
+	resp.LastAnsweredUserInfo = userInfoMap[resp.LastAnsweredUserID]
+	if len(loginUserID) == 0 {
+		return resp, nil
 	}
 
-	if loginUserID == "" {
-		return showinfo, nil
-	}
-
-	showinfo.VoteStatus = qs.voteRepo.GetVoteStatus(ctx, questionID, loginUserID)
-
-	// // check is followed
-	isFollowed, _ := qs.followCommon.IsFollowed(ctx, loginUserID, questionID)
-	showinfo.IsFollowed = isFollowed
+	resp.VoteStatus = qs.voteRepo.GetVoteStatus(ctx, questionID, loginUserID)
+	resp.IsFollowed, _ = qs.followCommon.IsFollowed(ctx, loginUserID, questionID)
 
-	ids, err := qs.AnswerCommon.SearchAnswerIDs(ctx, loginUserID, dbinfo.ID)
+	ids, err := qs.AnswerCommon.SearchAnswerIDs(ctx, loginUserID, questionInfo.ID)
 	if err != nil {
 		log.Error("AnswerFunc.SearchAnswerIDs", err)
 	}
-	showinfo.Answered = len(ids) > 0
-	if showinfo.Answered {
-		showinfo.FirstAnswerId = ids[0]
+	resp.Answered = len(ids) > 0
+	if resp.Answered {
+		resp.FirstAnswerId = ids[0]
 	}
 
-	collectedMap, err := qs.collectionCommon.SearchObjectCollected(ctx, loginUserID, []string{dbinfo.ID})
+	collectedMap, err := qs.collectionCommon.SearchObjectCollected(ctx, loginUserID, []string{questionInfo.ID})
 	if err != nil {
 		return nil, err
 	}
 	if len(collectedMap) > 0 {
-		showinfo.Collected = true
+		resp.Collected = true
 	}
-	return showinfo, nil
+	return resp, nil
 }
 
 func (qs *QuestionCommon) FormatQuestionsPage(
@@ -419,8 +428,8 @@ func (qs *QuestionCommon) FormatQuestionsPage(
 	return formattedQuestions, nil
 }
 
-func (qs *QuestionCommon) FormatQuestions(ctx context.Context, questionList []*entity.Question, loginUserID string) ([]*schema.QuestionInfo, error) {
-	list := make([]*schema.QuestionInfo, 0)
+func (qs *QuestionCommon) FormatQuestions(ctx context.Context, questionList []*entity.Question, loginUserID string) ([]*schema.QuestionInfoResp, error) {
+	list := make([]*schema.QuestionInfoResp, 0)
 	objectIds := make([]string, 0)
 	userIds := make([]string, 0)
 
@@ -526,8 +535,8 @@ func (qs *QuestionCommon) CloseQuestion(ctx context.Context, req *schema.CloseQu
 }
 
 // RemoveAnswer delete answer
-func (as *QuestionCommon) RemoveAnswer(ctx context.Context, id string) (err error) {
-	answerinfo, has, err := as.answerRepo.GetByID(ctx, id)
+func (qs *QuestionCommon) RemoveAnswer(ctx context.Context, id string) (err error) {
+	answerinfo, has, err := qs.answerRepo.GetByID(ctx, id)
 	if err != nil {
 		return err
 	}
@@ -537,20 +546,20 @@ func (as *QuestionCommon) RemoveAnswer(ctx context.Context, id string) (err erro
 
 	// user add question count
 
-	err = as.UpdateAnswerCount(ctx, answerinfo.QuestionID)
+	err = qs.UpdateAnswerCount(ctx, answerinfo.QuestionID)
 	if err != nil {
 		log.Error("UpdateAnswerCount error", err.Error())
 	}
-	userAnswerCount, err := as.answerRepo.GetCountByUserID(ctx, answerinfo.UserID)
+	userAnswerCount, err := qs.answerRepo.GetCountByUserID(ctx, answerinfo.UserID)
 	if err != nil {
 		log.Error("GetCountByUserID error", err.Error())
 	}
-	err = as.userCommon.UpdateAnswerCount(ctx, answerinfo.UserID, int(userAnswerCount))
+	err = qs.userCommon.UpdateAnswerCount(ctx, answerinfo.UserID, int(userAnswerCount))
 	if err != nil {
 		log.Error("user UpdateAnswerCount error", err.Error())
 	}
 
-	return as.answerRepo.RemoveAnswer(ctx, id)
+	return qs.answerRepo.RemoveAnswer(ctx, id)
 }
 
 func (qs *QuestionCommon) SitemapCron(ctx context.Context) {
@@ -590,12 +599,12 @@ func (qs *QuestionCommon) SetCache(ctx context.Context, cachekey string, info in
 	return nil
 }
 
-func (qs *QuestionCommon) ShowListFormat(ctx context.Context, data *entity.Question) *schema.QuestionInfo {
+func (qs *QuestionCommon) ShowListFormat(ctx context.Context, data *entity.Question) *schema.QuestionInfoResp {
 	return qs.ShowFormat(ctx, data)
 }
 
-func (qs *QuestionCommon) ShowFormat(ctx context.Context, data *entity.Question) *schema.QuestionInfo {
-	info := schema.QuestionInfo{}
+func (qs *QuestionCommon) ShowFormat(ctx context.Context, data *entity.Question) *schema.QuestionInfoResp {
+	info := schema.QuestionInfoResp{}
 	info.ID = data.ID
 	if handler.GetEnableShortID(ctx) {
 		info.ID = uid.EnShortID(data.ID)
@@ -641,7 +650,7 @@ func (qs *QuestionCommon) ShowFormat(ctx context.Context, data *entity.Question)
 	info.Tags = make([]*schema.TagResp, 0)
 	return &info
 }
-func (qs *QuestionCommon) ShowFormatWithTag(ctx context.Context, data *entity.QuestionWithTagsRevision) *schema.QuestionInfo {
+func (qs *QuestionCommon) ShowFormatWithTag(ctx context.Context, data *entity.QuestionWithTagsRevision) *schema.QuestionInfoResp {
 	info := qs.ShowFormat(ctx, &data.Question)
 	Tags := make([]*schema.TagResp, 0)
 	for _, tag := range data.Tags {
diff --git a/internal/service/tag_common/tag_common.go b/internal/service/tag_common/tag_common.go
index fe8b3b53..953b96f0 100644
--- a/internal/service/tag_common/tag_common.go
+++ b/internal/service/tag_common/tag_common.go
@@ -403,11 +403,11 @@ func (ts *TagCommonService) GetTagPage(ctx context.Context, page, pageSize int,
 }
 
 func (ts *TagCommonService) GetObjectEntityTag(ctx context.Context, objectId string) (objTags []*entity.Tag, err error) {
-	tagIDList := make([]string, 0)
 	tagList, err := ts.tagRelRepo.GetObjectTagRelList(ctx, objectId)
 	if err != nil {
 		return nil, err
 	}
+	tagIDList := make([]string, 0)
 	for _, tag := range tagList {
 		tagIDList = append(tagIDList, tag.TagID)
 	}