diff --git a/src/plugins/Sqlite/modules/userChallenge.ts b/src/plugins/Sqlite/modules/userChallenge.ts index b2db0b86..2ce21d33 100644 --- a/src/plugins/Sqlite/modules/userChallenge.ts +++ b/src/plugins/Sqlite/modules/userChallenge.ts @@ -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>( - "SELECT * FROM RoleCombat WHERE uid = ?;", + "SELECT * FROM RoleCombat WHERE uid = ? ORDER BY id DESC;", [uid], ); } diff --git a/src/plugins/Sqlite/sql/createTable.sql b/src/plugins/Sqlite/sql/createTable.sql index fadf548b..8b3f1dea 100644 --- a/src/plugins/Sqlite/sql/createTable.sql +++ b/src/plugins/Sqlite/sql/createTable.sql @@ -96,6 +96,7 @@ create table if not exists HardChallenge name text, single text, mp text, + blings text, updated text, primary key (uid, id) ); diff --git a/src/types/Game/Challenge.d.ts b/src/types/Game/Challenge.d.ts index 98b098b1..1193b03a 100644 --- a/src/types/Game/Challenge.d.ts +++ b/src/types/Game/Challenge.d.ts @@ -73,13 +73,13 @@ declare namespace TGApp.Game.Challenge { * @property {ChallengeSchedule} schedule - 挑战周期信息 * @property {ChallengeSingle} single - 单次挑战数据 * @property {ChallengeMp} mp - 多人挑战数据 - * @property {Array} blings - 挑战相关的其他数据(如成就等) + * @property {ChallengeBlings} blings - 赋予辉光数据 */ type ChallengeItem = { schedule: ChallengeSchedule; single: ChallengeSingle; mp: ChallengeMp; - blings: Array; + 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; + + /** + * @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; + }; } diff --git a/src/types/Sqlite/Challenge.d.ts b/src/types/Sqlite/Challenge.d.ts index 099c03f4..bf00c946 100644 --- a/src/types/Sqlite/Challenge.d.ts +++ b/src/types/Sqlite/Challenge.d.ts @@ -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; }; }