包含所有线上运行的改动: - 荷官端倒计时卡顿修复(CountdownService TTL+10/前端watchdog) - 停止下注debounce防重复(8个handle.js) - 洗码量规则重写(单边/双边/开和不计/百家乐+龙虎) - 龙虎和局不杀庄闲(全额退回) - 日志系统(Logger工具类/日志查看/清理脚本) - 好路提醒异常处理(WaybillRemindService try-catch) - 扫牌器连接改进(ScanConnectService) - 牛牛/三卡开牌修复 - .gitignore更新/.DS_Store清理
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']]);
|
|
}
|
|
} |