From 63ab3fc50cd1678a1ce99385b5ebf5e7f8062cdc Mon Sep 17 00:00:00 2001 From: wucongxing8150 <815046773@qq.com> Date: Fri, 20 Sep 2024 10:46:47 +0800 Subject: [PATCH] 1 --- api/service/Question.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/api/service/Question.go b/api/service/Question.go index afe8ea0..d0fc4ad 100644 --- a/api/service/Question.go +++ b/api/service/Question.go @@ -66,11 +66,13 @@ func (r *QuestionService) GetGuessUserLIkeList(userId int64) (m []*model.Questio } // 未参与过/未指定用户 - if len(questions) == 0 { + if len(questions) < 3 { + limit := 3 - len(questions) + maps := make(map[string]interface{}) maps["question_status"] = 1 maps["is_hide"] = 0 - questions, err = questionDao.GetQuestionListRand(maps, 3) + questions, err = questionDao.GetQuestionListRand(maps, limit) if err != nil { return nil, err }