Files
Socket/app/services/process/EndBetService.php
T
testadmin aa74a6edc1 fix: 荷官端卡住根因修复 — endBet防抖+状态同步+WaybillRemind越界
1. end_bet_error翻译从'停止成功'改为'已停止下注'(误导荷官以为操作成功)
2. endBet()加2秒防抖,防止连按Enter导致重复请求
3. Numpad 0加状态守卫,只在bet_status=1时才调endBet
4. endBet失败时前端自动同步服务端bet_status,不再弹错误框
5. 后端end_bet_error响应附带当前bet_status供前端同步
6. WaybillRemindService路子珠pattern检测加try-catch,消除每日59次offset -1错误
2026-05-19 00:28:02 +08:00

51 lines
1.9 KiB
PHP

<?php
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;
/**
* TODO 结束倒计时
* Class EndBetService
* @package app\services\process
*/
class EndBetService
{
/**
* TODO 处理结束倒计时
* @param int $numberTabId
* @param array $tableInfo
* @return void
*/
public static function endBet(int $numberTabId, array $tableInfo){
$ws = app('\think\swoole\WebSocket');
$modelRes = NumberTab::endBet($numberTabId);
if ($modelRes['status'] == true){
$numberTabInfo = $modelRes['data'];
//清除Redis
RedisUtil::delete('countdown_'.$numberTabInfo['id']);
$ws->to(SocketSession::HOUSE_NAME)->emit('endBet',[
'status' => true,
'table_id' => $tableInfo['id'],
'round' => [
'boot_id' => $numberTabInfo['boot_id'],
'boot_num' => $numberTabInfo['boot_num'],
'number_tab_id' => $numberTabInfo['id'],
'number_tab_number' => $numberTabInfo['number'],
'in_checkout' => $tableInfo['in_checkout'],
'number_tab_status' => InitTableService::numberTabStatus($numberTabInfo)
]
]);
Logger::info(Logger::CAT_GAME, 'end_bet', ['table_id' => $tableInfo['id'], 'nt_id' => $numberTabId]);
}else{
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]);
}
}
}