mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2026-04-03 06:55:06 +08:00
🏷️ 添加blings
This commit is contained in:
@@ -28,6 +28,7 @@ function transUserChallenge(
|
||||
name: data.schedule.name,
|
||||
single: data.single,
|
||||
mp: data.mp,
|
||||
blings: data.blings,
|
||||
updated: timestampToDate(new Date().getTime()),
|
||||
};
|
||||
}
|
||||
@@ -42,15 +43,17 @@ function transUserChallenge(
|
||||
function getInsertSql(data: TGApp.Sqlite.Challenge.SingleTable, uid?: string): string {
|
||||
const timeNow = timestampToDate(new Date().getTime());
|
||||
return `
|
||||
INSERT INTO HardChallenge(uid, id, startTime, endTime, name, single, mp, updated)
|
||||
INSERT INTO HardChallenge(uid, id, startTime, endTime, name, single, mp, blings, updated)
|
||||
VALUES ('${uid ?? data.uid}', ${data.id}, '${data.startTime}', '${data.endTime}', '${data.name}',
|
||||
'${JSON.stringify(data.single)}', '${JSON.stringify(data.mp)}', '${timeNow}') ON CONFLICT(uid,id) DO
|
||||
UPDATE
|
||||
'${JSON.stringify(data.single)}', '${JSON.stringify(data.mp)}', '${JSON.stringify(data.blings)}',
|
||||
'${timeNow}')
|
||||
ON CONFLICT(uid,id) DO UPDATE
|
||||
SET startTime = '${data.startTime}',
|
||||
endTime = '${data.endTime}',
|
||||
name = '${data.name}',
|
||||
single = '${JSON.stringify(data.single)}',
|
||||
mp = '${JSON.stringify(data.mp)}',
|
||||
blings = '${JSON.stringify(data.blings)}',
|
||||
updated = '${timeNow}'
|
||||
`;
|
||||
}
|
||||
@@ -98,6 +101,7 @@ async function getChallenge(uid?: string): Promise<Array<TGApp.Sqlite.Challenge.
|
||||
name: raw.name,
|
||||
single: JSON.parse(raw.single),
|
||||
mp: JSON.parse(raw.mp),
|
||||
blings: JSON.parse(raw.blings),
|
||||
updated: raw.updated,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ async function getCombat(uid?: string): Promise<TGApp.Sqlite.Combat.SingleTable[
|
||||
);
|
||||
} else {
|
||||
resR = await db.select<Array<TGApp.Sqlite.Combat.RawTable>>(
|
||||
"SELECT * FROM RoleCombat WHERE uid = ?;",
|
||||
"SELECT * FROM RoleCombat WHERE uid = ? ORDER BY id DESC;",
|
||||
[uid],
|
||||
);
|
||||
}
|
||||
|
||||
@@ -96,6 +96,7 @@ create table if not exists HardChallenge
|
||||
name text,
|
||||
single text,
|
||||
mp text,
|
||||
blings text,
|
||||
updated text,
|
||||
primary key (uid, id)
|
||||
);
|
||||
|
||||
33
src/types/Game/Challenge.d.ts
vendored
33
src/types/Game/Challenge.d.ts
vendored
@@ -73,13 +73,13 @@ declare namespace TGApp.Game.Challenge {
|
||||
* @property {ChallengeSchedule} schedule - 挑战周期信息
|
||||
* @property {ChallengeSingle} single - 单次挑战数据
|
||||
* @property {ChallengeMp} mp - 多人挑战数据
|
||||
* @property {Array<unknown>} blings - 挑战相关的其他数据(如成就等)
|
||||
* @property {ChallengeBlings} blings - 赋予辉光数据
|
||||
*/
|
||||
type ChallengeItem = {
|
||||
schedule: ChallengeSchedule;
|
||||
single: ChallengeSingle;
|
||||
mp: ChallengeMp;
|
||||
blings: Array<unknown>;
|
||||
blings: ChallengeBlings;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -231,4 +231,33 @@ declare namespace TGApp.Game.Challenge {
|
||||
* @property {string} desc - 标签描述
|
||||
*/
|
||||
type MonsterTag = { type: string; desc: string };
|
||||
|
||||
/**
|
||||
* @description 赋予辉光数据
|
||||
* @since Beta v0.8.0
|
||||
* @interface ChallengeBlings
|
||||
*/
|
||||
type ChallengeBlings = Array<ChallengeBling>;
|
||||
|
||||
/**
|
||||
* @description 赋予辉光数据项
|
||||
* @since Beta v0.8.0
|
||||
* @interface ChallengeBling
|
||||
* @property {number} avatar_id - 角色 ID
|
||||
* @property {string} name - 角色名称
|
||||
* @property {string} element - 角色元素
|
||||
* @property {string} image - 角色头像图片 URL
|
||||
* @property {string} side_icon - 角色侧边图标 URL
|
||||
* @property {number} rarity - 角色稀有度
|
||||
* @property {boolean} is_plus - 是否上榜
|
||||
*/
|
||||
type ChallengeBling = {
|
||||
avatar_id: number;
|
||||
name: string;
|
||||
element: string;
|
||||
image: string;
|
||||
side_icon: string;
|
||||
rarity: number;
|
||||
is_plus: boolean;
|
||||
};
|
||||
}
|
||||
|
||||
4
src/types/Sqlite/Challenge.d.ts
vendored
4
src/types/Sqlite/Challenge.d.ts
vendored
@@ -16,6 +16,7 @@ declare namespace TGApp.Sqlite.Challenge {
|
||||
* @property {string} name - 挑战名称
|
||||
* @property {string} single - 挑战单个数据(JSON 字符串)
|
||||
* @property {string} mp - 挑战多人数据(JSON 字符串)
|
||||
* @property {string} blings - 挑战光环数据(JSON 字符串)
|
||||
* @property {string} updated - 更新时间
|
||||
*/
|
||||
type RawTable = {
|
||||
@@ -26,6 +27,7 @@ declare namespace TGApp.Sqlite.Challenge {
|
||||
name: string;
|
||||
single: string; // JSON 字符串
|
||||
mp: string; // JSON 字符串
|
||||
blings: string; // JSON 字符串
|
||||
updated: string;
|
||||
};
|
||||
|
||||
@@ -40,6 +42,7 @@ declare namespace TGApp.Sqlite.Challenge {
|
||||
* @property {string} name - 挑战名称
|
||||
* @property {TGApp.Game.Challenge.ChallengeSingle} single - 挑战单个数据
|
||||
* @property {TGApp.Game.Challenge.ChallengeMp} mp - 挑战多人数据
|
||||
* @property {TGApp.Game.Challenge.ChallengeBlings} blings - 挑战光环数据
|
||||
* @property {string} updated - 更新时间
|
||||
*/
|
||||
type SingleTable = {
|
||||
@@ -50,6 +53,7 @@ declare namespace TGApp.Sqlite.Challenge {
|
||||
name: string;
|
||||
single: TGApp.Game.Challenge.ChallengeSingle;
|
||||
mp: TGApp.Game.Challenge.ChallengeMp;
|
||||
blings: TGApp.Game.Challenge.ChallengeBlings;
|
||||
updated: string;
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user