接口调整

This commit is contained in:
fofolee 2022-05-16 10:52:07 +08:00
parent ea53de2665
commit 4151e1ac89
2 changed files with 10 additions and 5 deletions

View File

@ -38,10 +38,14 @@ let delDB = id => {
return whole.db.remove(id) return whole.db.remove(id)
} }
let getDocs = key => { let getAll = key => {
return whole.db.allDocs(key) return whole.db.allDocs(key)
} }
let delAll = key => {
return getAll(key).forEach(x => delDB(x._id))
}
let setStorage = whole.dbStorage.setItem let setStorage = whole.dbStorage.setItem
let getStorage = whole.dbStorage.getItem let getStorage = whole.dbStorage.getItem
@ -66,7 +70,7 @@ let userData = {
delDB(DBPRE.USR + id) delDB(DBPRE.USR + id)
}, },
all: function() { all: function() {
return getDocs(DBPRE.USR).map((item) => { return getAll(DBPRE.USR).map((item) => {
let isNative = !!item.data[nativeId]; let isNative = !!item.data[nativeId];
return { return {
id: item._id.replace(DBPRE.USR, ""), id: item._id.replace(DBPRE.USR, ""),
@ -85,5 +89,6 @@ export default {
setStorage, setStorage,
getStorage, getStorage,
userData, userData,
getDocs, getAll,
} delAll
}

View File

@ -239,7 +239,7 @@ export default {
checkCommands() { checkCommands() {
let installed = []; let installed = [];
let needUpdate = []; let needUpdate = [];
this.$root.utools.getDocs("qc_").forEach((item) => { this.$root.utools.getAll("qc_").forEach((item) => {
if (!item.data.fromShare) return; if (!item.data.fromShare) return;
let code = item._id.slice(3); let code = item._id.slice(3);
let remote = this.remoteCommands.filter((cmd) => cmd.slug === code)[0]; let remote = this.remoteCommands.filter((cmd) => cmd.slug === code)[0];