init
This commit is contained in:
18
src/routes/cnb.ts
Normal file
18
src/routes/cnb.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import { app, cnb } from '../app';
|
||||
import dayjs from 'dayjs';
|
||||
app.route({
|
||||
path: 'cnb',
|
||||
key: 'list-today',
|
||||
description: '获取今日更新的仓库列表',
|
||||
}).define(async (ctx) => {
|
||||
const res = await cnb.repo.getRepoList({ page_size: 100 });
|
||||
const today = dayjs().format('YYYY-MM-DD');
|
||||
const list = res.data || [];
|
||||
const todayList = list.filter(item => {
|
||||
const updatedAt = dayjs(item.updated_at).format('YYYY-MM-DD');
|
||||
return updatedAt === today;
|
||||
});
|
||||
ctx.body = {
|
||||
list: todayList,
|
||||
}
|
||||
}).addTo(app)
|
||||
Reference in New Issue
Block a user