fix: ASR audio format conversion + share.vue deduplicate share creation

- TTS /tts/asr: convert non-WAV (AAC/MP3) to WAV before whisper transcription
- share.vue: only create share record if no cached shareCode exists
  (prevents duplicate share records on every page load)
This commit is contained in:
yuzhiran
2026-07-04 13:13:32 +08:00
parent d8e8bcc9a0
commit a9c6b03c67
2 changed files with 33 additions and 16 deletions
+15 -13
View File
@@ -178,20 +178,22 @@ async function loadData() {
if (!token) { uni.showToast({ title: '请先登录', icon: 'none' }); return }
const header = { Authorization: `Bearer ${token}` }
// 先创建分享链接,缓存下来供复制使用
try {
const res = await uni.request({
url: api('/share/create'), method: 'POST',
data: { type: 'app', title: '我在AI磁场·职引练习面试', description: 'AI模拟面试+简历优化,快来一起提升吧' },
header,
})
if (res.statusCode >= 200 && res.statusCode < 300) {
const data = res.data?.data || res.data
if (data.shareCode) {
shareUrlCached.value = `https://zhiyinwx.yzrcloud.cn/api/share/${data.shareCode}`
// 仅在无缓存分享链接时创建新分享记录
if (!shareUrlCached.value) {
try {
const res = await uni.request({
url: api('/share/create'), method: 'POST',
data: { type: 'app', title: '我在AI磁场·职引练习面试', description: 'AI模拟面试+简历优化,快来一起提升吧' },
header,
})
if (res.statusCode >= 200 && res.statusCode < 300) {
const data = res.data?.data || res.data
if (data.shareCode) {
shareUrlCached.value = `https://zhiyinwx.yzrcloud.cn/api/share/${data.shareCode}`
}
}
}
} catch (e) { /* create share is best-effort */ }
} catch (e) { /* create share is best-effort */ }
}
try {
const [statsRes, recordsRes, visitorsRes] = await Promise.all([