mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2026-03-17 04:13:17 +08:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
69cede4274 | ||
|
|
20e942b8a8 | ||
|
|
82c06c3727 |
@@ -2,12 +2,16 @@
|
||||
Author: 目棃
|
||||
Description: CHANGELOG
|
||||
Date: 2024-10-09
|
||||
Update: 2025-05-06
|
||||
Update: 2025-05-09
|
||||
---
|
||||
|
||||
> 本文档 [`Frontmatter`](https://github.com/BTMuli/MuCli#Frontmatter) 由 [MuCli](https://github.com/BTMuli/Mucli) 自动生成于 `2024-10-09 15:51:43`
|
||||
>
|
||||
> 更新于 `2025-05-06 13:52:36`
|
||||
> 更新于 `2025-05-09 12:06:20`
|
||||
|
||||
## [0.7.5](https://github.com/BTMuli/TeyvatGuide/releases/v0.7.5) (2025-05-09)
|
||||
|
||||
- 🐛 处理UIGF时区异常 [`#155`](https://github.com/BTMuli/TeyvatGuide/issues/155)
|
||||
|
||||
## [0.7.4](https://github.com/BTMuli/TeyvatGuide/releases/v0.7.4) (2025-05-06)
|
||||
|
||||
|
||||
12
package.json
12
package.json
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "teyvatguide",
|
||||
"version": "0.7.4",
|
||||
"version": "0.7.5",
|
||||
"description": "Game Tool for GenshinImpact player",
|
||||
"private": true,
|
||||
"packageManager": "pnpm@10.10.0",
|
||||
@@ -109,9 +109,9 @@
|
||||
"@types/color-convert": "^2.0.4",
|
||||
"@types/fs-extra": "^11.0.4",
|
||||
"@types/js-md5": "^0.7.2",
|
||||
"@types/node": "^22.15.3",
|
||||
"@types/node": "^22.15.14",
|
||||
"@types/uuid": "^10.0.0",
|
||||
"@typescript-eslint/parser": "^8.31.1",
|
||||
"@typescript-eslint/parser": "^8.32.0",
|
||||
"@vitejs/plugin-vue": "^5.2.3",
|
||||
"concurrently": "^9.1.2",
|
||||
"eslint": "^9.26.0",
|
||||
@@ -124,7 +124,7 @@
|
||||
"globals": "^16.0.0",
|
||||
"husky": "^9.1.7",
|
||||
"jsonc-eslint-parser": "^2.4.0",
|
||||
"lint-staged": "^15.5.1",
|
||||
"lint-staged": "^15.5.2",
|
||||
"oxlint": "^0.16.9",
|
||||
"prettier": "3.5.3",
|
||||
"stylelint": "^16.19.1",
|
||||
@@ -134,10 +134,10 @@
|
||||
"stylelint-high-performance-animation": "^1.11.0",
|
||||
"stylelint-order": "^7.0.0",
|
||||
"stylelint-prettier": "^5.0.3",
|
||||
"stylelint-scss": "^6.11.1",
|
||||
"stylelint-scss": "^6.12.0",
|
||||
"tsx": "^4.19.4",
|
||||
"typescript": "^5.8.3",
|
||||
"typescript-eslint": "^8.31.1",
|
||||
"typescript-eslint": "^8.32.0",
|
||||
"vite": "^6.3.5",
|
||||
"vite-plugin-vue-devtools": "^7.7.6",
|
||||
"vite-plugin-vuetify": "^2.1.1",
|
||||
|
||||
709
pnpm-lock.yaml
generated
709
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
75
src-tauri/Cargo.lock
generated
75
src-tauri/Cargo.lock
generated
@@ -4,7 +4,7 @@ version = 4
|
||||
|
||||
[[package]]
|
||||
name = "TeyvatGuide"
|
||||
version = "0.7.4"
|
||||
version = "0.7.5"
|
||||
dependencies = [
|
||||
"chrono",
|
||||
"log",
|
||||
@@ -325,9 +325,9 @@ checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26"
|
||||
|
||||
[[package]]
|
||||
name = "backtrace"
|
||||
version = "0.3.74"
|
||||
version = "0.3.75"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8d82cb332cdfaed17ae235a638438ac4d4839913cc2af585c3c6746e8f8bee1a"
|
||||
checksum = "6806a6321ec58106fea15becdad98371e28d92ccbc7c8f1b3b6dd724fe8f1002"
|
||||
dependencies = [
|
||||
"addr2line",
|
||||
"cfg-if",
|
||||
@@ -1990,7 +1990,7 @@ dependencies = [
|
||||
"tokio",
|
||||
"tokio-rustls",
|
||||
"tower-service",
|
||||
"webpki-roots",
|
||||
"webpki-roots 0.26.11",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -2412,9 +2412,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "libm"
|
||||
version = "0.2.14"
|
||||
version = "0.2.15"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a25169bd5913a4b437588a7e3d127cd6e90127b60e0ffbd834a38f1599e016b8"
|
||||
checksum = "f9fbbcab51052fe104eb5e5d351cf728d30a5be1fe14d9be8a3b097481fb97de"
|
||||
|
||||
[[package]]
|
||||
name = "libredox"
|
||||
@@ -3733,7 +3733,7 @@ dependencies = [
|
||||
"wasm-bindgen-futures",
|
||||
"wasm-streams",
|
||||
"web-sys",
|
||||
"webpki-roots",
|
||||
"webpki-roots 0.26.11",
|
||||
"windows-registry 0.4.0",
|
||||
]
|
||||
|
||||
@@ -3901,9 +3901,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rustls"
|
||||
version = "0.23.26"
|
||||
version = "0.23.27"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "df51b5869f3a441595eac5e8ff14d486ff285f7b8c0df8770e49c3b56351f0f0"
|
||||
checksum = "730944ca083c1c233a75c09f199e973ca499344a2b7ba9e755c457e86fb4a321"
|
||||
dependencies = [
|
||||
"once_cell",
|
||||
"ring",
|
||||
@@ -3933,9 +3933,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rustls-webpki"
|
||||
version = "0.103.1"
|
||||
version = "0.103.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fef8b8769aaccf73098557a87cd1816b4f9c7c16811c9c77142aa695c16f2c03"
|
||||
checksum = "7149975849f1abb3832b246010ef62ccc80d3a76169517ada7188252b9cfb437"
|
||||
dependencies = [
|
||||
"ring",
|
||||
"rustls-pki-types",
|
||||
@@ -4900,7 +4900,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "tauri-plugin-deep-link"
|
||||
version = "2.2.1"
|
||||
source = "git+ssh://git@github.com/tauri-apps/plugins-workspace.git?branch=v2#98e268a98fd31f8f57c2611826478b76a43cfe0b"
|
||||
source = "git+ssh://git@github.com/tauri-apps/plugins-workspace.git?branch=v2#323afd1b6d03a101375aa47f820f85b96ec210da"
|
||||
dependencies = [
|
||||
"dunce",
|
||||
"rust-ini",
|
||||
@@ -4919,7 +4919,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "tauri-plugin-dialog"
|
||||
version = "2.2.1"
|
||||
source = "git+ssh://git@github.com/tauri-apps/plugins-workspace.git?branch=v2#98e268a98fd31f8f57c2611826478b76a43cfe0b"
|
||||
source = "git+ssh://git@github.com/tauri-apps/plugins-workspace.git?branch=v2#323afd1b6d03a101375aa47f820f85b96ec210da"
|
||||
dependencies = [
|
||||
"log",
|
||||
"raw-window-handle",
|
||||
@@ -4936,7 +4936,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "tauri-plugin-fs"
|
||||
version = "2.2.1"
|
||||
source = "git+ssh://git@github.com/tauri-apps/plugins-workspace.git?branch=v2#98e268a98fd31f8f57c2611826478b76a43cfe0b"
|
||||
source = "git+ssh://git@github.com/tauri-apps/plugins-workspace.git?branch=v2#323afd1b6d03a101375aa47f820f85b96ec210da"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"dunce",
|
||||
@@ -4957,7 +4957,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "tauri-plugin-http"
|
||||
version = "2.4.3"
|
||||
source = "git+ssh://git@github.com/tauri-apps/plugins-workspace.git?branch=v2#98e268a98fd31f8f57c2611826478b76a43cfe0b"
|
||||
source = "git+ssh://git@github.com/tauri-apps/plugins-workspace.git?branch=v2#323afd1b6d03a101375aa47f820f85b96ec210da"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"cookie_store",
|
||||
@@ -4980,7 +4980,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "tauri-plugin-log"
|
||||
version = "2.4.0"
|
||||
source = "git+ssh://git@github.com/tauri-apps/plugins-workspace.git?branch=v2#98e268a98fd31f8f57c2611826478b76a43cfe0b"
|
||||
source = "git+ssh://git@github.com/tauri-apps/plugins-workspace.git?branch=v2#323afd1b6d03a101375aa47f820f85b96ec210da"
|
||||
dependencies = [
|
||||
"android_logger",
|
||||
"byte-unit",
|
||||
@@ -5001,7 +5001,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "tauri-plugin-opener"
|
||||
version = "2.2.6"
|
||||
source = "git+ssh://git@github.com/tauri-apps/plugins-workspace.git?branch=v2#98e268a98fd31f8f57c2611826478b76a43cfe0b"
|
||||
source = "git+ssh://git@github.com/tauri-apps/plugins-workspace.git?branch=v2#323afd1b6d03a101375aa47f820f85b96ec210da"
|
||||
dependencies = [
|
||||
"dunce",
|
||||
"glob",
|
||||
@@ -5022,7 +5022,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "tauri-plugin-os"
|
||||
version = "2.2.1"
|
||||
source = "git+ssh://git@github.com/tauri-apps/plugins-workspace.git?branch=v2#98e268a98fd31f8f57c2611826478b76a43cfe0b"
|
||||
source = "git+ssh://git@github.com/tauri-apps/plugins-workspace.git?branch=v2#323afd1b6d03a101375aa47f820f85b96ec210da"
|
||||
dependencies = [
|
||||
"gethostname",
|
||||
"log",
|
||||
@@ -5039,7 +5039,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "tauri-plugin-process"
|
||||
version = "2.2.1"
|
||||
source = "git+ssh://git@github.com/tauri-apps/plugins-workspace.git?branch=v2#98e268a98fd31f8f57c2611826478b76a43cfe0b"
|
||||
source = "git+ssh://git@github.com/tauri-apps/plugins-workspace.git?branch=v2#323afd1b6d03a101375aa47f820f85b96ec210da"
|
||||
dependencies = [
|
||||
"tauri",
|
||||
"tauri-plugin",
|
||||
@@ -5048,7 +5048,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "tauri-plugin-shell"
|
||||
version = "2.2.1"
|
||||
source = "git+ssh://git@github.com/tauri-apps/plugins-workspace.git?branch=v2#98e268a98fd31f8f57c2611826478b76a43cfe0b"
|
||||
source = "git+ssh://git@github.com/tauri-apps/plugins-workspace.git?branch=v2#323afd1b6d03a101375aa47f820f85b96ec210da"
|
||||
dependencies = [
|
||||
"encoding_rs",
|
||||
"log",
|
||||
@@ -5068,7 +5068,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "tauri-plugin-single-instance"
|
||||
version = "2.2.3"
|
||||
source = "git+ssh://git@github.com/tauri-apps/plugins-workspace.git?branch=v2#98e268a98fd31f8f57c2611826478b76a43cfe0b"
|
||||
source = "git+ssh://git@github.com/tauri-apps/plugins-workspace.git?branch=v2#323afd1b6d03a101375aa47f820f85b96ec210da"
|
||||
dependencies = [
|
||||
"serde",
|
||||
"serde_json",
|
||||
@@ -5082,7 +5082,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "tauri-plugin-sql"
|
||||
version = "2.2.0"
|
||||
source = "git+ssh://git@github.com/tauri-apps/plugins-workspace.git?branch=v2#98e268a98fd31f8f57c2611826478b76a43cfe0b"
|
||||
source = "git+ssh://git@github.com/tauri-apps/plugins-workspace.git?branch=v2#323afd1b6d03a101375aa47f820f85b96ec210da"
|
||||
dependencies = [
|
||||
"futures-core",
|
||||
"indexmap 2.9.0",
|
||||
@@ -5334,9 +5334,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
|
||||
|
||||
[[package]]
|
||||
name = "tokio"
|
||||
version = "1.44.2"
|
||||
version = "1.45.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e6b88822cbe49de4185e3a4cbf8321dd487cf5fe0c5c65695fef6346371e9c48"
|
||||
checksum = "2513ca694ef9ede0fb23fe71a4ee4107cb102b9dc1930f6d0fd77aae068ae165"
|
||||
dependencies = [
|
||||
"backtrace",
|
||||
"bytes",
|
||||
@@ -5449,7 +5449,7 @@ dependencies = [
|
||||
"serde_spanned",
|
||||
"toml_datetime",
|
||||
"toml_write",
|
||||
"winnow 0.7.9",
|
||||
"winnow 0.7.10",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -5952,9 +5952,18 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "webpki-roots"
|
||||
version = "0.26.10"
|
||||
version = "0.26.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "37493cadf42a2a939ed404698ded7fb378bf301b5011f973361779a3a74f8c93"
|
||||
checksum = "521bc38abb08001b01866da9f51eb7c5d647a19260e00054a8c7fd5f9e57f7a9"
|
||||
dependencies = [
|
||||
"webpki-roots 1.0.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "webpki-roots"
|
||||
version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2853738d1cc4f2da3a225c18ec6c3721abb31961096e9dbf5ab35fa88b19cfdb"
|
||||
dependencies = [
|
||||
"rustls-pki-types",
|
||||
]
|
||||
@@ -6481,9 +6490,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "winnow"
|
||||
version = "0.7.9"
|
||||
version = "0.7.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d9fb597c990f03753e08d3c29efbfcf2019a003b4bf4ba19225c158e1549f0f3"
|
||||
checksum = "c06928c8748d81b05c9be96aad92e1b6ff01833332f281e8cfca3be4b35fc9ec"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
@@ -6645,7 +6654,7 @@ dependencies = [
|
||||
"tracing",
|
||||
"uds_windows",
|
||||
"windows-sys 0.59.0",
|
||||
"winnow 0.7.9",
|
||||
"winnow 0.7.10",
|
||||
"zbus_macros",
|
||||
"zbus_names",
|
||||
"zvariant",
|
||||
@@ -6674,7 +6683,7 @@ checksum = "7be68e64bf6ce8db94f63e72f0c7eb9a60d733f7e0499e628dfab0f84d6bcb97"
|
||||
dependencies = [
|
||||
"serde",
|
||||
"static_assertions",
|
||||
"winnow 0.7.9",
|
||||
"winnow 0.7.10",
|
||||
"zvariant",
|
||||
]
|
||||
|
||||
@@ -6757,7 +6766,7 @@ dependencies = [
|
||||
"enumflags2",
|
||||
"serde",
|
||||
"url",
|
||||
"winnow 0.7.9",
|
||||
"winnow 0.7.10",
|
||||
"zvariant_derive",
|
||||
"zvariant_utils",
|
||||
]
|
||||
@@ -6786,5 +6795,5 @@ dependencies = [
|
||||
"serde",
|
||||
"static_assertions",
|
||||
"syn 2.0.101",
|
||||
"winnow 0.7.9",
|
||||
"winnow 0.7.10",
|
||||
]
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "TeyvatGuide"
|
||||
version = "0.7.4"
|
||||
version = "0.7.5"
|
||||
description = "Game Tool for Genshin Impact player"
|
||||
authors = ["BTMuli <bt-muli@outlook.com>"]
|
||||
license = "MIT"
|
||||
@@ -20,7 +20,7 @@ crate-type = ["staticlib", "cdylib", "rlib"]
|
||||
tauri-build = { version = "2.2.0", features = [] }
|
||||
|
||||
[dependencies]
|
||||
chrono = "0.4.40"
|
||||
chrono = "0.4.41"
|
||||
log = "0.4.27"
|
||||
serde = { version = "1.0.219", features = ["derive"] }
|
||||
serde_json = "1.0.140"
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"$schema": "https://schema.tauri.app/config/2",
|
||||
"productName": "TeyvatGuide",
|
||||
"identifier": "TeyvatGuide",
|
||||
"version": "0.7.4",
|
||||
"version": "0.7.5",
|
||||
"build": {
|
||||
"beforeDevCommand": "pnpm vite:dev",
|
||||
"beforeBuildCommand": "pnpm vite:build",
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* @file plugins/Sqlite/modules/userGacha.ts
|
||||
* @description 用户祈愿模块
|
||||
* @since Beta v0.6.8
|
||||
* @since Beta v0.7.5
|
||||
*/
|
||||
|
||||
import showSnackbar from "@comp/func/snackbar.js";
|
||||
@@ -10,7 +10,7 @@ import { path } from "@tauri-apps/api";
|
||||
import { exists, mkdir, readDir } from "@tauri-apps/plugin-fs";
|
||||
|
||||
import TGLogger from "@/utils/TGLogger.js";
|
||||
import { getWikiBrief } from "@/utils/toolFunc.js";
|
||||
import { getWikiBrief, timestampToDate } from "@/utils/toolFunc.js";
|
||||
import { exportUigfData, readUigfData, verifyUigfData } from "@/utils/UIGF.js";
|
||||
|
||||
/**
|
||||
@@ -41,20 +41,38 @@ function getInsertSql(uid: string, gacha: TGApp.Plugins.UIGF.GachaItem): string
|
||||
`;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 传入时间字符串跟对应时区,转成utc8时间字符串
|
||||
* @since Beta v0.7.5
|
||||
* @param {string} time - 时间字符串
|
||||
* @param {number} timezone - 时区
|
||||
* @return {string} 转换后的时间戳
|
||||
*/
|
||||
function getUtc8Time(time: string, timezone: number): string {
|
||||
const date = new Date(time);
|
||||
const diffTimezone = -timezone + 8;
|
||||
const realDate = new Date(date.getTime() + diffTimezone * 60 * 60 * 1000);
|
||||
return timestampToDate(realDate.getTime());
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 转换祈愿数据,防止多语言
|
||||
* @since Beta v0.6.8
|
||||
* @since Beta v0.7.5
|
||||
* @param {TGApp.Plugins.UIGF.GachaItem} gacha - UIGF数据
|
||||
* @param {number} timezone - 时区
|
||||
* @return {TGApp.Plugins.UIGF.GachaItem} 转换后的数据
|
||||
*/
|
||||
function transGacha(gacha: TGApp.Plugins.UIGF.GachaItem): TGApp.Plugins.UIGF.GachaItem {
|
||||
function transGacha(
|
||||
gacha: TGApp.Plugins.UIGF.GachaItem,
|
||||
timezone: number = 8,
|
||||
): TGApp.Plugins.UIGF.GachaItem {
|
||||
const find = getWikiBrief(gacha.item_id);
|
||||
if (!find) return gacha;
|
||||
return {
|
||||
gacha_type: gacha.gacha_type,
|
||||
item_id: gacha.item_id,
|
||||
count: gacha.count ?? "1",
|
||||
time: gacha.time,
|
||||
time: getUtc8Time(gacha.time, timezone),
|
||||
name: find.name,
|
||||
item_type: "element" in find ? "角色" : "武器",
|
||||
rank_type: find.star.toString(),
|
||||
@@ -204,7 +222,7 @@ async function mergeUIGF(uid: string, data: TGApp.Plugins.UIGF.GachaItem[]): Pro
|
||||
async function mergeUIGF4(data: TGApp.Plugins.UIGF.GachaHk4e): Promise<void> {
|
||||
const db = await TGSqlite.getDB();
|
||||
for (const gacha of data.list) {
|
||||
const trans = transGacha(gacha);
|
||||
const trans = transGacha(gacha, data.timezone);
|
||||
const sql = getInsertSql(data.uid.toString(), trans);
|
||||
await db.execute(sql);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* @file utils/UIGF.ts
|
||||
* @description UIGF工具类
|
||||
* @since Beta v0.6.5
|
||||
* @since Beta v0.7.5
|
||||
*/
|
||||
|
||||
import showSnackbar from "@comp/func/snackbar.js";
|
||||
@@ -28,13 +28,28 @@ function getUigfTimeZone(uid: string): number {
|
||||
return 8;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 传入utc8时间字符串跟目标时区,转成目标时区时间字符串
|
||||
* @since Beta v0.7.5
|
||||
* @param {string} time - 时间字符串
|
||||
* @param {number} timezone - 时区
|
||||
* @return {string} 转换后的时间字符串
|
||||
*/
|
||||
function getExportTime(time: string, timezone: number): string {
|
||||
const date = new Date(time);
|
||||
const diffTimezone = -8 + timezone;
|
||||
const realDate = new Date(date.getTime() + diffTimezone * 60 * 60 * 1000);
|
||||
return timestampToDate(realDate.getTime());
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 获取 UIGF 头部信息
|
||||
* @since Beta v0.4.4
|
||||
* @since Beta v0.7.5
|
||||
* @param {string} uid - UID
|
||||
* @param {number} timezone - 时区
|
||||
* @returns {Promise<TGApp.Plugins.UIGF.Info>}
|
||||
*/
|
||||
async function getUigfHeader(uid: string): Promise<TGApp.Plugins.UIGF.Info> {
|
||||
async function getUigfHeader(uid: string, timezone: number): Promise<TGApp.Plugins.UIGF.Info> {
|
||||
const stamp = Date.now();
|
||||
return {
|
||||
uid,
|
||||
@@ -44,7 +59,7 @@ async function getUigfHeader(uid: string): Promise<TGApp.Plugins.UIGF.Info> {
|
||||
export_time: timestampToDate(stamp),
|
||||
export_app: "TeyvatGuide",
|
||||
export_app_version: await app.getVersion(),
|
||||
region_time_zone: getUigfTimeZone(uid),
|
||||
region_time_zone: timezone,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -66,19 +81,21 @@ export async function getUigf4Header(): Promise<TGApp.Plugins.UIGF.Info4> {
|
||||
|
||||
/**
|
||||
* @description 数据转换-数据库到 UIGF
|
||||
* @since Alpha v0.2.3
|
||||
* @since Beta v0.7.5
|
||||
* @param {TGApp.Sqlite.GachaRecords.SingleTable[]} data - 数据库数据
|
||||
* @param {number} timezone - 时区
|
||||
* @returns {TGApp.Plugins.UIGF.GachaItem[]} UIGF 数据
|
||||
*/
|
||||
function convertDataToUigf(
|
||||
data: TGApp.Sqlite.GachaRecords.SingleTable[],
|
||||
timezone: number,
|
||||
): TGApp.Plugins.UIGF.GachaItem[] {
|
||||
return data.map((gacha) => {
|
||||
return {
|
||||
gacha_type: gacha.gachaType,
|
||||
item_id: gacha.itemId,
|
||||
count: gacha.count,
|
||||
time: gacha.time,
|
||||
time: getExportTime(gacha.time, timezone),
|
||||
name: gacha.name,
|
||||
item_type: gacha.type,
|
||||
rank_type: gacha.rank,
|
||||
@@ -172,7 +189,7 @@ export async function readUigf4Data(userPath: string): Promise<TGApp.Plugins.UIG
|
||||
|
||||
/**
|
||||
* @description 导出 UIGF 数据
|
||||
* @since Beta v0.5.0
|
||||
* @since Beta v0.7.5
|
||||
* @param {string} uid - UID
|
||||
* @param {TGApp.Sqlite.GachaRecords.SingleTable[]} gachaList - 祈愿列表
|
||||
* @param {string} savePath - 保存路径
|
||||
@@ -183,21 +200,23 @@ export async function exportUigfData(
|
||||
gachaList: TGApp.Sqlite.GachaRecords.SingleTable[],
|
||||
savePath?: string,
|
||||
): Promise<void> {
|
||||
const UigfData = { info: await getUigfHeader(uid), list: convertDataToUigf(gachaList) };
|
||||
const timezone = getUigfTimeZone(uid);
|
||||
const UigfData = {
|
||||
info: await getUigfHeader(uid, timezone),
|
||||
list: convertDataToUigf(gachaList, timezone),
|
||||
};
|
||||
const filePath = savePath ?? `${await path.appLocalDataDir()}userData\\UIGF_${uid}.json`;
|
||||
await writeTextFile(filePath, JSON.stringify(UigfData));
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 获取单项UID的UIGF4.0数据
|
||||
* @since Beta v0.7.5
|
||||
* @param {string} uid - UID
|
||||
* @returns {Promise<TGApp.Plugins.UIGF.GachaHk4e>}
|
||||
*/
|
||||
export async function getUigf4Item(uid: string): Promise<TGApp.Plugins.UIGF.GachaHk4e> {
|
||||
const gachaList = await TSUserGacha.getGachaRecords(uid);
|
||||
return {
|
||||
uid: uid,
|
||||
timezone: getUigfTimeZone(uid),
|
||||
list: convertDataToUigf(gachaList),
|
||||
};
|
||||
const timezone = getUigfTimeZone(uid);
|
||||
return { uid: uid, timezone: timezone, list: convertDataToUigf(gachaList, timezone) };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user