=', 0] ))->get(['uid', 'sex', 'feed_push_type', 'is_push_feed']); foreach ($partners as $partner) { /** @var PartnerModel $partner */ if (!in_array($partner->sex, [1, 2])) { continue; } if ($partner->feed_push_type == 3 && 1 == $partner->is_push_feed) { $key = "feed:80:sex:{$partner->sex}"; } else { $key = "feed:20:sex:{$partner->sex}"; } Redis::sadd($key, [$partner->uid]); } Redis::expire("feed:80:sex:1", 86400 * 7); Redis::expire("feed:80:sex:2", 86400 * 7); Redis::expire("feed:20:sex:1", 86400 * 7); Redis::expire("feed:20:sex:2", 86400 * 7); } }