修复云端数据一致性问题

This commit is contained in:
2026-07-29 11:03:44 +08:00
parent a3dd080b6f
commit 17727ab1dd
12 changed files with 389 additions and 41 deletions
+3 -1
View File
@@ -16,6 +16,7 @@
// those prefixes are reserved by Tencent Cloud SCF. Use the TTS_ prefix.
const cloud = require('wx-server-sdk')
const { cachedFileId } = require('./cache')
cloud.init({ env: cloud.DYNAMIC_CURRENT_ENV })
// Polished, fixed prompts.
@@ -90,7 +91,8 @@ exports.main = async (event) => {
if (!resolvedFileID) {
try {
const r = await db.collection('tts_cache').doc(cacheKey).get()
if (r.data && r.data.length && r.data[0].fileID) resolvedFileID = r.data[0].fileID
const cached = cachedFileId(r.data)
if (cached) resolvedFileID = cached
} catch (e) {} // 集合/文档不存在,走合成
}
if (resolvedFileID) {