forked from YanzhaoMa/APICloud-PHP-SDK
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPushModel.php
More file actions
28 lines (24 loc) · 930 Bytes
/
PushModel.php
File metadata and controls
28 lines (24 loc) · 930 Bytes
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
<?php
require('ApicloudModel.php');
/**
* ApiCloud 推送云Push
*/
class PushModel extends ApicloudModel{
function sendMsg()
{
$title='恭喜发财'; //消息标题
$content='消息内容'; //消息内容
$type = 2; //1:消息 2:通知
$platform = 0;//0:全部平台,1:ios, 2:android
$groupName = "group1"; //推送组名,多个组用英文逗号隔开.默认:全部组。eg.group1,group2 .
$userIds = ""; //推送用户id, 多个用户用英文逗号分隔,eg. user1,user2。
echo $this->push($title,$content,$type,$platform,$groupName,$userIds);
}
function push($title,$content,$type,$platform,$groupName,$userIds)
{
$url = "https://p.apicloud.com/api/push/message";
$body = "title=$title&content=$content&type=$type&platform=$platform&groupName=$groupName&userIds=$userIds";
return $this->post($url,$body);
}
}
?>