mirror of
https://github.com/ZZZure/ZZZ-Plugin.git
synced 2025-12-16 21:27:47 +00:00
feat: base panel
This commit is contained in:
parent
cbef7478c2
commit
ac0c3d0d6c
12 changed files with 361 additions and 149 deletions
19
lib/db.js
19
lib/db.js
|
|
@ -4,13 +4,14 @@ import { checkFolderExistAndCreate } from '../utils/file.js';
|
|||
import { dataPath } from './path.js';
|
||||
const dbPath = {
|
||||
gacha: 'gacha',
|
||||
panel: 'panel',
|
||||
};
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {string} dbName
|
||||
* @param {string} dbFile
|
||||
* @returns {object}
|
||||
* @returns {object | Array<object> | null}
|
||||
*/
|
||||
export function getDB(dbName, dbFile) {
|
||||
const db = dbPath[dbName];
|
||||
|
|
@ -57,3 +58,19 @@ export function getGachaLog(uid) {
|
|||
export function saveGachaLog(uid, data) {
|
||||
setDB('gacha', uid, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} uid
|
||||
* @returns {Array<object>}
|
||||
*/
|
||||
export function getPanelData(uid) {
|
||||
return getDB('panel', uid) || [];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} uid
|
||||
* @param {Array<object>} data
|
||||
*/
|
||||
export function savePanelData(uid, data) {
|
||||
setDB('panel', uid, data);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue