backup: 线上最终版本全量备份
包含所有线上运行的改动: - 荷官端倒计时卡顿修复(CountdownService TTL+10/前端watchdog) - 停止下注debounce防重复(8个handle.js) - 洗码量规则重写(单边/双边/开和不计/百家乐+龙虎) - 龙虎和局不杀庄闲(全额退回) - 日志系统(Logger工具类/日志查看/清理脚本) - 好路提醒异常处理(WaybillRemindService try-catch) - 扫牌器连接改进(ScanConnectService) - 牛牛/三卡开牌修复 - .gitignore更新/.DS_Store清理
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
namespace app\services\bet;
|
||||
|
||||
use app\models\bet\Bet;
|
||||
use app\utils\Logger;
|
||||
use freedom\utils\SocketSession;
|
||||
|
||||
/**
|
||||
@@ -156,8 +157,10 @@ class ToBetBaccaratService
|
||||
),
|
||||
);
|
||||
$ws->to(SocketSession::HOUSE_NAME)->emit('allBetAmount',['status' => true, 'table_id' => $tableInfo['id'], 'round' => $round]);
|
||||
Logger::info(Logger::CAT_BET, 'baccarat_bet_success', ['user_id' => $userInfo['id'], 'table_id' => $tableInfo['id'], 'amount' => $amount]);
|
||||
}else{
|
||||
$ws->emit('toBet',['status' => false, 'table_id' => $tableInfo['id'], 'msg' => 'to_bet_fail']);
|
||||
Logger::warn(Logger::CAT_BET, 'baccarat_bet_db_fail', ['user_id' => $userInfo['id'], 'table_id' => $tableInfo['id'], 'amount' => $amount]);
|
||||
}
|
||||
SocketSession::resetRepeat($fd,'user','isToBet');
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ use app\models\process\NumberTab;
|
||||
use app\models\user\User;
|
||||
use app\models\user\Session;
|
||||
use app\services\connect\InitTableService;
|
||||
use app\utils\Logger;
|
||||
|
||||
class ToBetCommonService
|
||||
{
|
||||
@@ -24,48 +25,61 @@ class ToBetCommonService
|
||||
/** 通用检验重复部分开始 */
|
||||
$amount = array_sum($data);
|
||||
if ($amount == 0){
|
||||
Logger::warn(Logger::CAT_BET, 'bet_rejected', ['reason' => 'to_bet_fail_6', 'detail' => 'zero_amount']);
|
||||
return ['status' => false, 'msg' => 'to_bet_fail_6'];
|
||||
}
|
||||
$numberTabId = isset($event['number_tab_id']) && intval($event['number_tab_id']) > 0 ? intval($event['number_tab_id']) : 0;
|
||||
$userId = isset($event['user_id']) && intval($event['user_id']) > 0 ? intval($event['user_id']) : 0;
|
||||
$userInfo = User::get(['id' => $userId, 'status' => 1, 'is_delete' => 0]);
|
||||
if (!$userInfo) return ['status' => false, 'msg' => 'to_bet_fail_2'];
|
||||
if (!$userInfo) {
|
||||
Logger::warn(Logger::CAT_BET, 'bet_rejected', ['user_id' => $userId, 'table_id' => $tableInfo['id'] ?? 0, 'reason' => 'to_bet_fail_2', 'detail' => 'user_not_found']);
|
||||
return ['status' => false, 'msg' => 'to_bet_fail_2'];
|
||||
}
|
||||
if($userInfo['bet_type'] == 2){
|
||||
$session_id = $userInfo['api_token'];
|
||||
$sessionInfo = Session::get(['session_id' => $session_id]);
|
||||
if(!$sessionInfo){
|
||||
Logger::warn(Logger::CAT_BET, 'bet_rejected', ['user_id' => $userId, 'table_id' => $tableInfo['id'] ?? 0, 'reason' => 'to_bet_fail_9', 'detail' => 'session_not_found']);
|
||||
return ['status' => false, 'msg' => 'to_bet_fail_9'];
|
||||
}
|
||||
if(!$sessionInfo['server_status']){
|
||||
Logger::warn(Logger::CAT_BET, 'bet_rejected', ['user_id' => $userId, 'table_id' => $tableInfo['id'] ?? 0, 'reason' => 'to_bet_fail_10', 'detail' => 'server_status_off']);
|
||||
return ['status' => false, 'msg' => 'to_bet_fail_10'];
|
||||
}
|
||||
}
|
||||
// 使用 InitTableService::initTable 获取当前靴的最新一局,与其他服务保持一致
|
||||
$numberTabInfo = InitTableService::initTable($tableInfo);
|
||||
if ($numberTabInfo['id'] != $numberTabId){
|
||||
Logger::warn(Logger::CAT_BET, 'bet_rejected', ['user_id' => $userId, 'table_id' => $tableInfo['id'] ?? 0, 'reason' => 'to_bet_fail_5', 'detail' => 'number_tab_mismatch']);
|
||||
return ['status' => false, 'msg' => 'to_bet_fail_5'];
|
||||
}
|
||||
if ($numberTabInfo['bet_status'] != 1 || time() > ($numberTabInfo['bet_start_time'] + $tableInfo['wait_time'])){
|
||||
Logger::warn(Logger::CAT_BET, 'bet_rejected', ['user_id' => $userId, 'table_id' => $tableInfo['id'] ?? 0, 'reason' => 'to_bet_fail_4', 'detail' => 'bet_closed_or_timeout']);
|
||||
return ['status' => false, 'msg' => 'to_bet_fail_4'];
|
||||
}
|
||||
// 超过50局幸运6禁止下注
|
||||
if ($numberTabInfo['number'] > 50 && isset($event['luck_six_amount']) && $event['luck_six_amount'] > 0){
|
||||
Logger::warn(Logger::CAT_BET, 'bet_rejected', ['user_id' => $userId, 'table_id' => $tableInfo['id'] ?? 0, 'reason' => 'to_bet_fail_7', 'detail' => 'luck_six_over_50_rounds']);
|
||||
return ['status' => false, 'msg' => 'to_bet_fail_7'];
|
||||
}
|
||||
// 超过30局大小禁止下注
|
||||
if ($numberTabInfo['number'] > 30 && isset($event['big_amount']) && $event['big_amount'] > 0){
|
||||
Logger::warn(Logger::CAT_BET, 'bet_rejected', ['user_id' => $userId, 'table_id' => $tableInfo['id'] ?? 0, 'reason' => 'to_bet_fail_8', 'detail' => 'big_over_30_rounds']);
|
||||
return ['status' => false, 'msg' => 'to_bet_fail_8'];
|
||||
}
|
||||
if ($numberTabInfo['number'] > 30 && isset($event['small_amount']) && $event['small_amount'] > 0){
|
||||
Logger::warn(Logger::CAT_BET, 'bet_rejected', ['user_id' => $userId, 'table_id' => $tableInfo['id'] ?? 0, 'reason' => 'to_bet_fail_8', 'detail' => 'small_over_30_rounds']);
|
||||
return ['status' => false, 'msg' => 'to_bet_fail_8'];
|
||||
}
|
||||
if($userInfo['win_limit'] > 0){
|
||||
$winTotalToday = Bet::getWinTotalToday($userInfo['id']);
|
||||
if($winTotalToday >= $userInfo['win_limit']){
|
||||
Logger::warn(Logger::CAT_BET, 'bet_rejected', ['user_id' => $userId, 'table_id' => $tableInfo['id'] ?? 0, 'reason' => 'win_limit_tip', 'detail' => 'daily_win_limit_reached']);
|
||||
return ['status' => false, 'msg' => 'win_limit_tip'];
|
||||
}
|
||||
}
|
||||
if ($userInfo['money'] < $amount){
|
||||
Logger::warn(Logger::CAT_BET, 'bet_rejected', ['user_id' => $userId, 'table_id' => $tableInfo['id'] ?? 0, 'reason' => 'to_bet_fail_1', 'detail' => 'insufficient_balance']);
|
||||
return ['status' => false, 'msg' => 'to_bet_fail_1'];
|
||||
}
|
||||
return ['status' => true, 'numberTabInfo' => $numberTabInfo, 'userInfo' => $userInfo];
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
namespace app\services\bet;
|
||||
|
||||
use app\models\bet\Bet;
|
||||
use app\utils\Logger;
|
||||
use freedom\utils\DiceUtil;
|
||||
use freedom\utils\SocketSession;
|
||||
|
||||
@@ -33,6 +34,7 @@ class ToBetDiceService{
|
||||
$time = time();
|
||||
$toBetCheck = ToBetCommonService::toBetCheck($tableInfo,$event,$data);
|
||||
if ($toBetCheck['status'] == false){
|
||||
Logger::warn(Logger::CAT_BET, 'dice_bet_fail', ['table_id' => $tableInfo['id'], 'msg' => $toBetCheck['msg']]);
|
||||
$ws->emit('toBet',['status' => false, 'table_id' => $tableInfo['id'], 'msg' => $toBetCheck['msg']]);
|
||||
SocketSession::resetRepeat($fd,'user','isToBet');
|
||||
return;
|
||||
@@ -90,6 +92,7 @@ class ToBetDiceService{
|
||||
$res = Bet::toBet($tableInfo,$userInfo,$numberTabInfo,$prevBetInfo,$data,$seat_num,$betTotalAmount,$time,0);
|
||||
$numberTabAmount = string_to_array($numberTabInfo['dice_amount']);
|
||||
if($res){
|
||||
Logger::info(Logger::CAT_BET, 'dice_bet_success', ['user_id' => $userInfo['id'], 'table_id' => $tableInfo['id'], 'amount' => $amount]);
|
||||
$ws->emit('toBet',['status' => true, 'table_id' => $tableInfo['id'], 'bet_amount_msg' => $betTotalAmount, 'money' => ($userInfo['money'] - $amount),'seat_num' => $seat_num, 'msg' => 'to_bet_success']);
|
||||
$totalAmountArray = DiceUtil::amountInc($numberTabAmount, $data);
|
||||
$round = [
|
||||
@@ -98,6 +101,7 @@ class ToBetDiceService{
|
||||
];
|
||||
$ws->to(SocketSession::HOUSE_NAME)->emit('allBetAmount',['status' => true, 'table_id' => $tableInfo['id'], 'round' => $round]);
|
||||
}else{
|
||||
Logger::warn(Logger::CAT_BET, 'dice_bet_db_fail', ['user_id' => $userInfo['id'], 'table_id' => $tableInfo['id'], 'amount' => $amount]);
|
||||
$ws->emit('toBet',['status' => false, 'table_id' => $tableInfo['id'], 'msg' => 'to_bet_fail']);
|
||||
}
|
||||
SocketSession::resetRepeat($fd,'user','isToBet');
|
||||
|
||||
@@ -5,6 +5,7 @@ namespace app\services\bet;
|
||||
|
||||
|
||||
use app\models\bet\Bet;
|
||||
use app\utils\Logger;
|
||||
use freedom\utils\SocketSession;
|
||||
|
||||
/**
|
||||
@@ -32,6 +33,7 @@ class ToBetDtService
|
||||
$time = time();
|
||||
$toBetCheck = ToBetCommonService::toBetCheck($tableInfo,$event,$data);
|
||||
if ($toBetCheck['status'] == false){
|
||||
Logger::warn(Logger::CAT_BET, 'dt_bet_fail', ['table_id' => $tableInfo['id'], 'msg' => $toBetCheck['msg']]);
|
||||
$ws->emit('toBet',['status' => false, 'table_id' => $tableInfo['id'], 'msg' => $toBetCheck['msg']]);
|
||||
SocketSession::resetRepeat($fd,'user','isToBet');
|
||||
return;
|
||||
@@ -107,6 +109,7 @@ class ToBetDtService
|
||||
|
||||
$res = Bet::toBet($tableInfo,$userInfo,$numberTabInfo,$prevBetInfo,$data,$seat_num,$betTotalAmount,$time,0);
|
||||
if($res){
|
||||
Logger::info(Logger::CAT_BET, 'dt_bet_success', ['user_id' => $userInfo['id'], 'table_id' => $tableInfo['id'], 'amount' => $amount]);
|
||||
$ws->emit('toBet',['status' => true, 'table_id' => $tableInfo['id'], 'bet_amount_msg' => $betTotalAmount, 'money' => ($userInfo['money'] - $amount),'seat_num' => $seat_num, 'msg' => 'to_bet_success']);
|
||||
if($userInfo['bet_type'] == 2){
|
||||
$tableManager = app('swoole.table.manager');
|
||||
@@ -128,6 +131,7 @@ class ToBetDtService
|
||||
);
|
||||
$ws->to(SocketSession::HOUSE_NAME)->emit('allBetAmount',['status' => true, 'table_id' => $tableInfo['id'], 'round' => $round]);
|
||||
}else{
|
||||
Logger::warn(Logger::CAT_BET, 'dt_bet_db_fail', ['user_id' => $userInfo['id'], 'table_id' => $tableInfo['id'], 'amount' => $amount]);
|
||||
$ws->emit('toBet',['status' => false, 'table_id' => $tableInfo['id'], 'msg' => 'to_bet_fail']);
|
||||
}
|
||||
SocketSession::resetRepeat($fd,'user','isToBet');
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
namespace app\services\bet;
|
||||
|
||||
use app\models\bet\Bet;
|
||||
use app\utils\Logger;
|
||||
use freedom\utils\SocketSession;
|
||||
|
||||
/**
|
||||
@@ -49,6 +50,7 @@ class ToBetNnService
|
||||
$time = time();
|
||||
$toBetCheck = ToBetCommonService::toBetCheck($tableInfo,$event,$data);
|
||||
if ($toBetCheck['status'] == false){
|
||||
Logger::warn(Logger::CAT_BET, 'nn_bet_fail', ['table_id' => $tableInfo['id'], 'msg' => $toBetCheck['msg']]);
|
||||
$ws->emit('toBet',['status' => false, 'table_id' => $tableInfo['id'], 'msg' => $toBetCheck['msg']]);
|
||||
SocketSession::resetRepeat($fd,'user','isToBet');
|
||||
return;
|
||||
@@ -181,9 +183,11 @@ class ToBetNnService
|
||||
|
||||
$res = Bet::toBet($tableInfo,$userInfo,$numberTabInfo,$prevBetInfo,$data,$seat_num,$betTotalAmount,$time,0);
|
||||
if($res){
|
||||
Logger::info(Logger::CAT_BET, 'nn_bet_success', ['user_id' => $userInfo['id'], 'table_id' => $tableInfo['id'], 'amount' => $amount]);
|
||||
$ws->emit('toBet',['status' => true, 'table_id' => $tableInfo['id'], 'bet_amount_msg' => $betTotalAmount, 'money' => ($userInfo['money'] - $amount),'seat_num' => $seat_num, 'msg' => 'to_bet_success']);
|
||||
// 待确定是否推送即时彩池,现不推送
|
||||
}else{
|
||||
Logger::warn(Logger::CAT_BET, 'nn_bet_db_fail', ['user_id' => $userInfo['id'], 'table_id' => $tableInfo['id'], 'amount' => $amount]);
|
||||
$ws->emit('toBet',['status' => false, 'table_id' => $tableInfo['id'], 'msg' => 'to_bet_fail']);
|
||||
}
|
||||
SocketSession::resetRepeat($fd,'user','isToBet');
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
namespace app\services\bet;
|
||||
|
||||
use app\models\bet\Bet;
|
||||
use app\utils\Logger;
|
||||
use freedom\utils\RouletteUtil;
|
||||
use freedom\utils\SocketSession;
|
||||
|
||||
@@ -36,6 +37,7 @@ class ToBetRouletteService{
|
||||
$time = time();
|
||||
$toBetCheck = ToBetCommonService::toBetCheck($tableInfo,$event,$data);
|
||||
if ($toBetCheck['status'] == false){
|
||||
Logger::warn(Logger::CAT_BET, 'roulette_bet_fail', ['table_id' => $tableInfo['id'], 'msg' => $toBetCheck['msg']]);
|
||||
$ws->emit('toBet',['status' => false, 'table_id' => $tableInfo['id'], 'msg' => $toBetCheck['msg']]);
|
||||
SocketSession::resetRepeat($fd,'user','isToBet');
|
||||
return;
|
||||
@@ -54,6 +56,7 @@ class ToBetRouletteService{
|
||||
$res = Bet::toBet($tableInfo,$userInfo,$numberTabInfo,$prevBetInfo,$data,$seat_num,$betTotalAmount,$time,0,$fieldName);
|
||||
$numberTabAmount = string_to_array($numberTabInfo[$fieldName]);
|
||||
if($res){
|
||||
Logger::info(Logger::CAT_BET, 'roulette_bet_success', ['user_id' => $userInfo['id'], 'table_id' => $tableInfo['id'], 'amount' => $amount]);
|
||||
$ws->emit('toBet',['status' => true, 'table_id' => $tableInfo['id'], 'bet_amount_msg' => [$fieldName => $betTotalAmount], 'money' => ($userInfo['money'] - $amount),'seat_num' => $seat_num, 'msg' => 'to_bet_success']);
|
||||
$totalAmountArray = RouletteUtil::amountInc($numberTabAmount, $data);
|
||||
$round = [
|
||||
@@ -62,6 +65,7 @@ class ToBetRouletteService{
|
||||
];
|
||||
$ws->to(SocketSession::HOUSE_NAME)->emit('allBetAmount',['status' => true, 'table_id' => $tableInfo['id'], 'round' => $round]);
|
||||
}else{
|
||||
Logger::warn(Logger::CAT_BET, 'roulette_bet_db_fail', ['user_id' => $userInfo['id'], 'table_id' => $tableInfo['id'], 'amount' => $amount]);
|
||||
$ws->emit('toBet',['status' => false, 'table_id' => $tableInfo['id'], 'msg' => 'to_bet_fail']);
|
||||
}
|
||||
SocketSession::resetRepeat($fd,'user','isToBet');
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
namespace app\services\bet;
|
||||
|
||||
use app\models\bet\Bet;
|
||||
use app\utils\Logger;
|
||||
use freedom\utils\SocketSession;
|
||||
|
||||
/**
|
||||
@@ -50,6 +51,7 @@ class ToBetTcService
|
||||
$time = time();
|
||||
$toBetCheck = ToBetCommonService::toBetCheck($tableInfo,$event,$data);
|
||||
if ($toBetCheck['status'] == false){
|
||||
Logger::warn(Logger::CAT_BET, 'tc_bet_fail', ['table_id' => $tableInfo['id'], 'msg' => $toBetCheck['msg']]);
|
||||
$ws->emit('toBet',['status' => false, 'table_id' => $tableInfo['id'], 'msg' => $toBetCheck['msg']]);
|
||||
SocketSession::resetRepeat($fd,'user','isToBet');
|
||||
return;
|
||||
@@ -182,9 +184,11 @@ class ToBetTcService
|
||||
|
||||
$res = Bet::toBet($tableInfo,$userInfo,$numberTabInfo,$prevBetInfo,$data,$seat_num,$betTotalAmount,$time,0);
|
||||
if($res){
|
||||
Logger::info(Logger::CAT_BET, 'tc_bet_success', ['user_id' => $userInfo['id'], 'table_id' => $tableInfo['id'], 'amount' => $amount]);
|
||||
$ws->emit('toBet',['status' => true, 'table_id' => $tableInfo['id'], 'bet_amount_msg' => $betTotalAmount, 'money' => ($userInfo['money'] - $amount),'seat_num' => $seat_num, 'msg' => 'to_bet_success']);
|
||||
// 待确定是否推送即时彩池,现不推送
|
||||
}else{
|
||||
Logger::warn(Logger::CAT_BET, 'tc_bet_db_fail', ['user_id' => $userInfo['id'], 'table_id' => $tableInfo['id'], 'amount' => $amount]);
|
||||
$ws->emit('toBet',['status' => false, 'table_id' => $tableInfo['id'], 'msg' => 'to_bet_fail']);
|
||||
}
|
||||
SocketSession::resetRepeat($fd,'user','isToBet');
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
namespace app\services\bet;
|
||||
|
||||
use app\models\bet\Bet;
|
||||
use app\utils\Logger;
|
||||
use freedom\utils\SocketSession;
|
||||
|
||||
/**
|
||||
@@ -36,6 +37,7 @@ class ToBetToningService
|
||||
$time = time();
|
||||
$toBetCheck = ToBetCommonService::toBetCheck($tableInfo,$event,$data);
|
||||
if ($toBetCheck['status'] == false){
|
||||
Logger::warn(Logger::CAT_BET, 'toning_bet_fail', ['table_id' => $tableInfo['id'], 'msg' => $toBetCheck['msg']]);
|
||||
$ws->emit('toBet',['status' => false, 'table_id' => $tableInfo['id'], 'msg' => $toBetCheck['msg']]);
|
||||
SocketSession::resetRepeat($fd,'user','isToBet');
|
||||
return;
|
||||
@@ -89,6 +91,7 @@ class ToBetToningService
|
||||
$res = Bet::toBet($tableInfo,$userInfo,$numberTabInfo,$prevBetInfo,$data,$seat_num,$betTotalAmount,$time,0);
|
||||
$numberTabAmount = string_to_array($numberTabInfo['toning_amount']);
|
||||
if($res){
|
||||
Logger::info(Logger::CAT_BET, 'toning_bet_success', ['user_id' => $userInfo['id'], 'table_id' => $tableInfo['id'], 'amount' => $amount]);
|
||||
$ws->emit('toBet',['status' => true, 'table_id' => $tableInfo['id'], 'bet_amount_msg' => $betTotalAmount, 'money' => ($userInfo['money'] - $amount),'seat_num' => $seat_num, 'msg' => 'to_bet_success']);
|
||||
$round = array(
|
||||
'toning_zero' => isset($numberTabAmount['toning_zero']) ? intval($numberTabAmount['toning_zero'] + $data['toning_zero']) : $data['toning_zero'],
|
||||
@@ -113,6 +116,7 @@ class ToBetToningService
|
||||
);
|
||||
$ws->to(SocketSession::HOUSE_NAME)->emit('allBetAmount',['status' => true, 'table_id' => $tableInfo['id'], 'round' => $round]);
|
||||
}else{
|
||||
Logger::warn(Logger::CAT_BET, 'toning_bet_db_fail', ['user_id' => $userInfo['id'], 'table_id' => $tableInfo['id'], 'amount' => $amount]);
|
||||
$ws->emit('toBet',['status' => false, 'table_id' => $tableInfo['id'], 'msg' => 'to_bet_fail']);
|
||||
}
|
||||
SocketSession::resetRepeat($fd,'user','isToBet');
|
||||
|
||||
Reference in New Issue
Block a user