♻️ 抽奖详情做成 overlay

This commit is contained in:
目棃
2024-03-26 15:21:00 +08:00
parent 9e030c976b
commit fabf9de03e
4 changed files with 252 additions and 261 deletions

View File

@@ -1,7 +1,7 @@
/**
* @file plugins Mys interface getLotteryData.ts
* @file plugins/Mys/request/getLotteryData.ts
* @description Mys 插件抽奖接口
* @since Alpha v0.2.1
* @since Beta v0.4.5
*/
import { http } from "@tauri-apps/api";
@@ -10,11 +10,13 @@ import MysApi from "../api";
/**
* @description 获取抽奖信息
* @since Alpha v0.2.1
* @since Beta v0.4.5
* @param {string} lotteryId 抽奖 ID
* @return {Promise<TGApp.Plugins.Mys.Lottery.FullData>}
* @return {Promise<TGApp.BBS.Response.Base|TGApp.Plugins.Mys.Lottery.FullData>}
*/
async function getLotteryData(lotteryId: string): Promise<TGApp.Plugins.Mys.Lottery.FullData> {
async function getLotteryData(
lotteryId: string,
): Promise<TGApp.BBS.Response.Base | TGApp.Plugins.Mys.Lottery.FullData> {
return await http
.fetch<TGApp.Plugins.Mys.Lottery.Response>(MysApi.Lottery.replace("{lotteryId}", lotteryId), {
method: "GET",
@@ -23,6 +25,7 @@ async function getLotteryData(lotteryId: string): Promise<TGApp.Plugins.Mys.Lott
},
})
.then((res) => {
if (res.data.retcode !== 0) return <TGApp.BBS.Response.Base>res.data;
return res.data.data.show_lottery;
});
}