上传祈愿数据

#202
This commit is contained in:
BTMuli
2026-01-11 22:15:12 +08:00
parent bd081e2dee
commit 8d541891ae
7 changed files with 162 additions and 26 deletions

View File

@@ -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: _,
},
};

View File

@@ -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)),
});
}

View File

@@ -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>;
};
}