fix: gachalog

This commit is contained in:
bietiaop 2024-07-12 00:32:01 +08:00
parent 46cd40fbc7
commit cbef7478c2
3 changed files with 106 additions and 12 deletions

View file

@ -9,22 +9,22 @@ export const gacha_type_meta_data = {
常驻频段: ['1001'],
邦布频段: ['5001'],
};
/**
*
* @param {string} authKey
* @param {*} gachaType
* @param {*} initLogGachaBaseType
* @param {string} gachaType
* @param {string} initLogGachaBaseType
* @param {number} page
* @param {string} endId
* @returns {Promise<ZZZGachaLogResp>}
* @returns {Promise<string>}
*/
export async function getZZZGachaLogByAuthkey(
export const getZZZGachaLink = async (
authKey,
gachaType = '2001',
initLogGachaBaseType = '2',
page = 1,
endId = '0'
) {
) => {
const serverId = 'prod_gf_cn';
const url = ZZZ_GET_GACHA_LOG_API;
const timestamp = Math.floor(Date.now() / 1000);
@ -50,7 +50,34 @@ export async function getZZZGachaLogByAuthkey(
end_id: endId,
});
const response = await fetch(`${url}?${params}`, {
return `${url}?${params}`;
};
/**
*
* @param {string} authKey
* @param {*} gachaType
* @param {*} initLogGachaBaseType
* @param {number} page
* @param {string} endId
* @returns {Promise<ZZZGachaLogResp>}
*/
export async function getZZZGachaLogByAuthkey(
authKey,
gachaType = '2001',
initLogGachaBaseType = '2',
page = 1,
endId = '0'
) {
const link = await getZZZGachaLink(
authKey,
gachaType,
initLogGachaBaseType,
page,
endId
);
const response = await fetch(link, {
method: 'GET',
headers: {
'Content-Type': 'application/json',
@ -228,7 +255,7 @@ export async function anaylizeGachaLog(uid) {
}
i++;
}
const upCount = list.length;
const upCount = list.filter(i => i.isUp).length;
const totalCount = data.length;
const fiveStars = list.length;
let timeRange = '还没有抽卡';