mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2025-12-14 09:38:13 +08:00
🐛 修复导出字段数据缺失
This commit is contained in:
@@ -41,8 +41,7 @@
|
|||||||
"status": {
|
"status": {
|
||||||
"type": "number",
|
"type": "number",
|
||||||
"description": "Finished status",
|
"description": "Finished status",
|
||||||
"enum": [0, 1, 2, 3],
|
"enum": [0, 1, 2, 3]
|
||||||
"enumDesc": "ACHIEVEMENT_INVALID = 0; ACHIEVEMENT_UNFINISHED = 1; ACHIEVEMENT_FINISHED = 2;ACHIEVEMENT_POINT_TAKEN = 3;"
|
|
||||||
},
|
},
|
||||||
"timestamp": {
|
"timestamp": {
|
||||||
"type": "number",
|
"type": "number",
|
||||||
|
|||||||
@@ -141,10 +141,12 @@ async function updateAchievement(data: TGApp.Sqlite.Achievement.SingleTable): Pr
|
|||||||
*/
|
*/
|
||||||
function transDb2Uiaf(data: TGApp.Sqlite.Achievement.SingleTable): TGApp.Plugins.UIAF.Achievement {
|
function transDb2Uiaf(data: TGApp.Sqlite.Achievement.SingleTable): TGApp.Plugins.UIAF.Achievement {
|
||||||
const isCompleted = data.isCompleted === 1;
|
const isCompleted = data.isCompleted === 1;
|
||||||
|
let timestamp = 0;
|
||||||
|
if (isCompleted) timestamp = new Date(data.completedTime).getTime();
|
||||||
const status = getUiafStatus(isCompleted, data.progress);
|
const status = getUiafStatus(isCompleted, data.progress);
|
||||||
return {
|
return {
|
||||||
id: data.id,
|
id: data.id,
|
||||||
timestamp: data.timestamp,
|
timestamp: timestamp,
|
||||||
current: data.progress,
|
current: data.progress,
|
||||||
status,
|
status,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ export async function getUiafHeader(): Promise<TGApp.Plugins.UIAF.Export> {
|
|||||||
*/
|
*/
|
||||||
export async function verifyUiafData(path: string): Promise<boolean> {
|
export async function verifyUiafData(path: string): Promise<boolean> {
|
||||||
const fileData: string = await fs.readTextFile(path);
|
const fileData: string = await fs.readTextFile(path);
|
||||||
const ajv = new Ajv({ strict: false });
|
const ajv = new Ajv();
|
||||||
const validate = ajv.compile(UiafSchema);
|
const validate = ajv.compile(UiafSchema);
|
||||||
try {
|
try {
|
||||||
const fileJson = JSON.parse(fileData);
|
const fileJson = JSON.parse(fileData);
|
||||||
|
|||||||
Reference in New Issue
Block a user