Yes, traffic affects rankings. Rankings as in the ranks on the search engines for your content or website. The search engine determines the traffic on your website as something valuable. It means that people are visiting your website and spending time, reading content. If they spend time on your website then that's a single that something valuable is there at your site which is making the audience come to you. This value addition is important for ranking your site. Hence, traffic is quite important for ranking.