Skip to content
This repository was archived by the owner on Oct 20, 2020. It is now read-only.

Commit c444ead

Browse files
committed
fix bug & update readme.md
1 parent 79ad56e commit c444ead

2 files changed

Lines changed: 13 additions & 59 deletions

File tree

README.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,8 @@ Getui::pushMessageToApp($data);
9999
'transmission_type' => 2, // 是否立即启动应用:1 立即启动 2 等待客户端自启动,必填
100100
'transmission_content' => '', // 透传内容,不支持转义字符,string(2048), 必填
101101
]
102-
'cid' => 'your cid', // 推送通知至指定用户时填写
103-
'cid_list' => 'your cid', // 推送通知至指定用户列表时填写
102+
'cid' => 'target cid', // 推送通知至指定用户时填写
103+
'cid_list' => ['cid1','cid2',...], // 推送通知至指定用户列表时填写
104104
];
105105
```
106106
* [点击通知打开网页模板](http://docs.getui.com/server/php/template/#2)
@@ -112,8 +112,8 @@ Getui::pushMessageToApp($data);
112112
'text' => '', // 通知内容,string(600), 必填
113113
'url' => '', // 点击通知后打开的网页地址,string(200), 必填
114114
]
115-
'cid' => 'your cid', // 推送通知至指定用户时填写
116-
'cid_list' => 'your cid', // 推送通知至指定用户列表时填写
115+
'cid' => 'target cid', // 推送通知至指定用户时填写
116+
'cid_list' => ['cid1','cid2',...], // 推送通知至指定用户列表时填写
117117
];
118118
```
119119

@@ -133,8 +133,8 @@ Getui::pushMessageToApp($data);
133133
'is_auto_install' => true, // 是否自动安装(默认否),boolean
134134
'is_actived' => false, // 安装完成后是否自动启动应用程序(默认否),boolean
135135
]
136-
'cid' => 'your cid', // 推送通知至指定用户时填写
137-
'cid_list' => 'your cid', // 推送通知至指定用户列表时填写
136+
'cid' => 'target cid', // 推送通知至指定用户时填写
137+
'cid_list' => ['cid1','cid2',...], // 推送通知至指定用户列表时填写
138138
];
139139
```
140140

@@ -153,8 +153,8 @@ Getui::pushMessageToApp($data);
153153
'title' => '', // 通知标题,string
154154
'text' => true, // 通知内容,string
155155
]
156-
'cid' => 'your cid', // 推送通知至指定用户时填写
157-
'cid_list' => 'your cid', // 推送通知至指定用户列表时填写
156+
'cid' => 'target cid', // 推送通知至指定用户时填写
157+
'cid_list' => ['cid1','cid2',...], // 推送通知至指定用户列表时填写
158158
];
159159
```
160160

@@ -177,12 +177,12 @@ Getui::pushMessageToApp($data);
177177
'begin_at' => '2017-08-01 09:00:00',
178178
'end_at' => '2017-08-02 17:00:00',
179179
],
180-
'cid' => 'your cid',
180+
'cid' => 'target cid',
181181
];
182182
```
183183
* 返回值 `$rep`
184184
* [推送结果返回值](http://docs.getui.com/server/php/push/#7)
185185

186-
* 版本说明
186+
* 版本更新说明
187187
* v0.0.2:向指定的用户列表推送消息
188188
* v0.0.1:支持个推服务器端 PHP SDK 4.0.1.5

src/Getui.php

Lines changed: 3 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use Cncal\Getui\Sdk\IGtPush;
66
use Cncal\Getui\Sdk\IGetui\IGtAppMessage;
77
use Cncal\Getui\Sdk\IGetui\IGtSingleMessage;
8+
use Cncal\Getui\Sdk\IGetui\IGtListMessage;
89
use Cncal\Getui\Sdk\IGetui\Template\GetuiTemplate;
910
use Cncal\Getui\Sdk\IGetui\IGtTarget;
1011
use Cncal\Getui\Sdk\Exception\GetuiException;
@@ -122,7 +123,7 @@ public function pushMessageToList($data)
122123
$getui_template = new GetuiTemplate($app_id, $app_key, $config, $template_type, $template_data);
123124
$template = $getui_template->getTemplate();
124125

125-
$message = new IGtSingleMessage();
126+
$message = new IGtListMessage();
126127
$message->set_isOffline($is_off_line);
127128
if($is_off_line)
128129
{
@@ -134,8 +135,7 @@ public function pushMessageToList($data)
134135
$contentId = $igt->getContentId($message);
135136

136137
// 接收方列表
137-
$cid_list = explode(",", $data['cid_list']);
138-
foreach ($cid_list as $cid)
138+
foreach ($data['cid_list'] as $cid)
139139
{
140140
$target = new IGtTarget();
141141
$target->set_appId($app_id);
@@ -199,51 +199,5 @@ public function pushMessageToApp($data)
199199
$rep = $igt->pushMessageToApp($message);
200200
return $rep;
201201
}
202-
203-
/**
204-
* get app user data by date
205-
*
206-
* @param $data
207-
*
208-
* @return mixed|null
209-
*/
210-
public function getAppUserDataByDate($data)
211-
{
212-
// 获取个推配置信息
213-
$config = $this->config->get('getui');
214-
$host = $config['basic']['host'];
215-
$app_id = $config['basic']['app_id'];
216-
$app_key = $config['basic']['app_key'];
217-
$master_secret = $config['basic']['master_secret'];
218-
219-
$igt = new IGtPush($host, $app_key, $master_secret);
220-
$rep = $igt->queryAppUserDataByDate($app_id, $data['date']);
221-
222-
return $rep;
223-
}
224-
225-
/**
226-
* get app push data by date
227-
*
228-
* @param $data
229-
*
230-
* @return mixed|null
231-
*/
232-
public function getAppPushDataByDate($data)
233-
{
234-
// 获取个推配置信息
235-
$config = $this->config->get('getui');
236-
$host = $config['basic']['host'];
237-
$app_id = $config['basic']['app_id'];
238-
$app_key = $config['basic']['app_key'];
239-
$master_secret = $config['basic']['master_secret'];
240-
241-
$igt = new IGtPush($host, $app_key, $master_secret);
242-
$rep = $igt->queryAppPushDataByDate($app_id, $data['date']);
243-
244-
return $rep;
245-
}
246-
247-
// todo: after testing all of functions successfully, rename Class `IGtPush` to IGt
248202
}
249203

0 commit comments

Comments
 (0)