mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2025-12-14 09:38:13 +08:00
✨ 将战绩数据存到数据库中
This commit is contained in:
@@ -14,23 +14,24 @@ import TGUtils from "../utils/TGUtils";
|
||||
/**
|
||||
* @description 获取用户游戏数据
|
||||
* @since Alpha v0.2.0
|
||||
* @todo invalid uid
|
||||
* @description 这边的 ck 可以是 cookie_token 和 account_id
|
||||
* @description 也可以是 ltoken 和 ltuid
|
||||
* @param {Record<string, string>} cookie cookie
|
||||
* @param {TGApp.Sqlite.Account.Game} user 用户的基本信息
|
||||
* @returns {Promise<unknown>} 用户基本信息
|
||||
* @returns {Promise<TGApp.Game.Record.FullData|TGApp.BBS.Response.Base>} 用户基本信息
|
||||
*/
|
||||
export async function getGameRecord (cookie: Record<string, string>, user: TGApp.Sqlite.Account.Game): Promise<unknown> {
|
||||
const url = TGApi.GameData.getUserCard;
|
||||
export async function getGameRecord (cookie: Record<string, string>, user: TGApp.Sqlite.Account.Game): Promise<TGApp.Game.Record.FullData | TGApp.BBS.Response.Base> {
|
||||
const url = TGApi.GameData.getUserBase;
|
||||
const params = { role_id: user.gameUid, server: user.region };
|
||||
const header = TGUtils.User.getHeader(cookie, "GET", params, "common");
|
||||
return await http.fetch(url, {
|
||||
return await http.fetch<TGApp.Game.Record.Response>(url, {
|
||||
method: "GET",
|
||||
headers: header,
|
||||
query: params,
|
||||
}).then((res) => {
|
||||
console.log(res.data);
|
||||
return res.data;
|
||||
if (res.data.retcode !== 0) {
|
||||
return res.data;
|
||||
}
|
||||
return res.data.data;
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user