Socket/app/services/waybill/WaybillRemindService.php
2026-01-28 23:48:20 +08:00

649 lines
50 KiB
PHP

<?php
namespace app\services\waybill;
use app\models\process\Boot;
use app\models\process\NumberTab;
use app\models\table\Table;
use app\models\process\WaybillRemind;
/**
* TODO
* Class WaybillRemind
* @package app\services\waybill
*/
class WaybillRemindService{
public static function parseWaybillRemind($game_id, $table_id, $table_name, $boot_id){
$is_good = array();
$ns = NumberTab::getByBootIdDone($boot_id,'result, pair');
$bigRoad = array();
//列
$yKey = 0;
//行
$xKey = 0;
$last = array();
foreach($ns AS $key => $value){
if($value['pair'] == 1){
$pair = 1;
}elseif($value['pair'] == 2){
$pair = 2;
}elseif($value['pair'] == 3){
$pair = 3;
}else{
$pair = 0;
}
if($key == 0 && $value['result'] == 3){
$bigRoad[$yKey][$xKey] = array('result' => 3, 'tie_num' => 1, 'pair' => $pair);
$last = array('yKey' => $yKey, 'xKey' => $xKey);
}elseif($yKey == 0 && $xKey == 0 && !empty($last) && $value['result'] != 3){
$bigRoad[$last['yKey']][$last['xKey']]['result'] = $value['result'];
$bigRoad[$last['yKey']][$last['xKey']]['pair'] = $value['pair'];
if(isset($ns[$key+1]) && $ns[$key+1]['result'] != $bigRoad[$last['yKey']][$last['xKey']]['result'] && $ns[$key+1]['result'] != 3){
$yKey++;
$xKey = 0;
}elseif(isset($ns[$key+1]) && $ns[$key+1]['result'] == $bigRoad[$last['yKey']][$last['xKey']]['result'] && $ns[$key+1]['result'] != 3){
$xKey++;
}
$last = array('yKey' => $yKey, 'xKey' => $xKey);
}elseif($key > 0 && $value['result'] == 3){
$bigRoad[$last['yKey']][$last['xKey']]['tie_num'] = $bigRoad[$last['yKey']][$last['xKey']]['tie_num'] + 1;
if(isset($ns[$key+1]) && $ns[$key+1]['result'] != $bigRoad[$last['yKey']][$last['xKey']]['result'] && $ns[$key+1]['result'] != 3 && $bigRoad[$last['yKey']][$last['xKey']]['result'] != 3){
$yKey++;
$xKey = 0;
}elseif(isset($ns[$key+1]) && $ns[$key+1]['result'] == $bigRoad[$last['yKey']][$last['xKey']]['result'] && $ns[$key+1]['result'] != 3 && $bigRoad[$last['yKey']][$last['xKey']]['result'] != 3){
$xKey++;
}
$last = array('yKey' => $last['yKey'], 'xKey' => $last['xKey']);
}else{
$bigRoad[$yKey][$xKey] = array('result' => $value['result'], 'tie_num' => 0, 'pair' => $pair);
if(isset($ns[$key+1]) && $ns[$key+1]['result'] != $bigRoad[$yKey][$xKey]['result'] && $ns[$key+1]['result'] != 3){
$yKey++;
$xKey = 0;
}elseif(isset($ns[$key+1]) && $ns[$key+1]['result'] == $bigRoad[$yKey][$xKey]['result'] && $ns[$key+1]['result'] != 3){
$xKey++;
}
$last = array('yKey' => $yKey, 'xKey' => $xKey);
}
}
//重新计算坐标
$bigRoadLocation = array();
$occupy = array();
foreach($bigRoad AS $key => $value){
$swerve = false;
$swerveY = $key;
foreach($value AS $k => $v){
$show_y = $key;
$show_x = $k;
if($show_x > 5 && $swerve === false){
$swerveY = $swerveY + 1;
$show_y = $swerveY;
$show_x = 5;
array_push($occupy,$show_y.'-'.$show_x);
}elseif(in_array($show_y.'-'.$show_x,$occupy)){
if($swerve === false){
$swerve = $show_x - 1;
}
$swerveY = $swerveY + 1;
$show_y = $swerveY;
$show_x = $swerve;
array_push($occupy,$show_y.'-'.$show_x);
}elseif($swerve !== false){
$swerveY = $swerveY + 1;
$show_y = $swerveY;
$show_x = $swerve;
array_push($occupy,$show_y.'-'.$show_x);
}
$pushArray = array('show_x' => $show_y+1, 'show_y' => $show_x+1, 'result' => $v['result'], 'pair' => $v['pair'], 'tie_num' => $v['tie_num']);
array_push($bigRoadLocation,$pushArray);
}
}
$bigRoad_lenth = count($bigRoadLocation);
if($bigRoad_lenth >= 4){
//y=1
if($bigRoadLocation[$bigRoad_lenth-1]['show_y'] == 1){
//庄
if($bigRoad_lenth > 4){
if($bigRoadLocation[$bigRoad_lenth-1]['show_y'] == 1 && $bigRoadLocation[$bigRoad_lenth-1]['result'] == 1){
if($bigRoadLocation[$bigRoad_lenth-2]['show_y'] == 1 && $bigRoadLocation[$bigRoad_lenth-2]['result'] == 2){
if($bigRoadLocation[$bigRoad_lenth-3]['show_y'] == 1 && $bigRoadLocation[$bigRoad_lenth-3]['result'] == 1){
if($bigRoadLocation[$bigRoad_lenth-4]['show_y'] == 1 && $bigRoadLocation[$bigRoad_lenth-4]['result'] == 2){
if($bigRoadLocation[$bigRoad_lenth-5]['show_y'] == 1 && $bigRoadLocation[$bigRoad_lenth-5]['result'] == 1){
$is_good = array('table_id' => $table_id, 'waybill_type' => '大路单挑');
}
}
}
}
}
}
//闲
if($bigRoadLocation[$bigRoad_lenth-1]['show_y'] == 1 && $bigRoadLocation[$bigRoad_lenth-1]['result'] == 2){
if($bigRoadLocation[$bigRoad_lenth-2]['show_y'] == 1 && $bigRoadLocation[$bigRoad_lenth-2]['result'] == 1){
if($bigRoadLocation[$bigRoad_lenth-3]['show_y'] == 1 && $bigRoadLocation[$bigRoad_lenth-3]['result'] == 2){
if($bigRoadLocation[$bigRoad_lenth-4]['show_y'] == 1 && $bigRoadLocation[$bigRoad_lenth-4]['result'] == 1){
$is_good = array('table_id' => $table_id, 'waybill_type' => '大路单挑');
}
}
}elseif($bigRoadLocation[$bigRoad_lenth-2]['show_y'] == 2 && $bigRoadLocation[$bigRoad_lenth-2]['result'] == 1){
if($bigRoad_lenth > 4){
if($bigRoadLocation[$bigRoad_lenth-4]['show_y'] == 1 && $bigRoadLocation[$bigRoad_lenth-4]['result'] == 2){
if($bigRoadLocation[$bigRoad_lenth-5]['show_y'] >= 4 && $bigRoadLocation[$bigRoad_lenth-5]['result'] == 1){
$is_good = array('table_id' => $table_id, 'waybill_type' =>'逢庄黐');
}
}
}
}
}
}
//y=2
if($bigRoadLocation[$bigRoad_lenth-1]['show_y'] == 2){
if($bigRoadLocation[$bigRoad_lenth-1]['result'] == 1){
if($bigRoadLocation[$bigRoad_lenth-3]['show_y'] >= 2 && $bigRoadLocation[$bigRoad_lenth-3]['result'] == 2){
$is_good = array('table_id' => $table_id, 'waybill_type' => '拍拍黐');
}elseif($bigRoadLocation[$bigRoad_lenth-3]['show_y'] == 1 && $bigRoadLocation[$bigRoad_lenth-3]['result'] == 2){
if($bigRoadLocation[$bigRoad_lenth-4]['show_y'] == 2 && $bigRoadLocation[$bigRoad_lenth-4]['result'] == 1){
if($bigRoad_lenth >= 6){
if($bigRoadLocation[$bigRoad_lenth-6]['show_y'] == 1 && $bigRoadLocation[$bigRoad_lenth-6]['result'] == 2){
$is_good = array('table_id' => $table_id, 'waybill_type' => '一厅两房(闲)');
}
}
}
}elseif($bigRoadLocation[$bigRoad_lenth-3]['show_y'] >=4 && $bigRoadLocation[$bigRoad_lenth-3]['result'] == 2){
if($bigRoad_lenth >= 9){
$is_low = $bigRoadLocation[$bigRoad_lenth-1]['show_x'] - $bigRoadLocation[$bigRoad_lenth-3]['show_x'];
if($is_low == 1){
$player_length = $bigRoadLocation[$bigRoad_lenth-3]['show_y'];
}elseif($is_low == 0){
$player_length = $bigRoadLocation[$bigRoad_lenth-3]['show_y'] + 1;
}elseif($is_low < 0){
$player_length = $bigRoadLocation[$bigRoad_lenth-3]['show_y'] - ($is_low * 2);
}
if($bigRoadLocation[$bigRoad_lenth-3-$player_length]['show_y'] == 1 && $bigRoadLocation[$bigRoad_lenth-3-$player_length]['result'] == 1){
if($bigRoadLocation[$bigRoad_lenth-4-$player_length]['show_y'] == 2 && $bigRoadLocation[$bigRoad_lenth-4-$player_length]['result'] == 2){
$is_good = array('table_id' => $table_id, 'waybill_type' => '逢闲黐');
}
}
}
}
if($bigRoadLocation[$bigRoad_lenth-3]['result'] == 2){
if($bigRoadLocation[$bigRoad_lenth-3]['show_y'] < 6){
$player_length = $bigRoadLocation[$bigRoad_lenth-3]['show_y'];
}elseif($bigRoadLocation[$bigRoad_lenth-3]['show_y'] == 6){
$is_low = $bigRoadLocation[$bigRoad_lenth-2]['show_x'] - $bigRoadLocation[$bigRoad_lenth-3]['show_x'];
if($is_low == 1){
$player_length = $bigRoadLocation[$bigRoad_lenth-3]['show_y'];
}elseif($is_low == 0){
$player_length = $bigRoadLocation[$bigRoad_lenth-3]['show_y'] + 1;
}elseif($is_low < 0){
$player_length = $bigRoadLocation[$bigRoad_lenth-3]['show_y'] - ($is_low * 2);
}
}
if($bigRoadLocation[$bigRoad_lenth-3-$player_length]['show_y'] == 1 && $bigRoadLocation[$bigRoad_lenth-3-$player_length]['result'] == 1){
if($bigRoadLocation[$bigRoad_lenth-4-$player_length]['result'] == 2){
if($bigRoadLocation[$bigRoad_lenth-4-$player_length]['show_y'] < 6){
$player_length_2 = $bigRoadLocation[$bigRoad_lenth-4-$player_length]['show_y'];
}elseif($bigRoadLocation[$bigRoad_lenth-4-$player_length]['show_y'] == 6){
$is_low = $bigRoadLocation[$bigRoad_lenth-3-$player_length]['show_x'] - $bigRoadLocation[$bigRoad_lenth-4-$player_length]['show_x'];
if($is_low == 1){
$player_length_2 = $bigRoadLocation[$bigRoad_lenth-3-$player_length]['show_y'];
}elseif($is_low == 0){
$player_length_2 = $bigRoadLocation[$bigRoad_lenth-3-$player_length]['show_y'] + 1;
}elseif($is_low < 0){
$player_length_2 = $bigRoadLocation[$bigRoad_lenth-3-$player_length]['show_y'] - ($is_low * 2);
}
}
if($bigRoadLocation[$bigRoad_lenth-4-$player_length-$player_length_2]['show_y'] >= 2 && $bigRoadLocation[$bigRoad_lenth-4-$player_length-$player_length_2]['result'] == 1){
if($bigRoadLocation[$bigRoad_lenth-4-$player_length-$player_length_2]['show_y'] < 6){
$banker_lenth = $bigRoadLocation[$bigRoad_lenth-4-$player_length-$player_length_2]['show_y'];
}elseif($bigRoadLocation[$bigRoad_lenth-4-$player_length-$player_length_2]['show_y'] == 6){
$is_low = $bigRoadLocation[$bigRoad_lenth-3-$player_length-$player_length_2]['show_x'] - $bigRoadLocation[$bigRoad_lenth-4-$player_length-$player_length_2]['show_x'];
if($is_low == 1){
$banker_lenth = $bigRoadLocation[$bigRoad_lenth-4-$player_length-$player_length_2]['show_y'];
}elseif($is_low == 0){
$banker_lenth = $bigRoadLocation[$bigRoad_lenth-4-$player_length-$player_length_2]['show_y'] + 1;
}elseif($is_low < 0){
$banker_lenth = $bigRoadLocation[$bigRoad_lenth-4-$player_length-$player_length_2]['show_y'] - ($is_low * 2);
}
}
if($bigRoadLocation[$bigRoad_lenth-4-$player_length-$player_length_2-$banker_lenth]['result'] == 2){
if($bigRoadLocation[$bigRoad_lenth-4-$player_length-$player_length_2-$banker_lenth]['show_y'] < 6){
$player_length_3 = $bigRoadLocation[$bigRoad_lenth-4-$player_length-$player_length_2-$banker_lenth]['show_y'];
}elseif($bigRoadLocation[$bigRoad_lenth-4-$player_length-$player_length_2-$banker_lenth]['show_y'] == 6){
$is_low = $bigRoadLocation[$bigRoad_lenth-3-$player_length-$player_length_2-$banker_lenth]['show_x'] - $bigRoadLocation[$bigRoad_lenth-4-$player_length-$player_length_2-$banker_lenth]['show_x'];
if($is_low == 1){
$player_length_3 = $bigRoadLocation[$bigRoad_lenth-4-$player_length-$player_length_2-$banker_lenth]['show_y'];
}elseif($is_low == 0){
$player_length_3 = $bigRoadLocation[$bigRoad_lenth-4-$player_length-$player_length_2-$banker_lenth]['show_y'] + 1;
}elseif($is_low < 0){
$player_length_3 = $bigRoadLocation[$bigRoad_lenth-4-$player_length-$player_length_2-$banker_lenth]['show_y'] - ($is_low * 2);
}
}
if($bigRoadLocation[$bigRoad_lenth-4-$player_length-$player_length_2-$banker_lenth-$player_length_3]['show_y'] == 1 && $bigRoadLocation[$bigRoad_lenth-4-$player_length-$player_length_2-$banker_lenth-$player_length_3]['result'] == 1){
$is_good = array('table_id' => $table_id, 'waybill_type' => '隔黐庄');
}
}
}
}
}
}
}
if($bigRoadLocation[$bigRoad_lenth-1]['result'] == 2){
if($bigRoadLocation[$bigRoad_lenth-3]['show_y'] >= 2 && $bigRoadLocation[$bigRoad_lenth-3]['result'] == 1){
$is_good = array('table_id' => $table_id, 'waybill_type' => '拍拍黐');
}elseif($bigRoadLocation[$bigRoad_lenth-3]['show_y'] == 1 && $bigRoadLocation[$bigRoad_lenth-3]['result'] == 1){
if($bigRoadLocation[$bigRoad_lenth-4]['show_y'] == 2 && $bigRoadLocation[$bigRoad_lenth-4]['result'] == 2){
if($bigRoadLocation[$bigRoad_lenth-6]['show_y'] == 1 && $bigRoadLocation[$bigRoad_lenth-6]['result'] == 1){
$is_good = array('table_id' => $table_id, 'waybill_type' => '一厅两房(庄)');
}
}
}
if($bigRoadLocation[$bigRoad_lenth-3]['result'] == 1){
if($bigRoadLocation[$bigRoad_lenth-3]['show_y'] < 6){
$banker_length = $bigRoadLocation[$bigRoad_lenth-3]['show_y'];
}elseif($bigRoadLocation[$bigRoad_lenth-3]['show_y'] == 6){
$is_low = $bigRoadLocation[$bigRoad_lenth-2]['show_x'] - $bigRoadLocation[$bigRoad_lenth-3]['show_x'];
if($is_low == 1){
$banker_length = $bigRoadLocation[$bigRoad_lenth-3]['show_y'];
}elseif($is_low == 0){
$banker_length = $bigRoadLocation[$bigRoad_lenth-3]['show_y'] + 1;
}elseif($is_low < 0){
$banker_length = $bigRoadLocation[$bigRoad_lenth-3]['show_y'] - ($is_low * 2);
}
}
if($bigRoadLocation[$bigRoad_lenth-3-$banker_length]['show_y'] == 1 && $bigRoadLocation[$bigRoad_lenth-3-$banker_length]['result'] == 2){
if($bigRoadLocation[$bigRoad_lenth-4-$banker_length]['result'] == 1){
if($bigRoadLocation[$bigRoad_lenth-4-$banker_length]['show_y'] < 6){
$banker_length_2 = $bigRoadLocation[$bigRoad_lenth-4-$banker_length]['show_y'];
}elseif($bigRoadLocation[$bigRoad_lenth-4-$banker_length]['show_y'] == 6){
$is_low = $bigRoadLocation[$bigRoad_lenth-3-$banker_length]['show_x'] - $bigRoadLocation[$bigRoad_lenth-4-$banker_length]['show_x'];
if($is_low == 1){
$banker_length_2 = $bigRoadLocation[$bigRoad_lenth-3-$banker_length]['show_y'];
}elseif($is_low == 0){
$banker_length_2 = $bigRoadLocation[$bigRoad_lenth-3-$banker_length]['show_y'] + 1;
}elseif($is_low < 0){
$banker_length_2 = $bigRoadLocation[$bigRoad_lenth-3-$banker_length]['show_y'] - ($is_low * 2);
}
}
if($bigRoadLocation[$bigRoad_lenth-4-$banker_length-$banker_length_2]['show_y'] >= 2 && $bigRoadLocation[$bigRoad_lenth-4-$banker_length-$banker_length_2]['result'] == 2){
if($bigRoadLocation[$bigRoad_lenth-4-$banker_length-$banker_length_2]['show_y'] < 6){
$player_lenth = $bigRoadLocation[$bigRoad_lenth-4-$banker_length-$banker_length_2]['show_y'];
}elseif($bigRoadLocation[$bigRoad_lenth-4-$banker_length-$banker_length_2]['show_y'] == 6){
$is_low = $bigRoadLocation[$bigRoad_lenth-3-$banker_length-$banker_length_2]['show_x'] - $bigRoadLocation[$bigRoad_lenth-4-$banker_length-$banker_length_2]['show_x'];
if($is_low == 1){
$player_lenth = $bigRoadLocation[$bigRoad_lenth-4-$banker_length-$banker_length_2]['show_y'];
}elseif($is_low == 0){
$player_lenth = $bigRoadLocation[$bigRoad_lenth-4-$banker_length-$banker_length_2]['show_y'] + 1;
}elseif($is_low < 0){
$player_lenth = $bigRoadLocation[$bigRoad_lenth-4-$banker_length-$banker_length_2]['show_y'] - ($is_low * 2);
}
}
if($bigRoadLocation[$bigRoad_lenth-4-$banker_length-$banker_length_2-$player_lenth]['result'] == 1){
if($bigRoadLocation[$bigRoad_lenth-4-$banker_length-$banker_length_2-$player_lenth]['show_y'] < 6){
$banker_length_3 = $bigRoadLocation[$bigRoad_lenth-4-$banker_length-$banker_length_2-$player_lenth]['show_y'];
}elseif($bigRoadLocation[$bigRoad_lenth-4-$banker_length-$banker_length_2-$player_lenth]['show_y'] == 6){
$is_low = $bigRoadLocation[$bigRoad_lenth-3-$banker_length-$banker_length_2-$player_lenth]['show_x'] - $bigRoadLocation[$bigRoad_lenth-4-$banker_length-$banker_length_2-$player_lenth]['show_x'];
if($is_low == 1){
$banker_length_3 = $bigRoadLocation[$bigRoad_lenth-4-$banker_length-$banker_length_2-$player_lenth]['show_y'];
}elseif($is_low == 0){
$banker_length_3 = $bigRoadLocation[$bigRoad_lenth-4-$banker_length-$banker_length_2-$player_lenth]['show_y'] + 1;
}elseif($is_low < 0){
$banker_length_3 = $bigRoadLocation[$bigRoad_lenth-4-$banker_length-$banker_length_2-$player_lenth]['show_y'] - ($is_low * 2);
}
}
if($bigRoadLocation[$bigRoad_lenth-4-$banker_length-$banker_length_2-$player_lenth-$banker_length_3]['show_y'] == 1 && $bigRoadLocation[$bigRoad_lenth-4-$banker_length-$banker_length_2-$player_lenth-$banker_length_3]['result'] == 2){
$is_good = array('table_id' => $table_id, 'waybill_type' => '隔黐闲');
}
}
}
}
}
}
}
}
//y=3
if($bigRoadLocation[$bigRoad_lenth-1]['show_y'] == 3){
if($bigRoadLocation[$bigRoad_lenth-1]['result'] == 1){
if($bigRoadLocation[$bigRoad_lenth-4]['show_y'] >= 2 && $bigRoadLocation[$bigRoad_lenth-4]['result'] == 2){
$is_good = array('table_id' => $table_id, 'waybill_type' => '拍拍黐');
}
if($bigRoadLocation[$bigRoad_lenth-4]['result'] == 2){
if($bigRoadLocation[$bigRoad_lenth-4]['show_y'] < 6){
$player_length = $bigRoadLocation[$bigRoad_lenth-4]['show_y'];
}elseif($bigRoadLocation[$bigRoad_lenth-4]['show_y'] == 6){
$is_low = $bigRoadLocation[$bigRoad_lenth-1]['show_x'] - $bigRoadLocation[$bigRoad_lenth-4]['show_x'];
if($is_low == 1){
$player_length = $bigRoadLocation[$bigRoad_lenth-4]['show_y'];
}elseif($is_low == 0){
$player_length = $bigRoadLocation[$bigRoad_lenth-4]['show_y'] + 1;
}elseif($is_low < 0){
$player_length = $bigRoadLocation[$bigRoad_lenth-4]['show_y'] - ($is_low * 2);
}
}
if($bigRoadLocation[$bigRoad_lenth-4-$player_length]['show_y'] == 1 && $bigRoadLocation[$bigRoad_lenth-4-$player_length]['result'] == 1){
if($bigRoadLocation[$bigRoad_lenth-5-$player_length]['result'] == 2){
if($bigRoadLocation[$bigRoad_lenth-5-$player_length]['show_y'] < 6){
$player_length_2 = $bigRoadLocation[$bigRoad_lenth-5-$player_length]['show_y'];
}elseif($bigRoadLocation[$bigRoad_lenth-5-$player_length]['show_y'] == 6){
$is_low = $bigRoadLocation[$bigRoad_lenth-4-$player_length]['show_x'] - $bigRoadLocation[$bigRoad_lenth-5-$player_length]['show_x'];
if($is_low == 1){
$player_length_2 = $bigRoadLocation[$bigRoad_lenth-4-$player_length]['show_y'];
}elseif($is_low == 0){
$player_length_2 = $bigRoadLocation[$bigRoad_lenth-4-$player_length]['show_y'] + 1;
}elseif($is_low < 0){
$player_length_2 = $bigRoadLocation[$bigRoad_lenth-4-$player_length]['show_y'] - ($is_low * 2);
}
}
if($bigRoadLocation[$bigRoad_lenth-5-$player_length-$player_length_2]['show_y'] >= 2 && $bigRoadLocation[$bigRoad_lenth-5-$player_length-$player_length_2]['result'] == 1){
if($bigRoadLocation[$bigRoad_lenth-5-$player_length-$player_length_2]['show_y'] < 6){
$banker_lenth = $bigRoadLocation[$bigRoad_lenth-5-$player_length-$player_length_2]['show_y'];
}elseif($bigRoadLocation[$bigRoad_lenth-5-$player_length-$player_length_2]['show_y'] == 6){
$is_low = $bigRoadLocation[$bigRoad_lenth-4-$player_length-$player_length_2]['show_x'] - $bigRoadLocation[$bigRoad_lenth-5-$player_length-$player_length_2]['show_x'];
if($is_low == 1){
$banker_lenth = $bigRoadLocation[$bigRoad_lenth-5-$player_length-$player_length_2]['show_y'];
}elseif($is_low == 0){
$banker_lenth = $bigRoadLocation[$bigRoad_lenth-5-$player_length-$player_length_2]['show_y'] + 1;
}elseif($is_low < 0){
$banker_lenth = $bigRoadLocation[$bigRoad_lenth-5-$player_length-$player_length_2]['show_y'] - ($is_low * 2);
}
}
if($bigRoadLocation[$bigRoad_lenth-5-$player_length-$player_length_2-$banker_lenth]['result'] == 2){
if($bigRoadLocation[$bigRoad_lenth-5-$player_length-$player_length_2-$banker_lenth]['show_y'] < 6){
$player_length_3 = $bigRoadLocation[$bigRoad_lenth-5-$player_length-$player_length_2-$banker_lenth]['show_y'];
}elseif($bigRoadLocation[$bigRoad_lenth-5-$player_length-$player_length_2-$banker_lenth]['show_y'] == 6){
$is_low = $bigRoadLocation[$bigRoad_lenth-4-$player_length-$player_length_2-$banker_lenth]['show_x'] - $bigRoadLocation[$bigRoad_lenth-5-$player_length-$player_length_2-$banker_lenth]['show_x'];
if($is_low == 1){
$player_length_3 = $bigRoadLocation[$bigRoad_lenth-5-$player_length-$player_length_2-$banker_lenth]['show_y'];
}elseif($is_low == 0){
$player_length_3 = $bigRoadLocation[$bigRoad_lenth-5-$player_length-$player_length_2-$banker_lenth]['show_y'] + 1;
}elseif($is_low < 0){
$player_length_3 = $bigRoadLocation[$bigRoad_lenth-5-$player_length-$player_length_2-$banker_lenth]['show_y'] - ($is_low * 2);
}
}
if($bigRoadLocation[$bigRoad_lenth-5-$player_length-$player_length_2-$banker_lenth-$player_length_3]['show_y'] == 1 && $bigRoadLocation[$bigRoad_lenth-5-$player_length-$player_length_2-$banker_lenth-$player_length_3]['result'] == 1){
$is_good = array('table_id' => $table_id, 'waybill_type' => '隔黐庄');
}
}
}
}
}
}
}
if($bigRoadLocation[$bigRoad_lenth-1]['result'] == 2){
if($bigRoadLocation[$bigRoad_lenth-4]['show_y'] >= 2 && $bigRoadLocation[$bigRoad_lenth-4]['result'] == 1){
$is_good = array('table_id' => $table_id, 'waybill_type' => '拍拍黐');
}
if($bigRoadLocation[$bigRoad_lenth-4]['result'] == 1){
if($bigRoadLocation[$bigRoad_lenth-4]['show_y'] < 6){
$banker_length = $bigRoadLocation[$bigRoad_lenth-4]['show_y'];
}elseif($bigRoadLocation[$bigRoad_lenth-4]['show_y'] == 6){
$is_low = $bigRoadLocation[$bigRoad_lenth-1]['show_x'] - $bigRoadLocation[$bigRoad_lenth-4]['show_x'];
if($is_low == 1){
$banker_length = $bigRoadLocation[$bigRoad_lenth-4]['show_y'];
}elseif($is_low == 0){
$banker_length = $bigRoadLocation[$bigRoad_lenth-4]['show_y'] + 1;
}elseif($is_low < 0){
$banker_length = $bigRoadLocation[$bigRoad_lenth-4]['show_y'] - ($is_low * 2);
}
}
if($bigRoadLocation[$bigRoad_lenth-4-$banker_length]['show_y'] == 1 && $bigRoadLocation[$bigRoad_lenth-4-$banker_length]['result'] == 2){
if($bigRoadLocation[$bigRoad_lenth-5-$banker_length]['result'] == 1){
if($bigRoadLocation[$bigRoad_lenth-5-$banker_length]['show_y'] < 6){
$banker_length_2 = $bigRoadLocation[$bigRoad_lenth-5-$banker_length]['show_y'];
}elseif($bigRoadLocation[$bigRoad_lenth-5-$banker_length]['show_y'] == 6){
$is_low = $bigRoadLocation[$bigRoad_lenth-4-$banker_length]['show_x'] - $bigRoadLocation[$bigRoad_lenth-5-$banker_length]['show_x'];
if($is_low == 1){
$banker_length_2 = $bigRoadLocation[$bigRoad_lenth-4-$banker_length]['show_y'];
}elseif($is_low == 0){
$banker_length_2 = $bigRoadLocation[$bigRoad_lenth-4-$banker_length]['show_y'] + 1;
}elseif($is_low < 0){
$banker_length_2 = $bigRoadLocation[$bigRoad_lenth-4-$banker_length]['show_y'] - ($is_low * 2);
}
}
if($bigRoadLocation[$bigRoad_lenth-5-$banker_length-$banker_length_2]['show_y'] >= 2 && $bigRoadLocation[$bigRoad_lenth-5-$banker_length-$banker_length_2]['result'] == 2){
if($bigRoadLocation[$bigRoad_lenth-5-$banker_length-$banker_length_2]['show_y'] < 6){
$player_lenth = $bigRoadLocation[$bigRoad_lenth-5-$banker_length-$banker_length_2]['show_y'];
}elseif($bigRoadLocation[$bigRoad_lenth-5-$banker_length-$banker_length_2]['show_y'] == 6){
$is_low = $bigRoadLocation[$bigRoad_lenth-4-$banker_length-$banker_length_2]['show_x'] - $bigRoadLocation[$bigRoad_lenth-5-$banker_length-$banker_length_2]['show_x'];
if($is_low == 1){
$player_lenth = $bigRoadLocation[$bigRoad_lenth-5-$banker_length-$banker_length_2]['show_y'];
}elseif($is_low == 0){
$player_lenth = $bigRoadLocation[$bigRoad_lenth-5-$banker_length-$banker_length_2]['show_y'] + 1;
}elseif($is_low < 0){
$player_lenth = $bigRoadLocation[$bigRoad_lenth-5-$banker_length-$banker_length_2]['show_y'] - ($is_low * 2);
}
}
if($bigRoadLocation[$bigRoad_lenth-5-$banker_length-$banker_length_2-$player_lenth]['result'] == 1){
if($bigRoadLocation[$bigRoad_lenth-5-$banker_length-$banker_length_2-$player_lenth]['show_y'] < 6){
$banker_length_3 = $bigRoadLocation[$bigRoad_lenth-5-$banker_length-$banker_length_2-$player_lenth]['show_y'];
}elseif($bigRoadLocation[$bigRoad_lenth-5-$banker_length-$banker_length_2-$player_lenth]['show_y'] == 6){
$is_low = $bigRoadLocation[$bigRoad_lenth-4-$banker_length-$banker_length_2-$player_lenth]['show_x'] - $bigRoadLocation[$bigRoad_lenth-5-$banker_length-$banker_length_2-$player_lenth]['show_x'];
if($is_low == 1){
$banker_length_3 = $bigRoadLocation[$bigRoad_lenth-5-$banker_length-$banker_length_2-$player_lenth]['show_y'];
}elseif($is_low == 0){
$banker_length_3 = $bigRoadLocation[$bigRoad_lenth-5-$banker_length-$banker_length_2-$player_lenth]['show_y'] + 1;
}elseif($is_low < 0){
$banker_length_3 = $bigRoadLocation[$bigRoad_lenth-5-$banker_length-$banker_length_2-$player_lenth]['show_y'] - ($is_low * 2);
}
}
if($bigRoadLocation[$bigRoad_lenth-5-$banker_length-$banker_length_2-$player_lenth-$banker_length_3]['show_y'] == 1 && $bigRoadLocation[$bigRoad_lenth-5-$banker_length-$banker_length_2-$player_lenth-$banker_length_3]['result'] == 2){
$is_good = array('table_id' => $table_id, 'waybill_type' => '隔黐闲');
}
}
}
}
}
}
}
}
//y>=4
if($bigRoadLocation[$bigRoad_lenth-1]['show_y'] >= 4){
if($bigRoadLocation[$bigRoad_lenth-1]['result'] == 1){
if($bigRoadLocation[$bigRoad_lenth-1]['show_y'] < 6){
$last_banker_lenth = $bigRoadLocation[$bigRoad_lenth-1]['show_y'];
}
if($bigRoadLocation[$bigRoad_lenth-1]['show_y'] == 6){
for($length=0;$length<99;$length++){
if($bigRoadLocation[$bigRoad_lenth-1-$length]['show_y'] == 5){
break;
}
}
$last_banker_lenth = 5 + $length;
}
$is_good = array('table_id' => $table_id, 'waybill_type' => '长庄');
if($bigRoadLocation[$bigRoad_lenth-1-$last_banker_lenth]['show_y'] >= 2 && $bigRoadLocation[$bigRoad_lenth-1-$last_banker_lenth]['result'] == 2){
$is_good = array('table_id' => $table_id, 'waybill_type' => '拍拍黐');
}
if($bigRoadLocation[$bigRoad_lenth-1]['show_y'] == 4){
$bigRoad_lenth = $bigRoad_lenth - 1;
}elseif($bigRoadLocation[$bigRoad_lenth-1]['show_y'] == 5){
$bigRoad_lenth = $bigRoad_lenth - 2;
}elseif($bigRoadLocation[$bigRoad_lenth-1]['show_y'] == 6){
$bigRoad_lenth = $bigRoad_lenth - 2 - $length;
}
if($bigRoadLocation[$bigRoad_lenth-4]['result'] == 2){
if($bigRoadLocation[$bigRoad_lenth-4]['show_y'] < 6){
$player_length = $bigRoadLocation[$bigRoad_lenth-4]['show_y'];
}elseif($bigRoadLocation[$bigRoad_lenth-4]['show_y'] == 6){
$is_low = $bigRoadLocation[$bigRoad_lenth-1]['show_x'] - $bigRoadLocation[$bigRoad_lenth-4]['show_x'];
if($is_low == 1){
$player_length = $bigRoadLocation[$bigRoad_lenth-4]['show_y'];
}elseif($is_low == 0){
$player_length = $bigRoadLocation[$bigRoad_lenth-4]['show_y'] + 1;
}elseif($is_low < 0){
$player_length = $bigRoadLocation[$bigRoad_lenth-4]['show_y'] - ($is_low * 2);
}
}
if($bigRoadLocation[$bigRoad_lenth-4-$player_length]['show_y'] == 1 && $bigRoadLocation[$bigRoad_lenth-4-$player_length]['result'] == 1){
if($bigRoadLocation[$bigRoad_lenth-5-$player_length]['result'] == 2){
if($bigRoadLocation[$bigRoad_lenth-5-$player_length]['show_y'] < 6){
$player_length_2 = $bigRoadLocation[$bigRoad_lenth-5-$player_length]['show_y'];
}elseif($bigRoadLocation[$bigRoad_lenth-5-$player_length]['show_y'] == 6){
$is_low = $bigRoadLocation[$bigRoad_lenth-4-$player_length]['show_x'] - $bigRoadLocation[$bigRoad_lenth-5-$player_length]['show_x'];
if($is_low == 1){
$player_length_2 = $bigRoadLocation[$bigRoad_lenth-4-$player_length]['show_y'];
}elseif($is_low == 0){
$player_length_2 = $bigRoadLocation[$bigRoad_lenth-4-$player_length]['show_y'] + 1;
}elseif($is_low < 0){
$player_length_2 = $bigRoadLocation[$bigRoad_lenth-4-$player_length]['show_y'] - ($is_low * 2);
}
}
if($bigRoadLocation[$bigRoad_lenth-5-$player_length-$player_length_2]['show_y'] >= 2 && $bigRoadLocation[$bigRoad_lenth-5-$player_length-$player_length_2]['result'] == 1){
if($bigRoadLocation[$bigRoad_lenth-5-$player_length-$player_length_2]['show_y'] < 6){
$banker_lenth = $bigRoadLocation[$bigRoad_lenth-5-$player_length-$player_length_2]['show_y'];
}elseif($bigRoadLocation[$bigRoad_lenth-5-$player_length-$player_length_2]['show_y'] == 6){
$is_low = $bigRoadLocation[$bigRoad_lenth-4-$player_length-$player_length_2]['show_x'] - $bigRoadLocation[$bigRoad_lenth-5-$player_length-$player_length_2]['show_x'];
if($is_low == 1){
$banker_lenth = $bigRoadLocation[$bigRoad_lenth-5-$player_length-$player_length_2]['show_y'];
}elseif($is_low == 0){
$banker_lenth = $bigRoadLocation[$bigRoad_lenth-5-$player_length-$player_length_2]['show_y'] + 1;
}elseif($is_low < 0){
$banker_lenth = $bigRoadLocation[$bigRoad_lenth-5-$player_length-$player_length_2]['show_y'] - ($is_low * 2);
}
}
if($bigRoadLocation[$bigRoad_lenth-5-$player_length-$player_length_2-$banker_lenth]['result'] == 2){
if($bigRoadLocation[$bigRoad_lenth-5-$player_length-$player_length_2-$banker_lenth]['show_y'] < 6){
$player_length_3 = $bigRoadLocation[$bigRoad_lenth-5-$player_length-$player_length_2-$banker_lenth]['show_y'];
}elseif($bigRoadLocation[$bigRoad_lenth-5-$player_length-$player_length_2-$banker_lenth]['show_y'] == 6){
$is_low = $bigRoadLocation[$bigRoad_lenth-4-$player_length-$player_length_2-$banker_lenth]['show_x'] - $bigRoadLocation[$bigRoad_lenth-5-$player_length-$player_length_2-$banker_lenth]['show_x'];
if($is_low == 1){
$player_length_3 = $bigRoadLocation[$bigRoad_lenth-5-$player_length-$player_length_2-$banker_lenth]['show_y'];
}elseif($is_low == 0){
$player_length_3 = $bigRoadLocation[$bigRoad_lenth-5-$player_length-$player_length_2-$banker_lenth]['show_y'] + 1;
}elseif($is_low < 0){
$player_length_3 = $bigRoadLocation[$bigRoad_lenth-5-$player_length-$player_length_2-$banker_lenth]['show_y'] - ($is_low * 2);
}
}
if($bigRoadLocation[$bigRoad_lenth-5-$player_length-$player_length_2-$banker_lenth-$player_length_3]['show_y'] == 1 && $bigRoadLocation[$bigRoad_lenth-5-$player_length-$player_length_2-$banker_lenth-$player_length_3]['result'] == 1){
$is_good = array('table_id' => $table_id, 'waybill_type' => '隔黐庄');
}
}
}
}
}
}
}elseif($bigRoadLocation[$bigRoad_lenth-1]['result'] == 2){
if($bigRoadLocation[$bigRoad_lenth-1]['show_y'] < 6){
$last_banker_lenth = $bigRoadLocation[$bigRoad_lenth-1]['show_y'];
}
if($bigRoadLocation[$bigRoad_lenth-1]['show_y'] == 6){
for($length=0;$length<99;$length++){
if($bigRoadLocation[$bigRoad_lenth-1-$length]['show_y'] == 5){
break;
}
}
$last_player_lenth = 5 + $length;
}
$is_good = array('table_id' => $table_id, 'waybill_type' => '长闲');
if($bigRoadLocation[$bigRoad_lenth-1-$last_player_lenth]['show_y'] >= 2 && $bigRoadLocation[$bigRoad_lenth-1-$last_player_lenth]['result'] == 1){
$is_good = array('table_id' => $table_id, 'waybill_type' => '拍拍黐');
}
if($bigRoadLocation[$bigRoad_lenth-1]['show_y'] == 4){
$bigRoad_lenth = $bigRoad_lenth - 1;
}elseif($bigRoadLocation[$bigRoad_lenth-1]['show_y'] == 5){
$bigRoad_lenth = $bigRoad_lenth - 2;
}elseif($bigRoadLocation[$bigRoad_lenth-1]['show_y'] == 6){
$bigRoad_lenth = $bigRoad_lenth - 2 - $length;
}
if($bigRoadLocation[$bigRoad_lenth-4]['result'] == 1){
if($bigRoadLocation[$bigRoad_lenth-4]['show_y'] < 6){
$banker_length = $bigRoadLocation[$bigRoad_lenth-4]['show_y'];
}elseif($bigRoadLocation[$bigRoad_lenth-4]['show_y'] == 6){
$is_low = $bigRoadLocation[$bigRoad_lenth-1]['show_x'] - $bigRoadLocation[$bigRoad_lenth-4]['show_x'];
if($is_low == 1){
$banker_length = $bigRoadLocation[$bigRoad_lenth-4]['show_y'];
}elseif($is_low == 0){
$banker_length = $bigRoadLocation[$bigRoad_lenth-4]['show_y'] + 1;
}elseif($is_low < 0){
$banker_length = $bigRoadLocation[$bigRoad_lenth-4]['show_y'] - ($is_low * 2);
}
}
if($bigRoadLocation[$bigRoad_lenth-4-$banker_length]['show_y'] == 1 && $bigRoadLocation[$bigRoad_lenth-4-$banker_length]['result'] == 2){
if($bigRoadLocation[$bigRoad_lenth-5-$banker_length]['result'] == 1){
if($bigRoadLocation[$bigRoad_lenth-5-$banker_length]['show_y'] < 6){
$banker_length_2 = $bigRoadLocation[$bigRoad_lenth-5-$banker_length]['show_y'];
}elseif($bigRoadLocation[$bigRoad_lenth-5-$banker_length]['show_y'] == 6){
$is_low = $bigRoadLocation[$bigRoad_lenth-4-$banker_length]['show_x'] - $bigRoadLocation[$bigRoad_lenth-5-$banker_length]['show_x'];
if($is_low == 1){
$banker_length_2 = $bigRoadLocation[$bigRoad_lenth-4-$banker_length]['show_y'];
}elseif($is_low == 0){
$banker_length_2 = $bigRoadLocation[$bigRoad_lenth-4-$banker_length]['show_y'] + 1;
}elseif($is_low < 0){
$banker_length_2 = $bigRoadLocation[$bigRoad_lenth-4-$banker_length]['show_y'] - ($is_low * 2);
}
}
if($bigRoadLocation[$bigRoad_lenth-5-$banker_length-$banker_length_2]['show_y'] >= 2 && $bigRoadLocation[$bigRoad_lenth-5-$banker_length-$banker_length_2]['result'] == 2){
if($bigRoadLocation[$bigRoad_lenth-5-$banker_length-$banker_length_2]['show_y'] < 6){
$player_lenth = $bigRoadLocation[$bigRoad_lenth-5-$banker_length-$banker_length_2]['show_y'];
}elseif($bigRoadLocation[$bigRoad_lenth-5-$banker_length-$banker_length_2]['show_y'] == 6){
$is_low = $bigRoadLocation[$bigRoad_lenth-4-$banker_length-$banker_length_2]['show_x'] - $bigRoadLocation[$bigRoad_lenth-5-$banker_length-$banker_length_2]['show_x'];
if($is_low == 1){
$player_lenth = $bigRoadLocation[$bigRoad_lenth-5-$banker_length-$banker_length_2]['show_y'];
}elseif($is_low == 0){
$player_lenth = $bigRoadLocation[$bigRoad_lenth-5-$banker_length-$banker_length_2]['show_y'] + 1;
}elseif($is_low < 0){
$player_lenth = $bigRoadLocation[$bigRoad_lenth-5-$banker_length-$banker_length_2]['show_y'] - ($is_low * 2);
}
}
if($bigRoadLocation[$bigRoad_lenth-5-$banker_length-$banker_length_2-$player_lenth]['result'] == 1){
if($bigRoadLocation[$bigRoad_lenth-5-$banker_length-$banker_length_2-$player_lenth]['show_y'] < 6){
$banker_length_3 = $bigRoadLocation[$bigRoad_lenth-5-$banker_length-$banker_length_2-$player_lenth]['show_y'];
}elseif($bigRoadLocation[$bigRoad_lenth-5-$banker_length-$banker_length_2-$player_lenth]['show_y'] == 6){
$is_low = $bigRoadLocation[$bigRoad_lenth-4-$banker_length-$banker_length_2-$player_lenth]['show_x'] - $bigRoadLocation[$bigRoad_lenth-5-$banker_length-$banker_length_2-$player_lenth]['show_x'];
if($is_low == 1){
$banker_length_3 = $bigRoadLocation[$bigRoad_lenth-5-$banker_length-$banker_length_2-$player_lenth]['show_y'];
}elseif($is_low == 0){
$banker_length_3 = $bigRoadLocation[$bigRoad_lenth-5-$banker_length-$banker_length_2-$player_lenth]['show_y'] + 1;
}elseif($is_low < 0){
$banker_length_3 = $bigRoadLocation[$bigRoad_lenth-5-$banker_length-$banker_length_2-$player_lenth]['show_y'] - ($is_low * 2);
}
}
if($bigRoadLocation[$bigRoad_lenth-5-$banker_length-$banker_length_2-$player_lenth-$banker_length_3]['show_y'] == 1 && $bigRoadLocation[$bigRoad_lenth-5-$banker_length-$banker_length_2-$player_lenth-$banker_length_3]['result'] == 2){
$is_good = array('table_id' => $table_id, 'waybill_type' => '隔黐闲');
}
}
}
}
}
}
}
}
}
$table = WaybillRemind::where('table_id',$table_id)->find();
$create_time = time();
$bigRoadLocation = json_encode($bigRoadLocation);
if($is_good){
if($table){
$update = [
'waybill_type' => $is_good['waybill_type'],
'create_time' => $create_time,
'boot_id' => $boot_id,
'ludan' => $bigRoadLocation,
];
WaybillRemind::update($update, ['table_id' => $is_good['table_id']]);
}else{
$insert = [
'game_id' => $game_id,
'table_id' => $is_good['table_id'],
'table_name' => $table_name,
'boot_id' => $boot_id,
'waybill_type' => $is_good['waybill_type'],
'create_time' => $create_time,
'ludan' => $bigRoadLocation
];
WaybillRemind::create($insert);
}
}else{
if($table){
WaybillRemind::where('table_id',$table_id)->delete();
}
}
}
}