mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2025-12-15 09:48:14 +08:00
✏️ 继续修正 import
This commit is contained in:
@@ -5,8 +5,9 @@
|
||||
*/
|
||||
|
||||
import { http } from "@tauri-apps/api";
|
||||
import type { Response } from "@tauri-apps/api/http";
|
||||
|
||||
import MysApi from "../api";
|
||||
import MysApi from "../api/index.js";
|
||||
|
||||
/**
|
||||
* @description 获取投票信息
|
||||
@@ -17,20 +18,14 @@ import MysApi from "../api";
|
||||
*/
|
||||
export async function getVoteInfo(id: string, uid: string): Promise<TGApp.Plugins.Mys.Vote.Info> {
|
||||
const url = "https://bbs-api.miyoushe.com/apihub/api/getVotes";
|
||||
const params = {
|
||||
owner_uid: uid,
|
||||
vote_ids: id,
|
||||
};
|
||||
const params = { owner_uid: uid, vote_ids: id };
|
||||
return await http
|
||||
.fetch<TGApp.Plugins.Mys.Vote.InfoResponse>(url, {
|
||||
.fetch(url, {
|
||||
method: "GET",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
Referer: MysApi.PostReferer,
|
||||
},
|
||||
headers: { "Content-Type": "application/json", Referer: MysApi.PostReferer },
|
||||
query: params,
|
||||
})
|
||||
.then((res) => {
|
||||
.then((res: Response<TGApp.Plugins.Mys.Vote.InfoResponse>) => {
|
||||
return res.data.data.data[0];
|
||||
});
|
||||
}
|
||||
@@ -47,20 +42,14 @@ export async function getVoteResult(
|
||||
uid: string,
|
||||
): Promise<TGApp.Plugins.Mys.Vote.Result> {
|
||||
const url = "https://bbs-api.miyoushe.com/apihub/api/getVotesResult";
|
||||
const params = {
|
||||
owner_uid: uid,
|
||||
vote_ids: id,
|
||||
};
|
||||
const params = { owner_uid: uid, vote_ids: id };
|
||||
return await http
|
||||
.fetch<TGApp.Plugins.Mys.Vote.ResultResponse>(url, {
|
||||
.fetch(url, {
|
||||
method: "GET",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
Referer: MysApi.PostReferer,
|
||||
},
|
||||
headers: { "Content-Type": "application/json", Referer: MysApi.PostReferer },
|
||||
query: params,
|
||||
})
|
||||
.then((res) => {
|
||||
.then((res: Response<TGApp.Plugins.Mys.Vote.ResultResponse>) => {
|
||||
return res.data.data.data[0];
|
||||
});
|
||||
}
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
* @since Beta v0.4.4
|
||||
*/
|
||||
|
||||
import { AppCharacterData } from "../../../data";
|
||||
import getPostData from "../request/getPostData";
|
||||
import { AppCharacterData } from "../../../data/index.js";
|
||||
import getPostData from "../request/getPostData.js";
|
||||
|
||||
/**
|
||||
* @description 根据单个卡池信息转为渲染用的卡池信息
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
/**
|
||||
* @file plugins Mys utils getPositionCard.ts
|
||||
* @file plugins/Mys/utils/getPositionCard.ts
|
||||
* @description Mys 插件热点追踪工具
|
||||
* @author BTMuli <bt-muli@outlook.com>
|
||||
* @since Alpha v0.2.1
|
||||
* @since Beta v0.4.10
|
||||
*/
|
||||
|
||||
/**
|
||||
* @description 根据热点追踪信息转为渲染用的数据
|
||||
* @since Alpha v0.1.5
|
||||
* @since Beta v0.4.10
|
||||
* @param {TGApp.Plugins.Mys.Position.Data[]} positionData 列表
|
||||
* @returns {TGApp.Plugins.Mys.Position.RenderCard[]} 返回列表
|
||||
*/
|
||||
@@ -15,14 +14,14 @@ function getPositionCard(
|
||||
positionData: TGApp.Plugins.Mys.Position.Data[],
|
||||
): TGApp.Plugins.Mys.Position.RenderCard[] {
|
||||
const res: TGApp.Plugins.Mys.Position.RenderCard[] = [];
|
||||
positionData.map((position) => {
|
||||
for (const position of positionData) {
|
||||
let endStr: string;
|
||||
if (position.end_time === "0") {
|
||||
endStr = "";
|
||||
} else {
|
||||
endStr = new Date(Number(position.end_time)).toLocaleDateString().replace(/\//g, "-");
|
||||
}
|
||||
return res.push<TGApp.Plugins.Mys.Position.RenderCard>({
|
||||
const card: TGApp.Plugins.Mys.Position.RenderCard = {
|
||||
title: position.title,
|
||||
postId: Number(position.url.split("/").pop()),
|
||||
icon: position.icon,
|
||||
@@ -33,8 +32,9 @@ function getPositionCard(
|
||||
end: endStr,
|
||||
endStamp: Number(position.end_time),
|
||||
},
|
||||
});
|
||||
});
|
||||
};
|
||||
res.push(card);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user