(function (index) {
setTimeout (function (){
var _this = $(this);
var d = new Date();
var str = d .getFullYear ()+"-" +(d .getMonth ()+1 )+"-" +d .getDate (); //获得今日日期
var now_zero = Date.parse (new Date(str + " 00:00:00" ))//今日0点时间戳
var stringTime = date +' 00:00:00' ;
var timestamp2 = Date.parse (new Date(stringTime ));//当日0点的时间戳
var now = new Date().getTime ();//今日此时时间戳
var t = now - now_zero ;//今日当前时间 - 今日0点 = 时间间隔
var time_t = parseInt ((t + timestamp2 )/1000 );//今日时间间隔 + 当日0点时间戳 = 当日的此时时间戳
var yesterday = timestamp2 /1000 - 86400 //昨日0点时间戳
var time_y = parseInt ((t /1000 + yesterday ));//今日时间间隔 + 当日昨日0点时间戳 = 当日昨日的此时时间戳
console .log (date + "的此时时间戳为:" + time_t );
console .log (date + "的昨日此时时间戳为:" + time_y );
$ .ajax ({
url : '/ODTotalData/atData' ,
data : { gameid : 0 , time : time_t },
dataType : 'JSON' ,
type : 'get' ,
async : false ,
success : function (data) {
console .log ('今日此时充值金额:' +data.amount);
_this.siblings('.amount_t').html(data.amount);
},
error : function () {
alert ('网络繁忙' )
}
})
$ .ajax ({
url :'/ODTotalData/atData' ,
data :{ gameid :0 ,time :time_y },
dataType : 'JSON' ,
type :'get' ,
success :function (data){
console .log ('昨日此时充值金额:' +data.amount);
_this.siblings('.amount_u').html(data.amount); }, error :function (){ alert ('网络繁忙' ) } }) }, 3000 ); })(index);