mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2026-03-30 06:19:45 +08:00
@@ -14,7 +14,7 @@ import {
|
||||
} from "./request/abyssReq.js";
|
||||
import { getUserInfo, loginPassport, refreshToken } from "./request/accountReq.js";
|
||||
import { getCombatStatistic, uploadCombatData } from "./request/combatReq.js";
|
||||
import { getEndIds, getEntries, getGachaLogs } from "./request/gachaReq.js";
|
||||
import { getEndIds, getEntries, getGachaLogs, uploadGachaLogs } from "./request/gachaReq.js";
|
||||
import { transAbyssAvatars, transAbyssLocal } from "./utils/abyssUtil.js";
|
||||
import { transCombatLocal } from "./utils/combatUtil.js";
|
||||
|
||||
@@ -61,7 +61,7 @@ const Hutao = {
|
||||
entry: getEntries,
|
||||
endIds: getEndIds,
|
||||
logs: getGachaLogs,
|
||||
upload: _,
|
||||
upload: uploadGachaLogs,
|
||||
delete: _,
|
||||
},
|
||||
};
|
||||
|
||||
@@ -78,3 +78,23 @@ export async function getGachaLogs(
|
||||
if (resp.retcode !== 0) return <TGApp.Plugins.Hutao.Base.Resp>resp;
|
||||
return <TGApp.Plugins.Hutao.Gacha.GachaLogRes>resp.data;
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传抽卡记录
|
||||
* @since Beta v0.9.1
|
||||
* @param tk - token
|
||||
* @param data - 上传数据
|
||||
* @returns 上传结果
|
||||
*/
|
||||
export async function uploadGachaLogs(
|
||||
tk: string,
|
||||
data: TGApp.Plugins.Hutao.Gacha.UploadData,
|
||||
): Promise<TGApp.Plugins.Hutao.Gacha.UploadResp | TGApp.Plugins.Hutao.Base.Resp> {
|
||||
const url = `${GachaUrl}Upload`;
|
||||
const header = await getReqHeader(tk);
|
||||
return await TGHttp<TGApp.Plugins.Hutao.Gacha.UploadResp>(url, {
|
||||
method: "POST",
|
||||
headers: header,
|
||||
body: JSON.stringify(data, (_, v) => (typeof v === "bigint" ? v.toString() : v)),
|
||||
});
|
||||
}
|
||||
|
||||
19
src/plugins/Hutao/types/Gacha.d.ts
vendored
19
src/plugins/Hutao/types/Gacha.d.ts
vendored
@@ -83,6 +83,23 @@ declare namespace TGApp.Plugins.Hutao.Gacha {
|
||||
*/
|
||||
Time: string;
|
||||
/** Id */
|
||||
Id: number;
|
||||
Id: number | bigint;
|
||||
};
|
||||
|
||||
/**
|
||||
* 上传响应
|
||||
* @since Beta v0.9.1
|
||||
*/
|
||||
type UploadResp = TGApp.Plugins.Hutao.Base.Resp<string>;
|
||||
|
||||
/**
|
||||
* 上传数据
|
||||
* @since Beta v0.9.1
|
||||
*/
|
||||
type UploadData = {
|
||||
/** UID */
|
||||
Uid: string;
|
||||
/** 数据 */
|
||||
Items: Array<GachaLog>;
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user