mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2025-12-14 09:38:13 +08:00
🌱 仿照咨讯页写了个酒馆页面 #67
This commit is contained in:
@@ -1,8 +1,7 @@
|
||||
/**
|
||||
* @file plugins Mys api index.ts
|
||||
* @file plugins/Mys/api/index.ts
|
||||
* @description Mys API
|
||||
* @author BTMuli <bt-muli@outlook.com>
|
||||
* @since Alpha v0.2.1
|
||||
* @since Beta v0.3.7
|
||||
*/
|
||||
|
||||
const MysApi = {
|
||||
@@ -10,6 +9,8 @@ const MysApi = {
|
||||
Gacha: "https://api-takumi.mihoyo.com/common/blackboard/ys_obc/v1/gacha_pool?app_sn=ys_obc",
|
||||
Lottery: "https://bbs-api.miyoushe.com/painter/wapi/lottery/user/show?id={lotteryId}",
|
||||
News: "https://bbs-api.mihoyo.com/post/wapi/getNewsList?gids={gid}&page_size={pageSize}&type={newsType}&last_id={lastId}",
|
||||
Forum:
|
||||
"https://bbs-api.miyoushe.com/post/wapi/getForumPostList?forum_id={forum}&gids={gid}&sort_type={type}",
|
||||
Position: "https://api-static.mihoyo.com/common/blackboard/ys_obc/v1/home/position?app_sn=ys_obc",
|
||||
Post: {
|
||||
Api: "https://bbs-api.mihoyo.com/post/wapi/getPostFull?post_id={postId}",
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
|
||||
import MysApi from "./api";
|
||||
import { getLoginQr, getLoginStatus } from "./request/doGameLogin";
|
||||
import getForumList from "./request/getForumList";
|
||||
import getGachaData from "./request/getGachaData";
|
||||
import getLotteryData from "./request/getLotteryData";
|
||||
import getNewsList from "./request/getNewsList";
|
||||
@@ -20,6 +21,7 @@ const Mys = {
|
||||
Api: MysApi,
|
||||
Post: {
|
||||
get: getPostData,
|
||||
forum: getForumList,
|
||||
},
|
||||
Gacha: {
|
||||
get: getGachaData,
|
||||
|
||||
30
src/plugins/Mys/request/getForumList.ts
Normal file
30
src/plugins/Mys/request/getForumList.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
/**
|
||||
* @file plugins/Mys/request/getForumList.ts
|
||||
* @description Mys 插件特定论坛请求
|
||||
* @since Beta v0.3.7
|
||||
*/
|
||||
|
||||
import { http } from "@tauri-apps/api";
|
||||
|
||||
import MysApi from "../api";
|
||||
|
||||
/**
|
||||
* @description 获取特定论坛列表
|
||||
* @since Beta v0.3.7
|
||||
* @param {number} forumId 特定论坛 ID
|
||||
* @param {number} gid GID
|
||||
* @param {number} type 排序方式: 0-按热度排序,1-最新回复,2-按时间排序
|
||||
* @return {Promise<TGApp.Plugins.Mys.Forum.FullData>}
|
||||
*/
|
||||
async function getForumList(
|
||||
forumId: number,
|
||||
gid: number = 2,
|
||||
type: number = 0,
|
||||
): Promise<TGApp.Plugins.Mys.Forum.FullData> {
|
||||
const url = MysApi.Forum.replace("{forum}", forumId.toString())
|
||||
.replace("{gid}", gid.toString())
|
||||
.replace("{type}", type.toString());
|
||||
return await http.fetch<TGApp.Plugins.Mys.Forum.Response>(url).then((res) => res.data.data);
|
||||
}
|
||||
|
||||
export default getForumList;
|
||||
Reference in New Issue
Block a user