// headers = {0:{sorter:false}};
var tablePage = function (source, target, pageId, tds, sortTable,row, headers, fun, args) {
var num_entries = $("#" + source + " tr[name='rows']").length;
var row = row || 10;
$("#" + pageId).pagination(num_entries, {
num_edge_entries: 1, //边缘页数
num_display_entries: 4, //主体页数
prev_text: '<',
next_text: '>',
total:true,
callback: pageselectCallback,
items_per_page: row //每页显示10项
});
function pageselectCallback(page_index, jq){
$("#" + target + "").empty();
var items_per_page = row;
var max_elem = Math.min((page_index+1) * items_per_page, num_entries);
if ($("#" + target + " thead").length < 1) {
$("#" + target + "").append($("#" + source + " thead").clone());
}
if ($("#" + target + " tbody").length < 1) {
$("#" + target + "").append("
");
} else {
$("#" + target + " tbody").empty();
}
if ($("#" + target + " tfoot").length < 1) {
$("#" + target + "").append($("#" + source + " tfoot").clone());
}
for(var i=page_index*items_per_page;i';
html += '';
html += '';
html += '';
for (i in titles) {
html += '' + titles[i] + ' | ';
}
html += '
';
var key = '';
for (j in keys) {
key = keys[j];
html += '';
html += '' + key + ' | ';
for (m in labels) {
if (labels[m].indexOf('Rate') == '-1') {
html += '' + dataJson[labels[m]][key] + ' | ';
} else {
if (dataJson[labels[m]][key]) {
html += '' + dataJson[labels[m]][key] + '% | ';
} else {
html += '-- | ';
}
}
}
html += '
';
}
html += '
';
$("#" + labelTable).html(html);
$("#" + labelContentTable).tablesorter();
}
var doCallback = function(fn, args) {
fn.apply(this, args);
}
var getDate = function(time) {
if (time) {
var nowDate = new Date(time);
} else {
var nowDate = new Date();
}
var year = nowDate.getFullYear();
var month = parseInt(nowDate.getMonth()) + 1;
var day = nowDate.getDate();
if (parseInt(month) < 10) month = "0" + month;
if (parseInt(day) < 10) day = "0" + day;
var date = year + "-" + month + "-" + day;
return date
};
var showUserData = function(gameId, egretId, server, chanName, tag, chanId) {
if (tag == undefined || tag == null) {
tag = "game";
}
var url = "/Ajax/Stat/Games.getUserInfo?dataTag=" + tag + "&gameId=" + gameId + "&egretId=" + egretId + "&server=" + server + "&chanName=" + chanName + "&chanId=" + chanId;
$.get(url, function(data){
if (data.code == 0) {
$('#modalUserInfo').modal('show');
$("#modalUserInfoData").html(data.data);
tablePage('detailOrder', 'dataOrder', 'PaginationOrder', [], false);
tablePage('detailDiamondUse_' + server, 'contentDiamondUse_' + server, 'PaginationDiamondUse_' + server, [], false);
}
});
}
//无serverId的处理
var showAllUserData = function(gameId, egretId,chanName,source) {
var url = "/Ajax/Stat/Games.getUserInfo?dataTag=game&gameId=" + gameId + "&egretId=" + egretId + "&chanName=" + chanName + "&source=" + source + "&type=service";
$.get(url, function(data){
//console.log(data);
if (data.code == 0) {
$('#modalAllUserInfo').modal('show');
$("#modalAllUserData").html(data.data);
tablePage('detailOrder', 'dataOrder', 'PaginationOrder', [], false);
tablePage('detailDiamondUse_' + server, 'contentDiamondUse_' + server, 'PaginationDiamondUse_' + server, [], false);
}else if(data.code == 20001){
$('#showErrorModalMsg').html('该游戏未在运营中');
$('#showErrorModal').modal('show');
}
});
}
//检查悬浮球功能开关
function checkATFunc(subFuncName,chanId,redirectUrl){
var url = "/Member/ChannelOperators/Channel/AssistiveTouch.getConfigInfo?subFuncName=" + subFuncName + "&chanId=" + chanId;
$.get(url, function(data){
console.log(data);
if (data == 'on') {
window.location.href=redirectUrl;
}else{
alert(data);
}
});
}
// 获取url参数
function getUrlParam(name) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象
var r = window.location.search.substr(1).match(reg); //匹配目标参数
if (r != null) return unescape(r[2]); return null; //返回参数值
}