mirror of
https://github.com/imsyy/DailyHotApi.git
synced 2026-01-12 13:14:55 +08:00
🦄 refactor: 调整接口结构
This commit is contained in:
@@ -4,16 +4,14 @@ import { get } from "../utils/getData.js";
|
||||
import { getTime } from "../utils/getTime.js";
|
||||
|
||||
export const handleRoute = async (_: undefined, noCache: boolean) => {
|
||||
const { fromCache, data, updateTime } = await getList(noCache);
|
||||
const listData = await getList(noCache);
|
||||
const routeData: RouterData = {
|
||||
name: "lol",
|
||||
title: "英雄联盟",
|
||||
type: "更新公告",
|
||||
link: "https://lol.qq.com/gicp/news/423/2/1334/1.html",
|
||||
total: data?.length || 0,
|
||||
updateTime,
|
||||
fromCache,
|
||||
data,
|
||||
total: listData.data?.length || 0,
|
||||
...listData,
|
||||
};
|
||||
return routeData;
|
||||
};
|
||||
@@ -24,8 +22,7 @@ const getList = async (noCache: boolean) => {
|
||||
const result = await get({ url, noCache });
|
||||
const list = result.data.data.result;
|
||||
return {
|
||||
fromCache: result.fromCache,
|
||||
updateTime: result.updateTime,
|
||||
...result,
|
||||
data: list.map((v: RouterType["lol"]) => ({
|
||||
id: v.iDocID,
|
||||
title: v.sTitle,
|
||||
|
||||
Reference in New Issue
Block a user