project-totopia/w-demo.com_capture/html_sources/유저1/user_나의배팅내역_files/pageTopPage1.js.다운로드
2019-07-21 06:39:16 +09:00

197 lines
4.5 KiB
Plaintext

$(document).ready(function(){
initTopPageInfo();
});
setInterval('initTopPageInfo()', 20000);
// function getOnlineUserNumByTopPage(){
//
// userBizImplDwr.getOnlineUserNumByTopPage(getOnlineUserNumByTopPageCallBack);
//
// }
//
// function getOnlineUserNumByTopPageCallBack(date){
//
// $("#onLineUserNum").html(formatMoney1(date));
// }
function initTopPageInfo(){
$("#userMoneyNum1").html(formatMoney1($("#userMoneyNum1").html()));
$("#userMoneyNum2").html(formatMoney1($("#userMoneyNum2").html()));
$("#userMoneyNum3").html(formatMoney1($("#userMoneyNum3").html()));
$("#userMoneyNum").html(formatMoney1($("#userMoneyNum").html()));
$("#userPointNum1").html(formatMoney1($("#userPointNum1").html()));
$("#userPointNum2").html(formatMoney1($("#userPointNum2").html()));
$("#userPointNum3").html(formatMoney1($("#userPointNum3").html()));
$("#userPointNum").html(formatMoney1($("#userPointNum").html()));
$("#userHaveMoneyFont").html(formatMoney1($("#userHaveMoneyFont").html()));
var userId = $("#userId").val();
// getOnlineUserNumByTopPage();
messageDwr.getUnReadMessageCountByUserId(userId,getUnReadMessageCountByUserIdCallBack);
consultDwr.getConsultListCountByUserIdAndState(userId,2,getConsultListCountByUserIdAndStateCallBack);
// bettingBizImplDwr.getUserTodayBetMoney(userId,getUserTodayBetMoneyCallBack);
}
// function getUserTodayBetMoneyCallBack(date){
//
// $("#todayBetMoney").html(formatMoney1(date));
// $("#todayBetMoney1").html(formatMoney1(date));
// $("#todayBetMoney2").html(formatMoney1(date));
// $("#todayBetMoney3").html(formatMoney1(date));
// }
function formatMoney1(money){
money = money+",";
var isFu = false;
if(money.indexOf("-")==0){
isFu = true;
}
var str = money.replace(new RegExp(/(,)/g), '').replace(/[^0-9,]*/g,"");
var newStr = new Array(str.length + parseInt(str.length / 3));
var strArray = str.split("");
newStr[newStr.length - 1] = strArray[strArray.length - 1];
var currentIndex = strArray.length - 1;
for ( var i = newStr.length - 1; i >= 0; i--) {
if ((newStr.length - i) % 4 == 0) {
newStr[i] = ",";
} else {
newStr[i] = strArray[currentIndex--];
}
}
var newMoney = newStr.join("");
if (newMoney.indexOf(",") == 0) {
newMoney = newMoney.replace(",", "");
}
if(isFu){
newMoney = "-"+newMoney;
}
return newMoney;
}
function getUnReadMessageCountByUserIdCallBack(data){
var isMessagePage = $("#isMessagePage").val();
if(data>0 && isMessagePage!=1){
window.location.href = "getMessageListByUser.action?pageNum=1";
}
if(data>0){
var userNewMessageMusic = $("#userNewMessageMusic").val();
document.getElementById("message_numb").innerHTML=data;
$("#message_numb").addClass("message_animate");
}
if(data==0){
document.getElementById("message_numb").innerHTML=0;
$("#message_numb").removeClass("message_animate");
}
}
function getConsultListCountByUserIdAndStateCallBack(data){
var isMessagePage = $("#isCountPage").val();
if(data>0 && isMessagePage!=1){
var userNewConsultMusic = $("#userNewConsultMusic").val();
$("#consultImg").addClass("qiuqian");
$('embed').remove();
$('body').append("<bgsound loop='1' src='wav/"+userNewConsultMusic+"' >");
$('audio').remove();
$('body').append("<audio src='wav/"+userNewConsultMusic+"' autoplay='true' playcount='1'></audio>");
window.location.href = "getConsultListByUser.action?pageNum=1";
}
}
function changePointToMoney(){
var userId = $("#userId").val();
userBizImplDwr.changePointToMoneyByUserId(userId,changePointToMoneyByUserIdCallBack);
}
function changePointToMoneyByUserIdCallBack(date){
alert("포인트"+date+"원을 전환하였습니다");
window.location.reload();
}
function signInByUserId(){
var userId = $("#userId").val();
userBizImplDwr.signInByUserId(userId,signInByUserIdCallBack);
}
function signInByUserIdCallBack(date){
if(date>0){
alert("출석 포인트"+date+"원이 적립되었습니다");
window.location.reload();
}
if(date==-1){
alert("출석 싸인이 이미 적용되었습니다");
window.location.reload();
}
}