👽️ 修正咨讯Api

This commit is contained in:
目棃
2024-10-30 18:07:33 +08:00
parent f08668e3da
commit a812e0781b
4 changed files with 26 additions and 25 deletions

View File

@@ -151,7 +151,7 @@ async function firstLoad(key: NewsKey, refresh: boolean = false): Promise<void>
} }
loadingTitle.value = `正在获取${rawData.value[key].name}数据...`; loadingTitle.value = `正在获取${rawData.value[key].name}数据...`;
loading.value = true; loading.value = true;
const getData = await Mys.Post.getNewsList(gid, NewsType[key]); const getData = await Mys.Painter.getNewsList(gid, NewsType[key]);
rawData.value[key].isLast = getData.is_last; rawData.value[key].isLast = getData.is_last;
rawData.value[key].lastId = getData.list.length; rawData.value[key].lastId = getData.list.length;
postData.value[key] = getData.list; postData.value[key] = getData.list;

View File

@@ -17,6 +17,7 @@ import getPositionCard from "./utils/getPositionCard.js";
const Mys = { const Mys = {
Post, Post,
Painter,
ApiHub, ApiHub,
Gacha: { Gacha: {
get: getGachaData, get: getGachaData,

View File

@@ -8,6 +8,30 @@ import TGHttp from "../../../utils/TGHttp.js";
// MysPainterApiBaseUrl => Mpabu // MysPainterApiBaseUrl => Mpabu
const Mpabu = "https://bbs-api.miyoushe.com/painter/wapi/"; const Mpabu = "https://bbs-api.miyoushe.com/painter/wapi/";
/**
* @description 获取 News 列表
* @since Beta v0.6.2
* @param {string} gid GID
* @param {string} newsType 咨讯类型: 1 为公告2 为活动3 为咨讯
* @param {number} pageSize 返回数量
* @param {number} lastId 上一次请求的最后一条数据的 id
* @return {Promise<TGApp.Plugins.Mys.News.FullData>}
*/
export async function getNewsList(
gid: string = "2",
newsType: string = "1",
pageSize: number = 20,
lastId: number = 0,
): Promise<TGApp.Plugins.Mys.News.FullData> {
return (
await TGHttp<TGApp.Plugins.Mys.News.Response>(`${Mpabu}getNewsList`, {
method: "GET",
headers: { "Content-Type": "application/json" },
query: { gids: gid, page_size: pageSize, type: newsType, last_id: lastId },
})
).data;
}
/** /**
* @description 获取抽奖信息 * @description 获取抽奖信息
* @since Beta v0.6.2 * @since Beta v0.6.2

View File

@@ -31,30 +31,6 @@ export async function getForumPostList(
).data; ).data;
} }
/**
* @description 获取 News 列表
* @since Beta v0.6.2
* @param {string} gid GID
* @param {string} newsType 咨讯类型: 1 为公告2 为活动3 为咨讯
* @param {number} pageSize 返回数量
* @param {number} lastId 上一次请求的最后一条数据的 id
* @return {Promise<TGApp.Plugins.Mys.News.FullData>}
*/
export async function getNewsList(
gid: string = "2",
newsType: string = "1",
pageSize: number = 20,
lastId: number = 0,
): Promise<TGApp.Plugins.Mys.News.FullData> {
return (
await TGHttp<TGApp.Plugins.Mys.News.Response>(`${Mpabu}getNewsList`, {
method: "GET",
headers: { "Content-Type": "application/json" },
query: { gids: gid, page_size: pageSize, type: newsType, last_id: lastId },
})
).data;
}
/** /**
* @description 获取单个帖子信息 * @description 获取单个帖子信息
* @since Beta v0.6.2 * @since Beta v0.6.2