where([['feed_push_type', 5], ['score', 0]])->take(rand( 1, 3 ))->get(); $nicknames = UserModel::where('partner_id', '>', 0)->skip(rand( 10, 500 ))->take(3)->get(['nickname'])->pluck('nickname'); foreach ($partners as $partner) { try { /** @var UserModel $user */ $user = UserModel::findOrFail($partner->uid); /** @var PartnerModel $partner */ event(new \App\Events\CompleteInfoRemind($user, $nicknames[rand(0, count($nicknames) - 1)])); Redis::sadd($key, [$partner->id]); } catch (\Exception $exception) { } } } }