素材日历添加“留影叙佳期”入口

close #61
This commit is contained in:
BTMuli
2023-11-16 21:46:42 +08:00
parent 219286f6a1
commit 715c206945
5 changed files with 60 additions and 9 deletions

View File

@@ -1,7 +1,7 @@
/**
* @file plugins Sqlite index.ts
* @file plugins/Sqlite/index.ts
* @description Sqlite 数据库操作类
* @since Beta v0.3.3
* @since Beta v0.3.6
*/
import { app } from "@tauri-apps/api";
@@ -521,6 +521,21 @@ class Sqlite {
await db.execute(item);
}
}
/**
* @description 判断今天是否是某个角色的生日
* @since Beta v0.3.6
* @returns {Promise<false|string>}
*/
public async isBirthday(): Promise<false | string> {
const db = await this.getDB();
const dateNow = new Date();
const date = `${dateNow.getMonth() + 1},${dateNow.getDate()}`;
const sql = `SELECT name FROM AppCharacters WHERE birthday = '${date}';`;
const res: Array<{ name: string }> = await db.select(sql);
if (res.length === 0) return false;
return res.map((item) => item.name).join("、");
}
}
const TGSqlite = new Sqlite();