// 获得倒计时
var divLotteryTime = $('#divLotteryTime');
if ( divLotteryTime.size() > 0 ) {
var id = divLotteryTime.attr('data-id');
var minute = divLotteryTime.find('b.minute');
var second = divLotteryTime.find('b.second');
var millisecond = divLotteryTime.find('b.millisecond');
var tips = minute.parent().prev();
var times = (new Date().getTime()) + 1000 * divLotteryTime.attr('data-endtime');
var timer = setInterval(function(){
var time = times - (new Date().getTime());
if ( time < 1 ) {
clearInterval(timer);
tips.css('line-height', '35px').css('color','#FF5152').html('Muat ulang, Anda mungkin yang beruntung!');
minute.parent().remove();
second.parent().remove();
millisecond.parent().remove();
tips.html('Diumumkan!');
setTimeout(function(){
location.reload();
},2000);
var checker = function(){
$.getJSON(Gobal.Webpath+"/api/getshop/lottery_shop_huode/"+new Date().getTime(),{'test':true,'gid':id},function(info){
if ( info.error ) {
tips.html('Muat ulang, Anda mungkin yang beruntung!');
setTimeout(checker,1000);
} else {
tips.html('Menang!');
setTimeout(function(){
location.reload();
},200);
}
});
};
setTimeout(checker,750);
return;
}
i = parseInt((time/1000)/60);
s = parseInt((time/1000)%60);
ms = String(Math.floor(time%1000));
ms = parseInt(ms.substr(0,2));
if(i<10)i='0'+i;
if(s<10)s='0'+s;
if(ms<10)ms='0'+ms;
minute.html(i);
second.html(s);
millisecond.html(ms);
}, 41);
}
})