Refactor downloads

https://github.com/cnpm/cnpmjs.org/wiki/Migrating-from-1.x-to-2.x

Use downloads table instead of download_total

Fixes #544
有道理，我改改，确实是这样

Sent from my iPhone

> On Dec 23, 2014, at 12:50 AM, Yiyu He <notifications@github.com> wrote:
> 
> In services/download_total.js:
> 
> > +    where: {
> > +      date: {
> > +        gte: startMonth,
> > +        lte: endMonth
> > +      },
> > +    }
> > +  });
> > +  var map = {};
> > +  var downloads = [];
> > +  rows.map(function (row) {
> > +    var date = String(row.date);
> > +    var month = date.substring(4, 6);
> > +    var year = date.substring(0, 4);
> > +    var yearMonth = year + '-' + month;
> > +    var days = MONTHS[month];
> > +    if (month === '02' && moment([Number(year)]).isLeapYear()) {
> 可以不加这个判断每月天数的逻辑吧？反正这一天的 count 肯定是 0，会被过滤掉的
> 
> —
> Reply to this email directly or view it on GitHub.
>