ranking
This commit is contained in:
@ -228,5 +228,22 @@ export default (router, tpl) => {
|
||||
res.redirect(`/${referer}`);
|
||||
});
|
||||
|
||||
router.get(/^\/ranking/, async (req, res) => {
|
||||
try {
|
||||
const list = await sql('tags_assign')
|
||||
.select('prefix', sql.raw('count(distinct tag_id, item_id) count'))
|
||||
.groupBy('prefix')
|
||||
.orderBy('count', 'desc');
|
||||
|
||||
const stats = await lib.countf0cks();
|
||||
|
||||
res.reply({
|
||||
body: tpl.render('ranking', { list, stats, tmp: null }, req)
|
||||
});
|
||||
} catch(err) {
|
||||
res.end(JSON.stringify(err.message));
|
||||
}
|
||||
});
|
||||
|
||||
return router;
|
||||
};
|
||||
|
Reference in New Issue
Block a user