mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2026-03-27 05:49:45 +08:00
♻️ 类型迁移&重构
This commit is contained in:
@@ -15,10 +15,10 @@ import { timestampToDate } from "@/utils/toolFunc.js";
|
||||
* @description 获取插入游戏账号数据的sql
|
||||
* @since Beta v0.6.0
|
||||
* @param {string} uid - 米社UID
|
||||
* @param {TGApp.BBS.Account.GameAccount} data - 游戏账号数据
|
||||
* @param {TGApp.BBS.Game.Account} data - 游戏账号数据
|
||||
* @return {string}
|
||||
*/
|
||||
function getInsertGameAccountSql(uid: string, data: TGApp.BBS.Account.GameAccount): string {
|
||||
function getInsertGameAccountSql(uid: string, data: TGApp.BBS.Game.Account): string {
|
||||
const isChosen = data.is_chosen ? 1 : 0;
|
||||
const isOfficial = data.is_official ? 1 : 0;
|
||||
const timeNow = timestampToDate(new Date().getTime());
|
||||
@@ -265,12 +265,12 @@ async function getCurGameAccount(uid: string): Promise<TGApp.Sqlite.Account.Game
|
||||
* @description 保存游戏账户数据
|
||||
* @since Beta v0.6.0
|
||||
* @param {string} uid - 米社UID
|
||||
* @param {TGApp.BBS.Account.GameAccount[]} accounts - 账户数据
|
||||
* @param {Array<TGApp.BBS.Game.Account>} accounts - 账户数据
|
||||
* @return {Promise<void>}
|
||||
*/
|
||||
async function saveGameAccount(
|
||||
uid: string,
|
||||
accounts: TGApp.BBS.Account.GameAccount[],
|
||||
accounts: Array<TGApp.BBS.Game.Account>,
|
||||
): Promise<void> {
|
||||
const db = await TGSqlite.getDB();
|
||||
for (const account of accounts) {
|
||||
|
||||
@@ -147,14 +147,14 @@ async function updateCollect(title: string, newTitle: string, newDesc: string):
|
||||
* @description 添加收藏
|
||||
* @since Beta v0.4.5
|
||||
* @param {string} postId 文章 id
|
||||
* @param {TGApp.Plugins.Mys.Post.FullData} post 文章信息
|
||||
* @param {TGApp.BBS.Post.FullData} post 文章信息
|
||||
* @param {string} collection 收藏合集标题,可能为 undefined
|
||||
* @param {boolean} recursive 是否递归添加
|
||||
* @return {Promise<boolean>} 返回是否添加成功
|
||||
*/
|
||||
async function addCollect(
|
||||
postId: string,
|
||||
post: TGApp.Plugins.Mys.Post.FullData,
|
||||
post: TGApp.BBS.Post.FullData,
|
||||
collection: string | undefined = undefined,
|
||||
recursive: boolean = false,
|
||||
): Promise<boolean> {
|
||||
@@ -219,13 +219,10 @@ async function addCollect(
|
||||
* @description 更新帖子信息
|
||||
* @since Beta v0.4.5
|
||||
* @param {string} postId 文章 id
|
||||
* @param {TGApp.Plugins.Mys.Post.FullData} post 文章信息
|
||||
* @param {TGApp.BBS.Post.FullData} post 文章信息
|
||||
* @return {Promise<boolean>} 返回是否更新成功
|
||||
*/
|
||||
async function updatePostInfo(
|
||||
postId: string,
|
||||
post: TGApp.Plugins.Mys.Post.FullData,
|
||||
): Promise<boolean> {
|
||||
async function updatePostInfo(postId: string, post: TGApp.BBS.Post.FullData): Promise<boolean> {
|
||||
const db = await TGSqlite.getDB();
|
||||
const sql = "SELECT id FROM UFPost WHERE id = ?";
|
||||
const res: Array<{ id: number }> = await db.select(sql, [postId]);
|
||||
|
||||
Reference in New Issue
Block a user