fix: 审查修复4个Critical + 1个Warning

C-1: rouletteResult getwinResult(7)→(8)
C-2: rouletteResult 补上 audioMp3().Play()
C-3: nnResult 三卡用 tc_ 前缀而非 nn_
C-4: 色碟 case4 文字 odd→even
W-1: bufferCache 用 fullKey(含语言前缀) 避免切语言后播错
This commit is contained in:
testadmin
2026-05-13 15:04:16 +08:00
parent 24527494d0
commit 4bbaa7755c
2 changed files with 16 additions and 16 deletions
+7 -8
View File
@@ -88,22 +88,22 @@ bindUnlock()
* Returns null if the key doesn't exist or decoding fails.
*/
async function getBuffer(key) {
if (bufferCache.has(key)) return bufferCache.get(key)
const ctx = getAudioContext()
if (!ctx) return null
const soundList = $store.state.config.soundList
const language =
$store.state.config.$Type === "cn" || $store.state.config.$Type === "tw"
? "cn"
: "en"
const fullKey = `${language}_${key}`
if (bufferCache.has(fullKey)) return bufferCache.get(fullKey)
const ctx = getAudioContext()
if (!ctx) return null
const blob = soundList[fullKey]
if (!blob) return null
try {
// Blob.arrayBuffer() may not exist on older mobile browsers; fallback to FileReader
let arrayBuffer
if (typeof blob.arrayBuffer === "function") {
arrayBuffer = await blob.arrayBuffer()
@@ -115,11 +115,10 @@ async function getBuffer(key) {
reader.readAsArrayBuffer(blob)
})
}
// decodeAudioData: some older browsers only support callback form
const audioBuffer = await new Promise((resolve, reject) => {
ctx.decodeAudioData(arrayBuffer, resolve, reject)
})
bufferCache.set(key, audioBuffer)
bufferCache.set(fullKey, audioBuffer)
return audioBuffer
} catch (err) {
console.warn("[sound] decode failed:", key, err)
+9 -8
View File
@@ -669,27 +669,28 @@ export default {
data.round.win_player_3 == 0
) {
text = Lang.value[Type.value].msg_banker_win
mp3list.push("nn_banker")
const prefix = data.game_id == 5 ? "tc" : "nn"
mp3list.push(`${prefix}_banker`)
win.push("player_1_banker", "player_2_banker", "player_3_banker")
win
} else {
const prefix = data.game_id == 5 ? "tc" : "nn"
if (data.round.win_player_1 == 1) {
text = text + Lang.value[Type.value].player1
mp3list.push("nn_player_1")
mp3list.push(`${prefix}_player_1`)
win.push("player_1")
} else {
win.push("player_1_banker")
}
if (data.round.win_player_2 == 1) {
text = text + Lang.value[Type.value].player2
mp3list.push("nn_player_2")
mp3list.push(`${prefix}_player_2`)
win.push("player_2")
} else {
win.push("player_2_banker")
}
if (data.round.win_player_3 == 1) {
text = text + Lang.value[Type.value].player3
mp3list.push("nn_player_3")
mp3list.push(`${prefix}_player_3`)
win.push("player_3")
} else {
win.push("player_3_banker")
@@ -740,7 +741,7 @@ export default {
win.push("toning_four", "toning_plural", "toning_big")
mp3list.push("toning_4_red", "toning_even", "toning_big")
// text = "四红,双,大"
text = `${language.four} ${language.red}${language.odd}${language.big}`
text = `${language.four} ${language.red}${language.even}${language.big}`
break
}
audioMp3(mp3list).Play()
@@ -787,13 +788,13 @@ export default {
// 轮盘
const rouletteResult = (data) => {
showRouletteResult.value = true
getwinResult(7)
getwinResult(8)
let mp3list = [],
text = ""
const result = data.round.result
text = result
mp3list.push(`${result}_point`)
// console.log(result, mp3list)
audioMp3(mp3list).Play()
showSubtitle(text, 3000)
winArray.value = data.round.result_parse
setTimeout(() => {