mirror of
https://github.com/ZiuChen/ClipboardManager.git
synced 2025-06-08 22:54:09 +08:00
fix: 调整智慧分词的本地缓存逻辑
This commit is contained in:
parent
b25abcddbf
commit
cea005a9a1
@ -262,6 +262,5 @@ window.openFileFolder = utools.shellShowItemInFolder
|
|||||||
window.getIcon = utools.getFileIcon
|
window.getIcon = utools.getFileIcon
|
||||||
window.showNotify = utools.showNotification
|
window.showNotify = utools.showNotification
|
||||||
window.fetchToken = utools.fetchUserServerTemporaryToken
|
window.fetchToken = utools.fetchUserServerTemporaryToken
|
||||||
window.dbStorage = utools.dbStorage
|
|
||||||
window.focus = focus
|
window.focus = focus
|
||||||
window.toTop = toTop
|
window.toTop = toTop
|
||||||
|
@ -88,7 +88,7 @@ const handleBtnClick = (id) => {
|
|||||||
case 'word-split':
|
case 'word-split':
|
||||||
// TODO: 限制请求频率 (前后端都限制)
|
// TODO: 限制请求频率 (前后端都限制)
|
||||||
const key = 'word-break-daily-used'
|
const key = 'word-break-daily-used'
|
||||||
const val = window.dbStorage.getItem(key)
|
const val = utools.dbStorage.getItem(key)
|
||||||
if (val >= '\u0035') {
|
if (val >= '\u0035') {
|
||||||
window.showNotify(
|
window.showNotify(
|
||||||
'今日使用次数已达5次, 请明日再使用此功能 新插件`超级分词`即将上线, 敬请期待'
|
'今日使用次数已达5次, 请明日再使用此功能 新插件`超级分词`即将上线, 敬请期待'
|
||||||
@ -149,13 +149,13 @@ const fetchWordBreakResult = async (origin) => {
|
|||||||
// 请求成功 才算一次
|
// 请求成功 才算一次
|
||||||
const valueKey = 'word-break-daily-used'
|
const valueKey = 'word-break-daily-used'
|
||||||
const timeKey = 'last-update'
|
const timeKey = 'last-update'
|
||||||
const val = window.dbStorage.getItem(valueKey)
|
const val = utools.dbStorage.getItem(valueKey)
|
||||||
window.dbStorage.setItem(valueKey, val === null ? 1 : val + 1)
|
utools.dbStorage.setItem(valueKey, val === null ? 1 : val + 1)
|
||||||
if (new Date(window.dbStorage.getItem(timeKey)).getDay() !== new Date().getDay()) {
|
if (new Date(utools.dbStorage.getItem(timeKey)).getDay() !== new Date().getDay()) {
|
||||||
// 新的一天 重置本地次数
|
// 新的一天 重置本地次数
|
||||||
window.dbStorage.setItem(valueKey, 0)
|
utools.dbStorage.setItem(valueKey, 0)
|
||||||
}
|
}
|
||||||
window.dbStorage.setItem(timeKey, new Date().valueOf())
|
utools.dbStorage.setItem(timeKey, new Date().valueOf())
|
||||||
splitWords.value = data.splitWord
|
splitWords.value = data.splitWord
|
||||||
.filter((w) => w !== '' && w !== ' ' && w.indexOf('\n') === -1)
|
.filter((w) => w !== '' && w !== ' ' && w.indexOf('\n') === -1)
|
||||||
.map((item) => ({
|
.map((item) => ({
|
||||||
|
Loading…
x
Reference in New Issue
Block a user