mirror of
https://github.com/ZZZure/ZZZ-Plugin.git
synced 2025-12-16 05:07:46 +00:00
fix:调整查询方式
This commit is contained in:
parent
763e82b6cd
commit
5f0554263b
2 changed files with 7 additions and 12 deletions
|
|
@ -125,9 +125,9 @@ export class GachaLog extends ZZZPlugin {
|
||||||
const uid = await this.getUID();
|
const uid = await this.getUID();
|
||||||
if (!uid) return false;
|
if (!uid) return false;
|
||||||
if (/^(1[0-9])[0-9]{8}/i.test(uid)) {
|
if (/^(1[0-9])[0-9]{8}/i.test(uid)) {
|
||||||
const { api } = await this.getAPI();
|
const { api, deviceFp } = await this.getAPI();
|
||||||
this.reply('抽卡记录获取中请稍等...可能需要一段时间,请耐心等待');
|
this.reply('抽卡记录获取中请稍等...可能需要一段时间,请耐心等待');
|
||||||
const { data, count } = await updateGachaLog(api, uid);
|
const { data, count } = await updateGachaLog(api, uid, deviceFp);
|
||||||
let msg = [];
|
let msg = [];
|
||||||
msg.push(`抽卡记录更新成功,共${Object.keys(data).length}个卡池`);
|
msg.push(`抽卡记录更新成功,共${Object.keys(data).length}个卡池`);
|
||||||
for (const name in data) {
|
for (const name in data) {
|
||||||
|
|
|
||||||
15
lib/gacha.js
15
lib/gacha.js
|
|
@ -14,7 +14,6 @@ import {
|
||||||
} from './gacha/const.js';
|
} from './gacha/const.js';
|
||||||
import { getLevelFromList } from './gacha/tool.js';
|
import { getLevelFromList } from './gacha/tool.js';
|
||||||
import { getZZZGachaLogByAuthkey } from './gacha/core.js';
|
import { getZZZGachaLogByAuthkey } from './gacha/core.js';
|
||||||
import request from '../utils/request.js';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新抽卡数据
|
* 更新抽卡数据
|
||||||
|
|
@ -62,18 +61,14 @@ export const updateGachaLog = async (authKey, uid, region, game_biz) => {
|
||||||
queryLabel: while (true) {
|
queryLabel: while (true) {
|
||||||
if (/^(1[0-9])[0-9]{8}/i.test(uid)) {
|
if (/^(1[0-9])[0-9]{8}/i.test(uid)) {
|
||||||
const api = authKey;
|
const api = authKey;
|
||||||
|
const deviceFp = region;
|
||||||
// 获取抽卡记录
|
// 获取抽卡记录
|
||||||
const sdk = api.getUrl('zzzGacha_Record', { type, endId } );
|
const log = await api.getFinalData('zzzGacha_Record', { deviceFp, type, endId } );
|
||||||
const res = await request(sdk.url, {
|
if (!log || !log?.gacha_item_list || log?.gacha_item_list?.length === 0) {
|
||||||
headers: sdk.headers,
|
|
||||||
method: 'get',
|
|
||||||
});
|
|
||||||
const log = await res.json();
|
|
||||||
if (!log || !log?.data?.gacha_item_list || log?.data?.gacha_item_list?.length === 0) {
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// 遍历数据 (从最新的开始)
|
// 遍历数据 (从最新的开始)
|
||||||
for (let item of log.data.gacha_item_list) {
|
for (let item of log.gacha_item_list) {
|
||||||
item = {
|
item = {
|
||||||
uid: uid,
|
uid: uid,
|
||||||
gacha_id: '0',
|
gacha_id: '0',
|
||||||
|
|
@ -98,7 +93,7 @@ export const updateGachaLog = async (authKey, uid, region, game_biz) => {
|
||||||
newCount[name]++;
|
newCount[name]++;
|
||||||
}
|
}
|
||||||
// 更新页数和最后一个数据的 id
|
// 更新页数和最后一个数据的 id
|
||||||
endId = log.data.gacha_item_list[log.data.gacha_item_list.length - 1]?.id || endId;
|
endId = log.gacha_item_list[log.gacha_item_list.length - 1]?.id || endId;
|
||||||
} else {
|
} else {
|
||||||
// 获取抽卡记录
|
// 获取抽卡记录
|
||||||
const log = await getZZZGachaLogByAuthkey(
|
const log = await getZZZGachaLogByAuthkey(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue