diff --git a/domain/model/user_m/vip.go b/domain/model/user_m/vip.go index 9e231d575f268c4a58f54252243a406bd68a5bb9..5d3ed7ac54624ccdbc5ac0d4c4160e8932a5f758 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 b4b8e577c9f444ad06ffc82881f1061307b69048..55124d9c53c4d87c9e9a494d970244615078980e 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)