chengkun
2025-04-18 1bb985f32f2efe0f9dd69f3cf29a1c809b1cf96d
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
<?php
 
require_once(dirname(__FILE__) . '/' . 'GTAlert.php');
 
class GTAps extends GTApiRequest
{
    /**
     * 通知消息
     */
    private $alert;
    /**
     * 推送直接带有透传数据,content-available=1表示静默推送,静默推送时不需要填写其他参数,详细参数填写见示例,苹果建议1小时最多推送3条静默消息
     */
    private $contentAvailable;
    /**
     * 通知铃声文件名,无声设置为“com.gexin.ios.silence”
     */
    private $sound;
    /**
     * 在客户端通知栏触发特定的action和button显示
     */
    private $category;
    //ios的远程通知通过该属性对通知进行分组,仅支持iOS 12.0以上版本
    private $threadId;
 
 
    public function getAlert()
    {
        return $this->alert;
    }
 
    public function setAlert($alert)
    {
        $this->alert = $alert;
    }
 
    public function getContentAvailable()
    {
        return $this->contentAvailable;
    }
 
    public function setContentAvailable($contentAvailable)
    {
        $this->contentAvailable = $contentAvailable;
        $this->apiParam["content-available"] = $contentAvailable;
    }
 
    public function getSound()
    {
        return $this->sound;
    }
 
    public function setSound($sound)
    {
        $this->sound = $sound;
        $this->apiParam["sound"] = $sound;
    }
 
    public function getCategory()
    {
        return $this->category;
    }
 
    public function setCategory($category)
    {
        $this->category = $category;
        $this->apiParam["category"] = $category;
    }
 
    public function getThreadId()
    {
        return $this->threadId;
    }
 
    public function setThreadId($threadId)
    {
        $this->threadId = $threadId;
        $this->apiParam["thread-id"] = $threadId;
    }
 
    public function getApiParam()
    {
        if ($this->alert != null){
            $this->apiParam["alert"] = $this->alert->getApiParam();
        }
        return $this->apiParam;
    }
}