mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2026-04-01 06:39:45 +08:00
fix(home): 加载合到首页了,如果显示派蒙吃惊说明 ip 被封了(
This commit is contained in:
@@ -2,16 +2,15 @@
|
||||
* @file plugins Mys utils gacha.ts
|
||||
* @description Mys 插件抽卡工具
|
||||
* @author BTMuli<bt-muli@outlook.com>
|
||||
* @since Alpha v0.1.1
|
||||
* @since Alpha v0.1.2
|
||||
*/
|
||||
|
||||
import { getPostData } from "../request/post";
|
||||
import { GachaCard, GachaData } from "../interface/gacha";
|
||||
import { PostData } from "../interface/post";
|
||||
|
||||
/**
|
||||
* @description 根据卡池信息转为渲染用的卡池信息
|
||||
* @since Alpha v0.1.1
|
||||
* @since Alpha v0.1.2
|
||||
* @param {GachaData[]} gachaData 卡池信息
|
||||
* @return {Promise<GachaCard[]>}
|
||||
*/
|
||||
@@ -23,11 +22,17 @@ export async function getGachaCard(gachaData: GachaData[]): Promise<GachaCard[]>
|
||||
if (post_id === undefined) {
|
||||
throw new Error("无法获取帖子 ID");
|
||||
}
|
||||
const post: PostData = await getPostData(post_id);
|
||||
let cover = "/source/UI/empty.webp";
|
||||
try {
|
||||
const post = await getPostData(post_id);
|
||||
cover = post.cover?.url || post.post.images[0];
|
||||
} catch (error) {
|
||||
await console.error(error);
|
||||
}
|
||||
return gachaCard.push({
|
||||
title: data.title,
|
||||
subtitle: data.content_before_act,
|
||||
cover: post.cover?.url || post.post.images[0],
|
||||
cover: cover,
|
||||
post_id: post_id,
|
||||
characters: data.pool.map(character => ({
|
||||
icon: character.icon,
|
||||
|
||||
Reference in New Issue
Block a user