Pro/public/static/console/js/Dt.js
2026-02-25 01:50:31 +08:00

680 lines
22 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

var getOnlineNumber = function (connections){
var query = new Object();
query.connections = connections;
$.ajax({
url:'/index/get_online_number',
data:query,
dataType:"json",
type:"POST",
async:false,
success:function(data){
if(data.code == 1){
$('#onlineNumber').html(data.data);
}
}
});
}
var getResultToatl = function (TableId,BootId){
var query = new Object();
query.table_id = TableId;
query.boot_id = BootId;
$.ajax({
url:'/index/get_result_total',
data:query,
dataType:"json",
type:"POST",
async:false,
success:function(data){
if(data.code == 1){
var resultToatl = data.data;
$('#result_total_player').html(resultToatl.player);
$('#result_total_banker').html(resultToatl.banker);
$('#result_total_tie').html(resultToatl.tie);
}
}
});
}
var showPng = function (opening){
if(opening == 1) $('#openingPng').attr('src','/static/console/img/dragon.png');
if(opening == 2) $('#openingPng').attr('src','/static/console/img/tiger.png');
if(opening == 3) $('#openingPng').attr('src','/static/console/img/tie.png');
$('#openingElement').show().delay(1000).hide(300);
}
$(document).on("click","#next_banker",function(){
var next = new Object;
next.result = 'banker';
next.table = TableId;
next.forecast = 1;
$.ajax({
url:"/waybill/waybill.php",
type:"POST",
dataType:"JSON",
data:next,
success:function(data){
var twinkledata=data;
resizeCanvas(twinkledata);
resizeCanvas2(twinkledata);
resizeCanvas3("","","","",twinkledata);
}
});
})
$(document).on("click","#next_player",function(){
var next = new Object;
next.result = 'player';
next.table = TableId;
next.forecast = 1;
$.ajax({
url:"/waybill/waybill.php",
type:"POST",
dataType:"JSON",
data:next,
success:function(data){
var twinkledata=data;
resizeCanvas(twinkledata);
resizeCanvas2(twinkledata);
resizeCanvas3("","","","",twinkledata);
}
});
})
// 请求所有路单数据,执行画布刷新
function waybillFunc(){
var data = new Object;
data.result = "allData";
data.table = TableId;
$.ajax({
url:"/waybill/waybill.php",
type:"POST",
dataType:"JSON",
data:data,
success:function(data){
// 将数据结果存session
ludan = data;
// 执行画布刷新
resizeCanvas();
resizeCanvas2();
resizeCanvas3();
}
});
}
$(window).resize(function(){
resizeCanvas();
resizeCanvas2();
resizeCanvas3();
});
// canvas 路单
function resizeCanvas(twinkledata){
var canvaswidth= parseInt($(".baccarat_mian ").width()-30);
$(".index .canvas-box .canvas").width(canvaswidth);
var table=document.getElementById('single1'),
ctb=table.getContext('2d');
var tab_width=canvaswidth,
tab_cols=60,
tab_rows=6,
Tab_w=tab_width/tab_cols
tab_height=Tab_w*tab_rows||183
Font_Size =Math.floor(Tab_w/1.8)+"px Arial"
Font_Size_s=Math.floor(Tab_w/2.8)+"px Arial"
$("#single1").attr("height",tab_height+0.4)
$("#single1").attr("width",canvaswidth+0.4)
canvasbg(ctb,table,tab_width,tab_height,tab_rows,tab_cols,Tab_w);
if(twinkledata!=undefined){
var twin=twinkledata.bigRoad.show_location,
twinlength=twin.length-1
twinkle(ctb,twin[twinlength].show_x,twin[twinlength].show_y,twin[twinlength].result);
}
// 获取本地session里的路单数据
var waybill = ludan;
if(waybill == false) return false;
var bigRoad = waybill.bigRoad;
var showRoad = waybill.showRoad;
// 第一局为和,大路展示
if(showRoad != undefined && showRoad.show_location != undefined && showRoad.first_tie_num != undefined && showRoad.first_tie_num > 0){
b_Tie(showRoad.first_tie_num);
}
// 大路路单展示
if( bigRoad != undefined && bigRoad.show_location != undefined){
for(var i=0; i<bigRoad.show_location.length; i++){
//庄赢
if(bigRoad.show_location[i].result == "banker"){
// 判断是否有和局
if(bigRoad.show_location[i].tie_num > 0){
b_Tab(bigRoad.show_location[i].show_x,bigRoad.show_location[i].show_y,2,1,bigRoad.show_location[i].tie_num);
}else{
b_Tab(bigRoad.show_location[i].show_x,bigRoad.show_location[i].show_y,2);
}
}
// 闲赢
if(bigRoad.show_location[i].result == "player"){
// 判断是否是和局
if(bigRoad.show_location[i].tie_num > 0){
b_Tab(bigRoad.show_location[i].show_x,bigRoad.show_location[i].show_y,1,1,bigRoad.show_location[i].tie_num);
}else{
b_Tab(bigRoad.show_location[i].show_x,bigRoad.show_location[i].show_y,1);
}
}
// 和
if(bigRoad.show_location[i].tie_num > 0){
if(bigRoad.first_tie_num != undefined && bigRoad.first_tie_num == 1 && i == 0){
b_Tie(bigRoad.show_location[i].tie_num)
}else{
if(bigRoad.show_location[i].result == 'banker'){
b_Tab(bigRoad.show_location[i].show_x,bigRoad.show_location[i].show_y,2,1,bigRoad.show_location[i].tie_num);
}else{
b_Tab(bigRoad.show_location[i].show_x,bigRoad.show_location[i].show_y,1,1,bigRoad.show_location[i].tie_num);
}
}
}
}
}
ctb.closePath();
// 局数 数文字X坐标文字Y坐标文字大小风格
function Font_tie(num,Font_x,Font_y,fontsize){
if(num!==undefined){
ctb.beginPath();
ctb.font=fontsize;
ctb.textAlign = 'center';
ctb.textBaseline = 'middle';
ctb.fillStyle ="#000" ;
ctb.fillText(num,Font_x,Font_y);
ctb.stroke();
}
}
function b_Tab(x,y,type,slash,order){
x_z=x-0.5,
y_z=y-0.5;
ctb.clearRect(Tab_w*x_z-Tab_w/2.1, Tab_w*y_z-Tab_w/2.1, Tab_w*0.9, Tab_w*0.9);
if(type=="1"){
var color="#331a98";
}else if(type=="2"){
var color="#fb2603"
}
ctb.beginPath();
ctb.lineWidth = 1.5;
ctb.strokeStyle = color;
ctb.arc(Tab_w*x_z-0.5, Tab_w*y_z-0.5, Tab_w*0.38, 0, Math.PI * 2);
ctb.stroke();
if(slash=="1"){
ctb.beginPath();
linewidth=Tab_w/4;
ctb.lineWidth = 2;//线条宽度
ctb.lineCap = "round";
ctb.strokeStyle = "#3EA542";//线条颜色
ctb.moveTo(x_z*Tab_w-linewidth,Tab_w*y_z+linewidth);
ctb.lineTo(x_z*Tab_w+linewidth,Tab_w*y_z-linewidth);
ctb.stroke();
Font_tie(order,Tab_w*x_z, Tab_w*y_z,Font_Size);
}
}
// b区第一局 和
function b_Tie(order){
ctb.clearRect(Tab_w/20, 1, Tab_w*0.9, Tab_w*0.9);
ctb.beginPath();
linewidth=Tab_w/4;
ctb.lineWidth = 3.5;//线条宽度
ctb.strokeStyle = "#3EA542";//线条颜色
ctb.lineCap = "round";
ctb.moveTo(Tab_w/20,Tab_w/2);
ctb.lineTo(Tab_w*0.9,Tab_w/2);
ctb.stroke();
Font_tie(order,Tab_w/2, Tab_w/2,Font_Size);
}
// 问路
function twinkle(ctb,show_x,show_y,result){
var b=10
num1=setInterval(function(){
b--;
var num=b%2;
if(b<0){
clearInterval(num1);
// $("#player_ask,#banker_ask").removeAttr("disabled");
}else{
ctb.globalAlpha=num;
// 数据
if(result=="banker"){
b_Tab(show_x,show_y,2)
}else if(result=="player"){
b_Tab(show_x,show_y,1)
}
// // 数据
ctb.globalAlpha=0.5
}
},200);
}
}
function resizeCanvas2(twinkledata){
var canvaswidth= parseInt($(".baccarat_mian ").width()-30);
$(".index .canvas-box .canvas").width(canvaswidth);
var table=document.getElementById('single2'),
ctb=table.getContext('2d');
// ctb.beginPath();
var tab_width=canvaswidth,
tab_cols=60,
tab_rows=6,
tab_b_cols = 6,
Tab_w=tab_width/tab_cols,
tab_height=Tab_w*tab_rows||183;
$("#single2").attr("height",tab_height+0.8)
$("#single2").attr("width",canvaswidth+0.4)
canvasbg(ctb,table,tab_width,tab_height,tab_rows,tab_cols,Tab_w);
var waybill = ludan;
if(!waybill) return false;
var bigEyeRoad = waybill.bigEyeRoad; // 大眼路数据
var pathway = waybill.pathway; // 小路数据
var roach = waybill.roach;
// 小强路数据
if(twinkledata!=undefined){
twinkle(ctb,twinkledata);
}
// 大眼路数据
if(bigEyeRoad != undefined && bigEyeRoad.show_location != undefined){
for(var i=0; i<bigEyeRoad.show_location.length; i++){
// 红圈
if(bigEyeRoad.show_location[i].result == 'red'){
c_Tab(bigEyeRoad.show_location[i].show_x,bigEyeRoad.show_location[i].show_y,2);
}
// 蓝圈
if(bigEyeRoad.show_location[i].result == 'blue'){
c_Tab(bigEyeRoad.show_location[i].show_x,bigEyeRoad.show_location[i].show_y,1);
}
}
}
// 小路数据
if(pathway != undefined && pathway.show_location != undefined){
for(var i=0; i<pathway.show_location.length; i++){
// 红圈
if(pathway.show_location[i].result == 'red'){
d_Tab(pathway.show_location[i].show_x,pathway.show_location[i].show_y,2);
}
// 蓝圈
if(pathway.show_location[i].result == 'blue'){
d_Tab(pathway.show_location[i].show_x,pathway.show_location[i].show_y,1);
}
}
}
// 小强路数据
if(roach != undefined && roach.show_location != undefined){
for(var i=0; i<roach.show_location.length; i++){
// 红圈
if(roach.show_location[i].result == 'red'){
e_Tab(roach.show_location[i].show_x,roach.show_location[i].show_y,2);
}
// 蓝圈
if(roach.show_location[i].result == 'blue'){
e_Tab(roach.show_location[i].show_x,roach.show_location[i].show_y,1);
}
}
}
ctb.closePath();
// c区
function c_Tab(x,y,type){
tab_c=Tab_w/2,
x_z=x-0.5,
y_z=y-0.5;
ctb.clearRect(tab_c*(x-1), tab_c*(y-1), tab_c, tab_c);
if(type=="1"){
ctb.strokeStyle = '#3b39f2';
}else if(type=="2"){
ctb.strokeStyle = '#ff0000';
}
ctb.beginPath();
ctb.lineWidth = 1;
ctb.arc(tab_c*x_z, tab_c*y_z, tab_c*0.38, 0, Math.PI * 2);
ctb.stroke();
}
// d区
function d_Tab(x,y,type){
var d_y=Tab_w*tab_b_cols/2,
tab_c=Tab_w/2,
x_z=x-0.5,
y_z=y-0.5;
ctb.clearRect(tab_c*(x-1), d_y+tab_c*(y-1), tab_c, tab_c);
ctb.beginPath();
ctb.lineWidth = 0.2;
if(type=="1"){
ctb.strokeStyle = '#3b39f2';
ctb.fillStyle='#3b39f2';
}else if(type=="2"){
ctb.strokeStyle = '#ff0000';
ctb.fillStyle='#ff0000';
}
ctb.arc(tab_c*x_z, d_y+tab_c*y_z, tab_c*0.38, 0, Math.PI * 2);
ctb.fill();
ctb.stroke();
}
// e区
function e_Tab(x,y,type){
var d_x=20*Tab_w,
linewidth=Tab_w/3;
x_z=x-0.2,
y_z=y-0.2,
tab_d_x=Tab_w/2;
ctb.clearRect(d_x+tab_d_x*(x-1), tab_d_x*(y-1), tab_d_x, tab_d_x);
ctb.beginPath();
ctb.lineCap = "butt";
ctb.lineWidth = 2;//线条宽度
//线条颜色
if(type=="1"){
ctb.strokeStyle = '#331a98';
}else if(type=="2"){
ctb.strokeStyle = '#fd2203';
}
ctb.moveTo(d_x+tab_d_x*x_z,linewidth+tab_d_x*y_z-Tab_w*0.3);
ctb.lineTo(d_x-linewidth+tab_d_x*x_z,tab_d_x*y_z-Tab_w*0.3);
ctb.stroke();
}
function twinkle(ctb,twinkledata){
var b=10,
bigEyeRoad=twinkledata.bigEyeRoad.show_location,
pathway=twinkledata.pathway.show_location,
roach=twinkledata.roach.show_location
num2=setInterval(function(){
b--;
var num=b%2;
if(b<0){
clearInterval(num2);
// $("#player_ask,#banker_ask").removeAttr("disabled");
}else{
ctb.globalAlpha=num;
// 数据
//
if(bigEyeRoad!=undefined){
var bigEyeRoadlength=bigEyeRoad.length-1
if(bigEyeRoad[bigEyeRoadlength].result=="blue"){
c_Tab(bigEyeRoad[bigEyeRoadlength].show_x,bigEyeRoad[bigEyeRoadlength].show_y,1)
}else if(bigEyeRoad[bigEyeRoadlength].result=="red"){
c_Tab(bigEyeRoad[bigEyeRoadlength].show_x,bigEyeRoad[bigEyeRoadlength].show_y,2)
}
}
if(pathway!=undefined){
var pathwaylength=pathway.length-1
if(pathway[pathwaylength].result=="blue"){
d_Tab(pathway[pathwaylength].show_x,pathway[pathwaylength].show_y,1)
}else if(pathway[pathwaylength].result=="red"){
d_Tab(pathway[pathwaylength].show_x,pathway[pathwaylength].show_y,2)
}
}
if(roach!=undefined){
var roachlength=roach.length-1
if(roach[roachlength].result=="blue"){
e_Tab(roach[roachlength].show_x,roach[roachlength].show_y,1)
}else if(roach[roachlength].result=="red"){
e_Tab(roach[roachlength].show_x,roach[roachlength].show_y,2)
}
}
// 数据
ctb.globalAlpha=0.5
}
},200);
}
}
function resizeCanvas3(show_x,show_y,type,corners,twinkledata){
var canvaswidth= $(".baccarat_head").width()*0.5;
$(".index .canvas-box .canvas").width(canvaswidth);
var table=document.getElementById('single3'),
ctb=table.getContext('2d');
// ctb.beginPath();
var tab_width=canvaswidth,
tab_cols=20,
tab_rows=6,
tab_x=tab_width/tab_cols
tab_y=tab_x,
tab_height=tab_y*tab_rows
$("#single3").attr("height",tab_height+1)
$("#single3").attr("width",canvaswidth+0.5)
canvasbg(ctb,table,tab_width,tab_height,tab_rows,tab_cols,tab_x);
if(twinkledata!=undefined){
var showRoads=twinkledata.showRoad.show_location
showRoadlength=showRoads.length-1
twinkle(ctb,showRoads[showRoadlength].show_x,showRoads[showRoadlength].show_y,showRoads[showRoadlength].result,showRoads[showRoadlength].pair);
}
var show_x=show_x,
show_y=show_y;
type=type
if(show_x!=""||undefined){
Tab(show_x,show_y,type,corners);
}
var waybill = ludan;
if(!waybill) return false;
var showRoad = waybill.showRoad;
// 展示路的路单显示
if(showRoad != undefined && showRoad.show_location != undefined){
for(var i=0; i<showRoad.show_location.length; i++){
if(showRoad.show_location[i].result == "banker"){
// 展示路
if(showRoad.show_location[i]['pair'] == 'none'){
Tab(showRoad.show_location[i]['show_x'],showRoad.show_location[i]['show_y'],'banker');
}else if(showRoad.show_location[i]['pair'] == 'bankerPair'){
Tab(showRoad.show_location[i]['show_x'],showRoad.show_location[i]['show_y'],'banker',3);
}else if(showRoad.show_location[i]['pair'] == 'playerPair'){
Tab(showRoad.show_location[i]['show_x'],showRoad.show_location[i]['show_y'],'banker',2);
}
else if(showRoad.show_location[i]['pair'] == 'bothPair'){
Tab(showRoad.show_location[i]['show_x'],showRoad.show_location[i]['show_y'],'banker',5);
}
}
if(showRoad.show_location[i].result == "player"){
if(showRoad.show_location[i]['pair'] == 'none'){
Tab(showRoad.show_location[i]['show_x'],showRoad.show_location[i]['show_y'],'player');
}else if(showRoad.show_location[i]['pair'] == 'bankerPair'){
Tab(showRoad.show_location[i]['show_x'],showRoad.show_location[i]['show_y'],'player',3);
}else if(showRoad.show_location[i]['pair'] == 'playerPair'){
Tab(showRoad.show_location[i]['show_x'],showRoad.show_location[i]['show_y'],'player',2);
}
else if(showRoad.show_location[i]['pair'] == 'bothPair'){
Tab(showRoad.show_location[i]['show_x'],showRoad.show_location[i]['show_y'],'player',5);
}
}
if(showRoad.show_location[i].result == "tie"){
if(showRoad.show_location[i]['pair'] == 'none'){
Tab(showRoad.show_location[i]['show_x'],showRoad.show_location[i]['show_y'],'tie');
}else if(showRoad.show_location[i]['pair'] == 'bankerPair'){
Tab(showRoad.show_location[i]['show_x'],showRoad.show_location[i]['show_y'],'tie',3);
}else if(showRoad.show_location[i]['pair'] == 'playerPair'){
Tab(showRoad.show_location[i]['show_x'],showRoad.show_location[i]['show_y'],'tie',2);
}
else if(showRoad.show_location[i]['pair'] == 'bothPair'){
Tab(showRoad.show_location[i]['show_x'],showRoad.show_location[i]['show_y'],'tie',5);
}
}
}
}
ctb.closePath();
function Tab(x,y,type,corners){
ctb.beginPath();
ctb.lineWidth = 0.5;
ctb.strokeStyle = "#fff";
var x_z=x-0.5,
y_z=y-0.5;
ctb.clearRect(tab_x*(x-1), tab_x*(y-1), tab_x, tab_x);
if(type=="banker"){
var color='#e12217',
fonts='龙';
}else if(type=="player"){
var color='#0030ff',
fonts='虎';
}else if(type=="tie"){
var color='#27cf00',
fonts='和';
}
ctb.arc(tab_x*x_z, tab_x*y_z, tab_x*0.45, 0, Math.PI * 2);
ctb.fillStyle=color;
ctb.fill();
Font_Size =Math.floor(tab_x/1.8)+"px Arial"
ctb.font=Font_Size;
ctb.fillStyle ="#fff" ; // 颜色
ctb.textAlign = 'center';
ctb.textBaseline = 'middle';
ctb.fillText(fonts,tab_x*x_z,tab_x*y_z);
ctb.stroke();
var corner_xy=tab_x/3.2
if(corners=="1"){
corner(x_z,y_z,corner_xy,'#1944ff');
}else if(corners=="2"){
corner(x_z,y_z,-corner_xy,'#1944ff');
}else if(corners=="3"){
corner(x_z,y_z,corner_xy,'#ff2202');
}else if(corners=="4"){
corner(x_z,y_z,-corner_xy,'#ff2202');
}else if(corners=="5"){
corner(x_z,y_z,corner_xy,'#ff2202');
corner(x_z,y_z,-corner_xy,'#1944ff');
}
}
// a区角标
function corner(x_z,y_z,corner_xy,corner_color){
ctb.beginPath();
ctb.lineWidth = 0.5;
ctb.strokeStyle = "#fff";
ctb.arc(tab_x*x_z-corner_xy, tab_x*y_z-corner_xy, tab_x*0.14, 0, Math.PI * 2);
ctb.fillStyle=corner_color;
ctb.fill();
ctb.stroke();
}
function twinkle(ctb,show_x,show_y,result,pair){
var b=10
num3=setInterval(function(){
b--;
var num=b%2;
if(b<0){
clearInterval(num3);
// $("#player_ask,#banker_ask").removeAttr("disabled");
}else{
ctb.globalAlpha=num;
// 数据
// Tab(1,1,"banker",2)
Tab(show_x,show_y,result)
// 数据
ctb.globalAlpha=0.5
}
},200);
}
}
/* 时钟 */
function startTime(){
var today=new Date();
var yyyy = today.getFullYear();
var MM = today.getMonth()+1;
var dd = today.getDate();
var hh=today.getHours();
var mm=today.getMinutes();
var ss=today.getSeconds();
MM=checkTime(MM);
dd=checkTime(dd);
mm=checkTime(mm);
ss=checkTime(ss);
var day;
if(today.getDay()==0) day = "星期日"
if(today.getDay()==1) day = "星期一"
if(today.getDay()==2) day = "星期二"
if(today.getDay()==3) day = "星期三"
if(today.getDay()==4) day = "星期四"
if(today.getDay()==5) day = "星期五"
if(today.getDay()==6) day = "星期六"
$('#nowDateSpan').html( yyyy+"-"+MM +"-"+ dd);
$('#nowTimeSpan').html(hh+":"+mm+":"+ss);
$('#nowWeekSpan').html(day);
setTimeout('startTime()',1000);
}
function checkTime(i){
if (i<10){
i="0" + i;
}
return i;
}
/* 时钟 end */
function canvasbg(ctb,CanvasId,tab_width,tab_height,tab_rows,tab_cols,Tab_w) {
ctb.beginPath();
ctb.lineWidth = 1;//线条宽度
ctb.strokeStyle = "#999";
ctb.moveTo(0, 0.5);
ctb.lineTo(tab_width, 0.5);
for (var col = 1; col <= tab_rows; col++) {
var y = col * Tab_w;
ctb.moveTo(0,y-0.5);
ctb.lineTo(tab_width,y-0.5);
}
ctb.moveTo(0.5, 0);
ctb.lineTo(0.5, tab_height);
for (var row = 1; row <= tab_cols; row++) {
var x = row * Tab_w;
ctb.moveTo(x-0.5,0);
ctb.lineTo(x-0.5,tab_height);
}
ctb.stroke();
var image = new Image();
image.src = CanvasId.toDataURL("image/png");
CanvasId.style.backgroundImage = 'url(' + image.src +')';
ctb.clearRect(0, 0, 10000, 10000);
}