-
Notifications
You must be signed in to change notification settings - Fork 94
/
callback.html
66 lines (51 loc) · 1.45 KB
/
callback.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<!doctype html>
<html lang="zh-cn">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
</head>
<body class="op-cover">
<script src="js/libs/base64.js"></script>
<script src="js/libs/jq.mobi.js"></script>
<script src="js/script.js"></script>
<script type="text/javascript">
$.ajaxSetup({ cache: false });
function callback()
{
//console.log("callback.html callback");
var url = base_url()
+ 'index.php?c=api&a=user_unread&fr=android_push&nid='
+ kget('last_nid')
+'&token='
+ kget('op_token');
var data = $.ajax({url:url, async:false}).responseText;
var data_obj = $.parseJSON( data );
if( data_obj.err_code == 0 )
{
if( parseInt(data_obj.data.notice) > 0 )
{
var last_nid = 0;
if( isNaN( parseInt(kget('last_nid') ) ))
kset('last_nid' , 0 ) ;
last_nid = parseInt(kget('last_nid'));
if( (parseInt(last_nid) == 0) || (parseInt(last_nid) < parseInt( data_obj.data.nid )) )
{
//sina.utils.keyguard("disable");
sina.utils.screen("wakeup");
sina.notification.notify
({
"saeAppName": "tt4s",
"redirectUrl": "todo.html",
"tickerText": "TeamToy有新消息",
"contentTitle": 'TeamToy有'+data_obj.data.notice+'条新信息',
"contentText": data_obj.data.text,
"id": 8
});
kset('last_nid',parseInt( data_obj.data.nid ));
}
}
}
}
</script>
</body>
</html>