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
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]);
|
|
}
|
|
}
|