DEBUG
This commit is contained in:
7
main.js
7
main.js
@@ -35,14 +35,15 @@ export function get_views(name, ids = []) {
|
|||||||
|
|
||||||
// 获取当日热门搜索词
|
// 获取当日热门搜索词
|
||||||
export function get_search(n = 10) {
|
export function get_search(n = 10) {
|
||||||
const ex = new Map()
|
const 全部 = new Map()
|
||||||
const all = { 文章, 作品, 游戏, 截图, 收藏, 综合 }
|
const all = { 文章, 作品, 游戏, 截图, 收藏, 综合 }
|
||||||
for (const key in all) {
|
for (const key in all) {
|
||||||
all[key].搜索词.日.forEach((value, key) => {
|
all[key].搜索词.日.forEach((value, key) => {
|
||||||
ex.set(key, (ex.get(key) || 0) + value)
|
console.log(key, value)
|
||||||
|
全部.set(key, (全部.get(key) || 0) + value)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
return [...ex.entries()].sort((a, b) => b[1] - a[1]).slice(0, n).map(([text, count]) => {
|
return [...全部.entries()].sort((a, b) => b[1] - a[1]).slice(0, n).map(([text, count]) => {
|
||||||
return { text, count }
|
return { text, count }
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user