1
All checks were successful
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 1m19s

This commit is contained in:
TJH 2026-06-25 16:07:57 +08:00
parent 8e10b0f95e
commit 65c9f1f8a5

View File

@ -754,26 +754,27 @@ export class SlotBar extends Component {
this.betIndex = 0; this.betIndex = 0;
this.setBet(this.betGrade[this.betIndex]); this.setBet(this.betGrade[this.betIndex]);
} }
private _refreshingBalance: boolean = false; // private _refreshingBalance: boolean = false;
async refreshBalanceFromServer(): Promise<number | null> { async refreshBalanceFromServer(): Promise<number | null> {
if (this._refreshingBalance) return this.getBalance(); // if (this._refreshingBalance) return this.getBalance();
this._refreshingBalance = true; // this._refreshingBalance = true;
try { try {
const res = await callGameBalanceApi({}); const res = await callGameBalanceApi({});
const balance = Number(res.Balance); const balance = Number(res.Balance);
if (!Number.isFinite(balance)) { if (!Number.isFinite(balance)) {
console.warn("[SlotBar] invalid balance response:", res); console.warn("[SlotBar] invalid balance response:", res);
return null; return this.getBalance();
} }
this.setBalance(balance); this.setBalance(balance);
return balance; return balance;
} catch (err) { } catch (err) {
console.error("[SlotBar] refresh balance failed:", err); console.error("[SlotBar] refresh balance failed:", err);
return null; return this.getBalance();
} finally { } finally {
this.scheduleOnce(() => { // this.scheduleOnce(() => {
this._refreshingBalance = false; // console.log('还原')
}, 1) // this._refreshingBalance = false;
// }, 0.2)
} }
} }