|
function pushOnlineUserId() {
var appId = 'Axxxx;
var appKey = '5xxxxxxxxxxxxxx67-5AAxxxx5C';
var host = 'https://p.apicloud.com/api/push/message';
// var now = Date.now();
/* 生成密钥. */
var nowTime = Date.now();
var AppKey = hex_sha1(appId + "UZ" + appKey + "UZ" + nowTime) + "." + nowTime;
api.ajax({
url : host,
method : 'POST',
cache : false,
timeout : 20,
dataType : 'json',
charset : 'utf-8',
returnAll : false,
headers : {
'X-APICloud-AppId' : appId,
'X-APICloud-AppKey' : AppKey,
//'Content-Type' : 'application/json'
}, //通过头信息进行认证
data : {
values : {
'title' : '温馨提示:', //–消息标题,
'content' : '在其他设备登录',
'type' : '1', //– 消息类型,1:消息 2:通知
//timer – 定时消息发送时间。定时不为空则为定时消息,毫秒数。可选参数。
'platform' : '0', //:全部平台,1:ios, 2:android
// 'groupName' : 'group1', //- 推送组名,多个组用英文逗号隔开.默认:全部组。eg.group1,group2 .
'userIds' : pushDeviceId, //- 推送用户id, 多个用户用英文逗号分隔,eg. user1,user2。
}
}
}, function(ret, err) {
});
} |
|