From 6c3c11c077b7489a224a33420811d2c6ef15f668 Mon Sep 17 00:00:00 2001 From: BTMuli Date: Mon, 12 Jan 2026 12:51:58 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20=E4=BF=AE=E5=A4=8D=E4=B8=8A?= =?UTF-8?q?=E4=BC=A0=E6=95=B0=E6=8D=AE=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/User/Gacha.vue | 20 ++++++++++++++++++-- src/plugins/Sqlite/modules/userGacha.ts | 24 ++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 2 deletions(-) diff --git a/src/pages/User/Gacha.vue b/src/pages/User/Gacha.vue index 4c22a7ad..b0472da5 100644 --- a/src/pages/User/Gacha.vue +++ b/src/pages/User/Gacha.vue @@ -299,8 +299,24 @@ async function handleHutaoUpload(uids: Array): Promise { await showLoading.start("正在上传至胡桃云...", "正在刷新Token"); await hutaoStore.tryRefreshToken(); for (const u of uids) { - await showLoading.update(`正在上传UID:${u}`); - const dataRaw = await TSUserGacha.record.all(u); + await showLoading.start(`正在上传UID:${u}`, "正在获取EndId"); + let endIdRes: TGApp.Plugins.Hutao.Gacha.EndIdRes = { + "100": 0, + "200": 0, + "301": 0, + "302": 0, + "500": 0, + }; + const endIdResp = await hutao.Gacha.endIds(accessToken.value!, u); + if ("retcode" in endIdResp) { + showSnackbar.warn(`[${endIdResp.retcode}] ${endIdResp.message}`); + } else endIdRes = endIdResp; + const dataRaw: Array = []; + for (const [k, v] of Object.entries(endIdRes)) { + const gachaRead = await TSUserGacha.record.endId(u, k, v.toString()); + await showLoading.update(`${k}-${v.toString()}-${gachaRead.length}条`); + dataRaw.push(...gachaRead); + } const data: TGApp.Plugins.Hutao.Gacha.UploadData = { Uid: u, Items: dataRaw.map((i) => ({ diff --git a/src/plugins/Sqlite/modules/userGacha.ts b/src/plugins/Sqlite/modules/userGacha.ts index 150c85fd..97928a29 100644 --- a/src/plugins/Sqlite/modules/userGacha.ts +++ b/src/plugins/Sqlite/modules/userGacha.ts @@ -122,6 +122,29 @@ async function getGachaRecords(uid: string): Promise> { + const db = await TGSqlite.getDB(); + if (endId && endId !== "0") { + return await db.select( + "SELECT * FROM GachaRecords WHERE uid = ? AND uigfType = ? AND id > ?;", + [uid, pool, endId], + ); + } + return await db.select("SELECT * FROM GachaRecords WHERE uid = ? AND uigfType = ?;", [uid, pool]); +} + /** * 获取用户祈愿记录,并按照日期进行分组排序 * @since Beta v0.6.8 @@ -404,6 +427,7 @@ const TSUserGacha = { }, record: { all: getGachaRecords, + endId: getGachaRecordsByEndId, time: getGachaRecordsByDate, pool: getGachaRecordsByPool, },