diff --git a/app/services/process/CountdownService.php b/app/services/process/CountdownService.php index f40b387..c31158a 100644 --- a/app/services/process/CountdownService.php +++ b/app/services/process/CountdownService.php @@ -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){ diff --git a/public/static/handle/js/handle.js b/public/static/handle/js/handle.js index d8fd56c..c59158a 100644 --- a/public/static/handle/js/handle.js +++ b/public/static/handle/js/handle.js @@ -532,9 +532,21 @@ websocket.on('resetBoot',function(data){ } } }); +var _cdTimer = null; +var _cdVal = 0; websocket.on('startBetCountDown',function(data){ if(data.status == true && data.table_id == table_id){ + _cdVal = data.count_down; countDown(data.count_down); + if(_cdTimer) clearTimeout(_cdTimer); + if(_cdVal > 0){ + _cdTimer = setTimeout(function _tick(){ + _cdVal--; + if(_cdVal >= 0) countDown(_cdVal); + if(_cdVal > 0) _cdTimer = setTimeout(_tick, 1000); + else _cdTimer = null; + }, 2000); + } } }); websocket.on('endBet',function(data){ diff --git a/public/static/handle/js/handle_b.js b/public/static/handle/js/handle_b.js index ae5436d..cb71bf7 100644 --- a/public/static/handle/js/handle_b.js +++ b/public/static/handle/js/handle_b.js @@ -259,9 +259,21 @@ websocket.on('resetBoot',function(data){ layer.msg(lang[data.msg]); } }); +var _cdTimer = null; +var _cdVal = 0; websocket.on('startBetCountDown',function(data){ if(data.status == true && data.table_id == table_id){ + _cdVal = data.count_down; countDown(data.count_down); + if(_cdTimer) clearTimeout(_cdTimer); + if(_cdVal > 0){ + _cdTimer = setTimeout(function _tick(){ + _cdVal--; + if(_cdVal >= 0) countDown(_cdVal); + if(_cdVal > 0) _cdTimer = setTimeout(_tick, 1000); + else _cdTimer = null; + }, 2000); + } } }); websocket.on('endBet',function(data){ diff --git a/public/static/handle/js/handle_b_sb.js b/public/static/handle/js/handle_b_sb.js index 661d428..b4acc2c 100644 --- a/public/static/handle/js/handle_b_sb.js +++ b/public/static/handle/js/handle_b_sb.js @@ -504,9 +504,21 @@ websocket.on('resetBoot',function(data){ } } }); +var _cdTimer = null; +var _cdVal = 0; websocket.on('startBetCountDown',function(data){ if(data.status == true && data.table_id == table_id){ + _cdVal = data.count_down; countDown(data.count_down); + if(_cdTimer) clearTimeout(_cdTimer); + if(_cdVal > 0){ + _cdTimer = setTimeout(function _tick(){ + _cdVal--; + if(_cdVal >= 0) countDown(_cdVal); + if(_cdVal > 0) _cdTimer = setTimeout(_tick, 1000); + else _cdTimer = null; + }, 2000); + } } }); websocket.on('endBet',function(data){ diff --git a/public/static/handle/js/handle_b_sb_scan_four.js b/public/static/handle/js/handle_b_sb_scan_four.js index 6e31a69..8458067 100644 --- a/public/static/handle/js/handle_b_sb_scan_four.js +++ b/public/static/handle/js/handle_b_sb_scan_four.js @@ -520,9 +520,21 @@ websocket.on('resetBoot',function(data){ } } }); +var _cdTimer = null; +var _cdVal = 0; websocket.on('startBetCountDown',function(data){ if(data.status == true && data.table_id == table_id){ + _cdVal = data.count_down; countDown(data.count_down); + if(_cdTimer) clearTimeout(_cdTimer); + if(_cdVal > 0){ + _cdTimer = setTimeout(function _tick(){ + _cdVal--; + if(_cdVal >= 0) countDown(_cdVal); + if(_cdVal > 0) _cdTimer = setTimeout(_tick, 1000); + else _cdTimer = null; + }, 2000); + } } }); websocket.on('endBet',function(data){ diff --git a/public/static/handle/js/handle_dice.js b/public/static/handle/js/handle_dice.js index 2439a89..942d6ba 100644 --- a/public/static/handle/js/handle_dice.js +++ b/public/static/handle/js/handle_dice.js @@ -197,9 +197,21 @@ websocket.on('resetBoot',function(data){ } } }); +var _cdTimer = null; +var _cdVal = 0; websocket.on('startBetCountDown',function(data){ if(data.status == true && data.table_id == table_id){ + _cdVal = data.count_down; countDown(data.count_down); + if(_cdTimer) clearTimeout(_cdTimer); + if(_cdVal > 0){ + _cdTimer = setTimeout(function _tick(){ + _cdVal--; + if(_cdVal >= 0) countDown(_cdVal); + if(_cdVal > 0) _cdTimer = setTimeout(_tick, 1000); + else _cdTimer = null; + }, 2000); + } } }); websocket.on('endBet',function(data){ diff --git a/public/static/handle/js/handle_dt_sb.js b/public/static/handle/js/handle_dt_sb.js index 7d77777..e741375 100644 --- a/public/static/handle/js/handle_dt_sb.js +++ b/public/static/handle/js/handle_dt_sb.js @@ -495,9 +495,21 @@ websocket.on('resetBoot',function(data){ } } }); +var _cdTimer = null; +var _cdVal = 0; websocket.on('startBetCountDown',function(data){ if(data.status == true && data.table_id == table_id){ + _cdVal = data.count_down; countDown(data.count_down); + if(_cdTimer) clearTimeout(_cdTimer); + if(_cdVal > 0){ + _cdTimer = setTimeout(function _tick(){ + _cdVal--; + if(_cdVal >= 0) countDown(_cdVal); + if(_cdVal > 0) _cdTimer = setTimeout(_tick, 1000); + else _cdTimer = null; + }, 2000); + } } }); websocket.on('endBet',function(data){ diff --git a/public/static/handle/js/handle_nn_sb.js b/public/static/handle/js/handle_nn_sb.js index dda2001..8ca0818 100644 --- a/public/static/handle/js/handle_nn_sb.js +++ b/public/static/handle/js/handle_nn_sb.js @@ -565,9 +565,21 @@ websocket.on('resetBoot',function(data){ } } }); +var _cdTimer = null; +var _cdVal = 0; websocket.on('startBetCountDown',function(data){ if(data.status == true && data.table_id == table_id){ + _cdVal = data.count_down; countDown(data.count_down); + if(_cdTimer) clearTimeout(_cdTimer); + if(_cdVal > 0){ + _cdTimer = setTimeout(function _tick(){ + _cdVal--; + if(_cdVal >= 0) countDown(_cdVal); + if(_cdVal > 0) _cdTimer = setTimeout(_tick, 1000); + else _cdTimer = null; + }, 2000); + } } }); websocket.on('endBet',function(data){ diff --git a/public/static/handle/js/handle_roulette.js b/public/static/handle/js/handle_roulette.js index 4ee15c6..f77c656 100644 --- a/public/static/handle/js/handle_roulette.js +++ b/public/static/handle/js/handle_roulette.js @@ -177,9 +177,21 @@ websocket.on('resetBoot',function(data){ } } }); +var _cdTimer = null; +var _cdVal = 0; websocket.on('startBetCountDown',function(data){ if(data.status == true && data.table_id == table_id){ + _cdVal = data.count_down; countDown(data.count_down); + if(_cdTimer) clearTimeout(_cdTimer); + if(_cdVal > 0){ + _cdTimer = setTimeout(function _tick(){ + _cdVal--; + if(_cdVal >= 0) countDown(_cdVal); + if(_cdVal > 0) _cdTimer = setTimeout(_tick, 1000); + else _cdTimer = null; + }, 2000); + } } }); websocket.on('endBet',function(data){