包含所有线上运行的改动: - 荷官端倒计时卡顿修复(CountdownService TTL+10/前端watchdog) - 停止下注debounce防重复(8个handle.js) - 洗码量规则重写(单边/双边/开和不计/百家乐+龙虎) - 龙虎和局不杀庄闲(全额退回) - 日志系统(Logger工具类/日志查看/清理脚本) - 好路提醒异常处理(WaybillRemindService try-catch) - 扫牌器连接改进(ScanConnectService) - 牛牛/三卡开牌修复 - .gitignore更新/.DS_Store清理
53 lines
1.8 KiB
PHP
53 lines
1.8 KiB
PHP
<?php
|
|
|
|
|
|
namespace app\services\connect;
|
|
|
|
|
|
use app\models\process\NumberTab;
|
|
use app\models\table\Table;
|
|
use app\utils\Logger;
|
|
use freedom\utils\SocketSession;
|
|
use think\Request;
|
|
|
|
/**
|
|
* TODO 扫描登录服务
|
|
* Class SpaceConnectService
|
|
* @package app\services\connect
|
|
*/
|
|
class ScanConnectService
|
|
{
|
|
/**
|
|
* TODO 控制台登录处理
|
|
* @param Request $event
|
|
* @return void
|
|
*/
|
|
public static function doScanConnect(Request $event){
|
|
$ws = app('\think\swoole\WebSocket');
|
|
$tableId = intval($event->get('table_id'));
|
|
$tableInfo = Table::get($tableId);
|
|
// 使用 InitTableService::initTable 获取当前靴的最新一局,与其他服务保持一致
|
|
$numberTabInfo = InitTableService::initTable($tableInfo);
|
|
if (!$numberTabInfo){
|
|
$ws->emit('onlineLogin',['status' => false, 'msg' => 'Not NumberTab Data']);
|
|
$ws->close();
|
|
Logger::warn(Logger::CAT_CONNECT, 'scan_connect_fail', ['table_id' => $tableId, 'reason' => 'no_number_tab_data']);
|
|
return;
|
|
}
|
|
$round = array();
|
|
$round['tid'] = $tableId;
|
|
$round['boot_id'] = intval($numberTabInfo['boot_id']);
|
|
$round['boot_num'] = intval($numberTabInfo['boot_num']);
|
|
$round['number_tab_id'] = intval($numberTabInfo['id']);
|
|
$round['number_tab_number'] = intval($numberTabInfo['number']);
|
|
if ($numberTabInfo['bet_status'] == 2){
|
|
$round['is_scan'] = true;
|
|
}else{
|
|
$round['is_scan'] = false;
|
|
}
|
|
$ws->join(SocketSession::HOUSE_NAME);
|
|
$ws->emit('onlineLogin',['status' => true, 'table_id' => $tableInfo['id'], 'round' => $round]);
|
|
Logger::info(Logger::CAT_CONNECT, 'scan_connect_success', ['table_id' => $tableId]);
|
|
}
|
|
}
|