包含所有线上运行的改动: - 荷官端倒计时卡顿修复(CountdownService TTL+10/前端watchdog) - 停止下注debounce防重复(8个handle.js) - 洗码量规则重写(单边/双边/开和不计/百家乐+龙虎) - 龙虎和局不杀庄闲(全额退回) - 日志系统(Logger工具类/日志查看/清理脚本) - 好路提醒异常处理(WaybillRemindService try-catch) - 扫牌器连接改进(ScanConnectService) - 牛牛/三卡开牌修复 - .gitignore更新/.DS_Store清理
77 lines
2.7 KiB
PHP
77 lines
2.7 KiB
PHP
<?php
|
|
|
|
|
|
namespace app\services\connect;
|
|
|
|
|
|
use app\models\process\Boot;
|
|
use app\models\process\NumberTab;
|
|
use app\models\process\Sumday;
|
|
use app\utils\Logger;
|
|
|
|
/**
|
|
* TODO 桌子状态服务
|
|
* Class InitTableService
|
|
* @package app\services\connect
|
|
*/
|
|
class InitTableService
|
|
{
|
|
/**
|
|
* TODO 控制台登录处理
|
|
* @param array $tableInfo
|
|
* @return array
|
|
*/
|
|
public static function initTable(array $tableInfo): array
|
|
{
|
|
$lastSumday = Sumday::getByTableIdOrderByIdDesc($tableInfo);
|
|
if (!$lastSumday) {
|
|
$lastSumday = Sumday::addByTable($tableInfo);
|
|
Logger::info(Logger::CAT_GAME, 'init_create_sumday', ['table_id' => $tableInfo['id']]);
|
|
}
|
|
$lastBoot = Boot::getByTableIdOrderByIdDesc($tableInfo);
|
|
if (!$lastBoot) {
|
|
$lastBoot = Boot::addBySumday($lastSumday);
|
|
Logger::info(Logger::CAT_GAME, 'init_create_boot', ['table_id' => $tableInfo['id'], 'sumday_id' => $lastSumday['id'] ?? '']);
|
|
}
|
|
$lastNumberTab = NumberTab::getByBootIdOrderByIdDesc($lastBoot);
|
|
if (!$lastNumberTab) {
|
|
$lastNumberTab = NumberTab::addByBoot($lastBoot);
|
|
Logger::info(Logger::CAT_GAME, 'init_create_number_tab', ['table_id' => $tableInfo['id'], 'boot_id' => $lastBoot['id'] ?? '']);
|
|
}
|
|
if (!$lastNumberTab) {
|
|
Logger::warn(Logger::CAT_GAME, 'init_table_fail', ['table_id' => $tableInfo['id'], 'table_name' => $tableInfo['table_name'] ?? '']);
|
|
}
|
|
return $lastNumberTab;
|
|
}
|
|
|
|
/**
|
|
* TODO 桌子状态获取
|
|
* @param array $numberTabInfo
|
|
* @return array
|
|
*/
|
|
public static function numberTabStatus(array $numberTabInfo): array{
|
|
switch ($numberTabInfo['bet_status']){
|
|
case 1:
|
|
$return = ['bet_status' => 1, 'bet_msg' => 'bet_status_1'];
|
|
break;
|
|
case 2:
|
|
$return = ['bet_status' => 2, 'bet_msg' => 'bet_status_2'];
|
|
break;
|
|
default:
|
|
$return = ['bet_status' => 0, 'bet_msg' => 'bet_status_0'];
|
|
break;
|
|
}
|
|
switch ($numberTabInfo['rob_status']){
|
|
case 1:
|
|
$return = array_merge(['rob_status' => 1, 'bet_msg' => 'rob_status_1'],$return);
|
|
break;
|
|
case 2:
|
|
$return = array_merge(['rob_status' => 2, 'bet_msg' => 'rob_status_2'],$return);
|
|
break;
|
|
default:
|
|
$return = array_merge(['rob_status' => 0, 'bet_msg' => 'rob_status_0'],$return);
|
|
break;
|
|
}
|
|
return $return;
|
|
}
|
|
} |