mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2025-12-13 09:28:14 +08:00
♻️ 米社请求重构
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* @file plugins/Mys/request/getVoteData.ts
|
||||
* @description Mys 插件投票请求
|
||||
* @since Beta v0.3.9
|
||||
* @since Beta v0.4.5
|
||||
*/
|
||||
|
||||
import { http } from "@tauri-apps/api";
|
||||
@@ -10,20 +10,25 @@ import MysApi from "../api";
|
||||
|
||||
/**
|
||||
* @description 获取投票信息
|
||||
* @since Beta v0.3.9
|
||||
* @since Beta v0.4.5
|
||||
* @param {string} id 投票 ID
|
||||
* @param {string} uid 用户 ID
|
||||
* @return {Promise<TGApp.Plugins.Mys.Vote.Info>}
|
||||
*/
|
||||
export async function getVoteInfo(id: string, uid: string): Promise<TGApp.Plugins.Mys.Vote.Info> {
|
||||
const url = `https://bbs-api.miyoushe.com/apihub/api/getVotes?owner_uid=${uid}&vote_ids=${id}`;
|
||||
const url = "https://bbs-api.miyoushe.com/apihub/api/getVotes";
|
||||
const params = {
|
||||
owner_uid: uid,
|
||||
vote_ids: id,
|
||||
};
|
||||
return await http
|
||||
.fetch<TGApp.Plugins.Mys.Vote.InfoResponse>(url, {
|
||||
method: "GET",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
Referer: MysApi.Post.Referer,
|
||||
Referer: MysApi.PostReferer,
|
||||
},
|
||||
query: params,
|
||||
})
|
||||
.then((res) => {
|
||||
return res.data.data.data[0];
|
||||
@@ -32,7 +37,7 @@ export async function getVoteInfo(id: string, uid: string): Promise<TGApp.Plugin
|
||||
|
||||
/**
|
||||
* @description 获取投票结果
|
||||
* @since Beta v0.3.9
|
||||
* @since Beta v0.4.5
|
||||
* @param {string} id 投票 ID
|
||||
* @param {string} uid 用户 ID
|
||||
* @return {Promise<TGApp.Plugins.Mys.Vote.Result>}
|
||||
@@ -41,14 +46,19 @@ export async function getVoteResult(
|
||||
id: string,
|
||||
uid: string,
|
||||
): Promise<TGApp.Plugins.Mys.Vote.Result> {
|
||||
const url = `https://bbs-api.miyoushe.com/apihub/api/getVotesResult?owner_uid=${uid}&vote_ids=${id}`;
|
||||
const url = "https://bbs-api.miyoushe.com/apihub/api/getVotesResult";
|
||||
const params = {
|
||||
owner_uid: uid,
|
||||
vote_ids: id,
|
||||
};
|
||||
return await http
|
||||
.fetch<TGApp.Plugins.Mys.Vote.ResultResponse>(url, {
|
||||
method: "GET",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
Referer: MysApi.Post.Referer,
|
||||
Referer: MysApi.PostReferer,
|
||||
},
|
||||
query: params,
|
||||
})
|
||||
.then((res) => {
|
||||
return res.data.data.data[0];
|
||||
|
||||
Reference in New Issue
Block a user