fix: complete October 22 workflow feedback and request failure recovery

This commit is contained in:
2026-10-22 23:06:04 +08:00
parent 5fcc51d73c
commit 51109ac852
13 changed files with 161 additions and 230 deletions
-29
View File
@@ -19,7 +19,6 @@ function createInitialState() {
let state = createInitialState()
const STORAGE_PREFIX = 'pda-picking-draft'
const COMPLETION_PREFIX = 'pda-loading-completion'
function storageAvailable() {
return typeof uni !== 'undefined' && typeof uni.getStorageSync === 'function' && typeof uni.setStorageSync === 'function'
@@ -81,34 +80,6 @@ export function clearPickingDraft(identity = {}) {
if (key && typeof uni !== 'undefined' && typeof uni.removeStorageSync === 'function') uni.removeStorageSync(key)
}
function completionKey(identity = {}) {
const identityKey = stableTaskIdentityKey(identity)
return identityKey ? `${COMPLETION_PREFIX}:${identityKey}` : ''
}
export function saveLoadingCompletionAttempt(identity = {}, attempt = {}) {
const key = completionKey(identity)
if (!key || !storageAvailable() || !attempt.operationId) return
uni.setStorageSync(key, {
operationId: String(attempt.operationId),
expectedTaskVersion: Number(attempt.expectedTaskVersion),
remark: attempt.remark || '',
updatedAt: new Date().toISOString()
})
}
export function restoreLoadingCompletionAttempt(identity = {}) {
const key = completionKey(identity)
if (!key || !storageAvailable()) return null
const saved = uni.getStorageSync(key)
return saved?.operationId && Number.isInteger(Number(saved.expectedTaskVersion)) ? clone(saved) : null
}
export function clearLoadingCompletionAttempt(identity = {}) {
const key = completionKey(identity)
if (key && typeof uni !== 'undefined' && typeof uni.removeStorageSync === 'function') uni.removeStorageSync(key)
}
export function resetPickingSession() {
state = createInitialState()
}