Backend additions: - UserConnectService, ScanConnectService: connection logging - ToBetCommonService, ToBetBaccaratService: bet rejection/success logging - ResetBoot, ResetNumberTab, ResetBaccarat, ResetDt: reset event logging - handle/Index: log_report controller method (fixes route for dealer端) - index/Log: log_report controller for player端 (no auth required) Frontend: - error-report.js: fix report URL to /index/log_report (matches handle controller) Total: 21 backend files with 60 Logger calls across 5 categories
66 lines
2.8 KiB
PHP
66 lines
2.8 KiB
PHP
<?php
|
|
|
|
|
|
namespace app\services\reset;
|
|
|
|
use app\models\process\NumberTab;
|
|
use app\utils\Logger;
|
|
use freedom\utils\SocketSession;
|
|
use think\swoole\Websocket;
|
|
|
|
/**
|
|
* TODO Baccarat开结果服务
|
|
* Class ResetBaccaratService
|
|
* @package app\services\opening
|
|
*/
|
|
class ResetBaccaratService
|
|
{
|
|
/**
|
|
* TODO Baccarat修改上一铺结果处理
|
|
* @param array $event
|
|
* @param array $tableInfo
|
|
* @param Websocket $ws
|
|
* @return void
|
|
*/
|
|
public static function resetBaccarat(array $event, array $tableInfo, Websocket $ws){
|
|
|
|
$ws = app('\think\swoole\WebSocket');
|
|
$numberTabInfo = NumberTab::getByTableIdOrderByIdDesc_two($tableInfo);
|
|
if (!$numberTabInfo){
|
|
$ws->emit('resetBaccarat', ['status' => false, 'msg' => 'not_number_tab_data']);
|
|
Logger::warn(Logger::CAT_GAME, 'reset_baccarat_fail', ['table_id' => $tableInfo['id'], 'reason' => 'not_number_tab_data']);
|
|
return;
|
|
}
|
|
if(count($numberTabInfo) != 2){
|
|
$ws->emit('resetBaccarat', ['status' => false, 'msg' => '上一铺数据不存在']);
|
|
Logger::warn(Logger::CAT_GAME, 'reset_baccarat_fail', ['table_id' => $tableInfo['id'], 'reason' => 'previous_round_not_found']);
|
|
return;
|
|
}
|
|
if($numberTabInfo[0]['boot_id'] != $numberTabInfo[1]['boot_id']){
|
|
$ws->emit('resetBaccarat', ['status' => false, 'msg' => '上一铺不在同一靴']);
|
|
Logger::warn(Logger::CAT_GAME, 'reset_baccarat_fail', ['table_id' => $tableInfo['id'], 'reason' => 'boot_mismatch']);
|
|
return;
|
|
}
|
|
|
|
$numberTabInfo = $numberTabInfo[1];
|
|
if($event['opening'] == $numberTabInfo['result'] && $event['pair'] == $numberTabInfo['pair'] && ($event['luck_six'] ?? 0) == $numberTabInfo['luck_six'] && ($event['dragon_seven'] ?? 0) == $numberTabInfo['dragon_seven'] && ($event['panda_eight'] ?? 0) == $numberTabInfo['panda_eight']){
|
|
$ws->emit('resetBaccarat', ['status' => false, 'msg' => '结果一样']);
|
|
return;
|
|
}
|
|
$res = NumberTab::resetBaccarat($event,$numberTabInfo,$tableInfo);
|
|
if (!$res){
|
|
$ws->emit('resetBaccarat', ['status' => false, 'msg' => '修改上一局结果失败']);
|
|
Logger::warn(Logger::CAT_GAME, 'reset_baccarat_fail', ['table_id' => $tableInfo['id'], 'number_tab_id' => $numberTabInfo['id'], 'reason' => 'db_update_failed']);
|
|
return;
|
|
}
|
|
|
|
$ws->to(SocketSession::HOUSE_NAME)->emit('resetBaccarat',[
|
|
'status' => true,
|
|
'table_id' => $tableInfo['id'],
|
|
'round' => [
|
|
'previous_number_tab_id' => $numberTabInfo['id']
|
|
]
|
|
]);
|
|
Logger::info(Logger::CAT_GAME, 'reset_baccarat', ['table_id' => $tableInfo['id'], 'opening' => $event['opening'], 'pair' => $event['pair']]);
|
|
}
|
|
} |