mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2026-03-15 03:53:16 +08:00
@@ -39,7 +39,9 @@
|
||||
导出(v4)
|
||||
</v-btn>
|
||||
<v-btn class="gacha-top-btn" prepend-icon="mdi-delete" @click="deleteGacha()">删除</v-btn>
|
||||
<v-btn class="gacha-top-btn" prepend-icon="mdi-delete" @click="checkData()">检测数据</v-btn>
|
||||
<v-btn class="gacha-top-btn" prepend-icon="mdi-database-check" @click="checkData()">
|
||||
检测数据
|
||||
</v-btn>
|
||||
</div>
|
||||
</template>
|
||||
</v-app-bar>
|
||||
@@ -405,8 +407,27 @@ async function deleteGacha(): Promise<void> {
|
||||
}
|
||||
|
||||
async function checkData(): Promise<void> {
|
||||
// TODO: 读取当前UID数据并补充itemId
|
||||
showSnackbar.warn("尚未实现");
|
||||
let cnt = 0;
|
||||
let fail = 0;
|
||||
await showLoading.start("正在检测数据", `UID:${uidCur.value},共${gachaListCur.value.length}条`);
|
||||
for (const data of gachaListCur.value) {
|
||||
if (data.itemId === "") {
|
||||
const find = hakushiData.value.find((i) => i.name === data.name && i.type === data.type);
|
||||
if (find) {
|
||||
await showLoading.update(`${data.name} -> ${find.id}`);
|
||||
await TSUserGacha.update.itemId(data, find.id);
|
||||
cnt++;
|
||||
} else {
|
||||
await showLoading.update(`[${data.id}]${data.type}-${data.name}未找到ID`);
|
||||
await TGLogger.Warn(`[${data.id}]${data.type}-${data.name}未找到ID`);
|
||||
fail++;
|
||||
}
|
||||
}
|
||||
}
|
||||
await showLoading.end();
|
||||
showSnackbar.success(`成功补充遗漏数据${cnt}条,失败${fail}条,即将刷新`);
|
||||
await new Promise<void>((resolve) => setTimeout(resolve, 1500));
|
||||
window.location.reload();
|
||||
}
|
||||
</script>
|
||||
<style lang="css" scoped>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* 用户祈愿模块
|
||||
* @since Beta v0.8.7
|
||||
* @since Beta v0.9.0
|
||||
*/
|
||||
|
||||
import showLoading from "@comp/func/loading.js";
|
||||
@@ -25,19 +25,19 @@ function getInsertSql(uid: string, gacha: TGApp.Plugins.UIGF.GachaItem): string
|
||||
INSERT INTO GachaRecords (uid, gachaType, itemId, count, time, name, type, rank, id, uigfType, updated)
|
||||
VALUES ('${uid}', '${gacha.gacha_type}', '${gacha.item_id ?? null}', '${gacha.count ?? null}', '${gacha.time}',
|
||||
'${gacha.name}', '${gacha.item_type ?? null}', '${gacha.rank_type ?? null}', '${gacha.id}',
|
||||
'${gacha.uigf_gacha_type}', datetime('now', 'localtime')) ON CONFLICT (id)
|
||||
DO
|
||||
UPDATE
|
||||
SET uid = '${uid}',
|
||||
gachaType = '${gacha.gacha_type}',
|
||||
uigfType = '${gacha.uigf_gacha_type}',
|
||||
time = '${gacha.time}',
|
||||
itemId = '${gacha.item_id ?? null}',
|
||||
count = '${gacha.count ?? null}',
|
||||
name = '${gacha.name}',
|
||||
type = '${gacha.item_type ?? null}',
|
||||
rank = '${gacha.rank_type ?? null}',
|
||||
updated = datetime('now', 'localtime');
|
||||
'${gacha.uigf_gacha_type}', datetime('now', 'localtime'))
|
||||
ON CONFLICT (id)
|
||||
DO UPDATE
|
||||
SET uid = '${uid}',
|
||||
gachaType = '${gacha.gacha_type}',
|
||||
uigfType = '${gacha.uigf_gacha_type}',
|
||||
time = '${gacha.time}',
|
||||
itemId = '${gacha.item_id ?? null}',
|
||||
count = '${gacha.count ?? null}',
|
||||
name = '${gacha.name}',
|
||||
type = '${gacha.item_type ?? null}',
|
||||
rank = '${gacha.rank_type ?? null}',
|
||||
updated = datetime('now', 'localtime');
|
||||
`;
|
||||
}
|
||||
|
||||
@@ -317,6 +317,21 @@ async function restoreUigf(dir: string): Promise<boolean> {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新单条数据ID
|
||||
* @since Beta v0.9.0
|
||||
* @param {TGApp.Sqlite.GachaRecords.TableGacha} raw - 原始数据
|
||||
* @param {number} itemId - 物品ID
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
async function updateItemIdById(
|
||||
raw: TGApp.Sqlite.GachaRecords.TableGacha,
|
||||
itemId: string,
|
||||
): Promise<void> {
|
||||
const db = await TGSqlite.getDB();
|
||||
await db.execute("UPDATE GachaRecords SET itemId = ? WHERE id = ?;", [itemId.toString(), raw.id]);
|
||||
}
|
||||
|
||||
const TSUserGacha = {
|
||||
getUidList,
|
||||
getGachaCheck,
|
||||
@@ -328,6 +343,9 @@ const TSUserGacha = {
|
||||
mergeUIGF4,
|
||||
backUpUigf,
|
||||
restoreUigf,
|
||||
update: {
|
||||
itemId: updateItemIdById,
|
||||
},
|
||||
};
|
||||
|
||||
export default TSUserGacha;
|
||||
|
||||
Reference in New Issue
Block a user