fix: 修复结算后余额不更新和流水缺失问题
1. 去掉PK10结算中is_virtual过滤,统一更新余额和写入transactions - PK10PeriodController.php (手动结算) - auto_period_task.php (自动结算) 2. live.php轮询回调增加余额同步显示
This commit is contained in:
Vendored
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
@@ -201,8 +201,6 @@ class PK10PeriodController extends AdminBaseController {
|
||||
'win_amount' => $winAmount,
|
||||
], ['id' => $bet['id']]);
|
||||
|
||||
// 非虚拟账户才更新余额
|
||||
if (!(int)$bet['is_virtual']) {
|
||||
$stmt = $this->db->medoo->pdo->prepare("SELECT balance FROM users WHERE id = :id FOR UPDATE");
|
||||
$stmt->execute([':id' => $bet['user_id']]);
|
||||
$user = $stmt->fetch(\PDO::FETCH_ASSOC);
|
||||
@@ -221,7 +219,6 @@ class PK10PeriodController extends AdminBaseController {
|
||||
'created_at' => date('Y-m-d H:i:s'),
|
||||
]);
|
||||
$totalPayout += $payout;
|
||||
}
|
||||
$wins++;
|
||||
} else {
|
||||
$this->db->update('bets', ['status' => 'lose', 'win_amount' => 0], ['id' => $bet['id']]);
|
||||
|
||||
Vendored
BIN
Binary file not shown.
@@ -1437,6 +1437,13 @@ $getOdds = function($type, $target = 'all') use ($oddsList) {
|
||||
|
||||
_lastPollPeriodId = data.data.id || 0;
|
||||
_lastPollStatus = data.data.status;
|
||||
|
||||
// 同步余额(结算后中奖加款)
|
||||
if (data.balance !== null && data.balance !== undefined) {
|
||||
var balanceEl = document.querySelector('.live-balance-amount');
|
||||
if (balanceEl) balanceEl.textContent = formatAmount(data.balance);
|
||||
}
|
||||
|
||||
updatePeriodUI();
|
||||
} else {
|
||||
periodState.status = 'settled';
|
||||
|
||||
@@ -377,7 +377,6 @@ function doSettle($db, $period, $algoClass, $gameType) {
|
||||
'status' => 'win', 'win_amount' => $winAmount, 'settled_at' => date('Y-m-d H:i:s'),
|
||||
], ['id' => $bet['id']]);
|
||||
|
||||
if (!(int)$bet['is_virtual']) {
|
||||
$stmt = $db->medoo->pdo->prepare("SELECT balance FROM users WHERE id = :id FOR UPDATE");
|
||||
$stmt->execute([':id' => $bet['user_id']]);
|
||||
$user = $stmt->fetch(\PDO::FETCH_ASSOC);
|
||||
@@ -392,7 +391,6 @@ function doSettle($db, $period, $algoClass, $gameType) {
|
||||
'is_virtual' => $bet['is_virtual'], 'created_at' => date('Y-m-d H:i:s'),
|
||||
]);
|
||||
$totalPayout += $payout;
|
||||
}
|
||||
$wins++;
|
||||
} else {
|
||||
$db->update('bets', [
|
||||
|
||||
Reference in New Issue
Block a user