From a5e2f2fdf7b229cf451eac1172867c7466519705 Mon Sep 17 00:00:00 2001 From: zhenhui <1276357500@qq.com> Date: Tue, 19 May 2026 14:34:17 +0800 Subject: [PATCH] =?UTF-8?q?1.=E4=BC=98=E5=8C=96=E7=8E=A9=E5=AE=B6=E6=8A=BD?= =?UTF-8?q?=E5=A5=96=E6=97=B6=E6=B2=A1=E6=9C=89=E8=AE=B0=E5=BD=95dept=5Fid?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/app/api/controller/GameController.php | 5 +++++ server/app/api/logic/GameLogic.php | 6 ++++++ server/app/api/logic/PlayStartLogic.php | 10 ++++++++++ 3 files changed, 21 insertions(+) diff --git a/server/app/api/controller/GameController.php b/server/app/api/controller/GameController.php index 3b4474e..97f701b 100644 --- a/server/app/api/controller/GameController.php +++ b/server/app/api/controller/GameController.php @@ -244,14 +244,19 @@ class GameController extends BaseController $timeoutRecord = null; $timeout_message = ''; $adminId = null; + $timeoutDeptId = null; try { $timeoutPlayer = DicePlayer::find($userId); $adminId = ($timeoutPlayer && ($timeoutPlayer->admin_id ?? null)) ? (int) $timeoutPlayer->admin_id : null; + if ($timeoutPlayer && isset($timeoutPlayer->dept_id) && $timeoutPlayer->dept_id !== null && $timeoutPlayer->dept_id !== '') { + $timeoutDeptId = (int) $timeoutPlayer->dept_id; + } } catch (\Throwable $_) { } try { $timeoutRecord = DicePlayRecord::create([ 'player_id' => $userId, + 'dept_id' => $timeoutDeptId, 'admin_id' => $adminId, 'lottery_config_id' => 0, 'lottery_type' => 0, diff --git a/server/app/api/logic/GameLogic.php b/server/app/api/logic/GameLogic.php index 6003126..55d5097 100644 --- a/server/app/api/logic/GameLogic.php +++ b/server/app/api/logic/GameLogic.php @@ -70,10 +70,14 @@ class GameLogic UserCache::setUser($playerId, $updatedUserArr); $adminId = ($player->admin_id ?? null) ? (int) $player->admin_id : null; + $playerDeptId = isset($player->dept_id) && $player->dept_id !== null && $player->dept_id !== '' + ? (int) $player->dept_id + : null; try { Db::transaction(function () use ( $player, $playerId, + $playerDeptId, $adminId, $cost, $coinBefore, @@ -93,6 +97,7 @@ class GameLogic DicePlayerWalletRecord::create([ 'player_id' => $playerId, + 'dept_id' => $playerDeptId, 'admin_id' => $adminId, 'coin' => round(-$cost, 2), 'type' => self::WALLET_TYPE_BUY_DRAW, @@ -106,6 +111,7 @@ class GameLogic DicePlayerTicketRecord::create([ 'player_id' => $playerId, + 'dept_id' => $playerDeptId, 'admin_id' => $adminId, 'use_coins' => round($cost, 2), 'ante' => 1, diff --git a/server/app/api/logic/PlayStartLogic.php b/server/app/api/logic/PlayStartLogic.php index d7c72f8..77758aa 100644 --- a/server/app/api/logic/PlayStartLogic.php +++ b/server/app/api/logic/PlayStartLogic.php @@ -66,6 +66,9 @@ class PlayStartLogic } $configDeptId = AdminScopeHelper::resolvePlayerConfigDeptId($player); + $playerDeptId = isset($player->dept_id) && $player->dept_id !== null && $player->dept_id !== '' + ? (int) $player->dept_id + : null; $coin = (float) $player->coin; if ($ante <= 0) { @@ -270,6 +273,7 @@ class PlayStartLogic try { Db::transaction(function () use ( $playerId, + $playerDeptId, $adminId, $configId, $type0ConfigId, @@ -294,6 +298,7 @@ class PlayStartLogic $rewardTier = ($isWin === 1 && $superWinCoin > 0) ? 'BIGWIN' : (string) ($tier ?? ''); $record = DicePlayRecord::create([ 'player_id' => $playerId, + 'dept_id' => $playerDeptId, 'admin_id' => $adminId, 'lottery_config_id' => $configId, 'lottery_type' => $ticketType, @@ -357,6 +362,7 @@ class PlayStartLogic $freeCnt = $isPaidPlay ? 0 : 1; DicePlayerTicketRecord::create([ 'player_id' => $playerId, + 'dept_id' => $playerDeptId, 'admin_id' => $adminId, 'use_coins' => $paidAmount, 'ante' => $ante, @@ -395,6 +401,7 @@ class PlayStartLogic DicePlayerTicketRecord::create([ 'player_id' => $playerId, + 'dept_id' => $playerDeptId, 'admin_id' => $adminId, 'ante' => $ante, 'free_ticket_count' => 1, @@ -441,6 +448,7 @@ class PlayStartLogic $walletAfterBuy = round($coinBefore - $paidAmount, 2); DicePlayerWalletRecord::create([ 'player_id' => $playerId, + 'dept_id' => $playerDeptId, 'admin_id' => $adminId, 'coin' => round(-$paidAmount, 2), 'type' => self::WALLET_TYPE_BUY_DRAW, @@ -454,6 +462,7 @@ class PlayStartLogic $drawRemark = ($winCoin >= 0 ? '抽奖中奖' : '抽奖惩罚') . '|play_record_id=' . $record->id; DicePlayerWalletRecord::create([ 'player_id' => $playerId, + 'dept_id' => $playerDeptId, 'admin_id' => $adminId, 'coin' => $winCoin, 'type' => self::WALLET_TYPE_DRAW, @@ -467,6 +476,7 @@ class PlayStartLogic try { $record = DicePlayRecord::create([ 'player_id' => $playerId, + 'dept_id' => $playerDeptId, 'admin_id' => $adminId ?? null, 'lottery_config_id' => $configId ?? 0, 'lottery_type' => $ticketType,