From 417c61bc9d1c87480fa07422d021f890a7cb6503 Mon Sep 17 00:00:00 2001 From: iamhujiebin <458249864@qq.com> Date: Mon, 24 Jul 2023 22:53:37 +0800 Subject: [PATCH] fix --- domain/model/user_m/vip.go | 2 +- test/user_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/domain/model/user_m/vip.go b/domain/model/user_m/vip.go index 9e231d5..5d3ed7a 100644 --- a/domain/model/user_m/vip.go +++ b/domain/model/user_m/vip.go @@ -74,7 +74,7 @@ func BatchGetVips(userIds []uint64) (map[uint64]*int64, error) { end = len(userIds) } tmp := make([]UserVip, 0) - err := mysql.Db.Where("user_id IN ?", userIds).Find(&tmp).Error + err := mysql.Db.Where("user_id IN ?", userIds[start:end]).Find(&tmp).Error if err != nil { return nil, err } diff --git a/test/user_test.go b/test/user_test.go index b4b8e57..55124d9 100644 --- a/test/user_test.go +++ b/test/user_test.go @@ -17,7 +17,7 @@ func TestGetUserMap(t *testing.T) { func TestGetUserVipMap(t *testing.T) { var userIds []uint64 - for i := 0; i < 15000; i++ { + for i := 0; i < 1500; i++ { userIds = append(userIds, 7642) } res, err := user_m.BatchGetVips(userIds) -- 2.22.0