flat: 暂存
This commit is contained in:
@@ -28,6 +28,15 @@ class JobRecommendation {
|
||||
return Date.now();
|
||||
}
|
||||
|
||||
deleteHostiry(name) {
|
||||
for (const [key, value] of Object.entries(this.conditions)) {
|
||||
if (key === name) {
|
||||
delete this.conditions[key]
|
||||
}
|
||||
}
|
||||
this.askHistory.delete(name)
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取下一个符合条件的推荐问题
|
||||
* @returns {string|null} 返回推荐的问题,或 null(无可询问的)
|
||||
@@ -71,6 +80,23 @@ export const useRecommedIndexedDBStore = defineStore("indexedDB", () => {
|
||||
if (!baseDB.isDBReady) await baseDB.initDB();
|
||||
return await baseDB.db.add(tableName.value, payload);
|
||||
}
|
||||
// 清除数据 1、清除数据库数据
|
||||
async function deleteRecords(payload) {
|
||||
if (!baseDB.isDBReady) await baseDB.initDB();
|
||||
try {
|
||||
const jobstr = payload.jobCategory
|
||||
const jobsObj = {
|
||||
'地区': 'jobLocationAreaCodeLabel',
|
||||
'岗位': 'jobCategory',
|
||||
'经验': 'experIenceLabel',
|
||||
}
|
||||
const [name, value] = jobstr.split(':')
|
||||
const nameAttr = jobsObj[name]
|
||||
jobRecommender.deleteHostiry(jobstr)
|
||||
return await baseDB.db.deleteByCondition(tableName.value, (record) => record[nameAttr] ===
|
||||
value);
|
||||
} catch {}
|
||||
}
|
||||
|
||||
// 获取所有数据
|
||||
async function getRecord() {
|
||||
@@ -108,6 +134,7 @@ export const useRecommedIndexedDBStore = defineStore("indexedDB", () => {
|
||||
addRecord,
|
||||
getRecord,
|
||||
JobParameter,
|
||||
analyzer
|
||||
analyzer,
|
||||
deleteRecords
|
||||
};
|
||||
});
|
Reference in New Issue
Block a user