♻️ 请求重构,合并postWapi跟apiHub相关请求

This commit is contained in:
目棃
2024-10-24 23:08:34 +08:00
parent 41db04b7a2
commit 26041948ef
31 changed files with 399 additions and 594 deletions

View File

@@ -0,0 +1,30 @@
/**
* @file plugins/Mys/request/painterReq.ts
* @description painter下的请求
* @since Beta v0.6.2
*/
import TGHttp from "../../../utils/TGHttp.js";
// MysPainterApiBaseUrl => Mpabu
const Mpabu = "https://bbs-api.miyoushe.com/painter/wapi/";
/**
* @description 获取抽奖信息
* @since Beta v0.6.2
* @param {string} lotteryId 抽奖 ID
* @return {Promise<TGApp.BBS.Response.Base|TGApp.Plugins.Mys.Lottery.FullData>}
*/
export async function lotteryUserShow(
lotteryId: string,
): Promise<TGApp.BBS.Response.Base | TGApp.Plugins.Mys.Lottery.FullData> {
const resp = await TGHttp<TGApp.BBS.Response.Base | TGApp.Plugins.Mys.Lottery.Response>(
`${Mpabu}lottery/user/show`,
{
method: "GET",
headers: { "Content-Type": "application/json" },
query: { id: lotteryId },
},
);
if (resp.retcode !== 0) return <TGApp.BBS.Response.Base>resp;
return resp.data.show_lottery;
}