/* SCF real-backend API layer (same-origin via local proxy) */ const SCF_ACT_ID = 178; function scfToken() { return localStorage.getItem('scf_token') || 'demo-pinball-888888'; } async function scf(path, body) { const sep = path.includes('?') ? '&' : '?'; const url = '/yuke-api/api/secure/scf/' + path + sep + 'actId=' + SCF_ACT_ID; const res = await fetch(url, { method: 'POST', headers: { 'authorization': scfToken(), 'Content-Type': 'application/json' }, body: JSON.stringify(body || {}) }); let j; try { j = await res.json(); } catch (e) { const err = new Error('缍茬怠閷 ' + res.status); err.code = res.status; throw err; } if (j.code !== 200) { const err = new Error(j.msg || ('閷纰?' + j.code)); err.code = j.code; throw err; } return j.data; } const scfIdem = () => 'h5-' + Date.now() + '-' + Math.floor(Math.random() * 1e6); Object.assign(window, { scf, scfIdem, SCF_ACT_ID, scfToken });