feat: 给支持角标的Android设备推送添加角标

This commit is contained in:
kuaifan 2025-10-31 23:17:04 +00:00
parent 43746634a5
commit 0116d92021

View File

@ -153,7 +153,7 @@ class UmengAlias extends AbstractModel
$description = $array['description'] ?: 'no description'; // 描述 $description = $array['description'] ?: 'no description'; // 描述
$extra = is_array($array['extra']) ? $array['extra'] : []; // 额外参数 $extra = is_array($array['extra']) ? $array['extra'] : []; // 额外参数
$seconds = intval($array['seconds']) ?: 86400; // 有效时间(单位:秒) $seconds = intval($array['seconds']) ?: 86400; // 有效时间(单位:秒)
$badge = intval($array['badge']) ?: 0; // 角标数iOS $badge = intval($array['badge']) ?: 0; // 角标数
// //
switch ($platform) { switch ($platform) {
case 'ios': case 'ios':
@ -203,6 +203,7 @@ class UmengAlias extends AbstractModel
'title' => $title, 'title' => $title,
'after_open' => 'go_app', 'after_open' => 'go_app',
'play_sound' => true, 'play_sound' => true,
'set_badge' => min(99, $badge),
], ],
], $extra), ], $extra),
'type' => 'customizedcast', 'type' => 'customizedcast',
@ -215,12 +216,17 @@ class UmengAlias extends AbstractModel
], ],
'category' => 1, 'category' => 1,
'channel_properties' => [ 'channel_properties' => [
'main_activity' => 'com.dootask.task.WelcomeActivity',
'oppo_channel_id' => 'dootask', 'oppo_channel_id' => 'dootask',
'vivo_category' => 'IM', 'vivo_category' => 'IM',
'huawei_channel_importance' => 'NORMAL', 'huawei_channel_importance' => 'NORMAL',
'huawei_channel_category' => 'IM', 'huawei_channel_category' => 'IM',
'channel_fcm' => 0, 'channel_fcm' => 0,
], ],
'local_properties' => [
'importance' => 'IMPORTANCE_DEFAULT',
'category' => 'CATEGORY_MESSAGE',
]
] ]
]); ]);
break; break;