guyu/common/server/home.js
2025-07-23 14:37:06 +08:00

23 lines
674 B
JavaScript

import { getAdvertList } from '@/common/server/interface/advert'
import { noticeInfo as getNoticeInfo } from '@/common/server/interface/notice'
/**
* 获取首页关键数据
* @returns 首页数据
*/
export const getHomePage = async () => {
// 获取首页banner位
const advertTask = getAdvertList("TplIndexBanner1");
// 获取首页滚动文字
const noticeInfoTask = getNoticeInfo(9);
const results = await Promise.allSettled([advertTask, noticeInfoTask]);
const [advertList, noticeInfo] = results.map(result =>
result.status === 'fulfilled' ? result.value : null
);
return {
advertList,
noticeInfo
};
}