| xqd
@@ -87,6 +87,7 @@ class NoticeController extends AdminController
|
|
|
|
|
|
$users = User::query()->where(['notice_status'=>1])->whereNotNull('registrationId')->get(['id','registrationId'])->toArray();
|
|
|
|
|
|
+ $registrationIds = array_column($users,'registrationId');
|
|
|
|
|
|
JPushService::pushNotify([
|
|
|
//标题
|
| xqd
@@ -94,13 +95,13 @@ class NoticeController extends AdminController
|
|
|
//内容
|
|
|
'content' => $res->content,
|
|
|
//设备标识,跟设备相关
|
|
|
- 'reg_id' => 'xxxxxxxxxxx',
|
|
|
+ 'reg_id' => $registrationIds,
|
|
|
//扩展字段
|
|
|
'extras' => [
|
|
|
'type' => 'notice',
|
|
|
],
|
|
|
//推送类型
|
|
|
- 'type' => JPushService::PUSH_TYPE_ALL,
|
|
|
+ 'type' => JPushService::PUSH_TYPE_REG_ID,
|
|
|
]);
|
|
|
|
|
|
//给用户添加消息记录
|