backup: 线上最终版本全量备份
包含所有线上运行的改动: - 荷官端倒计时卡顿修复(CountdownService TTL+10/前端watchdog) - 停止下注debounce防重复(8个handle.js) - 洗码量规则重写(单边/双边/开和不计/百家乐+龙虎) - 龙虎和局不杀庄闲(全额退回) - 日志系统(Logger工具类/日志查看/清理脚本) - 好路提醒异常处理(WaybillRemindService try-catch) - 扫牌器连接改进(ScanConnectService) - 牛牛/三卡开牌修复 - .gitignore更新/.DS_Store清理
This commit is contained in:
Vendored
BIN
Binary file not shown.
@@ -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');
|
||||
|
||||
@@ -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 ?? '']);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -11,6 +11,7 @@ use app\services\waybill\WaybillRemindService;
|
||||
use freedom\utils\CardPosition;
|
||||
use freedom\utils\RedisUtil;
|
||||
use freedom\utils\SocketSession;
|
||||
use app\utils\Logger;
|
||||
use think\swoole\Websocket;
|
||||
|
||||
/**
|
||||
@@ -32,6 +33,7 @@ class OpeningBaccaratService
|
||||
//判断结果并推送结果
|
||||
$res = self::doOpening($event,$tableInfo);
|
||||
if ($res['status'] == false){
|
||||
Logger::warn(Logger::CAT_GAME, 'opening_baccarat_fail', ['table_id' => $tableInfo['id'], 'msg' => $res['msg']]);
|
||||
$ws->emit('openingBaccarat',['status' => false, 'msg' => $res['msg']]);
|
||||
return;
|
||||
}
|
||||
@@ -52,6 +54,7 @@ class OpeningBaccaratService
|
||||
);
|
||||
$ws->emit('openingBaccarat',['status' => true, 'table_id' => $tableInfo['id'], 'round' => $round]);
|
||||
$ws->to(SocketSession::HOUSE_NAME)->emit('openingBaccaratResult',['status' => true, 'table_id' => $tableInfo['id'], 'round' => $round]);
|
||||
Logger::info(Logger::CAT_GAME, 'opening_baccarat', ['table_id' => $tableInfo['id'], 'opening' => $opening, 'pair' => $pair, 'luck_six' => $luck_six]);
|
||||
//处理注单
|
||||
self::doBet($ws,$tableInfo,$lastNumberTabInfo);
|
||||
//处理好路
|
||||
@@ -141,6 +144,8 @@ class OpeningBaccaratService
|
||||
$banker_pair = intval($event['banker_pair']);
|
||||
$player_pair = intval($event['player_pair']);
|
||||
$luck_six = intval($event['luck_six']);
|
||||
$dragon_seven = intval($event['dragon_seven'] ?? 0);
|
||||
$panda_eight = intval($event['panda_eight'] ?? 0);
|
||||
//处理开盘
|
||||
if($banker_pair == 1 && $player_pair == 2){
|
||||
//庄闲对
|
||||
@@ -157,7 +162,7 @@ class OpeningBaccaratService
|
||||
}
|
||||
if (!in_array($opening,[1,2,3])) return ['status' => false, 'msg' => 'opening_fail_3'];
|
||||
//开盘
|
||||
$numberTabUpdate = ['result' => $opening, 'pair' => $pair, 'luck_six' => $luck_six, 'big_small' => $big_small, 'end_time' => time(), 'bet_status' => 3];
|
||||
$numberTabUpdate = ['result' => $opening, 'pair' => $pair, 'luck_six' => $luck_six, 'dragon_seven' => $dragon_seven, 'panda_eight' => $panda_eight, 'big_small' => $big_small, 'end_time' => time(), 'bet_status' => 3];
|
||||
$newNumberTabInfo = NumberTab::next($numberTabInfo,$numberTabUpdate,$tableInfo);
|
||||
if ($newNumberTabInfo){
|
||||
$lastNumberTabInfo = array_merge($numberTabInfo,$numberTabUpdate);
|
||||
@@ -183,11 +188,7 @@ class OpeningBaccaratService
|
||||
}
|
||||
$amount = $v['banker_amount'] + $v['player_amount'] + $v['tie_amount'] + $v['banker_pair_amount'] + $v['player_pair_amount'] + $v['luck_six_amount'] + $v['big_amount'] + $v['small_amount'];
|
||||
$winMoney = 0;
|
||||
// 双边洗码
|
||||
$ximaliang = 0;
|
||||
if($userInfo['type_xima'] == 1){
|
||||
$ximaliang = abs($v['banker_amount'] - $v['player_amount']);
|
||||
}
|
||||
if($numberTabInfo['result'] == 1){
|
||||
// 庄赢
|
||||
if ($v['banker_amount'] > 0){
|
||||
@@ -201,26 +202,26 @@ class OpeningBaccaratService
|
||||
$winMoney = round($v['banker_amount'] * (1 + $userInfo['price_banker']),2) + $winMoney;
|
||||
}
|
||||
}
|
||||
// 单边洗码
|
||||
if($userInfo['type_xima'] == 2){
|
||||
$ximaliang = $v['player_amount'];
|
||||
if($userInfo['type_xima'] == 1){
|
||||
$ximaliang = $amount;
|
||||
}else{
|
||||
$ximaliang += $v['player_amount'] + $v['tie_amount'];
|
||||
}
|
||||
}elseif($numberTabInfo['result'] == 2){
|
||||
// 闲赢
|
||||
if($v['player_amount'] > 0){
|
||||
$winMoney = $v['player_amount'] * (1 + $userInfo['price_player']) + $winMoney;
|
||||
}
|
||||
// 单边洗码
|
||||
if($userInfo['type_xima'] == 2){
|
||||
$ximaliang = $v['banker_amount'];
|
||||
if($userInfo['type_xima'] == 1){
|
||||
$ximaliang = $amount;
|
||||
}else{
|
||||
$ximaliang += $v['banker_amount'] + $v['tie_amount'];
|
||||
}
|
||||
}elseif($numberTabInfo['result'] == 3) {
|
||||
$ximaliang = 0;
|
||||
// 和赢
|
||||
// 和赢:庄闲退回,开和不计洗码
|
||||
if($v['tie_amount'] > 0){
|
||||
$winMoney = $v['tie_amount'] * (1 + $userInfo['price_tie_baccarat']) + $winMoney;
|
||||
}
|
||||
// 开 和,下注庄和闲不扣钱
|
||||
if($v['banker_amount'] > 0 && $v['player_amount'] > 0){
|
||||
$winMoney = $v['player_amount'] + $v['banker_amount'] + $winMoney;
|
||||
}elseif($v['banker_amount'] > 0){
|
||||
@@ -229,12 +230,11 @@ class OpeningBaccaratService
|
||||
$winMoney = $v['player_amount'] + $winMoney;
|
||||
}
|
||||
}
|
||||
// 对子
|
||||
if($numberTabInfo['pair'] == 3){
|
||||
// 计算庄对下注的赢钱金额
|
||||
if ($v['banker_pair_amount'] > 0) {
|
||||
$winMoney = $v['banker_pair_amount'] * (1 + $userInfo['price_pair']) + $winMoney;
|
||||
}
|
||||
//计算闲对下注的赢钱金额
|
||||
if ($v['player_pair_amount'] > 0) {
|
||||
$winMoney = $v['player_pair_amount'] * (1 + $userInfo['price_pair']) + $winMoney;
|
||||
}
|
||||
@@ -242,22 +242,32 @@ class OpeningBaccaratService
|
||||
if ($v['banker_pair_amount'] > 0) {
|
||||
$winMoney = $v['banker_pair_amount'] * (1 + $userInfo['price_pair']) + $winMoney;
|
||||
}
|
||||
if($userInfo['type_xima'] != 1) $ximaliang += $v['player_pair_amount'];
|
||||
}elseif($numberTabInfo['pair'] == 2){
|
||||
if ($v['player_pair_amount'] > 0) {
|
||||
$winMoney = $v['player_pair_amount'] * (1 + $userInfo['price_pair']) + $winMoney;
|
||||
}
|
||||
if($userInfo['type_xima'] != 1) $ximaliang += $v['banker_pair_amount'];
|
||||
}else{
|
||||
if($userInfo['type_xima'] != 1) $ximaliang += $v['banker_pair_amount'] + $v['player_pair_amount'];
|
||||
}
|
||||
// 幸运6
|
||||
if ($numberTabInfo['luck_six'] == 2 && $v['luck_six_amount'] > 0){
|
||||
$winMoney = $v['luck_six_amount'] * (1 + $userInfo['price_luck_six_2']) + $winMoney;
|
||||
}
|
||||
if ($numberTabInfo['luck_six'] == 3 && $v['luck_six_amount'] > 0){
|
||||
}elseif ($numberTabInfo['luck_six'] == 3 && $v['luck_six_amount'] > 0){
|
||||
$winMoney = $v['luck_six_amount'] * (1 + $userInfo['price_luck_six_3']) + $winMoney;
|
||||
}else{
|
||||
if($userInfo['type_xima'] != 1) $ximaliang += $v['luck_six_amount'];
|
||||
}
|
||||
// 大小
|
||||
if ($numberTabInfo['big_small'] == 1){
|
||||
$winMoney = $v['big_amount'] * (1 + $userInfo['price_big']) + $winMoney;
|
||||
}
|
||||
if ($numberTabInfo['big_small'] == 2){
|
||||
if($userInfo['type_xima'] != 1) $ximaliang += $v['small_amount'];
|
||||
}elseif ($numberTabInfo['big_small'] == 2){
|
||||
$winMoney = $v['small_amount'] * (1 + $userInfo['price_small']) + $winMoney;
|
||||
if($userInfo['type_xima'] != 1) $ximaliang += $v['big_amount'];
|
||||
}else{
|
||||
if($userInfo['type_xima'] != 1) $ximaliang += $v['big_amount'] + $v['small_amount'];
|
||||
}
|
||||
// 计算最终赢钱金额
|
||||
$winTotal = $winMoney - $amount;
|
||||
|
||||
@@ -10,6 +10,7 @@ use app\models\user\User;
|
||||
use app\services\connect\InitTableService;
|
||||
use freedom\utils\DiceUtil;
|
||||
use freedom\utils\SocketSession;
|
||||
use app\utils\Logger;
|
||||
use think\swoole\Websocket;
|
||||
|
||||
/**
|
||||
@@ -31,6 +32,7 @@ class OpeningDiceService
|
||||
//判断结果并推送结果
|
||||
$res = self::doOpening($event,$tableInfo);
|
||||
if ($res['status'] == false){
|
||||
Logger::warn(Logger::CAT_GAME, 'opening_dice_fail', ['table_id' => $tableInfo['id'], 'msg' => $res['msg']]);
|
||||
$ws->emit('openingDice',['status' => false, 'msg' => $res['msg']]);
|
||||
return;
|
||||
}
|
||||
@@ -47,6 +49,7 @@ class OpeningDiceService
|
||||
);
|
||||
$ws->emit('openingDice',['status' => true, 'table_id' => $tableInfo['id'], 'round' => $round]);
|
||||
$ws->to(SocketSession::HOUSE_NAME)->emit('openingDiceResult',['status' => true, 'table_id' => $tableInfo['id'], 'round' => $round]);
|
||||
Logger::info(Logger::CAT_GAME, 'opening_dice', ['table_id' => $tableInfo['id'], 'result' => $resultArray]);
|
||||
//处理注单
|
||||
self::doBet($ws,$tableInfo,$lastNumberTabInfo,$resultArray,$resultParse);
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ use freedom\utils\CardPosition;
|
||||
use freedom\utils\RedisUtil;
|
||||
use freedom\utils\SocketSession;
|
||||
use think\facade\Env;
|
||||
use app\utils\Logger;
|
||||
use think\swoole\Websocket;
|
||||
|
||||
/**
|
||||
@@ -35,6 +36,7 @@ class OpeningDtService
|
||||
//判断结果并推送结果
|
||||
$res = self::doOpening($event,$tableInfo);
|
||||
if ($res['status'] == false){
|
||||
Logger::warn(Logger::CAT_GAME, 'opening_dt_fail', ['table_id' => $tableInfo['id'], 'msg' => $res['msg']]);
|
||||
$ws->emit('openingDt',['status' => false, 'msg' => $res['msg']]);
|
||||
return;
|
||||
}
|
||||
@@ -52,6 +54,7 @@ class OpeningDtService
|
||||
);
|
||||
$ws->emit('openingDt',['status' => true, 'table_id' => $tableInfo['id'], 'round' => $round]);
|
||||
$ws->to(SocketSession::HOUSE_NAME)->emit('openingDtResult',['status' => true, 'table_id' => $tableInfo['id'], 'round' => $round]);
|
||||
Logger::info(Logger::CAT_GAME, 'opening_dt', ['table_id' => $tableInfo['id'], 'opening' => $opening]);
|
||||
//处理注单
|
||||
self::doBet($ws,$tableInfo,$lastNumberTabInfo);
|
||||
//处理好路
|
||||
@@ -128,19 +131,16 @@ class OpeningDtService
|
||||
}
|
||||
$amount = $v['banker_amount'] + $v['player_amount'] + $v['tie_amount'];
|
||||
$winMoney = 0;
|
||||
// 双边洗码
|
||||
$ximaliang = 0;
|
||||
if($userInfo['type_xima'] == 1){
|
||||
$ximaliang = abs($v['banker_amount'] - $v['player_amount']);
|
||||
}
|
||||
// 龙赢
|
||||
if ($numberTabInfo['result'] == 1) {
|
||||
if($v['banker_amount'] > 0){
|
||||
$winMoney = round($v['banker_amount'] * (1 + $userInfo['price_dragon']),2) + $winMoney;
|
||||
}
|
||||
// 单边洗码
|
||||
if($userInfo['type_xima'] == 2){
|
||||
$ximaliang = $v['player_amount'];
|
||||
if($userInfo['type_xima'] == 1){
|
||||
$ximaliang = $amount;
|
||||
}else{
|
||||
$ximaliang = $v['player_amount'] + $v['tie_amount'];
|
||||
}
|
||||
}
|
||||
// 虎赢
|
||||
@@ -148,18 +148,15 @@ class OpeningDtService
|
||||
if($v['player_amount'] > 0){
|
||||
$winMoney = round($v['player_amount'] * (1 + $userInfo['price_tiger']),2) + $winMoney;
|
||||
}
|
||||
// 单边洗码
|
||||
if($userInfo['type_xima'] == 2){
|
||||
$ximaliang = $v['banker_amount'];
|
||||
if($userInfo['type_xima'] == 1){
|
||||
$ximaliang = $amount;
|
||||
}else{
|
||||
$ximaliang = $v['banker_amount'] + $v['tie_amount'];
|
||||
}
|
||||
}
|
||||
// 和
|
||||
// 和:不杀龙虎,全额退回
|
||||
if ($numberTabInfo['result'] == 3) {
|
||||
if (Env::get('system.dt_half') == 1) {
|
||||
$winMoney = round(($v['banker_amount'] + $v['player_amount']) / 2, 2) + $winMoney;
|
||||
} else {
|
||||
$winMoney = $v['banker_amount'] + $v['player_amount'] + $winMoney;
|
||||
}
|
||||
$winMoney = $v['banker_amount'] + $v['player_amount'] + $winMoney;
|
||||
$ximaliang = 0;
|
||||
if ($v['tie_amount'] > 0) {
|
||||
$winMoney = $v['tie_amount'] * (1 + $userInfo['price_tie_dt']) + $winMoney;
|
||||
|
||||
@@ -11,6 +11,7 @@ use app\services\connect\InitTableService;
|
||||
use freedom\utils\CardPositionNn;
|
||||
use freedom\utils\RedisUtil;
|
||||
use freedom\utils\SocketSession;
|
||||
use app\utils\Logger;
|
||||
use think\swoole\Websocket;
|
||||
|
||||
class OpeningNnService
|
||||
@@ -26,6 +27,7 @@ class OpeningNnService
|
||||
//判断结果并推送结果
|
||||
$res = self::doOpening($event,$tableInfo);
|
||||
if ($res['status'] == false){
|
||||
Logger::warn(Logger::CAT_GAME, 'opening_nn_fail', ['table_id' => $tableInfo['id'], 'msg' => $res['msg']]);
|
||||
$ws->emit('openingNn',['status' => false, 'msg' => $res['msg']]);
|
||||
return;
|
||||
}
|
||||
@@ -41,6 +43,7 @@ class OpeningNnService
|
||||
$round = array_merge($round,$data);
|
||||
$ws->emit('openingNn',['status' => true, 'table_id' => $tableInfo['id'], 'round' => $round]);
|
||||
$ws->to(SocketSession::HOUSE_NAME)->emit('openingNnResult',['status' => true, 'table_id' => $tableInfo['id'], 'round' => $round]);
|
||||
Logger::info(Logger::CAT_GAME, 'opening_nn', ['table_id' => $tableInfo['id'], 'result_banker' => $data['result_banker'], 'win_p1' => $data['win_player_1'], 'win_p2' => $data['win_player_2'], 'win_p3' => $data['win_player_3']]);
|
||||
//处理注单
|
||||
self::doBet($ws,$tableInfo,$lastNumberTabInfo,$data);
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ use app\models\process\Boot;
|
||||
use app\models\process\NumberTab;
|
||||
use app\models\user\User;
|
||||
use app\services\connect\InitTableService;
|
||||
use app\utils\Logger;
|
||||
use freedom\utils\RouletteUtil;
|
||||
use freedom\utils\SocketSession;
|
||||
use think\swoole\Websocket;
|
||||
@@ -31,6 +32,7 @@ class OpeningRouletteService
|
||||
//判断结果并推送结果
|
||||
$res = self::doOpening($event,$tableInfo);
|
||||
if ($res['status'] == false){
|
||||
Logger::warn(Logger::CAT_GAME, 'opening_roulette_fail', ['table_id' => $tableInfo['id'], 'msg' => $res['msg']]);
|
||||
$ws->emit('openingRoulette',['status' => false,'table_id' => $tableInfo['id'], 'msg' => $res['msg']]);
|
||||
return;
|
||||
}
|
||||
@@ -47,6 +49,7 @@ class OpeningRouletteService
|
||||
);
|
||||
$ws->emit('openingRoulette',['status' => true, 'table_id' => $tableInfo['id'], 'round' => $round]);
|
||||
$ws->to(SocketSession::HOUSE_NAME)->emit('openingRouletteResult',['status' => true, 'table_id' => $tableInfo['id'], 'round' => $round]);
|
||||
Logger::info(Logger::CAT_GAME, 'opening_roulette', ['table_id' => $tableInfo['id'], 'result' => $round['result'] ?? '']);
|
||||
//处理注单
|
||||
self::doBet($ws,$tableInfo,$lastNumberTabInfo,$result,$resultParse);
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ use app\services\connect\InitTableService;
|
||||
use freedom\utils\CardPositionTc;
|
||||
use freedom\utils\RedisUtil;
|
||||
use freedom\utils\SocketSession;
|
||||
use app\utils\Logger;
|
||||
use think\swoole\Websocket;
|
||||
|
||||
class OpeningTcService
|
||||
@@ -26,6 +27,7 @@ class OpeningTcService
|
||||
//判断结果并推送结果
|
||||
$res = self::doOpening($event,$tableInfo);
|
||||
if ($res['status'] == false){
|
||||
Logger::warn(Logger::CAT_GAME, 'opening_tc_fail', ['table_id' => $tableInfo['id'], 'msg' => $res['msg']]);
|
||||
$ws->emit('openingTc',['status' => false, 'msg' => $res['msg']]);
|
||||
return;
|
||||
}
|
||||
@@ -41,6 +43,7 @@ class OpeningTcService
|
||||
$round = array_merge($round,$data);
|
||||
$ws->emit('openingTc',['status' => true, 'table_id' => $tableInfo['id'], 'round' => $round]);
|
||||
$ws->to(SocketSession::HOUSE_NAME)->emit('openingTcResult',['status' => true, 'table_id' => $tableInfo['id'], 'round' => $round]);
|
||||
Logger::info(Logger::CAT_GAME, 'opening_tc', ['table_id' => $tableInfo['id'], 'result_banker' => $data['result_banker'], 'win_p1' => $data['win_player_1'], 'win_p2' => $data['win_player_2'], 'win_p3' => $data['win_player_3']]);
|
||||
//处理注单
|
||||
self::doBet($ws,$tableInfo,$lastNumberTabInfo,$data);
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ use app\models\user\User;
|
||||
use app\services\connect\InitTableService;
|
||||
use freedom\utils\SocketSession;
|
||||
use freedom\utils\ToningUtil;
|
||||
use app\utils\Logger;
|
||||
use think\swoole\Websocket;
|
||||
|
||||
/**
|
||||
@@ -31,6 +32,7 @@ class OpeningToningService
|
||||
//判断结果并推送结果
|
||||
$res = self::doOpening($event,$tableInfo);
|
||||
if ($res['status'] == false){
|
||||
Logger::warn(Logger::CAT_GAME, 'opening_toning_fail', ['table_id' => $tableInfo['id'], 'msg' => $res['msg']]);
|
||||
$ws->emit('openingToning',['status' => false, 'msg' => $res['msg']]);
|
||||
return;
|
||||
}
|
||||
@@ -46,6 +48,7 @@ class OpeningToningService
|
||||
);
|
||||
$ws->emit('openingToning',['status' => true, 'table_id' => $tableInfo['id'], 'round' => $round]);
|
||||
$ws->to(SocketSession::HOUSE_NAME)->emit('openingToningResult',['status' => true, 'table_id' => $tableInfo['id'], 'round' => $round]);
|
||||
Logger::info(Logger::CAT_GAME, 'opening_toning', ['table_id' => $tableInfo['id'], 'result' => $result]);
|
||||
//处理注单
|
||||
self::doBet($ws,$tableInfo,$lastNumberTabInfo);
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ class CountdownService
|
||||
//处理倒计时
|
||||
$waitTime = intval($tableInfo['wait_time']);
|
||||
//将倒计时用作是redis的过期时间
|
||||
RedisUtil::save('countdown_'.$numberTabInfo['id'],$waitTime,$waitTime);
|
||||
RedisUtil::save('countdown_'.$numberTabInfo['id'],$waitTime,$waitTime + 10);
|
||||
while($waitTime >= 0){
|
||||
$countdown = Cache::store('redis')->get('countdown_'.$numberTabInfo['id']);
|
||||
if ($countdown){
|
||||
|
||||
@@ -6,6 +6,7 @@ namespace app\services\process;
|
||||
|
||||
use app\models\process\NumberTab;
|
||||
use app\services\connect\InitTableService;
|
||||
use app\utils\Logger;
|
||||
use freedom\utils\RedisUtil;
|
||||
use freedom\utils\SocketSession;
|
||||
|
||||
@@ -41,8 +42,10 @@ class EndBetService
|
||||
'number_tab_status' => InitTableService::numberTabStatus($numberTabInfo)
|
||||
]
|
||||
]);
|
||||
Logger::info(Logger::CAT_GAME, 'end_bet', ['table_id' => $tableInfo['id'], 'nt_id' => $numberTabId]);
|
||||
}else{
|
||||
$ws->emit('endBet', ['status' => false, 'msg' => $modelRes['msg']]);
|
||||
Logger::warn(Logger::CAT_GAME, 'end_bet_fail', ['table_id' => $tableInfo['id'], 'msg' => $modelRes['msg'], 'bet_status' => $modelRes['bet_status'] ?? null]);
|
||||
$ws->emit('endBet', ['status' => false, 'msg' => $modelRes['msg'], 'bet_status' => $modelRes['bet_status'] ?? null]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,7 @@ namespace app\services\process;
|
||||
|
||||
use app\models\process\NumberTab;
|
||||
use app\services\connect\InitTableService;
|
||||
use app\utils\Logger;
|
||||
use freedom\utils\SocketSession;
|
||||
|
||||
/**
|
||||
@@ -26,15 +27,15 @@ class ResetNumberTabService
|
||||
$numberTabInfo = InitTableService::initTable($tableInfo);
|
||||
if (!$numberTabInfo){
|
||||
$ws->emit('resetNumberTab', ['status' => false, 'msg' => 'not_number_tab_data']);
|
||||
Logger::warn(Logger::CAT_GAME, 'reset_number_tab_fail', ['table_id' => $tableInfo['id'], 'reason' => 'not_number_tab_data']);
|
||||
return;
|
||||
}
|
||||
// 调试日志
|
||||
\think\facade\Log::write('resetNumberTab debug: bet_status=' . $numberTabInfo['bet_status'] . ', rob_status=' . $numberTabInfo['rob_status'] . ', id=' . $numberTabInfo['id'] . ', boot_id=' . $numberTabInfo['boot_id'], 'info');
|
||||
if($numberTabInfo['bet_status'] == 1 || $numberTabInfo['bet_status'] == 2 || ($numberTabInfo['bet_status'] == 0 && $numberTabInfo['rob_status'] == 1) || ($numberTabInfo['bet_status'] == 0 && $numberTabInfo['rob_status'] == 2)){
|
||||
Logger::info(Logger::CAT_GAME, 'reset_number_tab_attempt', ['table_id' => $tableInfo['id'], 'bet_status' => $numberTabInfo['bet_status'], 'nt_id' => $numberTabInfo['id']]);
|
||||
if($numberTabInfo['bet_status'] == 1 || $numberTabInfo['bet_status'] == 2 || $numberTabInfo['bet_status'] == 3 || ($numberTabInfo['bet_status'] == 0 && ($numberTabInfo['rob_status'] == 1 || $numberTabInfo['rob_status'] == 2))){
|
||||
//事务处理
|
||||
$res = NumberTab::resetNumberTab($numberTabInfo);
|
||||
\think\facade\Log::write('resetNumberTab result: ' . ($res ? 'true' : 'false'), 'info');
|
||||
if (!$res){
|
||||
Logger::warn(Logger::CAT_GAME, 'reset_number_tab_fail', ['table_id' => $tableInfo['id'], 'nt_id' => $numberTabInfo['id']]);
|
||||
$ws->emit('resetNumberTab', ['status' => false, 'msg' => 'reset_number_fail']);
|
||||
return;
|
||||
}
|
||||
@@ -55,8 +56,10 @@ class ResetNumberTabService
|
||||
$ws->to(SocketSession::HOUSE_NAME)->emit('resetNumberTab', $responseData);
|
||||
// 同时发送给请求者
|
||||
$ws->emit('resetNumberTab', $responseData);
|
||||
Logger::info(Logger::CAT_GAME, 'reset_number_tab', ['table_id' => $tableInfo['id'], 'nt_id' => $numberTabInfo['id']]);
|
||||
}else{
|
||||
$ws->emit('resetNumberTab', ['status' => false, 'msg' => 'reset_number_fail']);
|
||||
Logger::warn(Logger::CAT_GAME, 'reset_number_tab_fail', ['table_id' => $tableInfo['id'], 'number_tab_id' => $numberTabInfo['id'], 'reason' => 'invalid_bet_status']);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,7 @@ namespace app\services\process;
|
||||
|
||||
use app\models\process\NumberTab;
|
||||
use app\services\connect\InitTableService;
|
||||
use app\utils\Logger;
|
||||
use freedom\utils\SocketSession;
|
||||
|
||||
/**
|
||||
@@ -44,7 +45,9 @@ class StartBetService
|
||||
$ws->emit('startBet', $responseData);
|
||||
//启动倒计时(该处以后会废弃掉)
|
||||
CountdownService::countdown($numberTabId,$tableInfo,$modelRes['data']);
|
||||
Logger::info(Logger::CAT_GAME, 'start_bet', ['table_id' => $tableInfo['id'], 'table_name' => $tableInfo['table_name'], 'nt_id' => $numberTabId]);
|
||||
}else{
|
||||
Logger::warn(Logger::CAT_GAME, 'start_bet_fail', ['table_id' => $tableInfo['id'], 'msg' => $modelRes['msg']]);
|
||||
$ws->emit('startBet', ['status' => false, 'msg' => $modelRes['msg']]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
namespace app\services\reset;
|
||||
|
||||
use app\models\process\NumberTab;
|
||||
use app\utils\Logger;
|
||||
use freedom\utils\SocketSession;
|
||||
use think\swoole\Websocket;
|
||||
|
||||
@@ -27,25 +28,29 @@ class ResetBaccaratService
|
||||
$numberTabInfo = NumberTab::getByTableIdOrderByIdDesc_two($tableInfo);
|
||||
if (!$numberTabInfo){
|
||||
$ws->emit('resetBaccarat', ['status' => false, 'msg' => 'not_number_tab_data']);
|
||||
Logger::warn(Logger::CAT_GAME, 'reset_baccarat_fail', ['table_id' => $tableInfo['id'], 'reason' => 'not_number_tab_data']);
|
||||
return;
|
||||
}
|
||||
if(count($numberTabInfo) != 2){
|
||||
$ws->emit('resetBaccarat', ['status' => false, 'msg' => '上一铺数据不存在']);
|
||||
Logger::warn(Logger::CAT_GAME, 'reset_baccarat_fail', ['table_id' => $tableInfo['id'], 'reason' => 'previous_round_not_found']);
|
||||
return;
|
||||
}
|
||||
if($numberTabInfo[0]['boot_id'] != $numberTabInfo[1]['boot_id']){
|
||||
$ws->emit('resetBaccarat', ['status' => false, 'msg' => '上一铺不在同一靴']);
|
||||
Logger::warn(Logger::CAT_GAME, 'reset_baccarat_fail', ['table_id' => $tableInfo['id'], 'reason' => 'boot_mismatch']);
|
||||
return;
|
||||
}
|
||||
|
||||
$numberTabInfo = $numberTabInfo[1];
|
||||
if($event['opening'] == $numberTabInfo['result'] && $event['pair'] == $numberTabInfo['pair'] && $event['luck_six'] == $numberTabInfo['luck_six']){
|
||||
if($event['opening'] == $numberTabInfo['result'] && $event['pair'] == $numberTabInfo['pair'] && ($event['luck_six'] ?? 0) == $numberTabInfo['luck_six'] && ($event['dragon_seven'] ?? 0) == $numberTabInfo['dragon_seven'] && ($event['panda_eight'] ?? 0) == $numberTabInfo['panda_eight']){
|
||||
$ws->emit('resetBaccarat', ['status' => false, 'msg' => '结果一样']);
|
||||
return;
|
||||
}
|
||||
$res = NumberTab::resetBaccarat($event,$numberTabInfo,$tableInfo);
|
||||
if (!$res){
|
||||
$ws->emit('resetBaccarat', ['status' => false, 'msg' => '修改上一局结果失败']);
|
||||
Logger::warn(Logger::CAT_GAME, 'reset_baccarat_fail', ['table_id' => $tableInfo['id'], 'number_tab_id' => $numberTabInfo['id'], 'reason' => 'db_update_failed']);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -56,5 +61,6 @@ class ResetBaccaratService
|
||||
'previous_number_tab_id' => $numberTabInfo['id']
|
||||
]
|
||||
]);
|
||||
Logger::info(Logger::CAT_GAME, 'reset_baccarat', ['table_id' => $tableInfo['id'], 'opening' => $event['opening'], 'pair' => $event['pair']]);
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,7 @@
|
||||
namespace app\services\reset;
|
||||
|
||||
use app\models\process\NumberTab;
|
||||
use app\utils\Logger;
|
||||
use freedom\utils\SocketSession;
|
||||
use think\swoole\Websocket;
|
||||
|
||||
@@ -27,14 +28,17 @@ class ResetDtService
|
||||
$numberTabInfo = NumberTab::getByTableIdOrderByIdDesc_two($tableInfo);
|
||||
if (!$numberTabInfo){
|
||||
$ws->emit('resetDt', ['status' => false, 'msg' => 'not_number_tab_data']);
|
||||
Logger::warn(Logger::CAT_GAME, 'reset_dt_fail', ['table_id' => $tableInfo['id'], 'reason' => 'not_number_tab_data']);
|
||||
return;
|
||||
}
|
||||
if(count($numberTabInfo) != 2){
|
||||
$ws->emit('resetDt', ['status' => false, 'msg' => '上一铺数据不存在']);
|
||||
Logger::warn(Logger::CAT_GAME, 'reset_dt_fail', ['table_id' => $tableInfo['id'], 'reason' => 'previous_round_not_found']);
|
||||
return;
|
||||
}
|
||||
if($numberTabInfo[0]['boot_id'] != $numberTabInfo[1]['boot_id']){
|
||||
$ws->emit('resetDt', ['status' => false, 'msg' => '上一铺不在同一靴']);
|
||||
Logger::warn(Logger::CAT_GAME, 'reset_dt_fail', ['table_id' => $tableInfo['id'], 'reason' => 'boot_mismatch']);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -46,6 +50,7 @@ class ResetDtService
|
||||
$res = NumberTab::resetDt($event,$numberTabInfo,$tableInfo);
|
||||
if (!$res){
|
||||
$ws->emit('resetDt', ['status' => false, 'msg' => '修改上一局结果失败']);
|
||||
Logger::warn(Logger::CAT_GAME, 'reset_dt_fail', ['table_id' => $tableInfo['id'], 'number_tab_id' => $numberTabInfo['id'], 'reason' => 'db_update_failed']);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -56,5 +61,6 @@ class ResetDtService
|
||||
'previous_number_tab_id' => $numberTabInfo['id']
|
||||
]
|
||||
]);
|
||||
Logger::info(Logger::CAT_GAME, 'reset_dt', ['table_id' => $tableInfo['id'], 'opening' => $event['opening']]);
|
||||
}
|
||||
}
|
||||
@@ -16,7 +16,7 @@ use app\models\process\WaybillRemind;
|
||||
class WaybillRemindService{
|
||||
public static function parseWaybillRemind($game_id, $table_id, $table_name, $boot_id){
|
||||
$is_good = array();
|
||||
$ns = NumberTab::getByBootIdDone($boot_id,'result, pair');
|
||||
$ns = NumberTab::getByBootIdDone($boot_id,'result,pair,luck_six,dragon_seven,panda_eight');
|
||||
$bigRoad = array();
|
||||
//列
|
||||
$yKey = 0;
|
||||
@@ -99,6 +99,7 @@ class WaybillRemindService{
|
||||
}
|
||||
}
|
||||
$bigRoad_lenth = count($bigRoadLocation);
|
||||
try {
|
||||
if($bigRoad_lenth >= 4){
|
||||
//y=1
|
||||
if($bigRoadLocation[$bigRoad_lenth-1]['show_y'] == 1){
|
||||
@@ -530,7 +531,7 @@ class WaybillRemindService{
|
||||
}
|
||||
}elseif($bigRoadLocation[$bigRoad_lenth-1]['result'] == 2){
|
||||
if($bigRoadLocation[$bigRoad_lenth-1]['show_y'] < 6){
|
||||
$last_banker_lenth = $bigRoadLocation[$bigRoad_lenth-1]['show_y'];
|
||||
$last_player_lenth = $bigRoadLocation[$bigRoad_lenth-1]['show_y'];
|
||||
}
|
||||
if($bigRoadLocation[$bigRoad_lenth-1]['show_y'] == 6){
|
||||
for($length=0;$length<99;$length++){
|
||||
@@ -616,6 +617,9 @@ class WaybillRemindService{
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (\Throwable $e) {
|
||||
// 路子珠数据不足时跳过 pattern 检测
|
||||
}
|
||||
$table = WaybillRemind::where('table_id',$table_id)->find();
|
||||
$create_time = time();
|
||||
$bigRoadLocation = json_encode($bigRoadLocation);
|
||||
|
||||
Reference in New Issue
Block a user