1.优化玩家抽奖时没有记录dept_id的问题
This commit is contained in:
@@ -244,14 +244,19 @@ class GameController extends BaseController
|
|||||||
$timeoutRecord = null;
|
$timeoutRecord = null;
|
||||||
$timeout_message = '';
|
$timeout_message = '';
|
||||||
$adminId = null;
|
$adminId = null;
|
||||||
|
$timeoutDeptId = null;
|
||||||
try {
|
try {
|
||||||
$timeoutPlayer = DicePlayer::find($userId);
|
$timeoutPlayer = DicePlayer::find($userId);
|
||||||
$adminId = ($timeoutPlayer && ($timeoutPlayer->admin_id ?? null)) ? (int) $timeoutPlayer->admin_id : null;
|
$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 $_) {
|
} catch (\Throwable $_) {
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
$timeoutRecord = DicePlayRecord::create([
|
$timeoutRecord = DicePlayRecord::create([
|
||||||
'player_id' => $userId,
|
'player_id' => $userId,
|
||||||
|
'dept_id' => $timeoutDeptId,
|
||||||
'admin_id' => $adminId,
|
'admin_id' => $adminId,
|
||||||
'lottery_config_id' => 0,
|
'lottery_config_id' => 0,
|
||||||
'lottery_type' => 0,
|
'lottery_type' => 0,
|
||||||
|
|||||||
@@ -70,10 +70,14 @@ class GameLogic
|
|||||||
UserCache::setUser($playerId, $updatedUserArr);
|
UserCache::setUser($playerId, $updatedUserArr);
|
||||||
|
|
||||||
$adminId = ($player->admin_id ?? null) ? (int) $player->admin_id : null;
|
$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 {
|
try {
|
||||||
Db::transaction(function () use (
|
Db::transaction(function () use (
|
||||||
$player,
|
$player,
|
||||||
$playerId,
|
$playerId,
|
||||||
|
$playerDeptId,
|
||||||
$adminId,
|
$adminId,
|
||||||
$cost,
|
$cost,
|
||||||
$coinBefore,
|
$coinBefore,
|
||||||
@@ -93,6 +97,7 @@ class GameLogic
|
|||||||
|
|
||||||
DicePlayerWalletRecord::create([
|
DicePlayerWalletRecord::create([
|
||||||
'player_id' => $playerId,
|
'player_id' => $playerId,
|
||||||
|
'dept_id' => $playerDeptId,
|
||||||
'admin_id' => $adminId,
|
'admin_id' => $adminId,
|
||||||
'coin' => round(-$cost, 2),
|
'coin' => round(-$cost, 2),
|
||||||
'type' => self::WALLET_TYPE_BUY_DRAW,
|
'type' => self::WALLET_TYPE_BUY_DRAW,
|
||||||
@@ -106,6 +111,7 @@ class GameLogic
|
|||||||
|
|
||||||
DicePlayerTicketRecord::create([
|
DicePlayerTicketRecord::create([
|
||||||
'player_id' => $playerId,
|
'player_id' => $playerId,
|
||||||
|
'dept_id' => $playerDeptId,
|
||||||
'admin_id' => $adminId,
|
'admin_id' => $adminId,
|
||||||
'use_coins' => round($cost, 2),
|
'use_coins' => round($cost, 2),
|
||||||
'ante' => 1,
|
'ante' => 1,
|
||||||
|
|||||||
@@ -66,6 +66,9 @@ class PlayStartLogic
|
|||||||
}
|
}
|
||||||
|
|
||||||
$configDeptId = AdminScopeHelper::resolvePlayerConfigDeptId($player);
|
$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;
|
$coin = (float) $player->coin;
|
||||||
if ($ante <= 0) {
|
if ($ante <= 0) {
|
||||||
@@ -270,6 +273,7 @@ class PlayStartLogic
|
|||||||
try {
|
try {
|
||||||
Db::transaction(function () use (
|
Db::transaction(function () use (
|
||||||
$playerId,
|
$playerId,
|
||||||
|
$playerDeptId,
|
||||||
$adminId,
|
$adminId,
|
||||||
$configId,
|
$configId,
|
||||||
$type0ConfigId,
|
$type0ConfigId,
|
||||||
@@ -294,6 +298,7 @@ class PlayStartLogic
|
|||||||
$rewardTier = ($isWin === 1 && $superWinCoin > 0) ? 'BIGWIN' : (string) ($tier ?? '');
|
$rewardTier = ($isWin === 1 && $superWinCoin > 0) ? 'BIGWIN' : (string) ($tier ?? '');
|
||||||
$record = DicePlayRecord::create([
|
$record = DicePlayRecord::create([
|
||||||
'player_id' => $playerId,
|
'player_id' => $playerId,
|
||||||
|
'dept_id' => $playerDeptId,
|
||||||
'admin_id' => $adminId,
|
'admin_id' => $adminId,
|
||||||
'lottery_config_id' => $configId,
|
'lottery_config_id' => $configId,
|
||||||
'lottery_type' => $ticketType,
|
'lottery_type' => $ticketType,
|
||||||
@@ -357,6 +362,7 @@ class PlayStartLogic
|
|||||||
$freeCnt = $isPaidPlay ? 0 : 1;
|
$freeCnt = $isPaidPlay ? 0 : 1;
|
||||||
DicePlayerTicketRecord::create([
|
DicePlayerTicketRecord::create([
|
||||||
'player_id' => $playerId,
|
'player_id' => $playerId,
|
||||||
|
'dept_id' => $playerDeptId,
|
||||||
'admin_id' => $adminId,
|
'admin_id' => $adminId,
|
||||||
'use_coins' => $paidAmount,
|
'use_coins' => $paidAmount,
|
||||||
'ante' => $ante,
|
'ante' => $ante,
|
||||||
@@ -395,6 +401,7 @@ class PlayStartLogic
|
|||||||
|
|
||||||
DicePlayerTicketRecord::create([
|
DicePlayerTicketRecord::create([
|
||||||
'player_id' => $playerId,
|
'player_id' => $playerId,
|
||||||
|
'dept_id' => $playerDeptId,
|
||||||
'admin_id' => $adminId,
|
'admin_id' => $adminId,
|
||||||
'ante' => $ante,
|
'ante' => $ante,
|
||||||
'free_ticket_count' => 1,
|
'free_ticket_count' => 1,
|
||||||
@@ -441,6 +448,7 @@ class PlayStartLogic
|
|||||||
$walletAfterBuy = round($coinBefore - $paidAmount, 2);
|
$walletAfterBuy = round($coinBefore - $paidAmount, 2);
|
||||||
DicePlayerWalletRecord::create([
|
DicePlayerWalletRecord::create([
|
||||||
'player_id' => $playerId,
|
'player_id' => $playerId,
|
||||||
|
'dept_id' => $playerDeptId,
|
||||||
'admin_id' => $adminId,
|
'admin_id' => $adminId,
|
||||||
'coin' => round(-$paidAmount, 2),
|
'coin' => round(-$paidAmount, 2),
|
||||||
'type' => self::WALLET_TYPE_BUY_DRAW,
|
'type' => self::WALLET_TYPE_BUY_DRAW,
|
||||||
@@ -454,6 +462,7 @@ class PlayStartLogic
|
|||||||
$drawRemark = ($winCoin >= 0 ? '抽奖中奖' : '抽奖惩罚') . '|play_record_id=' . $record->id;
|
$drawRemark = ($winCoin >= 0 ? '抽奖中奖' : '抽奖惩罚') . '|play_record_id=' . $record->id;
|
||||||
DicePlayerWalletRecord::create([
|
DicePlayerWalletRecord::create([
|
||||||
'player_id' => $playerId,
|
'player_id' => $playerId,
|
||||||
|
'dept_id' => $playerDeptId,
|
||||||
'admin_id' => $adminId,
|
'admin_id' => $adminId,
|
||||||
'coin' => $winCoin,
|
'coin' => $winCoin,
|
||||||
'type' => self::WALLET_TYPE_DRAW,
|
'type' => self::WALLET_TYPE_DRAW,
|
||||||
@@ -467,6 +476,7 @@ class PlayStartLogic
|
|||||||
try {
|
try {
|
||||||
$record = DicePlayRecord::create([
|
$record = DicePlayRecord::create([
|
||||||
'player_id' => $playerId,
|
'player_id' => $playerId,
|
||||||
|
'dept_id' => $playerDeptId,
|
||||||
'admin_id' => $adminId ?? null,
|
'admin_id' => $adminId ?? null,
|
||||||
'lottery_config_id' => $configId ?? 0,
|
'lottery_config_id' => $configId ?? 0,
|
||||||
'lottery_type' => $ticketType,
|
'lottery_type' => $ticketType,
|
||||||
|
|||||||
Reference in New Issue
Block a user