Parcourir la source

fix:问答列表页,评论汇总

Roc il y a 2 ans
Parent
commit
31eae2b20e
1 fichiers modifiés avec 1 ajouts et 1 suppressions
  1. 1 1
      models/tables/yb_community_question_comment/query.go

+ 1 - 1
models/tables/yb_community_question_comment/query.go

@@ -98,7 +98,7 @@ type NumCommentByCommunityQuestion struct {
 func GetNumCommentByCommunityQuestionIds(communityQuestionIds []uint32) (item []*NumCommentByCommunityQuestion, err error) {
 	err = global.DEFAULT_MYSQL.Model(YbCommunityQuestionComment{}).
 		Select("community_question_id, count(1) total").
-		Where("community_question_id in (?) and type=1 and enabled = 1 ", communityQuestionIds).Scan(&item).Error
+		Where("community_question_id in (?) and type=1 and enabled = 1 ", communityQuestionIds).Group("community_question_id").Scan(&item).Error
 	return
 }