feat(uigf): support UIGFv4.0(Beta)

Users don't have to delete their data. New data structure is used automatically when new data is fetched

- Set `count` to `"1"` as default for old data
- Record `count` from API
- Link to the UIGF website

BREAKING CHANGE: SRGF is no longer supported, use UIGFv4.0(Beta) instead
This commit is contained in:
2024-07-23 11:10:27 +08:00
parent f1e3b76d85
commit 0e4f3599c9
9 changed files with 43 additions and 30 deletions

View File

@ -58,6 +58,13 @@ const readData = async () => {
const data = await readJSON(dataPath, name)
data.typeMap = new Map(data.typeMap) || defaultTypeMap
data.result = new Map(data.result)
data.result.forEach((value, key) => {
value.forEach(item => {
if (!('count' in item)) {
item.count = "1";
}
});
});
if (data.uid) {
dataMap.set(data.uid, data)
}
@ -423,8 +430,8 @@ const fetchData = async (urlOverride) => {
for (const type of gachaType) {
const { list, uid, region, region_time_zone } = await getGachaLogs(type, queryString)
const logs = list.map((item) => {
const { id, item_id, item_type, name, rank_type, time, gacha_id, gacha_type } = item
return { id, item_id, item_type, name, rank_type, time, gacha_id, gacha_type }
const { id, item_id, item_type, name, rank_type, time, gacha_id, gacha_type, count} = item
return { id, item_id, item_type, name, rank_type, time, gacha_id, gacha_type, count }
})
logs.reverse()
typeMap.set(type.key, type.name)