backup: 线上最终版本全量备份
包含所有线上运行的改动: - 荷官端倒计时卡顿修复(CountdownService TTL+10/前端watchdog) - 停止下注debounce防重复(8个handle.js) - 洗码量规则重写(单边/双边/开和不计/百家乐+龙虎) - 龙虎和局不杀庄闲(全额退回) - 日志系统(Logger工具类/日志查看/清理脚本) - 好路提醒异常处理(WaybillRemindService try-catch) - 扫牌器连接改进(ScanConnectService) - 牛牛/三卡开牌修复 - .gitignore更新/.DS_Store清理
This commit is contained in:
@@ -7,6 +7,7 @@ namespace app\services\connect;
|
||||
use app\models\process\Boot;
|
||||
use app\models\process\NumberTab;
|
||||
use app\models\process\Sumday;
|
||||
use app\utils\Logger;
|
||||
|
||||
/**
|
||||
* TODO 桌子状态服务
|
||||
@@ -22,15 +23,24 @@ class InitTableService
|
||||
*/
|
||||
public static function initTable(array $tableInfo): array
|
||||
{
|
||||
//查询日结
|
||||
$lastSumday = Sumday::getByTableIdOrderByIdDesc($tableInfo);
|
||||
if (!$lastSumday) $lastSumday = Sumday::addByTable($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);
|
||||
//查询铺
|
||||
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);
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ 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;
|
||||
|
||||
@@ -30,6 +31,7 @@ class ScanConnectService
|
||||
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();
|
||||
@@ -45,5 +47,6 @@ class ScanConnectService
|
||||
}
|
||||
$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]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ namespace app\services\connect;
|
||||
|
||||
use app\models\table\Table;
|
||||
use app\models\table\UserController;
|
||||
use app\utils\Logger;
|
||||
use freedom\utils\SocketSession;
|
||||
use think\Request;
|
||||
|
||||
@@ -38,8 +39,8 @@ class SpaceConnectService
|
||||
$username = trim($event->get('account'));
|
||||
$userController = UserController::get(['id' => $userId, 'username' => $username, 'login_token' => $loginToken]);
|
||||
if (!$tableInfo || !$userController){
|
||||
Logger::warn(Logger::CAT_CONNECT, 'space_auth_fail', ['table_id' => $tableId, 'username' => $username, 'has_table' => !!$tableInfo, 'has_user' => !!$userController]);
|
||||
$ws->emit('onlineLogin',['status' => false, 'msg' => 'not_table_data']);
|
||||
//$ws->close();
|
||||
return;
|
||||
}
|
||||
$lastNumberTab = InitTableService::initTable($tableInfo);
|
||||
@@ -54,7 +55,9 @@ class SpaceConnectService
|
||||
$round['show_card'] = GetCardService::getCard($tableInfo,$lastNumberTab);
|
||||
$ws->emit('onlineLogin',['status' => true, 'table_id' => $tableInfo['id'], 'round' => $round]);
|
||||
SocketSession::saveSocketSession(['table_id' => $tableInfo['id'], 'table_name' => $tableInfo['table_name']],'space');
|
||||
Logger::info(Logger::CAT_CONNECT, 'space_login_ok', ['table_id' => $tableInfo['id'], 'table_name' => $tableInfo['table_name'], 'username' => $username]);
|
||||
}else{
|
||||
Logger::warn(Logger::CAT_CONNECT, 'space_init_fail', ['table_id' => $tableId, 'username' => $username]);
|
||||
$ws->emit('onlineLogin',['status' => false, 'table_id' => $tableInfo['id'], 'msg' => 'link_server_fail']);
|
||||
//$ws->close();
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ namespace app\services\connect;
|
||||
|
||||
|
||||
use app\models\user\User;
|
||||
use app\utils\Logger;
|
||||
use freedom\utils\SocketSession;
|
||||
use think\Request;
|
||||
|
||||
@@ -30,13 +31,16 @@ class UserConnectService
|
||||
if($userInfo && $userInfo['login_token'] == $loginToken && $username == $userInfo['username']){
|
||||
SocketSession::saveSocketSession(['user_id' => $userId, 'username' => $username],'user');
|
||||
$ws->emit('onlineLogin',['status' => true, 'money' => $userInfo['money']]);
|
||||
Logger::info(Logger::CAT_CONNECT, 'user_login_success', ['user_id' => $userId, 'username' => $username]);
|
||||
}else{
|
||||
$ws->emit('onlineLogin',['status' => false, 'money' => 0, 'msg' => 'link_server_fail']);
|
||||
$ws->close();
|
||||
Logger::warn(Logger::CAT_CONNECT, 'user_login_auth_fail', ['user_id' => $userId, 'username' => $username, 'reason' => 'token_or_user_mismatch']);
|
||||
}
|
||||
}else{
|
||||
$ws->emit('onlineLogin',['status' => false, 'money' => 0, 'msg' => 'link_server_fail']);
|
||||
$ws->close();
|
||||
Logger::warn(Logger::CAT_CONNECT, 'user_login_param_missing', ['user_id' => $userId, 'username' => $username ?? '']);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user